sentinel: improve sync standby management logic #444
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.
Update the sync standbys only if the reported ones are the same as the required
ones. In this way, when we have to choose a new master we are sure that there're
no intermediate changes between the reported standbys and the required ones.
When we have to choose a new sync standby as master we can just choose one of
the common standbys between the reported and the required one since we are sure
these are defined in the master as sync standbys
Improve logic to always have some real sync standbys up to
MinSynchronousStanbys, also if not in good state, to improve the possibility
to be able to choose a sync standby to replace a failed master.
Always keep a common standby between the previous and the wanted
synchronousStandbys