Don't try and consolidate snapshots with a depth of 1
Former-commit-id: 26c298bd9bc4e2c6981de5c20284120ea54580c3
This commit is contained in:
parent
c3365964a0
commit
6ba6652fcf
@ -1421,13 +1421,12 @@ class redisDbPersistentDataSnapshot : protected redisDbPersistentData
|
|||||||
{
|
{
|
||||||
friend class redisDbPersistentData;
|
friend class redisDbPersistentData;
|
||||||
protected:
|
protected:
|
||||||
bool m_fConsolidated = false;
|
|
||||||
static void gcDisposeSnapshot(redisDbPersistentDataSnapshot *psnapshot);
|
static void gcDisposeSnapshot(redisDbPersistentDataSnapshot *psnapshot);
|
||||||
int snapshot_depth() const;
|
|
||||||
void consolidate_children(redisDbPersistentData *pdbPrimary, bool fForce);
|
void consolidate_children(redisDbPersistentData *pdbPrimary, bool fForce);
|
||||||
bool freeTombstoneObjects(int depth);
|
bool freeTombstoneObjects(int depth);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
int snapshot_depth() const;
|
||||||
bool FWillFreeChildDebug() const { return m_spdbSnapshotHOLDER != nullptr; }
|
bool FWillFreeChildDebug() const { return m_spdbSnapshotHOLDER != nullptr; }
|
||||||
|
|
||||||
bool iterate_threadsafe(std::function<bool(const char*, robj_roptr o)> fn, bool fKeyOnly = false, bool fCacheOnly = false) const;
|
bool iterate_threadsafe(std::function<bool(const char*, robj_roptr o)> fn, bool fKeyOnly = false, bool fCacheOnly = false) const;
|
||||||
|
@ -571,11 +571,12 @@ void redisDbPersistentData::consolidate_snapshot()
|
|||||||
{
|
{
|
||||||
aeAcquireLock();
|
aeAcquireLock();
|
||||||
auto psnapshot = (m_pdbSnapshot != nullptr) ? m_spdbSnapshotHOLDER.get() : nullptr;
|
auto psnapshot = (m_pdbSnapshot != nullptr) ? m_spdbSnapshotHOLDER.get() : nullptr;
|
||||||
if (psnapshot == nullptr)
|
if (psnapshot == nullptr || psnapshot->snapshot_depth() == 0)
|
||||||
{
|
{
|
||||||
aeReleaseLock();
|
aeReleaseLock();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
psnapshot->m_refCount++; // ensure it's not free'd
|
psnapshot->m_refCount++; // ensure it's not free'd
|
||||||
aeReleaseLock();
|
aeReleaseLock();
|
||||||
psnapshot->consolidate_children(this, false /* fForce */);
|
psnapshot->consolidate_children(this, false /* fForce */);
|
||||||
@ -648,7 +649,6 @@ void redisDbPersistentDataSnapshot::consolidate_children(redisDbPersistentData *
|
|||||||
|
|
||||||
serverLog(LL_VERBOSE, "cleaned %d snapshots", snapshot_depth()-1);
|
serverLog(LL_VERBOSE, "cleaned %d snapshots", snapshot_depth()-1);
|
||||||
spdb->m_refCount = depth;
|
spdb->m_refCount = depth;
|
||||||
spdb->m_fConsolidated = true;
|
|
||||||
// Drop our refs from this snapshot and its children
|
// Drop our refs from this snapshot and its children
|
||||||
psnapshotT = this;
|
psnapshotT = this;
|
||||||
std::vector<redisDbPersistentDataSnapshot*> vecT;
|
std::vector<redisDbPersistentDataSnapshot*> vecT;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user