View Issue Details
| ID | Project | Category | View Status | Date Submitted | Last Update |
|---|---|---|---|---|---|
| 0000292 | Pgpool-II | Bug | public | 2017-03-03 19:18 | 2017-03-13 19:25 |
| Reporter | nagata | Assigned To | nagata | ||
| Priority | normal | Severity | minor | Reproducibility | always |
| Status | resolved | Resolution | fixed | ||
| Summary | 0000292: pcp_promote_node fails when trying promoting node 0 | ||||
| Description | In streaming replication mode, there is a case that Pgpool-II are regarding the primary node as standby for some reason, for example, when pg_ctl promote is executed manually during Pgpool-II is running. pcp_promote_node should be able fix it, but when the node is master (the first alive node), it fails. See "Steps To Reproduce" for details. The reason is as following. pcp_promote_node check if the specified node is already primary or not by comparing the node id with PRIMARY_NODE_ID. However, if there is not primary from Pgpool-II's view, PRIMARY_NODE_ID is 0 which is same as MASTER_NODE_ID, so in this situation, master node cannot be promoted by pcp_promote_node. Instead, REAL_PRIMARY_NODE_ID should be used. Attached is the patch to fix it. | ||||
| Steps To Reproduce | 1. Make a 2-node streaming replication configuration by pgpool_setup. $ ./startall $ psql -p 11000 -h localhost -c "show pool_nodes" test node_id | hostname | port | status | lb_weight | role | select_cnt | load_balance_node | replication_delay ---------+----------+-------+--------+-----------+---------+------------+-------------------+------------------- 0 | /tmp | 11002 | up | 0.500000 | primary | 0 | true | 0 1 | /tmp | 11003 | up | 0.500000 | standby | 0 | false | 0 (2 rows) 2. Force node0 to run as standby $ ./shutdownall $ cp data1/recovery.conf data0 $ ./startall $ psql -p 11000 -h localhost -c "show pool_nodes" test node_id | hostname | port | status | lb_weight | role | select_cnt | load_balance_node | replication_delay ---------+----------+-------+--------+-----------+---------+------------+-------------------+------------------- 0 | /tmp | 11002 | up | 0.500000 | standby | 0 | true | 0 1 | /tmp | 11003 | up | 0.500000 | standby | 0 | false | 0 (2 rows) 3. promote node0 manually $ pg_ctl -D data0 promote 4. run pcp_promote_node $ pcp_promote_node -p 11001 -w 0 FATAL: invalid pgpool mode for process recovery request DETAIL: specified node is already primary node, can't promote node id 0 | ||||
| Tags | No tags attached. | ||||
|
|
|
|
|
It seems it's a reasonable fix to me. I have assigned you to the person in charge because you are a Pgpool-II developer. Please go ahead and apply the patch to all supported branches. |
|
|
fixed https://git.postgresql.org/gitweb/?p=pgpool2.git;a=commit;h=8c18444cd84709eb17204b8d108ab93f695c990f |
| Date Modified | Username | Field | Change |
|---|---|---|---|
| 2017-03-03 19:18 | nagata | New Issue | |
| 2017-03-03 19:18 | nagata | File Added: pcp_promote_node.patch | |
| 2017-03-06 17:59 | t-ishii | Assigned To | => nagata |
| 2017-03-06 17:59 | t-ishii | Status | new => assigned |
| 2017-03-06 17:59 | t-ishii | Note Added: 0001374 | |
| 2017-03-13 19:25 | nagata | Status | assigned => resolved |
| 2017-03-13 19:25 | nagata | Resolution | open => fixed |
| 2017-03-13 19:25 | nagata | Note Added: 0001376 |