Browse Source

HPCC-14142 Roxie could avoid exists() call in fileUpToDate

A slight reduction in load on dafilesrv...

Signed-off-by: Richard Chapman <rchapman@hpccsystems.com>
Richard Chapman 9 years ago
parent
commit
e39b0c166f

+ 3 - 1
common/remote/hooks/git/gitfile.cpp

@@ -210,6 +210,8 @@ public:
     }
     virtual offset_t size()
     {
+        if (!isExisting)
+            return (offset_t) -1;
         return fileSize;
     }
 
@@ -285,7 +287,7 @@ static IFile *createGitFile(const char *gitFileName)
         return file.getClear();
     }
     else
-        return new GitRepositoryFile(gitFileName, 0, false, false);
+        return new GitRepositoryFile(gitFileName, (offset_t) -1, false, false);
 }
 
 class GitRepositoryDirectoryIterator : public CInterface, implements IDirectoryIterator

+ 1 - 1
common/remote/hooks/libarchive/archive.cpp

@@ -369,7 +369,7 @@ public:
     virtual offset_t size()
     {
         if (!entry)
-            return 0;
+            return (offset_t) -1;
         return entry->size();
     }
 

+ 3 - 2
roxie/ccd/ccdfile.cpp

@@ -592,10 +592,11 @@ class CRoxieFileCache : public CInterface, implements ICopyFileProgress, impleme
             IFile *f;
         } autoDisconnector(f, autoDisconnect);
 
-        if (f->exists())
+        offset_t fileSize = f->size();
+        if (fileSize != (offset_t) -1)
         {
             // only check size if specified
-            if ( (size != -1) && !isCompressed && f->size()!=size) // MORE - should be able to do better on compressed you'da thunk
+            if ( (size != -1) && !isCompressed && fileSize != size) // MORE - should be able to do better on compressed you'da thunk
                 return FileSizeMismatch;
             CDateTime mt;
             return (modified.isNull() || (f->getTime(NULL, &mt, NULL) &&  mt.equals(modified, false))) ? FileIsValid : FileDateMismatch;

+ 1 - 1
system/jlib/jfile.hpp

@@ -97,7 +97,7 @@ interface IFile :extends IInterface
     virtual void move(const char *newName) = 0;         // can move between directories on same node (NB currently not always supported on remote files!)
     virtual void setReadOnly(bool ro) = 0;
     virtual void setFilePermissions(unsigned fPerms) = 0;
-    virtual offset_t size() = 0;
+    virtual offset_t size() = 0;                        // Returns (offset_t) -1 if file does not exist
     virtual bool setCompression(bool set) = 0;
     virtual offset_t compressedSize() = 0;
     virtual unsigned getCRC() = 0;