Prevent track changes from clearing out the cache and misreporting the key count

Former-commit-id: d7ceb59f11bc714e40f208cb8c774a5b762ad41e
This commit is contained in:
John Sully 2021-11-10 06:40:43 +00:00
parent fcad4dfc6b
commit 24fbc46352

View File

@ -2335,6 +2335,13 @@ bool readSnapshotBulkPayload(connection *conn, redisMaster *mi, rdbSaveInfo &rsi
EMPTYDB_NO_FLAGS;
serverLog(LL_NOTICE, "MASTER <-> REPLICA sync: Flushing old data");
emptyDb(-1,empty_db_flags,replicationEmptyDbCallback);
for (int idb = 0; idb < cserver.dbnum; ++idb) {
aeAcquireLock();
g_pserver->db[idb]->processChanges(false);
aeReleaseLock();
g_pserver->db[idb]->commitChanges();
g_pserver->db[idb]->trackChanges(false);
}
}
}