Browse Source

HPCC-8803 Directories hpcc-data2 and hpcc-data3 don't get used

Fix the local file resolution cases.

When resolving files without a dali specified, files with :: in them will now
be assumed to refer to local 1-way files in the default directory, while ones
 without will be assumed to be physical filenames.

Signed-off-by: Richard Chapman <rchapman@hpccsystems.com>
Richard Chapman 12 years ago
parent
commit
af0c087872
4 changed files with 28 additions and 28 deletions
  1. 0 1
      roxie/ccd/ccd.hpp
  2. 16 9
      roxie/ccd/ccdfile.cpp
  3. 9 14
      roxie/ccd/ccdmain.cpp
  4. 3 4
      roxie/ccd/ccdstate.cpp

+ 0 - 1
roxie/ccd/ccd.hpp

@@ -427,7 +427,6 @@ extern StringBuffer logDirectory;
 extern StringBuffer pluginDirectory;
 extern StringBuffer pluginsList;
 extern StringBuffer queryDirectory;
-extern StringBuffer baseDataDirectory;
 extern StringBuffer codeDirectory;
 extern StringBuffer tempDirectory;
 

+ 16 - 9
roxie/ccd/ccdfile.cpp

@@ -1049,6 +1049,7 @@ public:
     {
         IPropertyTree &partProps = pdesc->queryProperties();
         offset_t dfsSize = partProps.getPropInt64("@size", -1);
+        bool local = partProps.getPropBool("@local");
         unsigned crc;
         if (!pdesc->getCrc(crc))
             crc = 0;
@@ -1062,15 +1063,20 @@ public:
         unsigned partNo = pdesc->queryPartIndex() + 1;
         StringBuffer localLocation;
 
-        // MORE - not at all sure about this. Foreign files should stay foreign ?
-        CDfsLogicalFileName dlfn;
-        dlfn.set(lfn);
-        if (dlfn.isForeign())
-            dlfn.clearForeign();
-        const char *logicalname = dlfn.get();
-
-        makePhysicalPartName(logicalname, partNo, numParts, localLocation, replicationLevel, DFD_OSdefault);
-
+        if (local)
+        {
+            assertex(partNo==1 && numParts==1);
+            localLocation.append(lfn);  // any resolution done earlier
+        }
+        else
+        {
+            // MORE - not at all sure about this. Foreign files should stay foreign ?
+            CDfsLogicalFileName dlfn;
+            dlfn.set(lfn);
+            if (dlfn.isForeign())
+                dlfn.clearForeign();
+            makePhysicalPartName(dlfn.get(), partNo, numParts, localLocation, replicationLevel, DFD_OSdefault);
+        }
         Owned<ILazyFileIO> ret;
         try
         {
@@ -2020,6 +2026,7 @@ public:
         Owned<IFileDescriptor> fdesc = createFileDescriptor();
         Owned<IPropertyTree> pp = createPTree("Part");
         pp->setPropInt64("@size",size);
+        pp->setPropBool("@local", true);
         fdesc->setPart(0, queryMyNode(), localFileName, pp);
         addSubFile(fdesc.getClear(), NULL);
     }

+ 9 - 14
roxie/ccd/ccdmain.cpp

@@ -147,7 +147,6 @@ StringBuffer logDirectory;
 StringBuffer pluginDirectory;
 StringBuffer queryDirectory;
 StringBuffer codeDirectory;
-StringBuffer baseDataDirectory;
 StringBuffer tempDirectory;
 
 ClientCertificate clientCert;
@@ -517,7 +516,7 @@ int STARTQUERY_API start_query(int argc, const char *argv[])
             topology=createPTreeFromXMLString(
                 "<RoxieTopology numChannels='1' localSlave='1'>"
                  "<RoxieServerProcess netAddress='.'/>"
-                 "<RoxieSlaveProcess netAddress='.' channel='1'/>"
+                 "<RoxieSlaveProcess netAddress='.' channel='1' level='0'/>"
                 "</RoxieTopology>"
                 );
             int port = globals->getPropInt("--port", 9876);
@@ -553,7 +552,13 @@ int STARTQUERY_API start_query(int argc, const char *argv[])
         soapTraceLevel = topology->getPropInt("@soapTraceLevel", runOnce ? 0 : 1);
         miscDebugTraceLevel = topology->getPropInt("@miscDebugTraceLevel", 0);
 
-        IPropertyTree *directoryTree = topology->queryPropTree("Directories");
+        Linked<IPropertyTree> directoryTree = topology->queryPropTree("Directories");
+        if (!directoryTree)
+        {
+            Owned<IPropertyTree> envFile = getHPCCEnvironment();
+            if (envFile)
+                directoryTree.set(envFile->queryPropTree("Software/Directories"));
+        }
         if (directoryTree)
         {
             getConfigurationDirectory(directoryTree, "query", "roxie", roxieName, queryDirectory);
@@ -567,8 +572,7 @@ int STARTQUERY_API start_query(int argc, const char *argv[])
                     setBaseDirectory(dataDir, replicationLevel, DFD_OSdefault);
             }
         }
-        else
-            setBaseDirectory(".", 0, DFD_OSdefault);
+        directoryTree.clear();
 
         //Logging stuff
         if (globals->getPropBool("--stdlog", traceLevel != 0) || topology->getPropBool("@forceStdLog", false))
@@ -829,14 +833,7 @@ int STARTQUERY_API start_query(int argc, const char *argv[])
                 queryDirectory.append(codeDirectory).append("queries");
         }
         addNonEmptyPathSepChar(queryDirectory);
-
-        // if no Dali, files are local
-        if (fileNameServiceDali.length() == 0)
-            baseDataDirectory.append("./"); // Path separator will be replaced, if necessary
-        else
-            baseDataDirectory.append(topology->queryProp("@baseDataDir"));
         queryFileCache().start();
-
         getTempFilePath(tempDirectory, "roxie", topology);
 
 #ifdef _WIN32
@@ -862,8 +859,6 @@ int STARTQUERY_API start_query(int argc, const char *argv[])
                 unsigned roxieServerHost = roxieServer.getPropInt("@multihost", 0);
                 if (ipMatch(ep) && ((roxieServerHost == myHostNumber) || (myHostNumber==-1)))
                 {
-                    if (baseDataDirectory.length() == 0)  // if not set by other topology settings default to this ...
-                        baseDataDirectory.append(roxieServer.queryProp("@baseDataDirectory"));
                     unsigned numThreads = roxieServer.getPropInt("@numThreads", numServerThreads);
                     const char *aclName = roxieServer.queryProp("@aclName");
                     addServerChannel(port, numThreads, aclName, topology);

+ 3 - 4
roxie/ccd/ccdstate.cpp

@@ -281,8 +281,7 @@ protected:
             if (strstr(fileName,"::"))
             {
                 bool wasDFS;
-                // MORE - really we don't want the 1 of 1 bit of this...
-                makeSinglePhysicalPartName(fileName, useName, true, wasDFS, baseDataDirectory.str());
+                makeSinglePhysicalPartName(fileName, useName, true, wasDFS);
             }
             else
                 useName.append(fileName);
@@ -376,8 +375,8 @@ public:
 
     CRoxiePackageNode(IPropertyTree *p) : CPackageNode(p)
     {
-        daliHelper.setown(connectToDali()); // MORE - should make this conditional
-        if (!daliHelper.get() || !daliHelper->connected())
+        daliHelper.setown(connectToDali()); // MORE - should make this conditional?
+        if (!fileNameServiceDali.length())
             node->setPropBool("@localFiles", true);
     }