Skip to content

Commit

Permalink
add replconf sub command documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
amitnagl committed Apr 9, 2024
1 parent cefd9e2 commit e56ca18
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
1 change: 1 addition & 0 deletions src/rdb.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
19 changes: 12 additions & 7 deletions src/replication.c
Original file line number Diff line number Diff line change
Expand Up @@ -1264,7 +1264,17 @@ void syncCommand(client *c) {
* - rdb-filter-only <include-filters>
* 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;

Expand Down Expand Up @@ -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) {
Expand All @@ -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],
Expand Down

0 comments on commit e56ca18

Please sign in to comment.