File tree Expand file tree Collapse file tree 1 file changed +3
-2
lines changed
Expand file tree Collapse file tree 1 file changed +3
-2
lines changed Original file line number Diff line number Diff line change @@ -1036,6 +1036,9 @@ void syncCommand(client *c) {
10361036 /* ignore SYNC if already replica or in monitor mode */
10371037 if (c -> flag .replica ) return ;
10381038
1039+ /* Wait for any IO pending operation to finish before changing the client state to replica */
1040+ waitForClientIO (c );
1041+
10391042 /* Check if this is a failover request to a replica with the same replid and
10401043 * become a primary if so. */
10411044 if (c -> argc > 3 && !strcasecmp (c -> argv [0 ]-> ptr , "psync" ) && !strcasecmp (c -> argv [3 ]-> ptr , "failover" )) {
@@ -1147,8 +1150,6 @@ void syncCommand(client *c) {
11471150 c -> repl_state = REPLICA_STATE_WAIT_BGSAVE_START ;
11481151 if (server .repl_disable_tcp_nodelay ) connDisableTcpNoDelay (c -> conn ); /* Non critical if it fails. */
11491152 c -> repldbfd = -1 ;
1150- /* Wait for any IO pending operation to finish before changing the client state */
1151- waitForClientIO (c );
11521153 c -> flag .replica = 1 ;
11531154 listAddNodeTail (server .replicas , c );
11541155
You can’t perform that action at this time.
0 commit comments