Receipt of REPLCONF VERSION reply should be triggered by event (#1320)

This add the missing return when repl_state change to RECEIVE_VERSION_REPLY,
this way we won’t be blocked if the primary doesn’t reply with REPLCONF
VERSION.

In practice i guess this is no likely to block in this context, reading
small responses are are likely to be received in one packet, so this
is just a cleanup (consistent with the previous state machine
processing).

Also update the state machine diagram to mention the VERSION reply.

Signed-off-by: Binbin <binloveplay1314@qq.com>
This commit is contained in:
Binbin 2024-11-19 23:42:50 +08:00 committed by GitHub
parent 3d0c834203
commit 132798b57d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -3379,15 +3379,15 @@ void dualChannelSetupMainConnForPsync(connection *conn) {
* DUAL_CHANNEL_RECEIVE_ENDOFF by the primary
* RECEIVE_IP_REPLY
* $ENDOFF RECEIVE_PSYNC_REPLY
*
* +CONTINUE
*
* DUAL_CHANNEL_RDB_LOAD TRANSFER
* +OK
* +CONTINUE
* RECEIVE_CAPA_REPLY
* DUAL_CHANNEL_RDB_LOAD TRANSFER
* +OK
* Done loading
* RECEIVE_CAPA_REPLY
* DUAL_CHANNEL_RDB_LOADED
*
* Done loading
* RECEIVE_VERSION_REPLY
* DUAL_CHANNEL_RDB_LOADED
* +OK
*
* SEND_PSYNC Replica loads local replication
* buffer into memory
@ -3589,6 +3589,7 @@ void syncWithPrimary(connection *conn) {
sdsfree(err);
err = NULL;
server.repl_state = REPL_STATE_RECEIVE_VERSION_REPLY;
return;
}
/* Receive VERSION reply. */