Browse Source

HPCC-24738 Wait for prewarm before publishing Roxie agent address

Signed-off-by: Richard Chapman <rchapman@hpccsystems.com>
Richard Chapman 4 years ago
parent
commit
434b092049
3 changed files with 11 additions and 4 deletions
  1. 2 1
      roxie/ccd/ccdmain.cpp
  2. 7 2
      roxie/udplib/udptopo.cpp
  3. 2 1
      roxie/udplib/udptopo.hpp

+ 2 - 1
roxie/ccd/ccdmain.cpp

@@ -1188,7 +1188,7 @@ int CCD_API roxie_main(int argc, const char *argv[], const char * defaultYaml)
             loadPlugins();
         unsigned snifferChannel = numChannels+2; // MORE - why +2 not +1??
 #ifdef _CONTAINERIZED
-        initializeTopology(topoValues, myRoles, traceLevel);
+        initializeTopology(topoValues, myRoles);
 #endif
         createDelayedReleaser();
         globalPackageSetManager = createRoxiePackageSetManager(standAloneDll.getClear());
@@ -1356,6 +1356,7 @@ int CCD_API roxie_main(int argc, const char *argv[], const char * defaultYaml)
                 }
 #ifdef _CONTAINERIZED
                 queryFileCache().loadSavedOsCacheInfo();
+                publishTopology(traceLevel);
 #endif
                 writeSentinelFile(sentinelFile);
                 DBGLOG("Startup completed - LPT=%u APT=%u", queryNumLocalTrees(), queryNumAtomTrees());

+ 7 - 2
roxie/udplib/udptopo.cpp

@@ -224,6 +224,7 @@ public:
     const ITopologyServer &getCurrent();
 
     bool update();
+    unsigned numServers() const { return topoServers.length(); }
 private:
     Owned<const ITopologyServer> currentTopology;
     SpinLock lock;
@@ -366,11 +367,15 @@ static std::thread topoThread;
 static Semaphore abortTopo;
 const unsigned topoUpdateInterval = 5000;
 
-extern UDPLIB_API void initializeTopology(const StringArray &topoValues, const std::vector<RoxieEndpointInfo> &myRoles, unsigned traceLevel)
+extern UDPLIB_API void initializeTopology(const StringArray &topoValues, const std::vector<RoxieEndpointInfo> &myRoles)
 {
     topologyManager.setServers(topoValues);
     topologyManager.setRoles(myRoles);
-    if (topoValues.length())
+}
+
+extern UDPLIB_API void publishTopology(unsigned traceLevel)
+{
+    if (topologyManager.numServers())
     {
         topoThread = std::thread([traceLevel]()
         {

+ 2 - 1
roxie/udplib/udptopo.hpp

@@ -116,7 +116,8 @@ struct RoxieEndpointInfo
     unsigned replicationLevel;
 };
 
-extern UDPLIB_API void initializeTopology(const StringArray &topoServers, const std::vector<RoxieEndpointInfo> &myRoles, unsigned traceLevel);
+extern UDPLIB_API void initializeTopology(const StringArray &topoServers, const std::vector<RoxieEndpointInfo> &myRoles);
+extern UDPLIB_API void publishTopology(unsigned traceLevel);
 #ifndef _CONTAINERIZED
 extern UDPLIB_API void createStaticTopology(const std::vector<RoxieEndpointInfo> &allRoles, unsigned traceLevel);
 #endif