Przeglądaj źródła

HPCC-18721 Roxie not correctly preloading py3/py2 plugins

Signed-off-by: Richard Chapman <rchapman@hpccsystems.com>
Richard Chapman 7 lat temu
rodzic
commit
13689fbf7f

+ 1 - 0
common/dllserver/thorplugin.cpp

@@ -621,6 +621,7 @@ extern DLLSERVER_API void getAdditionalPluginsPath(StringBuffer &pluginsPath, co
     // We only add the additional plugins if the plugins path already includes the default plugins location
     StringBuffer base(_base);
     removeTrailingPathSepChar(base);
+    removeTrailingPathSepChar(pluginsPath);
     StringBuffer defaultLocation(base);
     defaultLocation.append(PATHSEPSTR "plugins");
     StringArray paths;

+ 0 - 18
ecl/eclcc/eclcc.cpp

@@ -163,24 +163,6 @@ static bool extractOption(StringAttr & option, IProperties * globals, const char
     return ret;
 }
 
-static bool getPackageFolder(StringBuffer & path)
-{
-    StringBuffer folder;
-    splitDirTail(queryCurrentProcessPath(), folder);
-    removeTrailingPathSepChar(folder);
-    if (folder.length())
-    {
-        StringBuffer foldersFolder;
-        splitDirTail(folder.str(), foldersFolder);
-        if (foldersFolder.length())
-        {
-            path = foldersFolder;
-            return true;
-        }
-    }
-    return false;
-}
-
 static bool getHomeFolder(StringBuffer & homepath)
 {
     if (!getHomeDir(homepath))

+ 7 - 3
roxie/ccd/ccdmain.cpp

@@ -934,9 +934,13 @@ int STARTQUERY_API start_query(int argc, const char *argv[])
 
 
         topology->getProp("@pluginDirectory", pluginDirectory);
-        if (pluginDirectory.length() == 0)
-            pluginDirectory.append(codeDirectory).append("plugins");
-        getAdditionalPluginsPath(pluginDirectory, codeDirectory);
+        StringBuffer packageDirectory;
+        getPackageFolder(packageDirectory);
+        if (pluginDirectory.length() == 0 && packageDirectory.length() != 0)
+        {
+            pluginDirectory.append(packageDirectory).append("plugins");
+        }
+        getAdditionalPluginsPath(pluginDirectory, packageDirectory);
         if (queryDirectory.length() == 0)
         {
             topology->getProp("@queryDir", queryDirectory);

+ 1 - 0
roxie/ccd/ccdstate.cpp

@@ -2853,6 +2853,7 @@ IRoxieQueryPackageManagerSet *globalPackageSetManager = NULL;
 
 extern void loadPlugins()
 {
+    DBGLOG("Preloading plugins from %s", pluginDirectory.str());
     if (pluginDirectory.length())
     {
         plugins = new SafePluginMap(&PluginCtx, traceLevel >= 1);

+ 19 - 0
system/jlib/jutil.cpp

@@ -2691,6 +2691,25 @@ const char * queryCurrentProcessPath()
     return processPath.str();
 }
 
+bool getPackageFolder(StringBuffer & path)
+{
+    StringBuffer folder;
+    splitDirTail(queryCurrentProcessPath(), folder);
+    removeTrailingPathSepChar(folder);
+    if (folder.length())
+    {
+        StringBuffer foldersFolder;
+        splitDirTail(folder.str(), foldersFolder);
+        if (foldersFolder.length())
+        {
+            path = foldersFolder;
+            return true;
+        }
+    }
+    return false;
+}
+
+
 inline bool isOctChar(char c) 
 { 
     return (c>='0' && c<'8'); 

+ 9 - 1
system/jlib/jutil.hpp

@@ -385,7 +385,15 @@ extern jlib_decl bool queryDafsSecSettings(DAFSConnectCfg *_connectMethod,
 extern jlib_decl const char * matchConfigurationDirectoryEntry(const char *path,const char *mask,StringBuffer &name, StringBuffer &component, StringBuffer &instance);
 extern jlib_decl bool replaceConfigurationDirectoryEntry(const char *path,const char *frommask,const char *tomask,StringBuffer &out);
 
-extern jlib_decl const char *queryCurrentProcessPath(); 
+extern jlib_decl const char *queryCurrentProcessPath();
+
+/**
+ * Locate the 'package home' directory - normally /opt/HPCCSystems - by detecting the current executable's location
+ *
+ * @param path     Returns the package home location
+ * @return         True if the home directory was located
+ */
+extern jlib_decl bool getPackageFolder(StringBuffer & path);
 
 extern jlib_decl int parseCommandLine(const char * cmdline, MemoryBuffer &mb, const char** &argvout); // parses cmdline into argvout returning arg count (mb used as buffer)