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-29880 Serialize index write's jhtree and disk io stats regularly #19385

Merged
merged 1 commit into from
Jan 23, 2025

Conversation

shamser
Copy link
Contributor

@shamser shamser commented Jan 8, 2025

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 Jan 8, 2025

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

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

@shamser shamser requested a review from jakesmith January 8, 2025 15:31
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.

The IKeyBuilder should expose the stats, so that gatherActiveStats can update the serialized stats. covering both scenarios.

@shamser - have added a few comments. Main issue is that I was expecting the stats to be refactored so that they came from IKeyBuilder, I think the code here, in thindexwriteslave (and master at some point), would become a lot cleaner.

@@ -261,6 +267,7 @@ class IndexWriteSlaveActivity : public ProcessSlaveActivity, public ILookAheadSt
}
try
{
CriticalBlock b(builderFileCS);
Copy link
Member

Choose a reason for hiding this comment

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

not new: I think the below mergeStats, followed by close() is in the wrong order (?) - close() might write to the underlying file io, so the close() should be before final mergeStats I think. Can you check?

CriticalBlock b(builderFileCS);
if (builderIFileIO)
{
mergeStats(activeStats, builderIFileIO, diskWriteRemoteStatistics);
Copy link
Member

Choose a reason for hiding this comment

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

from JIRA description:

The IKeyBuilder should expose the stats, so that gatherActiveStats can update the serialized stats. covering both scenarios.

I think all these stats should be coming from the builder (including the io stats), so that it a single call:

mergeStats(activeStats, builder, indexWriteActivityStatistics);

There's other stats that are currently be manually pulled out of the builder and serialize to the manager in a non-standardized stats way at the moment, that could also be directly gather from the IKeyBuilder

maxRecordSizeSeen = 0;
builder.setown(createKeyBuilder(out, flags, maxDiskRecordSize, nodeSize, helper->getKeyedSize(), isTlk ? 0 : totalCount, helper, defaultIndexCompression, !isTlk, isTlk));
{
CriticalBlock b(builderFileCS);
Copy link
Member

Choose a reason for hiding this comment

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

it may not be that important, but locking scope is quite large here, e.g. could block in createMultipleWrite in i/o etc.

See other comment (and original JIRA description), it would be cleaner if the stats came from the builder rather than from a stashed IFileIO + some from builder, and the mutex to protect gatherActiveStats can then just be around the assignment/clearing of the builder.

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 - looks good. A couple of trivial comments
You may want to address those 1st, but then go ahead and squash.

I also added some "future:" comments, re. moving other stats into regular stats. If you could look at those, open a JIRA(s) and link to this one. Thanks.

thorlcr/activities/indexwrite/thindexwriteslave.cpp Outdated Show resolved Hide resolved
thorlcr/activities/indexwrite/thindexwriteslave.cpp Outdated Show resolved Hide resolved
mb.append(numBranchNodes);
mb.append(inactiveStats.getStatisticValue(StNumLeafCacheAdds));
mb.append(inactiveStats.getStatisticValue(StNumBlobCacheAdds));
mb.append(inactiveStats.getStatisticValue(StNumNodeCacheAdds));
Copy link
Member

Choose a reason for hiding this comment

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

future: Is there a separate JIRA to remove these manual serializations? ..since they will now be serialized as part of the activity stats. and the deserializing and manual setting of @numLeafNodes, @numBranchNodes, @numBlobNodes is superfluous.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I didn't want to change it in this PR as they are used in few other places. Yes, I can remove these in a future 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.

duplicateKeyCount = tmpBuilder->getDuplicateCount();
offsetBranches = tmpBuilder->getOffsetBranches();
branchMemorySize = tmpBuilder->getBranchMemorySize();
leafMemorySize = tmpBuilder->getLeafMemorySize();
Copy link
Member

Choose a reason for hiding this comment

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

future: for next JIRA, but these should be added as stats to indexWriteActivityStatistics, and collected via builder in a common way, and manual serialization/deserialization here and in master should be removed.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

return numLeaves;
case StNumNodeCacheAdds:
return numBranches;
case StNumBlobCacheAdds:
Copy link
Member

Choose a reason for hiding this comment

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

future: add other stats (offsetBranches, branchMemorySize, leadMemorySize) to stats mapping and collect these via gather stats too.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@shamser shamser requested a review from jakesmith January 21, 2025 09:47
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 - looks good. Please squash.

@jakesmith jakesmith merged commit 44a639d into hpcc-systems:master Jan 23, 2025
49 of 50 checks passed
Copy link

Jirabot Action Result:
Added fix version: 9.10.0
Workflow Transition: 'Resolve issue'

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.

2 participants