Skip to content

Commit

Permalink
HPCC-31807 Remove stale job queue client entries
Browse files Browse the repository at this point in the history
Signed-off-by: Jake Smith <[email protected]>
  • Loading branch information
jakesmith committed Jun 18, 2024
1 parent 8a7b442 commit 59ff9d2
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 3 deletions.
12 changes: 9 additions & 3 deletions common/workunit/wujobq.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1122,11 +1122,17 @@ class CJobQueue: public CJobQueueBase, implements IJobQueue
void disconnect() // signal no longer wil be dequeing (optional - done automatically on release)
{
Cconnlockblock block(this,true);
if (connected) {
if (connected)
{
dounsubscribe();
ForEachQueue(qd) {
ForEachQueue(qd)
{
IPropertyTree *croot = queryClientRootSession(*qd);
croot->setPropInt64("@connected",croot->getPropInt64("@connected",0)-1);
unsigned newConnectedCount = croot->getPropInt64("@connected",0)-1;
if (newConnectedCount)
croot->setPropInt64("@connected", newConnectedCount);
else
qd->root->removeTree(croot);
}
connected = false;
}
Expand Down
13 changes: 13 additions & 0 deletions dali/base/dasds.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4938,6 +4938,18 @@ void initializeInternals(IPropertyTree *root)
root->addPropTree("Status/Servers",createPTree());
}

void clearStaleMeteData(IPropertyTree *root)
{
// JobQueues
// Remove all Client entries from all queues. By definition they are stale (they should normally be removed when the client disconnects)
Owned<IPropertyTreeIterator> jobQueues = root->getElements("JobQueues/Queue");
ForEach(*jobQueues)
{
IPropertyTree &queue = jobQueues->query();
while (queue.removeProp("Client"));
}
}

IPropertyTree *loadStore(const char *storeFilename, unsigned edition, IPTreeMaker *iMaker, unsigned crcValidation, bool logErrorsOnly=false, const bool *abort=NULL)
{
CHECKEDCRITICALBLOCK(loadStoreCrit, fakeCritTimeout);
Expand Down Expand Up @@ -6543,6 +6555,7 @@ void CCovenSDSManager::loadStore(const char *storeName, const bool *abort)
}
Owned<IRemoteConnection> conn = connect("/", 0, RTM_INTERNAL, INFINITE);
initializeInternals(conn->queryRoot());
clearStaleMeteData(conn->queryRoot());
conn.clear();
initializeStorageGroups(oldEnvironment);
}
Expand Down

0 comments on commit 59ff9d2

Please sign in to comment.