View Issue Details

IDProjectCategoryView StatusLast Update
0000484Pgpool-IIBugpublic2019-04-02 09:10
Reporterstaslg Assigned Topengbo  
PriorityhighSeveritymajorReproducibilityalways
Status closedResolutionopen 
Product Version4.0.1 
Summary0000484: Change node status withount change role type
DescriptionHello

pgpool --version
pgpool-II version 4.1devel (karasukiboshi)
Configuretion type [ raw mode ]

I have a problem with role status chages:
After failover:

In pgpool:

 node_id | hostname | port | status | lb_weight | role | select_cnt | load_balance_node | replication_delay | last_status_change
---------+---------------+------+--------+-----------+--------+------------+-------------------+-------------------+---------------------
 0 | db-n1 | 5432 | down | 0.500000 | slave | 0 | false | 0 | 2019-03-26 15:13:54
 1 | db-n2 | 5432 | up | 0.500000 | master | 594 | true | 0 | 2019-03-26 15:13:28

In repmgr :
 ID | Name | Role | Status | Upstream | Location | Connection string
----+-------+---------+-----------+----------+----------+--------------------------------------------------------
 1 | node1 | standby | running | node2 | default | host=db-n1 port=5432 user=repmgr dbname=repmgr
 2 | node2 | primary | * running | | default | host=db-n2 port=5432 user=repmgr dbname=repmgr


If I do change (pcp_attach_node 0 ), pgpool(master<->slave) update role status and begins to think that node 0 is master now, although it is not true, because in repmgr node1 in slave, node2 primary

 node_id | hostname | port | status | lb_weight | role | select_cnt | load_balance_node | replication_delay | last_status_change
---------+---------------+------+--------+-----------+--------+------------+-------------------+-------------------+---------------------
 0 | db-n1 | 5432 | up | 0.500000 | master | 0 | true | 0 | 2019-03-26 15:40:40
 1 | db-n2 | 5432 | up | 0.500000 | slave | 3745 | false | 0 | 2019-03-26 15:13:28

Why node 0 cannot be a slave role in up status ?
How to fix it or configure ?
 


TagsNo tags attached.

Activities

pengbo

2019-03-27 09:20

developer   ~0002466

Is node0 is a slave of node1? Did you recovery node0 from node1?
Connect to node0, try the command below:

------------
    select pg_is_in_recovery();
------------

If the result is "f", Pgpool-II will consider this node0 as primary.
So you have to recovery this node0 from node1 first by using "pcp_recovery_node".

staslg

2019-03-27 10:22

reporter   ~0002468

Is node0 is a slave of node1? -Yes
Did you recovery node0 from node1? - Yes
You can saw it in repmgr out: node1 | standby | running | node2

 ID | Name | Role | Status | Upstream | Location | Connection string
----+-------+---------+-----------+----------+----------+--------------------------------------------------------
 1 | node1 | standby | running | node2 | default | host=db-n1 port=5432 user=repmgr dbname=repmgr
 2 | node2 | primary | * running | | default | host=db-n2 port=5432 user=repmgr dbname=repmgr


 node_id | hostname | port | status | lb_weight | role | select_cnt | load_balance_node | replication_delay | last_status_change
---------+---------------+------+--------+-----------+--------+------------+-------------------+-------------------+---------------------
 0 | db-n1 | 5432 | down | 0.500000 | slave | 0 | false | 0 | 2019-03-26 15:40:50
 1 | db-n2 | 5432 | up | 0.500000 | master | 107229 | true | 0 | 2019-03-26 15:13:28


db-n1$
postgres=# select pg_is_in_recovery();
 pg_is_in_recovery
-------------------
 t
------------------------------------------------------------------
db-n2$
postgres=# select pg_is_in_recovery();
 pg_is_in_recovery
-------------------
 f

pcp_recovery_node option for replication and streaming replication modes, but we use raw mode

pengbo

2019-03-28 19:30

developer   ~0002479

You are using streaming replication between node0 and node1.
Why are you using raw mode. I think you should use streaming replication mode.

staslg

2019-04-01 13:43

reporter   ~0002490

Role status works correctly only in streaming replication mode ?

pengbo

2019-04-01 16:44

developer   ~0002493

> Role status works correctly only in streaming replication mode ?
Yes.
I think you may misunderstand raw mode.
In raw mode, pgpool will consider the alive node with smallest node number as master node.

staslg

2019-04-01 18:13

reporter   ~0002496

Ok, I've got it, thanks
You may close the case.

Issue History

Date Modified Username Field Change
2019-03-26 21:51 staslg New Issue
2019-03-27 09:20 pengbo Note Added: 0002466
2019-03-27 09:20 pengbo Assigned To => pengbo
2019-03-27 09:20 pengbo Status new => assigned
2019-03-27 10:22 staslg Note Added: 0002468
2019-03-28 19:30 pengbo Note Added: 0002479
2019-04-01 13:43 staslg Note Added: 0002490
2019-04-01 16:44 pengbo Note Added: 0002493
2019-04-01 18:13 staslg Note Added: 0002496
2019-04-02 09:10 pengbo Status assigned => closed