Skip to content

Commit

Permalink
Merge pull request #18455 from kenrowland/HPCC-31458
Browse files Browse the repository at this point in the history
HPCC-31458 Fix incorrect specification of Type enum in ws_topology

Reviewed-By: Kevin wang <[email protected]>
Merged-by: Gavin Halliday <[email protected]>
  • Loading branch information
ghalliday authored Apr 4, 2024
2 parents 6170824 + cd37131 commit 41c725a
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 24 deletions.
18 changes: 16 additions & 2 deletions esp/scm/ws_topology.ecm
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,20 @@ ESPenum RoxieQueueFilter : string
WorkunitsOnly("WorkunitsOnly")
};

ESPenum TpMachineType : string
{
All("ALLNODES"),
Thor("THORMACHINES"),
Hole("HOLEMACHINES"),
Roxie("ROXIEMACHINES"),
Machines("MACHINES"),
Available("AVAILABLEMACHINES"),
DropZone("DROPZONE"),
StandBy("STANDBYNNODE"),
ThorSpare("THORSPARENODES"),
HoleStandby("HOLESTANDBYNODES")
};

// ===========================================================================

ESPStruct TpMachine
Expand Down Expand Up @@ -418,7 +432,7 @@ ESPresponse [exceptions_inline,encode(0)] TpClusterInfoResponse
ESPrequest [] TpMachineQueryRequest
{
//Type of Node the parent is....
string Type;
ESPenum TpMachineType Type;
string Cluster;
string OldIP;
//Path to Parent within Dali(Encoded to prevent back-engineering)
Expand All @@ -433,7 +447,7 @@ ESPresponse [exceptions_inline] TpMachineQueryResponse
{
bool EnablePreflightInfo;
[min_ver("1.15")] bool HasThorSpareProcess;
string Type;
ESPenum TpMachineType Type;
string Cluster;
string OldIP;
string LogDirectory;
Expand Down
11 changes: 6 additions & 5 deletions esp/services/ws_topology/ws_topologyService.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1536,12 +1536,13 @@ bool CWsTopologyEx::onTpMachineQuery(IEspContext &context, IEspTpMachineQueryReq
const char* directory = req.getDirectory();

bool hasThorSpareProcess = false;
const char* type = req.getType();
if (!type || !*type || (strcmp(eqAllNodes,type) == 0))
const CTpMachineType type = req.getType();
// if (!type || !*type || (strcmp(eqAllNodes,type) == 0))
if (type == TpMachineType_Undefined || type == CTpMachineType_All )
{
m_TpWrapper.getClusterMachineList(version, eqTHORMACHINES, path, directory, MachineList, hasThorSpareProcess);
m_TpWrapper.getClusterMachineList(version, eqHOLEMACHINES, path, directory, MachineList, hasThorSpareProcess);
m_TpWrapper.getClusterMachineList(version, eqROXIEMACHINES,path, directory, MachineList, hasThorSpareProcess);
m_TpWrapper.getClusterMachineList(version, CTpMachineType_Thor, path, directory, MachineList, hasThorSpareProcess);
m_TpWrapper.getClusterMachineList(version, CTpMachineType_Hole, path, directory, MachineList, hasThorSpareProcess);
m_TpWrapper.getClusterMachineList(version, CTpMachineType_Roxie,path, directory, MachineList, hasThorSpareProcess);
}
else
{
Expand Down
2 changes: 1 addition & 1 deletion esp/smc/SMCLib/TpContainer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ const char* MSG_FAILED_GET_ENVIRONMENT_INFO = "Failed to get environment informa
//////////////////////////////////////////////////////////////////////

void CTpWrapper::getClusterMachineList(double clientVersion,
const char* ClusterType,
CTpMachineType ClusterType,
const char* ClusterPath,
const char* ClusterDirectory,
IArrayOf<IEspTpMachine> &MachineList,
Expand Down
30 changes: 15 additions & 15 deletions esp/smc/SMCLib/TpWrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ IPropertyTree* CTpWrapper::getEnvironment(const char* xpath)
}

void CTpWrapper::getClusterMachineList(double clientVersion,
const char* ClusterType,
CTpMachineType ClusterType,
const char* ClusterPath,
const char* ClusterDirectory,
IArrayOf<IEspTpMachine> &MachineList,
Expand All @@ -68,7 +68,7 @@ void CTpWrapper::getClusterMachineList(double clientVersion,
getAttPath(ClusterPath,path);
set<string> machineNames; //used for checking duplicates

if (strcmp(eqTHORMACHINES,ClusterType) == 0)
if (ClusterType == CTpMachineType_Thor)
{
bool multiSlaves = false;
getMachineList(clientVersion, eqThorMasterProcess, path.str(), "", ClusterDirectory, MachineList);
Expand All @@ -81,41 +81,41 @@ void CTpWrapper::getClusterMachineList(double clientVersion,
if (!checkMultiSlavesFlag(ClusterName) &&(count < MachineList.length()))
hasThorSpareProcess = true;
}
else if (strcmp(eqHOLEMACHINES,ClusterType) == 0)
else if (ClusterType == CTpMachineType_Hole)
{
getMachineList(clientVersion, eqHoleSocketProcess, path.str(), "", ClusterDirectory, MachineList);
getMachineList(clientVersion, eqHoleProcessorProcess, path.str(), "", ClusterDirectory, MachineList);
getMachineList(clientVersion, eqHoleControlProcess, path.str(), "", ClusterDirectory, MachineList);
getMachineList(clientVersion, eqHoleCollatorProcess, path.str(), "", ClusterDirectory, MachineList);
getMachineList(clientVersion, eqHoleStandbyProcess, path.str(), "", ClusterDirectory, MachineList);
}
else if (strcmp(eqROXIEMACHINES,ClusterType) == 0)
else if (ClusterType == CTpMachineType_Roxie)
{
getMachineList(clientVersion, "RoxieServerProcess", path.str(), "", ClusterDirectory, MachineList, &machineNames);
}
else if (strcmp(eqMACHINES,ClusterType) == 0)
else if (ClusterType == CTpMachineType_Machines)
{
//load a list of available machines.......
getMachineList(clientVersion, "Computer", "/Environment/Hardware", "", ClusterDirectory, MachineList);
}
else if (strcmp("AVAILABLEMACHINES",ClusterType) == 0)
else if (ClusterType == CTpMachineType_Available)
{
getMachineList(clientVersion, "Computer", "/Environment/Hardware", eqMachineAvailablability, ClusterDirectory, MachineList);
}
else if (strcmp("DROPZONE",ClusterType) == 0)
else if (ClusterType == CTpMachineType_DropZone)
{
getDropZoneMachineList(clientVersion, false, MachineList);
}
else if (strcmp("STANDBYNNODE",ClusterType) == 0)
else if (ClusterType == CTpMachineType_StandBy)
{
getThorSpareMachineList(clientVersion, ClusterName, ClusterDirectory, MachineList);
getMachineList(clientVersion, eqHoleStandbyProcess, path.str(), "", ClusterDirectory, MachineList);
}
else if (strcmp("THORSPARENODES",ClusterType) == 0)
else if (ClusterType == CTpMachineType_ThorSpare)
{
getThorSpareMachineList(clientVersion, ClusterName, ClusterDirectory, MachineList);
}
else if (strcmp("HOLESTANDBYNODES",ClusterType) == 0)
else if (ClusterType == CTpMachineType_HoleStandby)
{
getMachineList(clientVersion, eqHoleStandbyProcess, path.str(), "", ClusterDirectory, MachineList);
}
Expand Down Expand Up @@ -756,23 +756,23 @@ void CTpWrapper::queryTargetClusterProcess(double version, const char* processNa
OS_TYPE os = OS_WINDOWS;
unsigned int clusterTypeLen = strlen(clusterType);
const char* childType = NULL;
const char* clusterType0 = NULL;
CTpMachineType clusterType0 = TpMachineType_Undefined;
if (clusterTypeLen > 4)
{
if (!strnicmp(clusterType, "roxie", 4))
{
childType = "RoxieServerProcess[1]";
clusterType0 = eqROXIEMACHINES;
clusterType0 = CTpMachineType_Roxie;
}
else if (!strnicmp(clusterType, "thor", 4))
{
childType = "ThorMasterProcess";
clusterType0 = eqTHORMACHINES;
clusterType0 = CTpMachineType_Thor;
}
else
{
childType = "HoleControlProcess";
clusterType0 = eqHOLEMACHINES;
clusterType0 = CTpMachineType_Hole;
}
}

Expand Down Expand Up @@ -800,7 +800,7 @@ void CTpWrapper::queryTargetClusterProcess(double version, const char* processNa
}
clusterInfo->setOS(os);

if (clusterType0 && *clusterType0)
if (clusterType0 != TpMachineType_Undefined)
{
bool hasThorSpareProcess = false;
IArrayOf<IEspTpMachine> machineList;
Expand Down
2 changes: 1 addition & 1 deletion esp/smc/SMCLib/TpWrapper.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ class TPWRAPPER_API CTpWrapper : public CInterface
void getHthorClusterList(IArrayOf<IEspTpCluster>& clusterList);
void getGroupList(double espVersion, const char* kindReq, IArrayOf<IEspTpGroup> &Groups);
void getCluster(const char* ClusterType,IPropertyTree& returnRoot);
void getClusterMachineList(double clientVersion, const char* ClusterType,const char* ClusterPath, const char* ClusterDirectory,
void getClusterMachineList(double clientVersion, CTpMachineType ClusterType,const char* ClusterPath, const char* ClusterDirectory,
IArrayOf<IEspTpMachine> &MachineList, bool& hasThorSpareProcess, const char* ClusterName = NULL);
void getMachineList(double clientVersion, const char* MachineType, const char* MachinePath, const char* Status,
const char* Directory, IArrayOf<IEspTpMachine>& MachineList, set<string>* pMachineNames=nullptr);
Expand Down

0 comments on commit 41c725a

Please sign in to comment.