瀏覽代碼

HPCC-11253 Do not lock superfiles in roxie

Fix issues spotted in code review

Signed-off-by: Richard Chapman <rchapman@hpccsystems.com>
Richard Chapman 11 年之前
父節點
當前提交
80d9030781
共有 3 個文件被更改,包括 16 次插入11 次删除
  1. 8 4
      roxie/ccd/ccdfile.cpp
  2. 5 4
      roxie/ccd/ccdquery.cpp
  3. 3 3
      roxie/ccd/ccdstate.cpp

+ 8 - 4
roxie/ccd/ccdfile.cpp

@@ -1681,11 +1681,14 @@ protected:
     {
         if (traceLevel > 2)
             DBGLOG("Superfile %s change detected", lfn.get());
-        CriticalBlock b(lock);
-        if (cached)
+
         {
-            cached->removeCache(this);
-            cached = NULL;
+            CriticalBlock b(lock);
+            if (cached)
+            {
+                cached->removeCache(this);
+                cached = NULL;
+            }
         }
         globalPackageSetManager->requestReload();
     }
@@ -1746,6 +1749,7 @@ public:
     }
     virtual void beforeDispose()
     {
+        notifier.clear();
         if (cached)
         {
             cached->removeCache(this);

+ 5 - 4
roxie/ccd/ccdquery.cpp

@@ -898,18 +898,19 @@ public:
             return NULL;
     }
 
-    static hash64_t getQueryHash(const char *id, const IQueryDll *dll, const IRoxiePackage &package, const IPropertyTree *stateInfo, IArrayOf<IResolvedFile> &files)
+    static hash64_t getQueryHash(const char *id, const IQueryDll *dll, const IRoxiePackage &package, const IPropertyTree *stateInfo, IArrayOf<IResolvedFile> &files, bool isDynamic)
     {
         hash64_t hashValue = package.queryHash();
         if (dll)
         {
             hashValue = rtlHash64VStr(dll->queryDll()->queryName(), hashValue);
-            if (!allFilesDynamic)
+            if (!allFilesDynamic && !isDynamic)
             {
                 IConstWorkUnit *wu = dll->queryWorkUnit();
                 if (wu) // wu may be null in some unit test cases
                 {
                     SCMStringBuffer bStr;
+                    // Don't want to include files referenced in thor graphs... in practice isDynamic also likely to be set in such cases
                     if (getClusterType(wu->getDebugValue("targetClusterType", bStr).str(), RoxieCluster) == RoxieCluster)
                     {
                         Owned<IConstWUGraphIterator> graphs = &wu->getGraphs(GraphTypeActivities);
@@ -1458,7 +1459,7 @@ extern IQueryFactory *createServerQueryFactory(const char *id, const IQueryDll *
 {
     CriticalBlock b(CQueryFactory::queryCreateLock);
     IArrayOf<IResolvedFile> queryFiles; // Note - these should stay in scope long enough to ensure still cached when (if) query is loaded for real
-    hash64_t hashValue = CQueryFactory::getQueryHash(id, dll, package, stateInfo, queryFiles);
+    hash64_t hashValue = CQueryFactory::getQueryHash(id, dll, package, stateInfo, queryFiles, isDynamic);
     IQueryFactory *cached = getQueryFactory(hashValue, 0);
     if (cached && !(cached->loadFailed() && (reloadRetriesFailed || forceRetry)))
     {
@@ -1725,7 +1726,7 @@ IQueryFactory *createSlaveQueryFactory(const char *id, const IQueryDll *dll, con
 {
     CriticalBlock b(CQueryFactory::queryCreateLock);
     IArrayOf<IResolvedFile> queryFiles; // Note - these should stay in scope long enough to ensure still cached when (if) query is loaded for real
-    hash64_t hashValue = CQueryFactory::getQueryHash(id, dll, package, stateInfo, queryFiles);
+    hash64_t hashValue = CQueryFactory::getQueryHash(id, dll, package, stateInfo, queryFiles, isDynamic);
     IQueryFactory *cached = getQueryFactory(hashValue, channel);
     if (cached)
     {

+ 3 - 3
roxie/ccd/ccdstate.cpp

@@ -74,7 +74,7 @@ SafePluginMap *plugins;
 
 const char *queryNodeFileName(const IPropertyTree &graphNode)
 {
-    if (graphNode.hasProp("att[@name='_fileName_dynamic']"))
+    if (graphNode.hasProp("att[@name='_file_dynamic']"))
         return NULL;
     else
         return graphNode.queryProp("att[@name='_fileName']/@value");
@@ -82,13 +82,13 @@ const char *queryNodeFileName(const IPropertyTree &graphNode)
 
 const char *queryNodeIndexName(const IPropertyTree &graphNode)
 {
-    if (graphNode.hasProp("att[@name='_indexFileName_dynamic']"))
+    if (graphNode.hasProp("att[@name='_indexFile_dynamic']"))
         return NULL;
     else
     {
         const char * id = graphNode.queryProp("att[@name='_indexFileName']/@value");
         if (!id)
-            id = graphNode.queryProp("att[@name='_fileName']/@value");
+            id = queryNodeFileName(graphNode);
         return id;
     }
 }