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-32031 Generate summary information in workunit to speed up file list operations #18785

Merged
merged 1 commit into from
Jun 27, 2024

Conversation

richardkchapman
Copy link
Member

@richardkchapman richardkchapman commented Jun 19, 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

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

Jirabot Action Result:
Workflow Transition: Merge Pending
Updated PR

Copy link
Member

@ghalliday ghalliday left a comment

Choose a reason for hiding this comment

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

@richardkchapman looks good.

IPropertyTree *list = p->queryPropTree(xpath);
if (!list)
return false;
Owned<IPropertyTreeIterator> r = list->getElements("v");
Copy link
Member

Choose a reason for hiding this comment

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

I wonder if it would be much better to store all the (key,value) pairs as a single serialized string value.

It is likely to be more efficient to store and retrieve. @jakesmith how do you think the performance/storage requirements would compare.

@@ -648,7 +648,8 @@ bool ResourceManager::flush(StringBuffer &filename, const char *basename, bool f
}
fwrite(s.data.get(), 1, s.data.length(), bin);
fclose(bin);
fprintf(f, " .size %s,%u\n", label.str(), (unsigned)s.data.length());
if (!generateClang)
Copy link
Member

Choose a reason for hiding this comment

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

this looks like an unrelated bug. If so it will need to target an earlier build.

Copy link
Member Author

Choose a reason for hiding this comment

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

I don't know if it's in general a change that is needed - but I needed it to be able to compile ANY workunit on my current mac system

@richardkchapman richardkchapman force-pushed the summaries branch 2 times, most recently from 2a11740 to c6b6a42 Compare June 19, 2024 15:34
@richardkchapman
Copy link
Member Author

Couple of things to think about:

  1. Should we use a more compact format to store? Less readable, but potentially (slightly?) more efficient.
  2. Should we be using case-sensitive maps and/or lower-casing filenames before inserting them?

ForEach(*o)
{
const char *name = o->query().queryProp(".");
if (map.find(name) != map.end())
Copy link
Member Author

Choose a reason for hiding this comment

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

Should say == map.end() I think?

@richardkchapman richardkchapman changed the base branch from master to candidate-9.8.x June 26, 2024 10:19
@richardkchapman richardkchapman marked this pull request as ready for review June 26, 2024 10:19
@richardkchapman
Copy link
Member Author

@ghallidat rebased to 9.8.x and marked as ready. I have made the stored format more compact, and made teh table case-insensitive

@ghalliday
Copy link
Member

From regression test:
aggsq2,alljoin - spill:1 not classified as a spill
alien: jobtemp not classified as a spill (probably should be. They could be a separate category of spills)
apersistschedule: is it worth separating persists into a separate spill category?

@ghalliday ghalliday closed this Jun 26, 2024
@ghalliday ghalliday reopened this Jun 26, 2024
Copy link

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

Jirabot Action Result:

@richardkchapman richardkchapman force-pushed the summaries branch 2 times, most recently from a32640e to bddfe0c Compare June 26, 2024 15:36
…list operations

Track whether references are used in conjunction with OPT and signed code.

Signed-off-by: Richard Chapman <[email protected]>
@ghalliday
Copy link
Member

@jakesmith is it worth recording spills? They should be ignored for roxie targets (that can be in a later PR), but is there any benefit in having a summary list for hthor/thor jobs?

if (map.find(name) == map.end())
map[name] = flags;
else
map[name] = map[name] & flags;
Copy link
Member

Choose a reason for hiding this comment

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

can avoid re-searching. I will release an improvement.

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.

@richardkchapman - looks good to me, couple of trivial comments (1 question re. SpillFile/JobTemp's)

ForEach(*graphs)
{
Owned <IPropertyTree> xgmml = graphs->query().getXGMMLTree(false, false);
Owned<IPropertyTreeIterator> iter = xgmml->getElements("//node[att/@name='_*ileName']");
Copy link
Member

Choose a reason for hiding this comment

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

'_*ileName' looks odd, is it because it can be _fileName, or spillFileName or similar? could do with a comment.

Copy link
Member

Choose a reason for hiding this comment

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

(but I now see this is just moved code, not new code)

case SummaryType::WriteIndex: return "WriteIndex";
case SummaryType::PersistFile: return "PersistFile";
case SummaryType::SpillFile: return "SpillFile";
case SummaryType::JobTemp: return "JobTemp";
Copy link
Member

Choose a reason for hiding this comment

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

I am not sure of the usefulness/intended purposes of recording SpillTemp/JobTemp files

if (map.find(name) == map.end())
map[name] = flags;
else
map[name] = map[name] & flags;
Copy link
Member

Choose a reason for hiding this comment

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

trivial: could be:

            auto it = map.find(name);
            if (it == map.end())
                map[name] = flags;
            else
                it->second &= flags;

Copy link
Member

Choose a reason for hiding this comment

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

yes, I will fix in a follow on PR (along with the similar code below)

@ghalliday ghalliday merged commit 3c70c0d into hpcc-systems:candidate-9.8.x Jun 27, 2024
50 checks passed
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