-
Notifications
You must be signed in to change notification settings - Fork 687
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix early unblock/disconnect of clients during failover
When entering the `FAILOVER_IN_PROGRESS` state during a failover, `disconnectAllBlockedClients` is called (as part of `replicationSetPrimary`) to disconnect all blocked clients (except those that are postponed due to a client pause). While this makes sense in case of a role change in general, this is happening too early in case of failover: 1. The role switch hasn't happened in `FAILOVER_IN_PROGESS` yet, thus, there is no new primary to connect to. 2. The failover may still fail. In this case, there is no need to unblock/disconnect clients at all. Therefore, move the `disconnectAllBlockedClients` to when we unblock the paused clients after the failover completes. As said above, this call must only happen if the failover succeeds. Extend two tests to verify the changed behavior: 1. "failover to a replica with force works": Issue a blocking command before the failover and verify that it is unblocked after the failover finished. 2. "failover aborts if target rejects sync request": Both a blocking command issued before a failover as well as one issued during the failover won't be interrupted when the failover eventually aborts. (Note that the location of the previous `SET FOO BAR` command in the test was wrong, as it did not block and thus, wouldn't be "interrupted" by the failover in any case.) Signed-off-by: Simon Baatz <[email protected]>
- Loading branch information
Showing
4 changed files
with
66 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters