[pgpool-hackers: 674] Detecting split brain

Tatsuo Ishii ishii at postgresql.org
Thu Nov 20 16:27:50 JST 2014


Hi,

One of common complains from pgpool-II users is, pcp_attach_node feels
free to attach a primary node regardless there's already a primary
node in streaming replication mode. The worst scenario is as follows:

1) precondition:

node 0: detached (status 3)
node 1: primary
node 2: standby (following node 1)

2) pcp_attach_node attaches a primary node to node 0.

3) pgpool-II looks for new primary node starting from node 0 and
   happily decides node 0 is the new primary node.

4) user sends write query to node 0 but node 2 is not replicated from
   node 0 since node 1 is a standby node for node 1, not node 0.

Of course this is user's fault. He/she must be very careful before
attaching node 0, if there's already a primary node.

However, this is a common mistake and I would like pgpool-II do
something to prevent for this mistake. The instant idea is,
pcp_attach_node checks node status whether there's already a primary
node if the attaching node is a primary node. This is not terribly
hard to implement and seems to be doable.

Is there any pitfall in this idea? Or is there any better idea?

Best regards,
--
Tatsuo Ishii
SRA OSS, Inc. Japan
English: http://www.sraoss.co.jp/index_en.php
Japanese:http://www.sraoss.co.jp


More information about the pgpool-hackers mailing list