Unprotect rdb channel when bgsave child fails in dual channel replication (#1297)

If bgsaveerr is error, there is no need to protect the rdb channel.
The impact of this may be that when bgsave fails, we will protect
the rdb channel for 60s. It may occupy the reference of the repl
buf block, making it impossible to recycle it until we free the
client due to COB or free the client after 60s.

We kept the RDB channel open as long as the replica hadn't established
a main connection, even if the snapshot process failed. There is no
value in keeping the RDB client in this case.

Signed-off-by: Binbin <binloveplay1314@qq.com>
This commit is contained in:
Binbin 2024-11-15 16:48:13 +08:00 committed by GitHub
parent 92181b6797
commit 86f33ea2b0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1741,6 +1741,8 @@ void updateReplicasWaitingBgsave(int bgsaveerr, int type) {
struct valkey_stat buf;
if (bgsaveerr != C_OK) {
/* If bgsaveerr is error, there is no need to protect the rdb channel. */
replica->flag.protected_rdb_channel = 0;
freeClientAsync(replica);
serverLog(LL_WARNING, "SYNC failed. BGSAVE child returned an error");
continue;