Improve the failover efficiency #362
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This enhancement can improve the failover efficiency when a lots of master node probe failed concurrently.
Since there is only one can UpdateCluster successfully each time, we should reset the failure count after UpdateCluster successfully, and can do failover later again, there is no need to wait more than 15 seconds(ping_interval_seconds*max_ping_count).
For example, if 3 master node doing failover concurrently, it will cost more than 45 seconds before, but now it is 18 seconds (12s + 3s + 3s).
BTW, we should enlarge the minIdleConns to each node, this can save time in acquiring new connections when doing probe and sync cluster topology to all nodes, 10 is enough.