From 501c73508566b2ba0bf926314d7812ac0f2fb15d Mon Sep 17 00:00:00 2001 From: Richard Chapman Date: Wed, 27 Nov 2024 13:42:33 +0000 Subject: [PATCH] HPCC-32856 CKeyCursor should link parent nodes as well as current node More changes following review/testing/discussion Signed-off-by: Richard Chapman --- system/jhtree/jhtree.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/system/jhtree/jhtree.cpp b/system/jhtree/jhtree.cpp index 8e99806eb74..408b3b82397 100644 --- a/system/jhtree/jhtree.cpp +++ b/system/jhtree/jhtree.cpp @@ -1880,6 +1880,12 @@ bool CKeyCursor::_next(IContextLogger *ctx) } parents[depth].clear(); } + else + { + // We can't tell which parent node info is correct. Clear them all. + clearParentNodes(); + break; + } } return node->isKeyAt(0); } @@ -1996,7 +2002,7 @@ bool CKeyCursor::_gtEqual(IContextLogger *ctx) int rc = startnode->compareValueAt(recordBuffer, numParentKeys-1); if (rc <= 0) { - lwm = parentNodeKey+1; + lwm = parentNodeKey; node.set(startnode); break; } @@ -2098,7 +2104,7 @@ bool CKeyCursor::_ltEqual(IContextLogger *ctx) int rc = startnode->compareValueAt(recordBuffer, numParentKeys-1); if (rc < 0) { - lwm = parentNodeKey+1; + lwm = parentNodeKey; node.set(startnode); break; }