Skip to content

Commit

Permalink
HPCC-26634 Check query status only on 'can publish queries' roxies
Browse files Browse the repository at this point in the history
For containerized, the existing WUListQueries tries to check
suspended queries for all roxies. The existing WUListQueries
returns a query not found error if there is a non-queries roxie.
For bare metal, the existing WUListQueries tries to get suspended
queries for every target which contains a RoxieCluster process.
The same error occurs for the targets which cannot publish queries.
The WUListQueries should not check suspended queries for the
roxies which cannot publish queries.

Signed-off-by: wangkx <[email protected]>
  • Loading branch information
wangkx committed Dec 15, 2023
1 parent d6e08bb commit cf90768
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 22 deletions.
31 changes: 9 additions & 22 deletions esp/services/ws_workunits/ws_workunitsQuerySets.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1837,34 +1837,21 @@ void CWsWorkunitsEx::getSuspendedQueriesByCluster(MapStringTo<bool> &suspendedQu
if (!isEmptyString(queryID))
queryIDs.append(queryID);

StringArray roxieTargets;
if (!isEmptyString(querySet))
{
#ifndef _CONTAINERIZED
Owned<IPropertyTree> queriesOnCluster = getQueriesOnCluster(querySet, querySet, &queryIDs, checkAllNodes);
#else
Owned<IPropertyTree> queriesOnCluster = getQueriesOnCluster(querySet, querySet, &queryIDs, checkAllNodes, roxieConnMap);
#endif
addSuspendedQueryIDs(suspendedQueries, queriesOnCluster, querySet);
}
roxieTargets.append(querySet);
else
{
#ifdef _CONTAINERIZED
Owned<IStringIterator> targets = getContainerTargetClusters("roxie", nullptr);
#else
Owned<IStringIterator> targets = getTargetClusters("RoxieCluster", nullptr);
#endif
ForEach(*targets)
{
SCMStringBuffer target;
targets->str(target);
getRoxieTargetsSupportingPublishedQueries(roxieTargets);

ForEachItemIn(i, roxieTargets)
{
const char *roxieTarget = roxieTargets.item(i);
#ifndef _CONTAINERIZED
Owned<IPropertyTree> queriesOnCluster = getQueriesOnCluster(target.str(), target.str(), &queryIDs, checkAllNodes);
Owned<IPropertyTree> queriesOnCluster = getQueriesOnCluster(roxieTarget, roxieTarget, &queryIDs, checkAllNodes);
#else
Owned<IPropertyTree> queriesOnCluster = getQueriesOnCluster(target.str(), target.str(), &queryIDs, checkAllNodes, roxieConnMap);
Owned<IPropertyTree> queriesOnCluster = getQueriesOnCluster(roxieTarget, roxieTarget, &queryIDs, checkAllNodes, roxieConnMap);
#endif
addSuspendedQueryIDs(suspendedQueries, queriesOnCluster, target.str());
}
addSuspendedQueryIDs(suspendedQueries, queriesOnCluster, roxieTarget);
}
}

Expand Down
11 changes: 11 additions & 0 deletions esp/smc/SMCLib/TpContainer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -689,6 +689,17 @@ extern TPWRAPPER_API void initContainerRoxieTargets(MapStringToMyClass<ISmartSoc
}
}

extern TPWRAPPER_API void getRoxieTargetsSupportingPublishedQueries(StringArray& names)
{
Owned<IPropertyTreeIterator> queues = getComponentConfigSP()->getElements("queues[@type='roxie']");
ForEach(*queues)
{
IPropertyTree& queue = queues->query();
if (queue.getPropBool("@queriesOnly"))
names.append(queue.queryProp("@name"));
}
}

extern TPWRAPPER_API unsigned getThorClusterNames(StringArray& targetNames, StringArray& queueNames)
{
Owned<IStringIterator> targets = getContainerTargetClusters("thor", nullptr);
Expand Down
16 changes: 16 additions & 0 deletions esp/smc/SMCLib/TpWrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2093,6 +2093,22 @@ extern TPWRAPPER_API void initContainerRoxieTargets(MapStringToMyClass<ISmartSoc
}
}

extern TPWRAPPER_API void getRoxieTargetsSupportingPublishedQueries(StringArray& names)
{
CConstWUClusterInfoArray clusters;
getEnvironmentClusterInfo(clusters);
ForEachItemIn(i, clusters)
{
IConstWUClusterInfo& clusterInfo = clusters.item(i);
if (clusterInfo.canPublishQueries())
{
SCMStringBuffer name;
clusterInfo.getName(name);
names.append(name.str());
}
}
}

extern TPWRAPPER_API unsigned getThorClusterNames(StringArray& targetNames, StringArray& queueNames)
{
StringArray thorNames, groupNames;
Expand Down
1 change: 1 addition & 0 deletions esp/smc/SMCLib/TpWrapper.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,7 @@ extern TPWRAPPER_API IConstWUClusterInfo* getWUClusterInfoByName(const char* clu
extern TPWRAPPER_API IStringIterator *getContainerTargetClusters(const char* processType, const char* processName);
extern TPWRAPPER_API void initContainerRoxieTargets(MapStringToMyClass<ISmartSocketFactory>& connMap);
extern TPWRAPPER_API unsigned getThorClusterNames(StringArray& targetNames, StringArray& queueNames);
extern TPWRAPPER_API void getRoxieTargetsSupportingPublishedQueries(StringArray& names);
extern TPWRAPPER_API void validateTargetName(const char* target);
extern TPWRAPPER_API bool getSashaService(StringBuffer &serviceAddress, const char *service, bool failIfNotFound);
extern TPWRAPPER_API bool getSashaServiceEP(SocketEndpoint &serviceEndpoint, const char *service, bool failIfNotFound);
Expand Down

0 comments on commit cf90768

Please sign in to comment.