From 2e9c7aed031f5822ddbe955803b6a09c6c1a9aca Mon Sep 17 00:00:00 2001 From: VivekSainiEQ Date: Thu, 3 Jun 2021 20:44:32 +0000 Subject: [PATCH] Single threaded tests work now Former-commit-id: 0e760d7c71231c7f52102909a31fc8db1b3e2860 --- src/networking.cpp | 2 +- src/replication.cpp | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/networking.cpp b/src/networking.cpp index 80120d0ca..e8ede3338 100644 --- a/src/networking.cpp +++ b/src/networking.cpp @@ -3419,7 +3419,7 @@ void rewriteClientCommandArgument(client *c, int i, robj *newval) { * that writes to said replica are using data from the replication backlog * as opposed to it's own internal buffer, this number should keep track of that */ unsigned long getClientReplicationBacklogSharedUsage(client *c) { - return (!(c->flags & CLIENT_SLAVE) || c->repl_curr_idx == -1) ? 0 : g_pserver->master_repl_offset - c->repl_curr_off; + return (!(c->flags & CLIENT_SLAVE) || !c->fPendingReplicaWrite ) ? 0 : g_pserver->master_repl_offset - c->repl_curr_off; } /* This function returns the number of bytes that Redis is diff --git a/src/replication.cpp b/src/replication.cpp index 97638e833..a7a2aa79e 100644 --- a/src/replication.cpp +++ b/src/replication.cpp @@ -810,6 +810,10 @@ long long addReplyReplicationBacklog(client *c, long long offset) { #ifdef BYPASS_PSYNC c->repl_curr_off = offset - 1; serverLog(LL_NOTICE, "This client %lu at addr %s synchronized to %lld", c->id, getClientPeerId(c), c->repl_curr_off); + + /* Force the partial sync to be queued */ + prepareClientToWrite(c); + c->fPendingReplicaWrite = true; #else while(len) { long long thislen =