浏览代码

Merge remote-tracking branch 'origin/candidate-5.0.0' into closedown-5.0.x

Signed-off-by: Richard Chapman <rchapman@hpccsystems.com>
Richard Chapman 11 年之前
父节点
当前提交
a3e7b2604b

+ 1 - 0
common/workunit/pkgimpl.hpp

@@ -105,6 +105,7 @@ protected:
     virtual bool getEnableFieldTranslation() const
     {
         const char *val = queryEnv("control:enableFieldTranslation");
+        if (!val) val = queryEnv("enableFieldTranslation"); // Backward compatibility
         if (val)
             return strToBool(val);
         else

+ 60 - 29
dali/base/dadfs.cpp

@@ -1295,7 +1295,7 @@ public:
     void doDelete() // Throw on error!
     {
         const char *logicalname = lfn.get();
-        if (!checkLogicalName(lfn,user,true,true,true,"remove"))
+        if (!lfn.isExternal() && checkLogicalName(lfn,user,true,true,true,"remove"))
             ThrowStringException(-1, "Logical Name fails for removal on %s", lfn.get());
 
         // Transaction files have already been unlocked at this point, delete all remaining files
@@ -4504,7 +4504,7 @@ class CDistributedSuperFile: public CDistributedFileBase<IDistributedSuperFile>
             : parentlname(_parentlname), subfile(_subfile), before(_before), other(_other)
         {
         }
-        bool prepare()
+        virtual bool prepare()
         {
             parent.setown(transaction->lookupSuperFile(parentlname));
             if (!parent)
@@ -4541,7 +4541,7 @@ class CDistributedSuperFile: public CDistributedFileBase<IDistributedSuperFile>
             sub.clear();
             return false;
         }
-        void run()
+        virtual void run()
         {
             if (!sub)
                 throw MakeStringException(-1,"addSubFile(2): File %s cannot be found to add",subfile.get());
@@ -4549,13 +4549,19 @@ class CDistributedSuperFile: public CDistributedFileBase<IDistributedSuperFile>
             if (sf)
                 sf->doAddSubFile(LINK(sub),before,other,transaction);
         }
-        void commit()
+        virtual void commit()
         {
             CDistributedSuperFile *sf = QUERYINTERFACE(parent.get(),CDistributedSuperFile);                 
             if (sf)
                 sf->updateParentFileAttrs(transaction);
             CDFAction::commit();
         }
+        virtual void retry()
+        {
+            parent.clear();
+            sub.clear();
+            CDFAction::retry();
+        }
     };
 
     /**
@@ -4573,7 +4579,7 @@ class CDistributedSuperFile: public CDistributedFileBase<IDistributedSuperFile>
             : parentlname(_parentlname), subfile(_subfile), remsub(_remsub)
         {
         }
-        bool prepare()
+        virtual bool prepare()
         {
             parent.setown(transaction->lookupSuperFile(parentlname));
             if (!parent)
@@ -4611,7 +4617,7 @@ class CDistributedSuperFile: public CDistributedFileBase<IDistributedSuperFile>
             sub.clear();
             return false;
         }
-        void run()
+        virtual void run()
         {
             CDistributedSuperFile *sf = QUERYINTERFACE(parent.get(),CDistributedSuperFile);
             if (sf) {
@@ -4638,6 +4644,12 @@ class CDistributedSuperFile: public CDistributedFileBase<IDistributedSuperFile>
                     sf->doRemoveSubFiles(transaction);
             }
         }
+        virtual void retry()
+        {
+            parent.clear();
+            sub.clear();
+            CDFAction::retry();
+        }
     };
 
     /**
@@ -4653,7 +4665,7 @@ class CDistributedSuperFile: public CDistributedFileBase<IDistributedSuperFile>
             : parentlname(_parentlname), remsub(_remsub)
         {
         }
-        bool prepare()
+        virtual bool prepare()
         {
             parent.setown(transaction->lookupSuperFile(parentlname));
             if (!parent)
@@ -4666,7 +4678,7 @@ class CDistributedSuperFile: public CDistributedFileBase<IDistributedSuperFile>
             parent.clear();
             return false;
         }
-        void run()
+        virtual void run()
         {
             CDistributedSuperFile *sf = QUERYINTERFACE(parent.get(),CDistributedSuperFile);
             if (sf)
@@ -4705,6 +4717,11 @@ class CDistributedSuperFile: public CDistributedFileBase<IDistributedSuperFile>
                 }
             }
         }
+        virtual void retry()
+        {
+            parent.clear();
+            CDFAction::retry();
+        }
     };
 
     /**
@@ -4719,7 +4736,7 @@ class CDistributedSuperFile: public CDistributedFileBase<IDistributedSuperFile>
             : super1Name(_super1Name), super2Name(_super2Name)
         {
         }
-        bool prepare()
+        virtual bool prepare()
         {
             super1.setown(transaction->lookupSuperFile(super1Name));
             if (!super1)
@@ -4747,12 +4764,18 @@ class CDistributedSuperFile: public CDistributedFileBase<IDistributedSuperFile>
             super2.clear();
             return false;
         }
-        void run()
+        virtual void run()
         {
             CDistributedSuperFile *sf = QUERYINTERFACE(super1.get(),CDistributedSuperFile);
             if (sf)
                 sf->doSwapSuperFile(super2,transaction);
         }
+        virtual void retry()
+        {
+            super1.clear();
+            super2.clear();
+            CDFAction::retry();
+        }
     };
 
     /**
@@ -5389,9 +5412,6 @@ public:
 
     void attach(const char *_logicalname,IUserDescriptor *user)
     {
-        // will need more thought but this gives limited support for anon
-        if (isAnon())
-            return;
         assertex(!conn.get()); // already attached
         CriticalBlock block (sect);
         StringBuffer tail;
@@ -5409,9 +5429,6 @@ public:
 
     void detach(unsigned timeoutMs=INFINITE)
     {   
-        // will need more thought but this gives limited support for anon
-        if (isAnon())
-            return;
         assertex(conn.get()); // must be attached
         CriticalBlock block(sect);
         checkModify("CDistributedSuperFile::detach");
@@ -7400,6 +7417,15 @@ class CCreateSuperFileAction: public CDFAction
     IUserDescriptor *user;
     bool interleaved, created;
 
+    void clearSuper()
+    {
+        if (created)
+        {
+            created = false;
+            super->detach();
+        }
+        super.clear();
+    }
 public:
     CCreateSuperFileAction(CDistributedFileDirectory *_parent,
                            IUserDescriptor *_user,
@@ -7429,7 +7455,6 @@ public:
                 created = true;
                 transaction->addFile(super);
             }
-            addFileLock(super);
         }
         return super.getLink();
     }
@@ -7439,6 +7464,7 @@ public:
         // Attach the file to DFS, if wasn't there already
         if (created)
             super->attach(logicalname.get(), user);
+        addFileLock(super);
         if (lock())
             return true;
         unlock();
@@ -7451,15 +7477,13 @@ public:
     void retry()
     {
         // on retry, we need to remove the file so next lock doesn't fail
-        if (created)
-            super->detach();
+        clearSuper();
         CDFAction::retry();
     }
     void rollback()
     {
         state = TAS_FAILURE;
-        if (created)
-            super->detach();
+        clearSuper();
         CDFAction::rollback();
     }
 };
@@ -7544,7 +7568,7 @@ public:
     {
         logicalname.set(_flname);
     }
-    bool prepare()
+    virtual bool prepare()
     {
         // We *have* to make sure the file exists here
         super.setown(transaction->lookupSuperFile(logicalname.get(), SDS_SUB_LOCK_TIMEOUT));
@@ -7573,19 +7597,20 @@ public:
         super.clear();
         return false;
     }
-    void retry()
+    virtual void retry()
     {
+        super.clear();
         if (nestedTransaction)
             nestedTransaction->retryActions();
         CDFAction::retry();
     }
-    void run()
+    virtual void run()
     {
         if (nestedTransaction)
             nestedTransaction->runActions();
         super->detach();
     }
-    void commit()
+    virtual void commit()
     {
         if (nestedTransaction)
             nestedTransaction->commitAndClearup();
@@ -7626,7 +7651,7 @@ public:
         ra = ra_regular;
         renamed = false;
     }
-    bool prepare()
+    virtual bool prepare()
     {
         // We *have* to make sure the source file exists and can be renamed
         file.setown(transaction->lookupFile(fromName.get(), SDS_SUB_LOCK_TIMEOUT));
@@ -7684,12 +7709,17 @@ public:
         file.clear();
         return false;
     }
-    void run()
+    virtual void run()
     {
         doRename(fromName, toName, ra);
         renamed = true;
     }
-    void rollback()
+    virtual void retry()
+    {
+        file.clear();
+        CDFAction::retry();
+    }
+    virtual void rollback()
     {
         // Only roll back if already renamed
         if (renamed)
@@ -7850,7 +7880,8 @@ bool CDistributedFileDirectory::removeEntry(const char *name, IUserDescriptor *u
 {
     CDfsLogicalFileName logicalname;
     logicalname.set(name);
-    checkLogicalName(logicalname,user,true,true,false,"delete");
+    if (!logicalname.isExternal())
+        checkLogicalName(logicalname,user,true,true,false,"delete");
 
     // Create a local transaction that will be destroyed (MORE: make transaction compulsory)
     Linked<IDistributedFileTransactionExt> localtrans;

+ 7 - 6
dali/dfu/dfuutil.cpp

@@ -765,6 +765,7 @@ public:
             else
                 superfile->addSubFile(subfiles[i],false,NULL,false,transaction);
         }
+        superfile.clear();
         transaction->commit();
     }
 
@@ -812,15 +813,15 @@ public:
         // Do we have something to delete?
         if (toremove.ordinality()) {
             transaction->start();
+            if (removesuperfile && toremove.ordinality()!=superfile->numSubFiles())
+                removesuperfile = false;
             ForEachItemIn(i2,toremove)
                 superfile->removeSubFile(toremove.item(i2).text.get(),delsub,false,transaction);
-            transaction->commit();
-        }
-        // Delete superfile if empty
-        if (removesuperfile && (superfile->numSubFiles() == 0)) {
+            // Delete superfile if empty
+            if (removesuperfile)
+                queryDistributedFileDirectory().removeEntry(superfname, user, transaction);
             superfile.clear();
-            // MORE - add file deletion to transaction
-            queryDistributedFileDirectory().removeEntry(superfname,user);
+            transaction->commit();
         }
     }
 

+ 3 - 0
esp/src/eclwatch/QuerySetQueryWidget.js

@@ -124,6 +124,9 @@ define([
                 includeBlank: true,
                 Target: params.Cluster
             });
+            if (params.Wuid) {
+                this.filter.setValue(this.id + "Wuid", params.Wuid);
+            }
             this.initQuerySetGrid();
 
             var context = this;

+ 4 - 0
esp/src/eclwatch/WUDetailsWidget.js

@@ -268,6 +268,10 @@ define([
                 this.graphsWidget.init({
                     Wuid: this.wu.Wuid
                 });
+            } else if (currSel.id == this.widget._Queries.id && !this.widget._Queries.__hpcc_initalized) {
+                this.widget._Queries.init({
+                    Wuid: this.wu.Wuid
+                });
             } else if (currSel.id == this.widget._Resources.id && !this.resourcesWidgetLoaded) {
                 this.resourcesWidgetLoaded = true;
                 this.widget._Resources.init({

+ 1 - 0
esp/src/eclwatch/templates/QuerySetQueryWidget.html

@@ -15,6 +15,7 @@
                     <div id="${id}Deactivate" data-dojo-attach-event="onClick:_onDeactivate" data-dojo-type="dijit.form.Button">${i18n.Deactivate}</div>
                     <span data-dojo-type="dijit.ToolbarSeparator"></span>
                     <div id="${id}Filter" data-dojo-type="FilterDropDownWidget">
+                        <input id="${id}Wuid" title="${i18n.WUID}:" name="WUID" colspan="2" data-dojo-props="trim: true, placeHolder:'W20130222-171723'" data-dojo-type="dijit.form.TextBox" />
                         <input id="${id}ClusterTargetSelect" title="${i18n.Cluster}:" name="QuerySetName" colspan="2"  data-dojo-type="TargetSelectWidget" />
                         <select id="${id}SuspendedStates" title="${i18n.Suspended}:" name="SuspendedByUser" colspan="2" data-dojo-type="dijit.form.Select">
                             <option value="" selected="selected">${i18n.All}</option>

+ 2 - 0
esp/src/eclwatch/templates/WUDetailsWidget.html

@@ -104,6 +104,8 @@
             </div>
             <div id="${id}_Workflows" title="${i18n.Workflows}" data-dojo-props="delayWidget: 'WorkflowsWidget', disabled: true" data-dojo-type="DelayLoadWidget">
             </div>
+            <div id="${id}_Queries" title="${i18n.Queries}" data-dojo-props="delayWidget: 'QuerySetQueryWidget', iconClass:'iconFind'" data-dojo-type="DelayLoadWidget">
+            </div>
             <div id="${id}_Resources" title="${i18n.Resources}" data-dojo-props="delayWidget: 'ResourcesWidget', disabled: true" data-dojo-type="DelayLoadWidget">
             </div>
             <div id="${id}_Logs" title="${i18n.Helpers}" data-dojo-props="delayWidget: 'LogsWidget', disabled: true" data-dojo-type="DelayLoadWidget">

+ 18 - 13
roxie/ccd/ccdactivities.cpp

@@ -5348,20 +5348,25 @@ public:
 
         try  // operations does not want any missing file errors to be fatal, or throw traps - just log it
         {
-            bool isOpt = _graphNode.getPropBool("att[@name='_isOpt']/@value") || pretendAllOpt;
-            const char *fileName = queryNodeFileName(_graphNode);
-            const char *indexName = queryNodeIndexName(_graphNode);
-            if (indexName && (!fileName || !streq(indexName, fileName)))
+            ThorActivityKind kind = getActivityKind(_graphNode);
+            if (kind != TAKdiskwrite && kind != TAKindexwrite && kind != TAKpiperead && kind != TAKpipewrite)
             {
-                indexfile.setown(_queryFactory.queryPackage().lookupFileName(indexName, isOpt, true, true, _queryFactory.queryWorkUnit()));
-                if (indexfile)
-                    keyArray.setown(indexfile->getKeyArray(NULL, &layoutTranslators, isOpt, queryFactory.queryChannel(), queryFactory.getEnableFieldTranslation()));
-            }
-            if (fileName)
-            {
-                datafile.setown(_queryFactory.queryPackage().lookupFileName(fileName, isOpt, true, true, _queryFactory.queryWorkUnit()));
-                if (datafile)
-                    fileArray.setown(datafile->getIFileIOArray(isOpt, queryFactory.queryChannel()));
+                const char *fileName = queryNodeFileName(_graphNode, kind);
+                const char *indexName = queryNodeIndexName(_graphNode, kind);
+                if (indexName)
+                {
+                    bool isOpt = pretendAllOpt || _graphNode.getPropBool("att[@name='_isIndexOpt']/@value");
+                    indexfile.setown(_queryFactory.queryPackage().lookupFileName(indexName, isOpt, true, true, _queryFactory.queryWorkUnit()));
+                    if (indexfile)
+                        keyArray.setown(indexfile->getKeyArray(NULL, &layoutTranslators, isOpt, queryFactory.queryChannel(), queryFactory.getEnableFieldTranslation()));
+                }
+                if (fileName)
+                {
+                    bool isOpt = pretendAllOpt || _graphNode.getPropBool("att[@name='_isOpt']/@value");
+                    datafile.setown(_queryFactory.queryPackage().lookupFileName(fileName, isOpt, true, true, _queryFactory.queryWorkUnit()));
+                    if (datafile)
+                        fileArray.setown(datafile->getIFileIOArray(isOpt, queryFactory.queryChannel()));
+                }
             }
         }
         catch(IException *E)

+ 26 - 20
roxie/ccd/ccdquery.cpp

@@ -859,7 +859,7 @@ public:
         memoryLimit = defaultMemoryLimit;
         timeLimit = defaultTimeLimit[priority];
         warnTimeLimit = 0;
-        enableFieldTranslation = fieldTranslationEnabled;
+        enableFieldTranslation = package.getEnableFieldTranslation();
     }
 
     ~CQueryFactory()
@@ -921,27 +921,34 @@ public:
                             ForEach(*nodes)
                             {
                                 IPropertyTree &node = nodes->query();
-                                const char *fileName = queryNodeFileName(node);
-                                const char *indexName = queryNodeIndexName(node);
-                                // MORE - what about write? What about packages that resolve everything without dali?
-                                if (indexName && (!fileName || !streq(indexName, fileName)))
+                                ThorActivityKind kind = getActivityKind(node);
+                                if (kind != TAKdiskwrite && kind != TAKindexwrite && kind != TAKpiperead && kind != TAKpipewrite)
                                 {
-                                    bool isOpt = node.getPropBool("att[@name='_isIndexOpt']/@value") || pretendAllOpt;
-                                    const IResolvedFile *indexFile = package.lookupFileName(indexName, isOpt, true, true, wu);
-                                    if (indexFile)
+                                    const char *fileName = queryNodeFileName(node, kind);
+                                    const char *indexName = queryNodeIndexName(node, kind);
+                                    // What about packages that resolve everything without dali?
+                                    if (indexName)
                                     {
-                                        hashValue = indexFile->addHash64(hashValue);
-                                        files.append(*const_cast<IResolvedFile *>(indexFile));
+                                        bool isOpt = pretendAllOpt || node.getPropBool("att[@name='_isIndexOpt']/@value");
+                                        const IResolvedFile *indexFile = package.lookupFileName(indexName, isOpt, true, true, wu);
+                                        if (indexFile)
+                                        {
+                                            hashValue = indexFile->addHash64(hashValue);
+                                            files.append(*const_cast<IResolvedFile *>(indexFile));
+                                        }
                                     }
-                                }
-                                if (fileName)
-                                {
-                                    bool isOpt = node.getPropBool("att[@name='_isOpt']/@value") || pretendAllOpt;
-                                    const IResolvedFile *dataFile = package.lookupFileName(fileName, isOpt, true, true, wu);
-                                    if (dataFile)
+                                    if (fileName)
                                     {
-                                        hashValue = dataFile->addHash64(hashValue);
-                                        files.append(*const_cast<IResolvedFile *>(dataFile));
+                                        if (!node.getPropBool("att[@name='_isSpill']/@value") && !node.getPropBool("att[@name='_isSpillGlobal']/@value"))
+                                        {
+                                            bool isOpt = pretendAllOpt || node.getPropBool("att[@name='_isOpt']/@value");
+                                            const IResolvedFile *dataFile = package.lookupFileName(fileName, isOpt, true, true, wu);
+                                            if (dataFile)
+                                            {
+                                                hashValue = dataFile->addHash64(hashValue);
+                                                files.append(*const_cast<IResolvedFile *>(dataFile));
+                                            }
+                                        }
                                     }
                                 }
                             }
@@ -976,9 +983,8 @@ public:
             memoryLimit = (memsize_t) wu->getDebugValueInt64("memoryLimit", defaultMemoryLimit);
             timeLimit = (unsigned) wu->getDebugValueInt("timeLimit", defaultTimeLimit[priority]);
             warnTimeLimit = (unsigned) wu->getDebugValueInt("warnTimeLimit", 0);
+            enableFieldTranslation = wu->getDebugValueBool("layoutTranslationEnabled", enableFieldTranslation);
             SCMStringBuffer bStr;
-            enableFieldTranslation = strToBool(wu->getDebugValue("layoutTranslationEnabled", bStr).str());
-            bStr.clear();
             targetClusterType = getClusterType(wu->getDebugValue("targetClusterType", bStr).str(), RoxieCluster);
 
             // MORE - does package override stateInfo, or vice versa?

+ 1 - 1
roxie/ccd/ccdquery.hpp

@@ -277,7 +277,7 @@ inline unsigned getGraphId(IPropertyTree & node)
     return node.getPropInt("att[@name=\"_graphId\"]/@value", 0);
 }
 
-inline ThorActivityKind getActivityKind(IPropertyTree & node)
+inline ThorActivityKind getActivityKind(const IPropertyTree & node)
 {
     return (ThorActivityKind) node.getPropInt("att[@name=\"_kind\"]/@value", TAKnone);
 }

+ 22 - 17
roxie/ccd/ccdserver.cpp

@@ -23388,24 +23388,29 @@ public:
             if (_graphNode.getPropBool("att[@name='_isSpill']/@value", false) || _graphNode.getPropBool("att[@name='_isSpillGlobal']/@value", false))
                 return;  // ignore 'spills'
             bool isLocal = _graphNode.getPropBool("att[@name='local']/@value") && queryFactory.queryChannel()!=0;
-            bool isOpt = _graphNode.getPropBool("att[@name='_isOpt']/@value") || pretendAllOpt;
-            const char *fileName = queryNodeFileName(_graphNode);
-            const char *indexName = queryNodeIndexName(_graphNode);
-            if (indexName && (!fileName || !streq(indexName, fileName)))
+            ThorActivityKind kind = getActivityKind(_graphNode);
+            if (kind != TAKdiskwrite && kind != TAKindexwrite && kind != TAKpiperead && kind != TAKpipewrite)
             {
-                indexfile.setown(queryFactory.queryPackage().lookupFileName(indexName, isOpt, true, true, queryFactory.queryWorkUnit()));
-                if (indexfile)
-                    keySet.setown(indexfile->getKeyArray(NULL, &layoutTranslators, isOpt, isLocal ? queryFactory.queryChannel() : 0, false));
-            }
-            if (fileName)
-            {
-                datafile.setown(_queryFactory.queryPackage().lookupFileName(fileName, isOpt, true, true, queryFactory.queryWorkUnit()));
-                if (datafile)
+                const char *fileName = queryNodeFileName(_graphNode, kind);
+                const char *indexName = queryNodeIndexName(_graphNode, kind);
+                if (indexName)
                 {
-                    if (isLocal)
-                        files.setown(datafile->getIFileIOArray(isOpt, queryFactory.queryChannel()));
-                    else
-                        map.setown(datafile->getFileMap());
+                    bool isOpt = pretendAllOpt || _graphNode.getPropBool("att[@name='_isIndexOpt']/@value");
+                    indexfile.setown(queryFactory.queryPackage().lookupFileName(indexName, isOpt, true, true, queryFactory.queryWorkUnit()));
+                    if (indexfile)
+                        keySet.setown(indexfile->getKeyArray(NULL, &layoutTranslators, isOpt, isLocal ? queryFactory.queryChannel() : 0, false));
+                }
+                if (fileName)
+                {
+                    bool isOpt = pretendAllOpt || _graphNode.getPropBool("att[@name='_isOpt']/@value");
+                    datafile.setown(_queryFactory.queryPackage().lookupFileName(fileName, isOpt, true, true, queryFactory.queryWorkUnit()));
+                    if (datafile)
+                    {
+                        if (isLocal)
+                            files.setown(datafile->getIFileIOArray(isOpt, queryFactory.queryChannel()));
+                        else
+                            map.setown(datafile->getFileMap());
+                    }
                 }
             }
         }
@@ -24953,7 +24958,7 @@ public:
         if (!isHalfKeyed && !variableFetchFileName)
         {
             bool isFetchOpt = (helper->getFetchFlags() & FFdatafileoptional) != 0;
-            datafile.setown(_queryFactory.queryPackage().lookupFileName(queryNodeFileName(_graphNode), isFetchOpt, true, true, _queryFactory.queryWorkUnit()));
+            datafile.setown(_queryFactory.queryPackage().lookupFileName(queryNodeFileName(_graphNode, _kind), isFetchOpt, true, true, _queryFactory.queryWorkUnit()));
             if (datafile)
             {
                 if (isLocal)

+ 37 - 8
roxie/ccd/ccdstate.cpp

@@ -72,7 +72,7 @@ SafePluginMap *plugins;
 
 // These two helper functions will return the original filenames placed in the XGMML by the codegen, regardless of how/if roxieconfig resolved them
 
-const char *queryNodeFileName(const IPropertyTree &graphNode)
+static const char *_queryNodeFileName(const IPropertyTree &graphNode)
 {
     if (graphNode.hasProp("att[@name='_file_dynamic']"))
         return NULL;
@@ -80,19 +80,48 @@ const char *queryNodeFileName(const IPropertyTree &graphNode)
         return graphNode.queryProp("att[@name='_fileName']/@value");
 }
 
-const char *queryNodeIndexName(const IPropertyTree &graphNode)
+static const char *_queryNodeIndexName(const IPropertyTree &graphNode)
 {
     if (graphNode.hasProp("att[@name='_indexFile_dynamic']"))
         return NULL;
     else
-    {
-        const char * id = graphNode.queryProp("att[@name='_indexFileName']/@value");
-        if (!id)
-            id = queryNodeFileName(graphNode);
-        return id;
+        return graphNode.queryProp("att[@name='_indexFileName']/@value");
+}
+
+static bool isSimpleIndexActivity(ThorActivityKind kind)
+{
+    switch (kind)
+    {
+    case TAKindexaggregate:
+    case TAKindexcount:
+    case TAKindexexists:
+    case TAKindexgroupaggregate:
+    case TAKindexgroupcount:
+    case TAKindexgroupexists:
+    case TAKindexnormalize:
+    case TAKindexread:
+        return true;
+    default:
+        return false;
     }
 }
 
+const char *queryNodeFileName(const IPropertyTree &graphNode, ThorActivityKind kind)
+{
+    if (isSimpleIndexActivity(kind))
+        return false;
+    else
+        return _queryNodeFileName(graphNode);
+}
+
+const char *queryNodeIndexName(const IPropertyTree &graphNode, ThorActivityKind kind)
+{
+    if (isSimpleIndexActivity(kind))
+        return _queryNodeFileName(graphNode);
+    else
+        return _queryNodeIndexName(graphNode);
+}
+
 // DelayedReleaser mechanism hangs on to a link to an object for a while...
 
 class DelayedReleaseQueueItem : public CInterfaceOf<IInterface>
@@ -583,7 +612,7 @@ public:
     virtual IPropertyTreeIterator *getInMemoryIndexInfo(const IPropertyTree &graphNode) const 
     {
         StringBuffer xpath;
-        xpath.append("SuperFile[@id='").append(queryNodeFileName(graphNode)).append("']");
+        xpath.append("SuperFile[@id='").append(queryNodeFileName(graphNode, getActivityKind(graphNode))).append("']");
         return lookupElements(xpath.str(), "MemIndex");
     }
 

+ 2 - 2
roxie/ccd/ccdstate.hpp

@@ -140,8 +140,8 @@ extern void mergeStats(IPropertyTree *s1, IPropertyTree *s2, unsigned level);
 extern void mergeStats(IPropertyTree *s1, IPropertyTree *s2);
 extern void mergeQueries(IPropertyTree *s1, IPropertyTree *s2);
 
-extern const char *queryNodeFileName(const IPropertyTree &graphNode);
-extern const char *queryNodeIndexName(const IPropertyTree &graphNode);
+extern const char *queryNodeFileName(const IPropertyTree &graphNode, ThorActivityKind kind);
+extern const char *queryNodeIndexName(const IPropertyTree &graphNode, ThorActivityKind kind);
 
 extern void createDelayedReleaser();
 extern void stopDelayedReleaser();