Fix assert false alarm when freeTombstoneObjects is called

Former-commit-id: e21a011072505cfa0a37afefb94f7270e80625c5
This commit is contained in:
John Sully 2020-06-09 20:59:09 -04:00
parent ec01cc23b1
commit 29faa06028

View File

@ -502,10 +502,13 @@ void redisDbPersistentDataSnapshot::consolidate_children(redisDbPersistentData *
spdb->initialize(); spdb->initialize();
dictExpand(spdb->m_pdict, m_pdbSnapshot->size()); dictExpand(spdb->m_pdict, m_pdbSnapshot->size());
volatile size_t skipped = 0;
m_pdbSnapshot->iterate_threadsafe([&](const char *key, robj_roptr o) { m_pdbSnapshot->iterate_threadsafe([&](const char *key, robj_roptr o) {
if (o != nullptr) { if (o != nullptr) {
dictAdd(spdb->m_pdict, sdsdupshared(key), o.unsafe_robjcast()); dictAdd(spdb->m_pdict, sdsdupshared(key), o.unsafe_robjcast());
incrRefCount(o); incrRefCount(o);
} else {
++skipped;
} }
return true; return true;
}, true /*fKeyOnly*/, true /*fCacheOnly*/); }, true /*fKeyOnly*/, true /*fCacheOnly*/);
@ -518,7 +521,11 @@ void redisDbPersistentDataSnapshot::consolidate_children(redisDbPersistentData *
spdb->m_pdict->iterators++; spdb->m_pdict->iterators++;
serverAssert(spdb->size() == m_pdbSnapshot->size()); if (m_spstorage) {
serverAssert(spdb->size() == m_pdbSnapshot->size());
} else {
serverAssert((spdb->size()+skipped) == m_pdbSnapshot->size());
}
// Now wire us in (Acquire the LOCK) // Now wire us in (Acquire the LOCK)
AeLocker locker; AeLocker locker;