Browse Source

HPCC-19760 Use crc + file datestamp for index cache identification

Signed-off-by: Jake Smith <jake.smith@lexisnexisrisk.com>
Jake Smith 7 năm trước cách đây
mục cha
commit
8ae7bff2f3
1 tập tin đã thay đổi với 11 bổ sung1 xóa
  1. 11 1
      common/remote/sockfile.cpp

+ 11 - 1
common/remote/sockfile.cpp

@@ -4224,6 +4224,7 @@ class CRemoteIndexBaseActivity : public CRemoteDiskBaseActivity
 protected:
     bool isTlk = false;
     bool allowPreload = false;
+    unsigned crc = 0;
     Owned<IKeyIndex> keyIndex;
     Owned<IKeyManager> keyManager;
 
@@ -4231,7 +4232,15 @@ protected:
     {
         if (opened)
             return;
-        keyIndex.setown(createKeyIndex(fileName, 0, isTlk, allowPreload)); // JCSMORE crc
+        Owned<IFile> indexFile = createIFile(fileName);
+        CDateTime modTime;
+        indexFile->getTime(nullptr, &modTime, nullptr);
+        time_t modTimeTT = modTime.getSimple();
+        CRC32 crc32(crc);
+        crc32.tally(sizeof(time_t), &modTimeTT);
+        crc = crc32.get();
+
+        keyIndex.setown(createKeyIndex(fileName, crc, isTlk, allowPreload));
         keyManager.setown(createLocalKeyManager(*record, keyIndex, nullptr, true));
         filters.createSegmentMonitors(keyManager);
         keyManager->finishSegmentMonitors();
@@ -4251,6 +4260,7 @@ public:
     {
         isTlk = config.getPropBool("isTlk");
         allowPreload = config.getPropBool("allowPreload");
+        crc = config.getPropInt("crc");
     }
 };