-
Notifications
You must be signed in to change notification settings - Fork 56
Description
PAF Version: 2.2.0-2, 3 node cluster, sync commit, fixed priority
First I've implemented sync commit with the intention that I reduce or eliminate data loss on master failover to standby.
I implemented a fixed priority for my standbys (pghost1, pghost2, pghost3) thinking that would make things a bit more reliable on failover so that 1 standby would always be the most current and become the master and the 2nd standby could then immediately catch up and become the new standby as soon as it re-connected to the new master. IOW, a failover would lead to only a few seconds where the cluster did not have a functional standby. That is pretty much the case from my testing so far with PAF and sync commit and its almost a thing of beauty. Not to digress too far on this, but I'm pretty sure that its conceptually feasible to have this same behavior without prioritized commit; I'm just trying things to see what actually works and so far, this seems to be behaving better than just sync commit and letting postgres pick which standby to write to arbitrarily. I really think it all comes down to how PAF picks the standby and the timing of that decision (yeah I know distributed decisions are hard because facts change).
However, I've noticed something in the logging that concerns me. Turns out this happens with or without sync commit. PAF is apparently adjusting resource scores just based on lag.
Below master is pghost1
Dec 15 21:55:36 firefly25 pgsqlms(pgsqld)[40023]: INFO: Update score of "pghost3" from 990 to 1000 because of a change in the replication lag (512).
Dec 15 21:55:36 firefly25 pgsqlms(pgsqld)[40023]: INFO: Update score of "pghost2" from 1000 to 990 because of a change in the replication lag (464).
Dec 15 21:55:47 firefly25 pgsqlms(pgsqld)[40205]: INFO: Update score of "pghost2" from 990 to 1000 because of a change in the replication lag (224).
Dec 15 21:55:47 firefly25 pgsqlms(pgsqld)[40205]: INFO: Update score of "pghost3" from 1000 to 990 because of a change in the replication lag (224).
Dec 15 21:59:32 firefly25 pgsqlms(pgsqld)[43667]: INFO: Update score of "pghost3" from 990 to 1000 because of a change in the replication lag (6064).
Dec 15 21:59:32 firefly25 pgsqlms(pgsqld)[43667]: INFO: Update score of "pghost2" from 1000 to 990 because of a change in the replication lag (0).
Dec 15 21:59:42 firefly25 pgsqlms(pgsqld)[43845]: INFO: Update score of "pghost2" from 990 to 1000 because of a change in the replication lag (0).
Dec 15 21:59:42 firefly25 pgsqlms(pgsqld)[43845]: INFO: Update score of "pghost3" from 1000 to 990 because of a change in the replication lag (0).
It's not yet clear to me PAF is compatible with prioritized sync write, without avoidable data loss (e.g. it picking a server that has lower lag but is in fact farther behind). It seems to me, if I want to optimize to minimize data loss, the score should be based on replication state (pg_last_xlog_receive_location?). Please advise. I'm not certain I am right about this but mostly reacting the log messages above and of course my desire to minimize data loss on failover.