Selaa lähdekoodia

HPCC-17786 Roxie can't reload files after modification

Signed-off-by: Richard Chapman <rchapman@hpccsystems.com>
Richard Chapman 8 vuotta sitten
vanhempi
commit
786776e786
2 muutettua tiedostoa jossa 14 lisäystä ja 8 poistoa
  1. 13 8
      roxie/ccd/ccdfile.cpp
  2. 1 0
      roxie/ccd/ccdstate.hpp

+ 13 - 8
roxie/ccd/ccdfile.cpp

@@ -1168,13 +1168,11 @@ public:
                 if ((dfsSize != (offset_t) -1 && dfsSize != f->getSize()) ||
                     (!dfsDate.isNull() && !dfsDate.equals(*f->queryDateTime(), false)))
                 {
-                    if (fileType == ROXIE_KEY)
-                    {
-                        // jhtree cache can keep files active and thus prevent us from loading a new version
+                    releaseSlaveDynamicFileCache();  // Slave dynamic file cache or...
+                    if (fileType == ROXIE_KEY)       // ...jhtree cache can keep files active and thus prevent us from loading a new version
                         clearKeyStoreCacheEntry(f);  // Will release iff that is the only link
-                        f.clear(); // Note - needs to be done before calling getValue() again, hence the need to make it separate from the f.set below
-                        f.set(files.getValue(localLocation));
-                    }
+                    f.clear(); // Note - needs to be done before calling getValue() again, hence the need to make it separate from the f.set below
+                    f.set(files.getValue(localLocation));
                     if (f)  // May have been cleared above...
                     {
                         StringBuffer modifiedDt;
@@ -1766,6 +1764,7 @@ protected:
 
 public:
     IMPLEMENT_IINTERFACE;
+
     CResolvedFile(const char *_lfn, const char *_physicalName, IDistributedFile *_dFile, RoxieFileType _fileType, IRoxieDaliHelper* _daliHelper, bool isDynamic, bool cacheIt, bool writeAccess, bool _isSuperFile)
     : daliHelper(_daliHelper), lfn(_lfn), physicalName(_physicalName), dFile(_dFile), fileType(_fileType), isSuper(_isSuperFile)
     {
@@ -2423,7 +2422,7 @@ public:
     IMPLEMENT_IINTERFACE;
     CSlaveDynamicFileCache(unsigned _limit) : tableSize(_limit) {}
 
-    virtual IResolvedFile *lookupDynamicFile(const IRoxieContextLogger &logctx, const char *lfn, CDateTime &cacheDate, unsigned checksum, RoxiePacketHeader *header, bool isOpt, bool isLocal)
+    virtual IResolvedFile *lookupDynamicFile(const IRoxieContextLogger &logctx, const char *lfn, CDateTime &cacheDate, unsigned checksum, RoxiePacketHeader *header, bool isOpt, bool isLocal) override
     {
         if (logctx.queryTraceLevel() > 5)
         {
@@ -2467,6 +2466,11 @@ public:
         files.add(*ret.getLink(), 0);
         return ret.getClear();
     }
+
+    virtual void releaseAll() override
+    {
+        files.kill();
+    }
 };
 
 static CriticalSection slaveDynamicFileCacheCrit;
@@ -2486,7 +2490,8 @@ extern ISlaveDynamicFileCache *querySlaveDynamicFileCache()
 extern void releaseSlaveDynamicFileCache()
 {
     CriticalBlock b(slaveDynamicFileCacheCrit);
-    slaveDynamicFileCache.clear();
+    if (slaveDynamicFileCache)
+        slaveDynamicFileCache->releaseAll();
 }
 
 

+ 1 - 0
roxie/ccd/ccdstate.hpp

@@ -79,6 +79,7 @@ extern IRoxiePackage *createRoxiePackage(IPropertyTree *p, IRoxiePackageMap *pac
 interface ISlaveDynamicFileCache : extends IInterface
 {
     virtual IResolvedFile *lookupDynamicFile(const IRoxieContextLogger &logctx, const char *lfn, CDateTime &cacheDate, unsigned checksum, RoxiePacketHeader *header, bool isOpt, bool isLocal) = 0;
+    virtual void releaseAll() = 0;
 };
 extern ISlaveDynamicFileCache *querySlaveDynamicFileCache();
 extern void releaseSlaveDynamicFileCache();