Skip to content

Commit

Permalink
Clean roxie solution
Browse files Browse the repository at this point in the history
Signed-off-by: Gavin Halliday <[email protected]>
  • Loading branch information
ghalliday committed Dec 13, 2024
1 parent f384cc6 commit d706cc4
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 2 deletions.
23 changes: 21 additions & 2 deletions dali/base/dafdesc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3794,18 +3794,37 @@ static void doInitializeStorageGroups(bool createPlanesFromGroups, IPropertyTree
setupContainerizedStorageLocations();
}

//Store whether we are currently creating planes from groups, and what the last update was
static bool globalCreatePlanesFromGroups = false;
static bool lastCreatedPlanesFromGroups = false;
void initializeStoragePlanes(bool createPlanesFromGroups, bool threadSafe)
{
auto updateFunc = [createPlanesFromGroups](IPropertyTree * newComponentConfiguration, IPropertyTree * newGlobalConfiguration)
Rename parameter to updatePlanesFromDali?
{
//MORE: createPlanesFromGroup will never be updated....
//If the createPlanesFromGroups parameter is now true, and was previously false, force an update
CriticalBlock block(storageCS);
if (!lastCreatedPlanesFromGroups && createPlanesFromGroups)
configUpdateHook.clear();
globalCreatePlanesFromGroups = createPlanesFromGroups;
}
MORE: Check this logic

auto updateFunc = [](IPropertyTree * newComponentConfiguration, IPropertyTree * newGlobalConfiguration)
{
bool createPlanesFromGroups = globalCreatePlanesFromGroups;
lastCreatedPlanesFromGroups = createPlanesFromGroups;
PROGLOG("initializeStoragePlanes update");
doInitializeStorageGroups(createPlanesFromGroups, newGlobalConfiguration);
};

configUpdateHook.installModifierOnce(updateFunc, threadSafe);
}

void disableStoragePlanesDaliUpdates()
{
globalCreatePlanesFromGroups = false;
}

bool getDefaultStoragePlane(StringBuffer &ret)
{
#ifdef _CONTAINERIZED
Expand Down
2 changes: 2 additions & 0 deletions dali/base/dafdesc.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -407,6 +407,8 @@ extern da_decl void setPartMask(const char * mask);
extern da_decl bool setReplicateDir(const char *name,StringBuffer &out, bool isrep=true,const char *baseDir=NULL,const char *repDir=NULL); // changes directory of name passed to backup directory

extern da_decl void initializeStoragePlanes(bool createPlanesFromGroups, bool threadSafe); // threadSafe should be true if no other threads will be accessing the global config
extern da_decl void disableStoragePlanesUpdater();

extern da_decl bool getDefaultStoragePlane(StringBuffer &ret);
extern da_decl bool getDefaultSpillPlane(StringBuffer &ret);
extern da_decl bool getDefaultIndexBuildStoragePlane(StringBuffer &ret);
Expand Down
2 changes: 2 additions & 0 deletions roxie/ccd/ccddali.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,7 @@ class CRoxieDaliHelper : implements IRoxieDaliHelper, public CInterface
virtual void beforeDispose()
{
CriticalBlock b(daliHelperCrit);

disconnectSem.interrupt();
connectWatcher.stop();
if (daliHelper==this) // there is a tiny window where new dalihelper created immediately after final release
Expand Down Expand Up @@ -928,6 +929,7 @@ class CRoxieDaliHelper : implements IRoxieDaliHelper, public CInterface
CriticalBlock b(daliConnectionCrit);
if (isConnected)
{
disableStoragePlanesDaliUpdates();
isConnected = false;
delete serverStatus;
serverStatus = NULL;
Expand Down

0 comments on commit d706cc4

Please sign in to comment.