Skip to content

Commit c1e040d

Browse files
enjoy-binbinzhijun42
authored andcommitted
Add rdb_transmitted to replstateToString so that we can see it in INFO (valkey-io#2833)
In dual channel replication, when the rdb channel client finish the RDB transfer, it will enter REPLICA_STATE_RDB_TRANSMITTED state. During this time, there will be a brief window that we are not able to see the connection in the INFO REPLICATION. In the worst case, we might not see the connection for the DEFAULT_WAIT_BEFORE_RDB_CLIENT_FREE seconds. I guess there is no harm to list this state, showing connected_slaves but not showing the connection is bad when troubleshooting. Note that this also affects the `valkey-cli --rdb` and `--functions-rdb` options. Before the client is in the `rdb_transmitted` state and is released, we will now see it in the info (see the example later). Before, not showing the replica info ``` role:master connected_slaves:1 ``` After, for dual channel replication: ``` role:master connected_slaves:1 slave0:ip=xxx,port=xxx,state=rdb_transmitted,offset=0,lag=0,type=rdb-channel ``` After, for valkey-cli --rdb-only and --functions-rdb: ``` role:master connected_slaves:1 slave0:ip=xxx,port=xxx,state=rdb_transmitted,offset=0,lag=0,type=replica ``` Signed-off-by: Binbin <[email protected]>
1 parent f3843b6 commit c1e040d

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

src/server.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5642,6 +5642,7 @@ const char *replstateToString(int replstate) {
56425642
case REPLICA_STATE_BG_RDB_LOAD: return "bg_transfer";
56435643
case REPLICA_STATE_SEND_BULK: return "send_bulk";
56445644
case REPLICA_STATE_ONLINE: return "online";
5645+
case REPLICA_STATE_RDB_TRANSMITTED: return "rdb_transmitted";
56455646
default: return "";
56465647
}
56475648
}

0 commit comments

Comments
 (0)