Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
jakesmith committed Nov 29, 2023
1 parent f5ef1ea commit c848f18
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 6 deletions.
6 changes: 3 additions & 3 deletions ecl/hthor/hthorkey.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -419,7 +419,7 @@ bool CHThorIndexReadActivityBase::doPreopenLimitFile(unsigned __int64 & count, u
{
Owned<IKeyIndex> tlk = openKeyFile(df->queryPart(num));
verifyIndex(tlk);
Owned<IKeyManager> tlman = createLocalKeyManager(eclKeySize.queryRecordAccessor(true), tlk, &contextLogger, helper.hasNewSegmentMonitors(), false);
Owned<IKeyManager> tlman = createLocalKeyManager(eclKeySize.queryRecordAccessor(true), tlk, nullptr, helper.hasNewSegmentMonitors(), false);
initManager(tlman, true);
while(tlman->lookup(false) && (count<=limit))
{
Expand Down Expand Up @@ -591,7 +591,7 @@ bool CHThorIndexReadActivityBase::firstMultiPart()
if(!tlk)
openTlk();
verifyIndex(tlk);
tlManager.setown(createLocalKeyManager(eclKeySize.queryRecordAccessor(true), tlk, &contextLogger, helper.hasNewSegmentMonitors(), false));
tlManager.setown(createLocalKeyManager(eclKeySize.queryRecordAccessor(true), tlk, nullptr, helper.hasNewSegmentMonitors(), false));
initManager(tlManager, true);
nextPartNumber = 0;
return nextMultiPart();
Expand Down Expand Up @@ -3162,7 +3162,7 @@ class DistributedKeyLookupHandler : public CInterface, implements IThreadedExcep
//Owned<IRecordLayoutTranslator>
trans.setown(owner.getLayoutTranslator(&f));
owner.verifyIndex(&f, index, trans);
Owned<IKeyManager> manager = createLocalKeyManager(owner.queryIndexRecord(), index, &contextLogger, owner.hasNewSegmentMonitors(), false);
Owned<IKeyManager> manager = createLocalKeyManager(owner.queryIndexRecord(), index, nullptr, owner.hasNewSegmentMonitors(), false);
managers.append(*manager.getLink());
}
opened = true;
Expand Down
16 changes: 14 additions & 2 deletions system/jhtree/jhtree.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -351,6 +351,7 @@ class jhtree_decl CKeyLevelManager : implements IKeyManager, public CInterface
{
protected:
KeyStatsCollector stats;
IContextLogger *ctx = nullptr;
Owned <IIndexFilterList> filter;
IKeyCursor *keyCursor;
ConstPointerArray activeBlobs;
Expand All @@ -368,7 +369,7 @@ class jhtree_decl CKeyLevelManager : implements IKeyManager, public CInterface
IMPLEMENT_IINTERFACE;

CKeyLevelManager(const RtlRecord &_recInfo, IKeyIndex * _key, IContextLogger *_ctx, bool _newFilters, bool _logExcessiveSeeks)
: stats(_ctx), newFilters(_newFilters), logExcessiveSeeks(_logExcessiveSeeks)
: ctx(_ctx), stats(_ctx), newFilters(_newFilters), logExcessiveSeeks(_logExcessiveSeeks)
{
if (newFilters)
filter.setown(new IndexRowFilter(_recInfo));
Expand All @@ -395,7 +396,7 @@ class jhtree_decl CKeyLevelManager : implements IKeyManager, public CInterface
stats.reset();
}

void setKey(IKeyIndexBase * _key)
virtual void setKey(IKeyIndexBase * _key) override
{
::Release(keyCursor);
keyCursor = NULL;
Expand All @@ -410,6 +411,17 @@ class jhtree_decl CKeyLevelManager : implements IKeyManager, public CInterface
keyedSize = ki->keyedSize();
partitionFieldMask = ki->getPartitionFieldMask();
indexParts = ki->numPartitions();

if (ctx)
{
// If the key is a TLK, we don't want to conflate its stats into same context logger as other index parts
// suppress until next setKey() call
IKeyIndex *key = dynamic_cast<IKeyIndex *>(_key); // NB: should always be a IKeyIndex in the context of a CKeyLevelManager
if (key && key->isTopLevelKey())
stats.ctx = nullptr;
else
stats.ctx = ctx;
}
}
}

Expand Down
2 changes: 1 addition & 1 deletion thorlcr/activities/keyedjoin/thkeyedjoinslave.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2420,7 +2420,7 @@ class CKeyedJoinSlave : public CSlaveActivity, implements IJoinProcessor, implem
{
IKeyIndex *tlkKeyIndex = &tlkKeyIndexes.item(i);
const RtlRecord &keyRecInfo = helper->queryIndexRecordSize()->queryRecordAccessor(true);
Owned<IKeyManager> tlkManager = createLocalKeyManager(keyRecInfo, nullptr, &contextLogger, helper->hasNewSegmentMonitors(), false);
Owned<IKeyManager> tlkManager = createLocalKeyManager(keyRecInfo, nullptr, nullptr, helper->hasNewSegmentMonitors(), false);
tlkManager->setKey(tlkKeyIndex);
keyManagers.append(*tlkManager.getClear());
}
Expand Down

0 comments on commit c848f18

Please sign in to comment.