From e56ca18d5aa000fc88017895352eb60bbbb53510 Mon Sep 17 00:00:00 2001 From: Amit Nagler Date: Tue, 9 Apr 2024 16:17:30 +0000 Subject: [PATCH] add replconf sub command documentation --- src/rdb.c | 1 + src/replication.c | 19 ++++++++++++------- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/src/rdb.c b/src/rdb.c index 447432cc3e..4953b4252b 100644 --- a/src/rdb.c +++ b/src/rdb.c @@ -3573,6 +3573,7 @@ int rdbSaveToSlavesSockets(int req, rdbSaveInfo *rsi) { * the RDB to, which are i WAIT_BGSAVE_START state. */ int connsnum = 0; connection **conns = zmalloc(sizeof(connection *)*listLength(server.slaves)); + server.rdb_pipe_conns = NULL; if (!direct) { server.rdb_pipe_conns = conns; server.rdb_pipe_numconns = 0; diff --git a/src/replication.c b/src/replication.c index 323d065221..f0450f684c 100644 --- a/src/replication.c +++ b/src/replication.c @@ -1264,7 +1264,17 @@ void syncCommand(client *c) { * - rdb-filter-only * Define "include" filters for the RDB snapshot. Currently we only support * a single include filter: "functions". Passing an empty string "" will - * result in an empty RDB. */ + * result in an empty RDB. + * + * - rdb-channel <1|0> + * Used to identify the client as a replica's rdb connection in an rdb connection + * sync session. + * + * - main-conn <1|0> + * Used to identify the replica main connection during + * rdb-connection sync. It also means that if psync is impossible, master + * should not auto trigger full sync. + * */ void replconfCommand(client *c) { int j; @@ -1378,8 +1388,6 @@ void replconfCommand(client *c) { } sdsfreesplitres(filters, filter_count); } else if (!strcasecmp(c->argv[j]->ptr, "rdb-conn")) { - /* REPLCONF rdb-conn is used to identify the client as a - * replica's rdb connection in an rdb connection sync session. */ long start_with_offset = 0; if (getRangeLongFromObjectOrReply(c, c->argv[j +1], 0, 1, &start_with_offset,NULL) != C_OK) { @@ -1393,10 +1401,7 @@ void replconfCommand(client *c) { c->slave_req &= ~SLAVE_REQ_RDB_CHANNEL; } } else if (!strcasecmp(c->argv[j]->ptr, "main-conn") && server.rdb_channel_enabled) { - /* REPLCONF main-conn is used to identify the replica main connection during - * rdb-connection sync. It also means that if psync is impossible, master - * should not auto trigger full sync. - * If rdb-channel is disable on this master, treat this command as unrecognized + /* If rdb-channel is disable on this master, treat this command as unrecognized * replconf option. */ long main_conn = 0; if (getRangeLongFromObjectOrReply(c, c->argv[j +1],