From c091050d4aa40e6b797d51acec696cdc7cba0beb Mon Sep 17 00:00:00 2001 From: John Sully Date: Wed, 26 May 2021 17:29:01 +0000 Subject: [PATCH] Avoid differences between single thread and multi-thread Former-commit-id: 848c5ad784d6437533f6c86663b81e41e06a11ea --- src/replication.cpp | 20 ++++---------------- 1 file changed, 4 insertions(+), 16 deletions(-) diff --git a/src/replication.cpp b/src/replication.cpp index 2f5e205b1..ac412368b 100644 --- a/src/replication.cpp +++ b/src/replication.cpp @@ -834,10 +834,7 @@ int masterTryPartialResynchronization(client *c) { buflen = snprintf(buf,sizeof(buf),"+CONTINUE\r\n"); } if (connWrite(c->conn,buf,buflen) != buflen) { - if (FCorrectThread(c)) - freeClient(c); - else - freeClientAsync(c); + freeClientAsync(c); return C_OK; } psync_len = addReplyReplicationBacklog(c,psync_offset); @@ -1674,10 +1671,7 @@ void updateSlavesWaitingBgsave(int bgsaveerr, int type) if (bgsaveerr != C_OK) { ul.unlock(); - if (FCorrectThread(replica)) - freeClient(replica); - else - freeClientAsync(replica); + freeClientAsync(replica); serverLog(LL_WARNING,"SYNC failed. BGSAVE child returned an error"); continue; } @@ -1723,10 +1717,7 @@ void updateSlavesWaitingBgsave(int bgsaveerr, int type) if ((replica->repldbfd = open(g_pserver->rdb_filename,O_RDONLY)) == -1 || redis_fstat(replica->repldbfd,&buf) == -1) { ul.unlock(); - if (FCorrectThread(replica)) - freeClient(replica); - else - freeClientAsync(replica); + freeClientAsync(replica); serverLog(LL_WARNING,"SYNC failed. Can't open/stat DB after BGSAVE: %s", strerror(errno)); continue; } @@ -3677,10 +3668,7 @@ void replicationDiscardCachedMaster(redisMaster *mi) { serverLog(LL_NOTICE,"Discarding previously cached master state."); mi->cached_master->flags &= ~CLIENT_MASTER; - if (FCorrectThread(mi->cached_master)) - freeClient(mi->cached_master); - else - freeClientAsync(mi->cached_master); + freeClientAsync(mi->cached_master); mi->cached_master = NULL; }