Move the snapshot stale threshold to a named constant

Former-commit-id: 46d2aaf17abb0fb021aa6d7b393ffc143493d339
This commit is contained in:
John Sully 2021-09-23 17:45:49 +00:00
parent 99ff67283c
commit 3294e4f788
2 changed files with 4 additions and 3 deletions

View File

@ -1263,6 +1263,8 @@ public:
// These need to be fixed // These need to be fixed
using redisDbPersistentData::size; using redisDbPersistentData::size;
using redisDbPersistentData::expireSize; using redisDbPersistentData::expireSize;
static const uint64_t msStaleThreshold = 500;
}; };
/* Redis database representation. There are multiple databases identified /* Redis database representation. There are multiple databases identified
@ -1350,6 +1352,7 @@ public:
long long last_expire_set; /* when the last expire was set */ long long last_expire_set; /* when the last expire was set */
double avg_ttl; /* Average TTL, just for stats */ double avg_ttl; /* Average TTL, just for stats */
list *defrag_later; /* List of key names to attempt to defrag one by one, gradually. */ 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. /* Declare database backup that include redis main DBs and slots to keys map.

View File

@ -654,9 +654,7 @@ int redisDbPersistentDataSnapshot::snapshot_depth() const
bool redisDbPersistentDataSnapshot::FStale() const bool redisDbPersistentDataSnapshot::FStale() const
{ {
// 0.5 seconds considered stale; return ((getMvccTstamp() - m_mvccCheckpoint) >> MVCC_MS_SHIFT) >= redisDbPersistentDataSnapshot::msStaleThreshold;
static const uint64_t msStale = 500;
return ((getMvccTstamp() - m_mvccCheckpoint) >> MVCC_MS_SHIFT) >= msStale;
} }
void dictGCAsyncFree(dictAsyncRehashCtl *async) { void dictGCAsyncFree(dictAsyncRehashCtl *async) {