Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/candidate-9.0.x' into candidate-…
Browse files Browse the repository at this point in the history
…9.0.96

Signed-off-by: Gavin Halliday <[email protected]>

# Conflicts:
#	helm/hpcc/Chart.yaml
#	helm/hpcc/templates/_helpers.tpl
#	helm/hpcc/templates/dafilesrv.yaml
#	helm/hpcc/templates/dali.yaml
#	helm/hpcc/templates/dfuserver.yaml
#	helm/hpcc/templates/eclagent.yaml
#	helm/hpcc/templates/eclccserver.yaml
#	helm/hpcc/templates/eclscheduler.yaml
#	helm/hpcc/templates/esp.yaml
#	helm/hpcc/templates/localroxie.yaml
#	helm/hpcc/templates/roxie.yaml
#	helm/hpcc/templates/sasha.yaml
#	helm/hpcc/templates/thor.yaml
#	version.cmake
  • Loading branch information
ghalliday committed Apr 2, 2024
2 parents 1a56bd9 + 2e4a6f9 commit e4d4ffb
Showing 1 changed file with 22 additions and 6 deletions.
28 changes: 22 additions & 6 deletions system/jhtree/jhtree.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -690,7 +690,7 @@ class CNodeMapping : public HTMapping<CNodeCacheEntry, CKeyIdAndPos>
};

typedef OwningSimpleHashTableOf<CNodeMapping, CKeyIdAndPos> CNodeTable;
class CNodeMRUCache : public CMRUCacheOf<CKeyIdAndPos, CNodeCacheEntry, CNodeMapping, CNodeTable>
class CNodeMRUCache final : public CMRUCacheOf<CKeyIdAndPos, CNodeCacheEntry, CNodeMapping, CNodeTable>
{
std::atomic<size32_t> sizeInMem{0};
size32_t memLimit = 0;
Expand All @@ -706,15 +706,31 @@ class CNodeMRUCache : public CMRUCacheOf<CKeyIdAndPos, CNodeCacheEntry, CNodeMap
virtual void makeSpace()
{
// remove LRU until !full
// This code could walk the list, rather than restarting at the end each time - but there are unlikely to be
// many entries that have no associated node, and nodes could have been associated in the meantime.
do
{
//Never evict an entry that hasn't yet loaded - otherwise the sizeInMem can become inconsistent
CNodeMapping *tail = mruList.tail();
assertex(tail);
if (!tail->queryElement().isReady() )
break;
if (unlikely(!tail))
throw makeStringExceptionV(9999, "Index cache appears full but contains no entries size=%x limit=%x", sizeInMem.load(), memLimit);

//Never evict an entry that hasn't yet loaded - otherwise the sizeInMem can become inconsistent
//When running with slow remote storage this can take a long time to be ready - so we need
//to walk on to the next entry in the lrulist, otherwise we can run out of memory since nothing
//would be removed.
while (!tail->queryElement().isReady())
{
tail = tail->prev;
if (!tail)
{
// no pages in the cache are ready - this could possibly happen in a tiny race-window where
// sizes in the cache have been updated, but no nodes have yet been associated with the entries.
return;
}
}

clear(1);
mruList.remove(tail);
table.removeExact(tail);
}
while (full());
}
Expand Down

0 comments on commit e4d4ffb

Please sign in to comment.