Add rdb_transmitted to replstateToString so that we can see it in INFO (#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 <binloveplay1314@qq.com>
This commit is contained in:
Binbin 2025-11-21 18:31:31 +08:00 committed by GitHub
parent 05540af405
commit 8189fe5c42
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 1 additions and 0 deletions

View File

@ -5642,6 +5642,7 @@ const char *replstateToString(int replstate) {
case REPLICA_STATE_BG_RDB_LOAD: return "bg_transfer"; case REPLICA_STATE_BG_RDB_LOAD: return "bg_transfer";
case REPLICA_STATE_SEND_BULK: return "send_bulk"; case REPLICA_STATE_SEND_BULK: return "send_bulk";
case REPLICA_STATE_ONLINE: return "online"; case REPLICA_STATE_ONLINE: return "online";
case REPLICA_STATE_RDB_TRANSMITTED: return "rdb_transmitted";
default: return ""; default: return "";
} }
} }