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 =