[pgpool-general: 4183] Re: failover: set new primary node: -1

Ziyun Audrey Wang ziyun.wang at ericsson.com
Tue Nov 10 22:01:01 JST 2015


Hello Tatsuo

Thank you very much for quick reply!

After the pgpool set the new primary node : -1
Then it set the master node 0,

Then it start to direct the update request to the node 0, which is read-only


2015-11-07 08:43:52: pid 6378: LOG:  failover: set new primary node: -1
2015-11-07 08:43:52: pid 6378: LOG:  failover: set new master node: 0
...

2015-11-07 08:44:05: pid 1698: LOG:  pool_send_and_wait: Error or notice message from backend: : DB node id: 0 backend pid: 8651 statement: "update mdnowner.MDN_COMPONENT_PROCESS set MDN_COMPONENT_ID=$1, CREATED_AT=$2, NAME=$3, RUNNING=$4, STATUS=$5, UPDATED_AT=$6, version=$7 where id=$8 and version=$9" message: "cannot execute UPDATE in a read-only transaction"

At this point, pgpool was completed confused itself. It was not able to detect the proper master and slave node. 

After I restart the pgpool, the problem is gone.

But we have saw the pgpool find primary node -1 many times.

My question is , what cause the pgpool find the primary node "-1"?

And if The master node is a live node which has the youngest node id, how pgpool decide where to send the update?

Thanks!/Audrey


-----Original Message-----
From: Tatsuo Ishii [mailto:ishii at postgresql.org] 
Sent: November-09-15 6:20 PM
To: Ziyun Audrey Wang
Cc: pgpool-general at pgpool.net
Subject: Re: [pgpool-general: 4176] failover: set new primary node: -1

> Hello,
> 
> We are using pgpool II
> # pgpool -version
> pgpool-II version 3.4.2 (tataraboshi)
> 
> we have the following setup:
> 
> one pgpool node, with one master DB and 3 slave nodes
> 
> during our failover testing, after server failover happened,
> 
> we got the following:
> 2015-11-07 08:43:52: pid 6378: LOG:  failover: set new primary node: 
> -1
> 2015-11-07 08:43:52: pid 6378: LOG:  failover: set new master node: 0
> 
> But at this point the master node is actually node 1, the pgpool set the wrong node as master node.

"master node" != "primary node" in pgpool-II terms. The master node is a live node which has the youngest node id. So if node 0 is alive, your master node is 0.

> Can someone help to answer why the pgpool will set the new primary node: -1?
> 
> Is this a known bug?

Probably pgpool-II fails to detect the node is actually a primary. See below to know how pgpool-II detects a primary node.

http://pgpool.net/mediawiki/index.php/FAQ#How_does_pgpool-II_find_the_primary_node.3F

Also enabling debug mode (-d) will generate help us to see what's going on when failover occurs.

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-general mailing list