From 3294e4f7884df12d7c88bc934431961b10781187 Mon Sep 17 00:00:00 2001 From: John Sully Date: Thu, 23 Sep 2021 17:45:49 +0000 Subject: [PATCH] Move the snapshot stale threshold to a named constant Former-commit-id: 46d2aaf17abb0fb021aa6d7b393ffc143493d339 --- src/server.h | 3 +++ src/snapshot.cpp | 4 +--- 2 files changed, 4 insertions(+), 3 deletions(-) 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) {