Reduce snapshot window to 1 second instead of 10

Former-commit-id: 4f91f0503fe4eea1c20b977a5858ac345c3e7b9b
This commit is contained in:
John Sully 2019-11-29 22:21:49 -05:00
parent b0e6cc85ef
commit 6533428887
2 changed files with 4 additions and 4 deletions

View File

@ -265,7 +265,6 @@ void xorObjectDigest(redisDb *db, robj_roptr keyobj, unsigned char *digest, robj
* as input in order to ensure that a different ordered list will result in * as input in order to ensure that a different ordered list will result in
* a different digest. */ * a different digest. */
void computeDatasetDigest(unsigned char *final) { void computeDatasetDigest(unsigned char *final) {
unsigned char digest[20];
int j; int j;
uint32_t aux; uint32_t aux;
@ -282,7 +281,8 @@ void computeDatasetDigest(unsigned char *final) {
mixDigest(final,&aux,sizeof(aux)); mixDigest(final,&aux,sizeof(aux));
/* Iterate this DB writing every entry */ /* Iterate this DB writing every entry */
db->iterate([&](const char *key, robj *o)->bool { db->iterate_threadsafe([final, db](const char *key, robj_roptr o)->bool {
unsigned char digest[20];
robj *keyobj; robj *keyobj;
memset(digest,0,20); /* This key-val digest */ memset(digest,0,20); /* This key-val digest */

View File

@ -22,7 +22,7 @@ const redisDbPersistentDataSnapshot *redisDbPersistentData::createSnapshot(uint6
// If possible reuse an existing snapshot (we want to minimize nesting) // If possible reuse an existing snapshot (we want to minimize nesting)
if (mvccCheckpoint <= m_spdbSnapshotHOLDER->mvccCheckpoint) if (mvccCheckpoint <= m_spdbSnapshotHOLDER->mvccCheckpoint)
{ {
if (((getMvccTstamp() - m_spdbSnapshotHOLDER->mvccCheckpoint) >> MVCC_MS_SHIFT) < 10*1000) if (((getMvccTstamp() - m_spdbSnapshotHOLDER->mvccCheckpoint) >> MVCC_MS_SHIFT) < 1*1000)
{ {
m_spdbSnapshotHOLDER->m_refCount++; m_spdbSnapshotHOLDER->m_refCount++;
return m_spdbSnapshotHOLDER.get(); return m_spdbSnapshotHOLDER.get();
@ -285,7 +285,7 @@ bool redisDbPersistentDataSnapshot::iterate_threadsafe(std::function<bool(const
__atomic_load(&m_pdbSnapshot, &psnapshot, __ATOMIC_ACQUIRE); __atomic_load(&m_pdbSnapshot, &psnapshot, __ATOMIC_ACQUIRE);
if (fResult && psnapshot != nullptr) if (fResult && psnapshot != nullptr)
{ {
fResult = psnapshot->iterate_threadsafe([&](const char *key, robj_roptr o){ fResult = psnapshot->iterate_threadsafe([this, &fn, &celem](const char *key, robj_roptr o){
// Before passing off to the user we need to make sure it's not already in the // Before passing off to the user we need to make sure it's not already in the
// the current set, and not deleted // the current set, and not deleted
dictEntry *deCurrent = dictFind(m_pdict, key); dictEntry *deCurrent = dictFind(m_pdict, key);