Browse Source

HPCC-19903 Ensure localPath filled for remoteFiles

Regression introduced by HPCC-19687, caused remote files to
crash dafilesrv.

Signed-off-by: Jake Smith <jake.smith@lexisnexisrisk.com>
Jake Smith 7 years ago
parent
commit
89ffebdb8d
3 changed files with 11 additions and 2 deletions
  1. 3 0
      common/remote/sockfile.cpp
  2. 4 1
      ecl/hthor/hthor.cpp
  3. 4 1
      thorlcr/thorutil/thormisc.cpp

+ 3 - 0
common/remote/sockfile.cpp

@@ -3972,6 +3972,8 @@ protected:
     void initCommon(IPropertyTree &config)
     {
         fileName.set(config.queryProp("fileName"));
+        if (isEmptyString(fileName))
+            throw MakeStringException(0, "CRemoteDiskBaseActivity: fileName missing");
 
         record = &inMeta->queryRecordAccessor(true);
         translator.setown(createRecordTranslator(outMeta->queryRecordAccessor(true), *record));
@@ -4060,6 +4062,7 @@ class CRemoteDiskReadActivity : public CRemoteDiskBaseActivity
         }
 
         OwnedIFile iFile = createIFile(fileName);
+        assertex(iFile);
         iFileIO.setown(createCompressedFileReader(iFile));
         if (iFileIO)
         {

+ 4 - 1
ecl/hthor/hthor.cpp

@@ -166,12 +166,15 @@ ILocalOrDistributedFile *resolveLFNFlat(IAgentContext &agent, const char *logica
     return ldFile.getClear();
 }
 
+// NB: If returns true, localPath contains the local path of rfn
 bool isRemoteReadCandidate(const IAgentContext &agent, const RemoteFilename &rfn, StringBuffer &localPath)
 {
     if (!agent.queryWorkUnit()->getDebugValueBool("forceRemoteDisabled", false))
     {
-        if (!rfn.isLocal() || agent.queryWorkUnit()->getDebugValueBool("forceRemoteRead", testForceRemote(rfn.getLocalPath(localPath))))
+        rfn.getLocalPath(localPath);
+        if (!rfn.isLocal() || agent.queryWorkUnit()->getDebugValueBool("forceRemoteRead", testForceRemote(localPath)))
             return true;
+        localPath.clear();
     }
     return false;
 }

+ 4 - 1
thorlcr/thorutil/thormisc.cpp

@@ -1468,12 +1468,15 @@ const ITranslator *getLayoutTranslation(const char *fname, IPartDescriptor &part
     return getTranslators(fname, expectedFormatCrc, expectedFormat, publishedFormatCrc, actualFormat, projectedFormatCrc, projectedFormat, translationMode);
 }
 
+// NB: If returns true, localPath contains the local path of rfn
 bool isRemoteReadCandidate(const CActivityBase &activity, const RemoteFilename &rfn, StringBuffer &localPath)
 {
     if (!activity.getOptBool(THOROPT_FORCE_REMOTE_DISABLED))
     {
-        if (!rfn.isLocal() || activity.getOptBool(THOROPT_FORCE_REMOTE_READ, testForceRemote(rfn.getLocalPath(localPath))))
+        rfn.getLocalPath(localPath);
+        if (!rfn.isLocal() || activity.getOptBool(THOROPT_FORCE_REMOTE_READ, testForceRemote(localPath)))
             return true;
+        localPath.clear();
     }
     return false;
 }