Fixed data race? Seems to be passing multithreaded test cases now

Former-commit-id: cb13edd1200c1230fa7e313d69c69e06129951d3
This commit is contained in:
VivekSainiEQ 2021-05-05 22:26:36 +00:00
parent 6da7989518
commit 6e5c8246cc
2 changed files with 2 additions and 2 deletions

View File

@ -1782,7 +1782,7 @@ int writeToClient(client *c, int handler_installed) {
// }
if (nwritten == nrequested){
if (nwritten == nrequested && g_pserver->repl_backlog_idx == c->repl_curr_idx){
c->repl_curr_idx = -1; /* -1 denotes no more replica writes */
}
else if (nwritten > 0)

View File

@ -90,7 +90,7 @@ void resizeReplicationBacklogForClients(long long newsize);
void setReplIdx(client *c, long long idx, long long off){
// serverLog(LL_NOTICE, "calling this garbage function w/ idx and off: %lld, %lld, %lld", idx, off, off-idx);
// serverLog(LL_NOTICE, "Repl Index started at: %lld", c->repl_curr_idx);
if (c->repl_curr_idx == -1){
if (c->repl_curr_idx == -1 && off >= c->repl_curr_off){
if (prepareClientToWrite(c) != C_OK) return;
c->repl_curr_idx = idx;
c->repl_curr_off = off;