From cb4bb9d7eb6b57aac79b90cce3e66274350917e3 Mon Sep 17 00:00:00 2001 From: John Sully Date: Thu, 4 Jun 2020 00:26:51 -0400 Subject: [PATCH] Consolidate snapshots should not consider keys in bulk storage Former-commit-id: e02a8f503d45daf63150c60a8a8c3751b9b8581e --- src/server.h | 2 +- src/snapshot.cpp | 11 ++++++----- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/server.h b/src/server.h index bff867758..dcff5d0fe 100644 --- a/src/server.h +++ b/src/server.h @@ -1392,7 +1392,7 @@ protected: public: bool FWillFreeChildDebug() const { return m_spdbSnapshotHOLDER != nullptr; } - bool iterate_threadsafe(std::function fn, bool fKeyOnly = false) const; + bool iterate_threadsafe(std::function fn, bool fKeyOnly = false, bool fCacheOnly = false) const; using redisDbPersistentData::createSnapshot; using redisDbPersistentData::endSnapshot; using redisDbPersistentData::endSnapshotAsync; diff --git a/src/snapshot.cpp b/src/snapshot.cpp index 7ee2b7400..7a282b321 100644 --- a/src/snapshot.cpp +++ b/src/snapshot.cpp @@ -374,7 +374,7 @@ dict_iter redisDbPersistentDataSnapshot::find_cached_threadsafe(const char *key) return dict_iter(de); } -bool redisDbPersistentDataSnapshot::iterate_threadsafe(std::function fn, bool fKeyOnly) const +bool redisDbPersistentDataSnapshot::iterate_threadsafe(std::function fn, bool fKeyOnly, bool fCacheOnly) const { // Take the size so we can ensure we visited every element exactly once // use volatile to ensure it's not checked too late. This makes it more @@ -395,7 +395,7 @@ bool redisDbPersistentDataSnapshot::iterate_threadsafe(std::functionenumerate([&](const char *key, size_t cchKey, const void *data, size_t cbData){ sds sdsKey = sdsnewlen(key, cchKey); @@ -433,10 +433,11 @@ bool redisDbPersistentDataSnapshot::iterate_threadsafe(std::functionm_spstorage = m_pdbSnapshot->m_spstorage; spdb->m_pdict->iterators++;