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-32856 CKeyCursor should link parent nodes as well as current node #19228

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

Conversation

richardkchapman
Copy link
Member

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-32856

Jirabot Action Result:
Assigning user: [email protected]
Workflow Transition To: Merge Pending
Updated PR

@richardkchapman richardkchapman force-pushed the HPCC-32856 branch 2 times, most recently from 7a1caea to 90d15b0 Compare November 6, 2024 13:57
@richardkchapman richardkchapman marked this pull request as ready for review November 20, 2024 12:01
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.

Generally looks good. A couple of issues.

@@ -1762,9 +1769,26 @@ bool CKeyCursor::_next(IContextLogger *ctx)
if (node != NULL)
{
nodeKey = 0;
unsigned depth = key.getBranchDepth();
Copy link
Member

Choose a reason for hiding this comment

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

Would benefit from a comment about what this code is doing....

unsigned parentNodeKey = parentNodeKeys[depth];
if (parentNodeKey < numParentKeys-1)
{
parentNodeKeys[depth] = parentNodeKey;
Copy link
Member

Choose a reason for hiding this comment

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

I think this should be parentNodeKey+1.

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 think you are right. Would be a no-op without the +1

depth--;
if (depth < maxParentNodes)
{
node.set(parents[depth]);
Copy link
Member

Choose a reason for hiding this comment

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

move node.set to line 1905? to avoid the link (+release) if it does not match. (Still assign it to a temporary.)

Copy link
Member Author

Choose a reason for hiding this comment

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

Ok, have to be careful to set to null properly too...

Copy link
Member Author

Choose a reason for hiding this comment

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

Actually, I suppose you don't really.... lwm remaining 0 means it will get set to root

if (rc < 0)
{
lwm = parentNodeKey+1;
printf("Still in parent node at level %u %u\n", depth, numParentKeys);
Copy link
Member

Choose a reason for hiding this comment

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

needs removing or putting on a trace flag that disables off (same for other tracing above)

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 will remove all the printf lines whether commented out or not.

depth--;
if (depth < maxParentNodes)
{
node.set(parents[depth]);
Copy link
Member

Choose a reason for hiding this comment

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

similar comment to above about setting this later - e.g. move to line 2008

parentNodeKeys[depth] = a;
parents[depth].swap(node);
}
lwm = 0;
Copy link
Member

Choose a reason for hiding this comment

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

Is this a lurking bug?

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 think so, in that previously if lwm was non-zero we were already at leaf level and so would only go around the loop once. So you could argue it was a lurking bug but it's one that would never have been able to trigger previously.

@richardkchapman
Copy link
Member Author

@ghalliday Pushed a new commit addressing your comments

@ghalliday
Copy link
Member

@richardkchapman a couple of regression tests are now failing.

@richardkchapman
Copy link
Member Author

@ghalliday Pushed changes per our discussions

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, please squash.
What additional testing should we do to check i) it doesn't cause any regressions and ii) investigate its impact on performance?

@ghalliday ghalliday requested a review from mckellyln November 28, 2024 12:19
@ghalliday
Copy link
Member

@mckellyln please review this - related to roxie, and critical that it doesn't cause any regressions.

@richardkchapman
Copy link
Member Author

@ghalliday Squashed. Not sure what to do to test impact. I'm a bit nervous that the regression suite didn't initially pick up the pair of bugs in the first commit (only picked it up once one was fixed).

I doubt the performance impact will be huge - mostly reduced cache contention when under heavy load

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