From cf907682165b38744de4158ed0ebcbb0c93a9497 Mon Sep 17 00:00:00 2001 From: wangkx Date: Fri, 3 Nov 2023 16:22:08 -0400 Subject: [PATCH] HPCC-26634 Check query status only on 'can publish queries' roxies 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 --- .../ws_workunits/ws_workunitsQuerySets.cpp | 31 ++++++------------- esp/smc/SMCLib/TpContainer.cpp | 11 +++++++ esp/smc/SMCLib/TpWrapper.cpp | 16 ++++++++++ esp/smc/SMCLib/TpWrapper.hpp | 1 + 4 files changed, 37 insertions(+), 22 deletions(-) diff --git a/esp/services/ws_workunits/ws_workunitsQuerySets.cpp b/esp/services/ws_workunits/ws_workunitsQuerySets.cpp index 72eb3b87d31..8a7b75539c1 100644 --- a/esp/services/ws_workunits/ws_workunitsQuerySets.cpp +++ b/esp/services/ws_workunits/ws_workunitsQuerySets.cpp @@ -1837,34 +1837,21 @@ void CWsWorkunitsEx::getSuspendedQueriesByCluster(MapStringTo &suspendedQu if (!isEmptyString(queryID)) queryIDs.append(queryID); + StringArray roxieTargets; if (!isEmptyString(querySet)) - { -#ifndef _CONTAINERIZED - Owned queriesOnCluster = getQueriesOnCluster(querySet, querySet, &queryIDs, checkAllNodes); -#else - Owned queriesOnCluster = getQueriesOnCluster(querySet, querySet, &queryIDs, checkAllNodes, roxieConnMap); -#endif - addSuspendedQueryIDs(suspendedQueries, queriesOnCluster, querySet); - } + roxieTargets.append(querySet); else - { -#ifdef _CONTAINERIZED - Owned targets = getContainerTargetClusters("roxie", nullptr); -#else - Owned 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 queriesOnCluster = getQueriesOnCluster(target.str(), target.str(), &queryIDs, checkAllNodes); + Owned queriesOnCluster = getQueriesOnCluster(roxieTarget, roxieTarget, &queryIDs, checkAllNodes); #else - Owned queriesOnCluster = getQueriesOnCluster(target.str(), target.str(), &queryIDs, checkAllNodes, roxieConnMap); + Owned queriesOnCluster = getQueriesOnCluster(roxieTarget, roxieTarget, &queryIDs, checkAllNodes, roxieConnMap); #endif - addSuspendedQueryIDs(suspendedQueries, queriesOnCluster, target.str()); - } + addSuspendedQueryIDs(suspendedQueries, queriesOnCluster, roxieTarget); } } diff --git a/esp/smc/SMCLib/TpContainer.cpp b/esp/smc/SMCLib/TpContainer.cpp index 8d504dbe9de..9a3d81fe562 100644 --- a/esp/smc/SMCLib/TpContainer.cpp +++ b/esp/smc/SMCLib/TpContainer.cpp @@ -689,6 +689,17 @@ extern TPWRAPPER_API void initContainerRoxieTargets(MapStringToMyClass 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 targets = getContainerTargetClusters("thor", nullptr); diff --git a/esp/smc/SMCLib/TpWrapper.cpp b/esp/smc/SMCLib/TpWrapper.cpp index 89b8b7df25a..581739a7887 100644 --- a/esp/smc/SMCLib/TpWrapper.cpp +++ b/esp/smc/SMCLib/TpWrapper.cpp @@ -2093,6 +2093,22 @@ extern TPWRAPPER_API void initContainerRoxieTargets(MapStringToMyClass& 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);