瀏覽代碼

HPCC-23895 Support multiple eclccservers within one topology cluster

Signed-off-by: wangkx <kevin.wang@lexisnexis.com>
wangkx 5 年之前
父節點
當前提交
a9cfb5263d
共有 3 個文件被更改,包括 37 次插入28 次删除
  1. 32 23
      common/environment/environment.cpp
  2. 1 1
      common/environment/environment.hpp
  3. 4 4
      esp/services/ws_machine/ws_machineService.cpp

+ 32 - 23
common/environment/environment.cpp

@@ -2623,7 +2623,7 @@ class CEnvironmentClusterInfo: implements IConstWUClusterInfo, public CInterface
     StringAttr serverQueue;
     StringAttr agentQueue;
     StringAttr agentName;
-    StringAttr eclServerName;
+    StringArray eclServerNames;
     bool legacyEclServer = false;
     StringAttr eclSchedulerName;
     StringAttr roxieProcess;
@@ -2644,7 +2644,7 @@ class CEnvironmentClusterInfo: implements IConstWUClusterInfo, public CInterface
 public:
     IMPLEMENT_IINTERFACE;
     CEnvironmentClusterInfo(const char *_name, const char *_prefix, const char *_alias, IPropertyTree *agent,
-        IPropertyTree *eclServer, bool _legacyEclServer, IPropertyTree *eclScheduler, IArrayOf<IPropertyTree> &thors, IPropertyTree *roxie)
+        IArrayOf<IPropertyTree> &eclServers, bool _legacyEclServer, IPropertyTree *eclScheduler, IArrayOf<IPropertyTree> &thors, IPropertyTree *roxie)
         : name(_name), prefix(_prefix), alias(_alias), roxieRedundancy(0), channelsPerNode(0), numberOfSlaveLogs(0), roxieReplicateOffset(1), legacyEclServer(_legacyEclServer)
     {
         StringBuffer queue;
@@ -2731,8 +2731,11 @@ public:
 #endif
         if (eclScheduler)
             eclSchedulerName.set(eclScheduler->queryProp("@name"));
-        if (eclServer)
-            eclServerName.set(eclServer->queryProp("@name"));
+        ForEachItemIn(j, eclServers)
+        {
+            const IPropertyTree &eclServer = eclServers.item(j);
+            eclServerNames.append(eclServer.queryProp("@name"));
+        }
 
         // MORE - does this need to be conditional?
         serverQueue.set(getClusterEclCCServerQueueName(queue.clear(), name));
@@ -2762,10 +2765,9 @@ public:
         str.set(agentName);
         return str;
     }
-    IStringVal & getECLServerName(IStringVal & str) const
+    const StringArray & getECLServerNames() const
     {
-        str.set(eclServerName);
-        return str;
+        return eclServerNames;
     }
     bool isLegacyEclServer() const
     {
@@ -3037,6 +3039,23 @@ extern bool isProcessCluster(const char *remoteDali, const char *process)
     return true;
 }
 
+static void getTargetClusterProcesses(const IPropertyTree *environment, const IPropertyTree *cluster, const char *clustName, const char *processType, IArrayOf<IPropertyTree> &processes)
+{
+    StringBuffer xpath;
+    Owned<IPropertyTreeIterator> processItr = cluster->getElements(processType);
+    ForEach(*processItr)
+    {
+        const char *processName = processItr->query().queryProp("@process");
+        if (isEmptyString(processName))
+            throw MakeStringException(-1, "Empty %s/@process for %s", processType, clustName);
+
+        xpath.setf("Software/%s[@name=\"%s\"]", processType, processName);
+        if (!environment->hasProp(xpath))
+            throw MakeStringException(-1, "%s %s not found", processType, processName);
+        processes.append(*environment->getPropTree(xpath.str()));
+    }
+}
+
 IConstWUClusterInfo* getTargetClusterInfo(IPropertyTree *environment, IPropertyTree *cluster)
 {
     const char *clustname = cluster->queryProp("@name");
@@ -3066,23 +3085,13 @@ IConstWUClusterInfo* getTargetClusterInfo(IPropertyTree *environment, IPropertyT
         eclScheduler = environment->queryPropTree(xpath);
     }
     bool isLegacyEclServer = false;
-    IPropertyTree *eclServer = nullptr;
-    const char *eclServerName = cluster->queryProp("EclServerProcess/@process");
-    if (!isEmptyString(eclServerName))
-    {
-        xpath.setf("Software/EclServerProcess[@name=\"%s\"]", eclServerName);
-        eclServer = environment->queryPropTree(xpath);
+    IArrayOf<IPropertyTree> eclServers;
+    getTargetClusterProcesses(environment, cluster, clustname, "EclServerProcess", eclServers);
+    if (eclServers.ordinality())
         isLegacyEclServer = true;
-    }
     else
-    {
-        const char *eclccServerName = cluster->queryProp("EclCCServerProcess/@process");
-        if (!isEmptyString(eclccServerName))
-        {
-            xpath.setf("Software/EclCCServerProcess[@name=\"%s\"]", eclccServerName);
-            eclServer = environment->queryPropTree(xpath);
-        }
-    }
+        getTargetClusterProcesses(environment, cluster, clustname, "EclCCServerProcess", eclServers);
+
     Owned<IPropertyTreeIterator> ti = cluster->getElements("ThorCluster");
     IArrayOf<IPropertyTree> thors;
     ForEach(*ti)
@@ -3096,7 +3105,7 @@ IConstWUClusterInfo* getTargetClusterInfo(IPropertyTree *environment, IPropertyT
         }
     }
     const char *roxieName = cluster->queryProp("RoxieCluster/@process");
-    return new CEnvironmentClusterInfo(clustname, prefix, cluster->queryProp("@alias"), agent, eclServer, isLegacyEclServer, eclScheduler, thors, queryRoxieProcessTree(environment, roxieName));
+    return new CEnvironmentClusterInfo(clustname, prefix, cluster->queryProp("@alias"), agent, eclServers, isLegacyEclServer, eclScheduler, thors, queryRoxieProcessTree(environment, roxieName));
 }
 
 IPropertyTree* getTopologyCluster(Owned<IPropertyTree> &envRoot, const char *clustname)

+ 1 - 1
common/environment/environment.hpp

@@ -251,7 +251,7 @@ interface IConstWUClusterInfo : extends IInterface
     virtual IStringVal & getAgentQueue(IStringVal & str) const = 0;
     virtual IStringVal & getAgentName(IStringVal & str) const = 0;
     virtual IStringVal & getECLSchedulerName(IStringVal & str) const = 0;
-    virtual IStringVal & getECLServerName(IStringVal & str) const = 0;
+    virtual const StringArray & getECLServerNames() const = 0;
     virtual bool isLegacyEclServer() const = 0;
     virtual IStringVal & getServerQueue(IStringVal & str) const = 0;
     virtual IStringVal & getRoxieProcess(IStringVal & str) const = 0;

+ 4 - 4
esp/services/ws_machine/ws_machineService.cpp

@@ -2956,16 +2956,16 @@ IPropertyTree* Cws_machineEx::getTargetClusterUsageReq(IEspGetTargetClusterUsage
         if (roxie.length())
             readRoxieUsageReq(roxie.str(), constEnv, targetClusterTree);
 
-        SCMStringBuffer eclAgent, eclServer, eclScheduler;
+        SCMStringBuffer eclAgent, eclScheduler;
         targetClusterInfo->getAgentName(eclAgent);
         if (eclAgent.length())
             readOtherComponentUsageReq(eclAgent.str(), eqEclAgent, constEnv, targetClusterTree);
-        targetClusterInfo->getECLServerName(eclServer);
-        if (eclServer.length())
-            readOtherComponentUsageReq(eclServer.str(), targetClusterInfo->isLegacyEclServer() ? eqEclServer : eqEclCCServer, constEnv, targetClusterTree);
         targetClusterInfo->getECLSchedulerName(eclScheduler);
         if (eclScheduler.length())
             readOtherComponentUsageReq(eclScheduler.str(), eqEclScheduler, constEnv, targetClusterTree);
+        const StringArray& eclServers = targetClusterInfo->getECLServerNames();
+        ForEachItemIn(j, eclServers)
+            readOtherComponentUsageReq(eclServers.item(j), targetClusterInfo->isLegacyEclServer() ? eqEclServer : eqEclCCServer, constEnv, targetClusterTree);
 
         usageReq->addPropTree(targetClusterTree->queryName(), LINK(targetClusterTree));
     }