Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HPCC-32880 Ensure that legacy write costs are not lost after file read operation #19286

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

shamser
Copy link
Contributor

@shamser shamser commented Nov 8, 2024

Type of change:

  • This change is a bug fix (non-breaking change which fixes an issue).
  • This change is a new feature (non-breaking change which adds functionality).
  • This change improves the code (refactor or other change that does not change the functionality)
  • This change fixes warnings (the fix does not alter the functionality or the generated code)
  • This change is a breaking change (fix or feature that will cause existing behavior to change).
  • This change alters the query API (existing queries will have to be recompiled)

Checklist:

  • My code follows the code style of this project.
    • My code does not create any new warnings from compiler, build system, or lint.
  • The commit message is properly formatted and free of typos.
    • The commit message title makes sense in a changelog, by itself.
    • The commit is signed.
  • My change requires a change to the documentation.
    • I have updated the documentation accordingly, or...
    • I have created a JIRA ticket to update the documentation.
    • Any new interfaces or exported functions are appropriately commented.
  • I have read the CONTRIBUTORS document.
  • The change has been fully tested:
    • I have added tests to cover my changes.
    • All new and existing tests passed.
    • I have checked that this change does not introduce memory leaks.
    • I have used Valgrind or similar tools to check for potential issues.
  • I have given due consideration to all of the following potential concerns:
    • Scalability
    • Performance
    • Security
    • Thread-safety
    • Cloud-compatibility
    • Premature optimization
    • Existing deployed queries will not be broken
    • This change fixes the problem, not just the symptom
    • The target branch of this pull request is appropriate for such a change.
  • There are no similar instances of the same problem that should be addressed
    • I have addressed them here
    • I have raised JIRA issues to address them separately
  • This is a user interface / front-end modification
    • I have tested my changes in multiple modern browsers
    • The component(s) render as expected

Smoketest:

  • Send notifications about my Pull Request position in Smoketest queue.
  • Test my draft Pull Request.

Testing:

Copy link

github-actions bot commented Nov 8, 2024

Jira Issue: https://hpccsystems.atlassian.net//browse/HPCC-32880

Jirabot Action Result:
Workflow Transition To: Merge Pending
Updated PR

@shamser shamser force-pushed the issue32880 branch 3 times, most recently from 02c76e5 to ad901a7 Compare November 12, 2024 09:14
@shamser shamser changed the title HPCC-32880 Legacy write costs become inaccessible after for non-Legacy read HPCC-32880 Ensure that legacy write costs are not lost after file read operation Nov 12, 2024
@shamser shamser marked this pull request as ready for review November 12, 2024 09:15
@shamser shamser requested a review from jakesmith November 12, 2024 10:04
@AttilaVamos
Copy link
Contributor

@shamser I think you need to rebase to fix that build problem.

@shamser
Copy link
Contributor Author

shamser commented Nov 12, 2024

@jakesmith I've rebased.

Copy link
Member

@jakesmith jakesmith left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@shamser - please see comments

if (attrs)
{
if (hasReadWriteCostFields(*attrs))
if (!attrs->hasProp(getDFUQResultFieldName(DFUQRFreadCost))&& !isFileKey(*attrs))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

would be clearer if reversed :

            if (attrs->hasProp(getDFUQResultFieldName(DFUQRFreadCost))
                readCost = attrs->getPropInt64(getDFUQResultFieldName(DFUQRFreadCost));
            else if (!isFileKey(*attrs)) // cannot reliably calculate cost of index read based on num reads
            {
                numDiskReads = attrs->getPropInt64(getDFUQResultFieldName(DFUQRFnumDiskReads));
                doLegacyCostCalc = true;
            }

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you add a comment re. why !isFileKey , e.g. // cannot reliably calculate cost of index read based on num reads

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or, could this code be using getLegacyReadCost (and getLegacyWriteCost below) - so these conditions/comments are common?

}
else
readCost = attrs->getPropInt64(getDFUQResultFieldName(DFUQRFreadCost));

if (!attrs->hasProp(getDFUQResultFieldName(DFUQRFwriteCost)))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As above, would be clearer if condition reversed.

cost_type writeCost = file->getPropInt64(getDFUQResultFieldName(DFUQRFwriteCost));
if (!writeCost)
{
cost_type writeCost = getLegacyWriteCost(*file, nodeGroup);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is setting a scoped 'writeCost' atm, I think this should be:

writeCost = getLegacyWriteCost(*file, nodeGroup);

@shamser shamser force-pushed the issue32880 branch 4 times, most recently from f6eec69 to 6f2e1fb Compare November 14, 2024 14:39
@shamser shamser requested a review from jakesmith November 14, 2024 14:39
Copy link
Member

@jakesmith jakesmith left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@shamser - please see comments.

dali/base/dadfs.cpp Show resolved Hide resolved
}
else
{
// not sure if src superfile can have whichInput==-1 (but if so, this is best effort to calc cost)
totalReadCost += calcFileAccessCost(distributedSource, 0, curProgress.numReads);
}
}
return updateCostAndNumReads(distributedSource, totalNumReads, totalReadCost);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably reasonable to set these super props at this time, but they're going to be wrong if/when the super file is manipulated, e.g. a new subfile added or removed.

I think updateFileAttrs needs to be updated to cope with that.
They're also going to be wrong after o single subfile in an existing super is read ? i.e. what would update the super cost under those circumstances?

When the engines (e.g. thor) reads a super, it updates the sub file read costs in CMasterActivity::calcFileReadCostStats, I can't see that it updates the super costs though?

This PR may be okay as it is, but looks like there are problems with super cost info going stale in general?
@shamser - please comment, and if appropriate, open a new JIRA, reference here, and link it to this JIRA.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A jira to revisit super file costs: https://hpccsystems.atlassian.net/browse/HPCC-32901

@shamser shamser requested a review from jakesmith December 9, 2024 14:24
Copy link
Member

@jakesmith jakesmith left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@shamser - I think we can merge this now, but should revisit the superfile issues (https://hpccsystems.atlassian.net/browse/HPCC-32901) soon.

Please squash.

…d operation.

Signed-off-by: Shamser Ahmed <shamser.ahmed@lexisnexis.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants