diff --git a/src/server.h b/src/server.h index 819690b62..482be14a3 100644 --- a/src/server.h +++ b/src/server.h @@ -1263,6 +1263,8 @@ public: // These need to be fixed using redisDbPersistentData::size; using redisDbPersistentData::expireSize; + + static const uint64_t msStaleThreshold = 500; }; /* Redis database representation. There are multiple databases identified @@ -1350,6 +1352,7 @@ public: long long last_expire_set; /* when the last expire was set */ double avg_ttl; /* Average TTL, just for stats */ list *defrag_later; /* List of key names to attempt to defrag one by one, gradually. */ + uint64_t mvccLastSnapshot = 0; }; /* Declare database backup that include redis main DBs and slots to keys map. diff --git a/src/snapshot.cpp b/src/snapshot.cpp index 795df287d..a13f5d9f5 100644 --- a/src/snapshot.cpp +++ b/src/snapshot.cpp @@ -654,9 +654,7 @@ int redisDbPersistentDataSnapshot::snapshot_depth() const bool redisDbPersistentDataSnapshot::FStale() const { - // 0.5 seconds considered stale; - static const uint64_t msStale = 500; - return ((getMvccTstamp() - m_mvccCheckpoint) >> MVCC_MS_SHIFT) >= msStale; + return ((getMvccTstamp() - m_mvccCheckpoint) >> MVCC_MS_SHIFT) >= redisDbPersistentDataSnapshot::msStaleThreshold; } void dictGCAsyncFree(dictAsyncRehashCtl *async) {