Jelajahi Sumber

HPCC-11713 Increase timeout and remove need to clone tree

Signed-off-by: Gavin Halliday <gavin.halliday@lexisnexis.com>
Gavin Halliday 11 tahun lalu
induk
melakukan
1ade1088f9
2 mengubah file dengan 17 tambahan dan 15 penghapusan
  1. 1 1
      common/environment/environment.cpp
  2. 16 14
      plugins/fileservices/fileservices.cpp

+ 1 - 1
common/environment/environment.cpp

@@ -30,7 +30,7 @@
 #include "dasds.hpp"
 #include "dalienv.hpp"
 
-#define SDS_LOCK_TIMEOUT  10000
+#define SDS_LOCK_TIMEOUT  30000
 
 
 static int environmentTraceLevel = 1;

+ 16 - 14
plugins/fileservices/fileservices.cpp

@@ -170,31 +170,33 @@ static IConstWorkUnit * getWorkunit(ICodeContext * ctx)
     return factory->openWorkUnit(wuid, false);
 }
 
-static IPropertyTree *getEnvironment()
+static IConstEnvironment * openDaliEnvironment()
 {
-    Owned<IPropertyTree> envTree;
-    if (daliClientActive()) {
+    if (daliClientActive())
+    {
         Owned<IEnvironmentFactory> factory = getEnvironmentFactory();
-        Owned<IConstEnvironment> env = factory->openEnvironment();
-        if (env)
-        {
-            Owned<IPropertyTree> root = &env->getPTree();
-            //GH->JCS is this necessary?
-            envTree.setown(createPTreeFromIPT(root)); // we don't really need to copy here
-        }
+        return factory->openEnvironment();
     }
-    if (!envTree.get())
-        envTree.setown(getHPCCEnvironment());
-    return envTree.getClear();
+    return NULL;
+}
+
+static IPropertyTree *getEnvironmentTree(IConstEnvironment * daliEnv)
+{
+    if (daliEnv)
+        return &daliEnv->getPTree(); // No need to clone since daliEnv ensures connection stays alive.
+    return getHPCCEnvironment();
 }
 
 static const char *getEspServerURL(const char *param)
 {
     if (param&&*param)
         return param;
+
+    //MORE: Not thread safe, although not very likely to cause problems.
     static StringAttr espurl;
     if (espurl.isEmpty()) {
-        Owned<IPropertyTree> env = getEnvironment();
+        Owned<IConstEnvironment> daliEnv = openDaliEnvironment();
+        Owned<IPropertyTree> env = getEnvironmentTree(daliEnv);
         StringBuffer tmp;
         if (env.get()) {
             Owned<IPropertyTreeIterator> iter1 = env->getElements("Software/EspProcess");