Skip to content

Commit

Permalink
review changes
Browse files Browse the repository at this point in the history
Signed-off-by: Jake Smith <[email protected]>
  • Loading branch information
jakesmith committed Dec 8, 2023
1 parent 42dd28a commit a74b3d6
Showing 1 changed file with 17 additions and 17 deletions.
34 changes: 17 additions & 17 deletions system/jhtree/jhtree.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,7 @@ class jhtree_decl CKeyLevelManager : implements IKeyManager, public CInterface
{
protected:
IContextLogger *ctx = nullptr;
IContextLogger *conditionalCtx = nullptr;
IContextLogger *activeCtx = nullptr;
Owned <IIndexFilterList> filter;
IKeyCursor *keyCursor;
ConstPointerArray activeBlobs;
Expand Down Expand Up @@ -408,7 +408,7 @@ class jhtree_decl CKeyLevelManager : implements IKeyManager, public CInterface
indexParts = ki->numPartitions();

// If TLK don't collect context information
conditionalCtx = ki->isTopLevelKey() ? nullptr : ctx;
activeCtx = ki->isTopLevelKey() ? nullptr : ctx;
}
}

Expand Down Expand Up @@ -497,26 +497,26 @@ class jhtree_decl CKeyLevelManager : implements IKeyManager, public CInterface
virtual bool lookup(bool exact)
{
if (keyCursor)
return keyCursor->lookup(exact, conditionalCtx);
return keyCursor->lookup(exact, activeCtx);
else
return false;
}

virtual bool lookupSkip(const void *seek, size32_t seekOffset, size32_t seeklen)
{
return keyCursor ? keyCursor->lookupSkip(seek, seekOffset, seeklen, conditionalCtx) : false;
return keyCursor ? keyCursor->lookupSkip(seek, seekOffset, seeklen, activeCtx) : false;
}

unsigned __int64 getCount()
{
assertex(keyCursor);
return keyCursor->getCount(conditionalCtx);
return keyCursor->getCount(activeCtx);
}

unsigned __int64 getCurrentRangeCount(unsigned groupSegCount)
{
assertex(keyCursor);
return keyCursor->getCurrentRangeCount(groupSegCount, conditionalCtx);
return keyCursor->getCurrentRangeCount(groupSegCount, activeCtx);
}

bool nextRange(unsigned groupSegCount)
Expand All @@ -528,7 +528,7 @@ class jhtree_decl CKeyLevelManager : implements IKeyManager, public CInterface
unsigned __int64 checkCount(unsigned __int64 max)
{
assertex(keyCursor);
return keyCursor->checkCount(max, conditionalCtx);
return keyCursor->checkCount(max, activeCtx);
}

virtual void serializeCursorPos(MemoryBuffer &mb)
Expand All @@ -538,7 +538,7 @@ class jhtree_decl CKeyLevelManager : implements IKeyManager, public CInterface

virtual void deserializeCursorPos(MemoryBuffer &mb)
{
keyCursor->deserializeCursorPos(mb, conditionalCtx);
keyCursor->deserializeCursorPos(mb, activeCtx);
}

virtual const byte *loadBlob(unsigned __int64 blobid, size32_t &blobsize, IContextLogger *ctx)
Expand Down Expand Up @@ -1038,7 +1038,7 @@ void CKeyStore::clearCacheEntry(const IFileIO *io)

//

static void noteCLSeeks(IContextLogger *ctx, unsigned lseeks, unsigned lscans, unsigned lwildseeks)
static void noteSeeks(IContextLogger *ctx, unsigned lseeks, unsigned lscans, unsigned lwildseeks)
{
if (ctx)
{
Expand All @@ -1048,7 +1048,7 @@ static void noteCLSeeks(IContextLogger *ctx, unsigned lseeks, unsigned lscans, u
}
}

static void noteCLSkips(IContextLogger *ctx, unsigned lskips, unsigned lnullSkips)
static void noteSkips(IContextLogger *ctx, unsigned lskips, unsigned lnullSkips)
{
if (ctx)
{
Expand Down Expand Up @@ -1556,7 +1556,7 @@ const CJHSearchNode *CKeyIndex::locateFirstLeafNode(IContextLogger *ctx) const
const CJHSearchNode *CKeyIndex::locateLastLeafNode(IContextLogger *ctx) const
{
keySeeks++;
noteCLSeeks(ctx, 1, 0, 0);
noteSeeks(ctx, 1, 0, 0);

//Unusual - an index with no elements
if (keyHdr->getNumRecords() == 0)
Expand Down Expand Up @@ -1958,16 +1958,16 @@ bool CKeyCursor::_lookup(bool exact, unsigned lastSeg, bool unfiltered, IContext
}
if (logExcessiveSeeks && lwildseeks > 1000 && ret)
reportExcessiveSeeks(lwildseeks, lastSeg, ctx);
noteCLSeeks(ctx, lseeks, lscans, lwildseeks);
noteSeeks(ctx, lseeks, lscans, lwildseeks);
return ret;
}

bool CKeyCursor::lookupSkip(const void *seek, size32_t seekOffset, size32_t seeklen, IContextLogger *ctx)
{
if (skipTo(seek, seekOffset, seeklen))
noteCLSkips(ctx, 1, 0);
noteSkips(ctx, 1, 0);
else
noteCLSkips(ctx, 0, 1);
noteSkips(ctx, 0, 1);
bool ret = lookup(true, ctx);
#ifdef _DEBUG
if (doTrace(traceSmartStepping, TraceFlags::Max))
Expand Down Expand Up @@ -2033,7 +2033,7 @@ unsigned __int64 CKeyCursor::checkCount(unsigned __int64 max, IContextLogger *ct
bool unfiltered = filter->isUnfiltered();
if (lastFullSeg == (unsigned) -1)
{
noteCLSeeks(ctx, 1, 0, 0);
noteSeeks(ctx, 1, 0, 0);
if (_last(ctx))
return getSequence()+1;
else
Expand Down Expand Up @@ -2063,7 +2063,7 @@ unsigned __int64 CKeyCursor::getCurrentRangeCount(unsigned groupSegCount, IConte
unsigned __int64 locount = getSequence();
endRange(groupSegCount);
_ltEqual(ctx);
noteCLSeeks(ctx, 1, 0, 0);
noteSeeks(ctx, 1, 0, 0);
return getSequence()-locount+1;
}

Expand Down Expand Up @@ -3031,7 +3031,7 @@ class CKeyMerger : public CKeyLevelManager
if (!found || !seek || memcmp(cursor->queryKeyedBuffer() + seekOffset, seek, seeklen) >= 0)
break;
}
noteCLSkips(ctx, lskips, lnullSkips);
noteSkips(ctx, lskips, lnullSkips);
if (found)
{
IKeyCursor *mergeCursor;
Expand Down

0 comments on commit a74b3d6

Please sign in to comment.