-
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
Deactivate synchronous replication for cluster consisting of 2 nodes in case the slave fails #330
Comments
@KimSS If i got this right you're asking for a "best effort" synchronous replication. Use sync repl if possible but downgrade to async repl if not possible. As a note, the current sync repl logic is a strict one because the main use of sync repl is to avoid losing data and transactions when electing a new master. So if someone is going to implement this it should be an option disabled by default. |
@sgotti Would it be possible to implement such a feature? |
@KimSS it should be possible, it requires some changes in the sentinel code and to add/change the related tests. I'll keep it disabled by default and add a cluster spec option (like 'strictSyncRepl') which defaults to true. I cannot provide an estimate on when it'll be implemented, if no one is going to implement it I can do it after other older opened issues are implemented. |
@sgotti this is very positive! In out case at this moment infrastructure guys will immediately start working (probably they will be waken up). This reaction might take ~30 minutes. But the applications will continue operate smoothly. Also the environment (2 nodes) may face another instance of the problem: failure of the master. In this case stolon promotes the slave into master - this is magnificent. But the sync replication is still enabled. So the new master is not master in fact. It is not available for write operations. |
@KimSS I'm not sure if I understand your statements but your proposal will obviously trade consistency for availability (in the CAP theorem). For this reason I'll keep this option disabled by default. If you want consistency you should use sync repl with at least 3 nodes (and 2 sync repl standbys) to be available with one node loss. There are other solutions outside stolon if you want consistency with only 2 nodes using a shared storage (and this doesn't have the downside of the pg synchronous replication) like pacemaker with fencing, kubernetes with a stateful set using a single replica and persistent volumes (but you'll need a fence controller if the node is partitioned). See also the FAQ. |
@sgotti |
Hi, I actually suspect that just setting
So it should be a safe setup. In short, the rule is 'we will allow single node to work as long as it is proper one, that is, it contains all transactions. ' Availability is traded over consistency here: it is possible that one node is alive, but it won't be elected as master, as shown above. This is still useful because it allows to use synchronous replication with only two copies of data safely, while simultaneous failure of both instances should be rare. Now, curiously, 0 is forbidden value for |
Hi Sorintlab,
please consider the enhancement:
In 2 nodes cluster it makes sense to deactivate the synchronous replication from the master to slave in case the slave fails (or network is splitted) and restore it when the slave backs online.
Seems it should be the option.
Basic ideas:
The text was updated successfully, but these errors were encountered: