From 7a259e66985c9d077279544fe85c26190e8260f9 Mon Sep 17 00:00:00 2001 From: Terrence Asselin Date: Mon, 11 Nov 2024 12:46:13 -0600 Subject: [PATCH] HPCC-32963 Fix ecl unused-files for bare-metal roxie with TLS and custom port In non-containerized deployments, fix the `ecl roxie unused-files` command to work when roxies are configured for TLS (SSL) and/or they're using a nonstandard port other than 9876. Signed-off-by: Terrence Asselin --- esp/services/ws_dfu/ws_dfuXRefService.cpp | 17 +++++++++++++---- esp/services/ws_dfu/ws_dfuXRefService.hpp | 1 + 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/esp/services/ws_dfu/ws_dfuXRefService.cpp b/esp/services/ws_dfu/ws_dfuXRefService.cpp index 0bd88094f0f..759df1a7144 100644 --- a/esp/services/ws_dfu/ws_dfuXRefService.cpp +++ b/esp/services/ws_dfu/ws_dfuXRefService.cpp @@ -117,6 +117,10 @@ void CWsDfuXRefEx::init(IPropertyTree *cfg, const char *process, const char *ser throw MakeStringException(-1, "No Dali Connection Active. Please Specify a Dali to connect to in you configuration file"); } +#ifndef _CONTAINERIZED + initBareMetalRoxieTargets(roxieConnMap); +#endif + XRefNodeManager.setown(CreateXRefNodeFactory()); //Start out builder thread...... @@ -750,19 +754,24 @@ void CWsDfuXRefEx::findUnusedFilesWithDetailsInDFS(IEspContext &context, const c void CWsDfuXRefEx::getRoxieFiles(const char *process, bool checkPackageMaps, MapStringTo &usedFileMap) { SocketEndpointArray servers; + Owned controlXrefInfo; #ifdef _CONTAINERIZED StringBuffer epStr; getService(epStr, process, true); SocketEndpoint ep(epStr); servers.append(ep); -#else - getRoxieProcessServers(process, servers); if (!servers.length()) throw MakeStringExceptionDirect(ECLWATCH_INVALID_CLUSTER_INFO, "process cluster, not found."); + Owned sock = ISocket::connect_timeout(servers.item(0), ROXIECONNECTIONTIMEOUT); + controlXrefInfo.setown(sendRoxieControlQuery(sock, "", ROXIECONTROLXREFTIMEOUT)); +#else + ISmartSocketFactory *conn = roxieConnMap.getValue(process); + if (!conn) + throw makeStringExceptionV(ECLWATCH_CANNOT_GET_ENV_INFO, "Connection info for '%s' process cluster not found.", process ? process : "(null)"); + + controlXrefInfo.setown(sendRoxieControlQuery(conn, "", ROXIECONTROLXREFTIMEOUT, ROXIECONNECTIONTIMEOUT)); #endif - Owned sock = ISocket::connect_timeout(servers.item(0), ROXIECONNECTIONTIMEOUT); - Owned controlXrefInfo = sendRoxieControlQuery(sock, "", ROXIECONTROLXREFTIMEOUT); if (!controlXrefInfo) throw MakeStringExceptionDirect(ECLWATCH_INTERNAL_ERROR, "roxie cluster, not responding."); Owned roxieFiles = controlXrefInfo->getElements("//File"); diff --git a/esp/services/ws_dfu/ws_dfuXRefService.hpp b/esp/services/ws_dfu/ws_dfuXRefService.hpp index 9a17c4664a5..ded9f450a97 100644 --- a/esp/services/ws_dfu/ws_dfuXRefService.hpp +++ b/esp/services/ws_dfu/ws_dfuXRefService.hpp @@ -187,6 +187,7 @@ class CWsDfuXRefEx : public CWsDFUXRef { Owned XRefNodeManager; Owned m_XRefbuilder; + MapStringToMyClass roxieConnMap; IXRefFilesNode* getFileNodeInterface(IXRefNode& XRefNode,const char* nodeType); void addXRefNode(const char* name, IPropertyTree* pXRefNodeTree);