-
Notifications
You must be signed in to change notification settings - Fork 448
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add ability to disable sync replication when there're not enough ready standbys. #841
Conversation
Last test run errors look like etcd timeouts, unrelated to the code itself:
Could someone with permissions please rerun/confirm? |
@rg2011 Thanks for your PR. #330 was a very old discussion and many things in the code and sentinel logic changed from that time. So:
|
Hi, thanks for reviewing a PR for such an old issue :D. The extra logic is mostly for avoiding keeping previous / unhealthy standbys in the list of syncStandbys, to speed up failover from sync to async. But honestly I have not tested what's the actual speedup, if any. so I'm ok with trying just |
Hi @sgotti . Finished updating the PR and the tests passed, so I think it is ready for review. |
doc/cluster_spec.md
Outdated
@@ -24,7 +24,7 @@ Some options in a running cluster specification can be changed to update the des | |||
| maxStandbysPerSender | max number of standbys for every sender. A sender can be a master or another standby (with cascading replication). | no | uint16 | 3 | | |||
| maxStandbyLag | maximum lag (from the last reported master state, in bytes) that an asynchronous standby can have to be elected in place of a failed master. | no | uint32 | 1MiB | | |||
| synchronousReplication | use synchronous replication between the master and its standbys | no | bool | false | | |||
| minSynchronousStandbys | minimum number of required synchronous standbys when synchronous replication is enabled (only set this to a value > 1 when using PostgreSQL >= 9.6) | no | uint16 | 1 | | |||
| minSynchronousStandbys | minimum number of required synchronous standbys when synchronous replication is enabled (only set this to a value != 1 when using PostgreSQL >= 9.6) | no | uint16 | 1 | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll add a note about the behavior when the value is 0.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See 21f5e31
@rg2011 Thanks! Great work. Just a little request on adding a note about minSynchronousStandbys == 0 in the doc. Can you please squash in a single commit? |
Squished into a single commit in #843. Please move discussion to that PR. |
Learnt how to do the rebase on the same branch :) . Rebased to a single commit. |
Thanks. After thinking a bit more about this, someone could want to have You should also rename the commit to something like: *: Add option to disable sync replication when there're not enough ready standbys. |
I'm not sure about that use case. As long as there are ready replicas to add to the sync list, the sentinel will target for |
Yeah, it's probably a not really common use case, so we can go ahead with the current approach and improve it in future if someone wants to implement it. So just please add some doc on the behavior of *: Add ability to disable sync replication when there're not enough ready standbys. |
Added a brief note about |
@rg2011 Docs seems good, can you please also some brief note on the behavior of MinSynchronousStandbys == 0 in doc/cluster_spec.md and then squash and rename the commit? Thanks. |
Updated doc/cluster_spec.md and squashed. Glad to see this making it into milestone v0.18.0. Thanks! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@rg2011 Thanks a lot! LGTM. Merging.
Fixes issue #330 by adding support for
MinSynchronousStandbys == 0
, which removes fake sync replicas from the replica list.Changes to
cluster config
:MinSynchronousStandbys > 0
Changes to
sentinel
:fakeStandbyName
sync standby when the available standbys are 0.Changes to
ha_test
: