Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Prioritizes fast switch to master in HA
Previously as part of switching to master there was waiting introduced to let active transactions complete normally before switching. The concept of doing that is nice, but that comes at an expense of cluster downtime when there will be times where the slave that was picked to become master could wait for a long time for active transactions that perhaps would never complete or was blocked on some condition related to the previous master no longer being available. Reasons why having master switching wait is bad: - A master in a cluster is very important, without it the cluster cannot process any requests - Awaiting open transactions to complete assumes that this instance just now was a slave that is switching to master, which means the previous master where these active transactions were hosted is no longer available so these open transactions cannot continue and complete anyway, so what's the point waiting for them? - Read transactions may still be able to complete, but the correct response to failures in those is to have them throw transient error exceptions hinting that they should be retried, at which point they may get redirected to another instance, or to this instance if it has completed the switch until then. There was a related wait in SlaveLocksClient which was there to bridge some gap if slave in the middle of a transaction found itself unavailable. This waiting would wait for the slave to become available again, with the hope that the same cluster member was still master and hadn't restarted from last time this transaction saw the master. A better way to handle this is to make sure such transaction threads gets notified about this fact via a transient error exception, so that the transaction can be retried. Another problem with waiting at this point in time was that already acquired locks would be helt during a long time, blocking other transactions in the cluster. While doing this the setting `ha.state_switch_timeout` was split into that and `ha.internal_state_switch_timeout`. Previously that timeout setting was used both for timeout for request threads as well as timeout for internal switching logic, which was just a mixup that shouldn't have been to begin with. This means that members that switch to slave waits for active transactions to complete, using `ha.internal_state_switch_timeout` and requests wanting to begin transaction or similar waits for db to be available using `ha.state_switch_timeout`, which is much longer.
- Loading branch information
Showing
13 changed files
with
156 additions
and
146 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
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
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
Oops, something went wrong.