[pgpool-general: 7530] Re: Strange behavior on switchover with detach_false_primary enabled

Tatsuo Ishii ishii at sraoss.co.jp
Thu Apr 29 13:52:09 JST 2021

>>>From what I've observed, I think the problem is:
>> Starting with 3 backends, node 0 is primary, node 1 and 2 are following node 0.
>> Node 0 is detached, starting a failover
>> Node 1 is selected as the new primary and promoted
>> The new situation now is:
>> Node 0 is back online and primary, node 1 is primary and node 2 is
>> still following node 0.
>> This causes the detach_false_primary to think that node 1 is a false
>> primary (it has no slaves while node 0 has 1)
>> It detaches node 1, and all goes wrong.
> I think your analysis is correct. To overcome the issue,
> detach_false_primary should not execute while failover and/or follow
> primary process is running (detach_false_primary is kicked by
> streaming replication delay process. So even if detach_false_primary
> is missed at some point, next round of the streaming replication check
> will execute detach_false_primary if there's no failover and/or follow
> primary is running).
> Currently there's information about whether failover is going on, but
> there's no info on whether follow primary is running. I will study if
> we could add info about follow primary execution. This would be a
> little bit tricky since follow primary runs as separate process
> from the pgpool main process, which conducts failover.

For this purpose I have added a new shared memory variable. Either the
follow primary command or the detach_false_primary must set 1 to the
variable before execution only when the variable is 0. If it fails,
skip the execution or retry to acquire the lock so that the follow
primary command and the detach_false_primary never runs in
parallel. Attached patch implements this.

Best regards,
Tatsuo Ishii
SRA OSS, Inc. Japan
English: http://www.sraoss.co.jp/index_en.php
-------------- next part --------------
A non-text attachment was scrubbed...
Name: detach_false_primary.diff
Type: text/x-patch
Size: 5582 bytes
Desc: not available
URL: <http://www.pgpool.net/pipermail/pgpool-general/attachments/20210429/a5e68a43/attachment.bin>

More information about the pgpool-general mailing list