Fix wrong parameter passed to failover script.
authorTatsuo Ishii <ishii@postgresql.org>
Wed, 23 May 2018 08:18:42 +0000 (17:18 +0900)
committerTatsuo Ishii <ishii@postgresql.org>
Wed, 23 May 2018 08:18:42 +0000 (17:18 +0900)
From 3.7.2, one of the failover script parameters, namely old primary
node was not passed correctly. PRIMARY_NODE_ID macro was used for the
parameter value. Unfortunately it checks the node status since 3.7.2
and gives value 0 if the node is in down status.  The node status
could be down if former primary node was going down. To fix this, use
REAL_PRIMARY_NODE_ID macro which returns the current primary node id
regardless the node status.

Problem reported by Pierre Timmermans in [pgpool-general: 6092].

src/main/pgpool_main.c

index a4b46b65d2bc34006b1084b220fc3adf74a8ea99..74508e1c164e3c9fee6ce5d01eeeec61881e0717 100644 (file)
@@ -1892,7 +1892,7 @@ static void failover(void)
                                if (nodes[i])
                                {
                                        trigger_failover_command(i, pool_config->failover_command,
-                                                                                               MASTER_NODE_ID, new_master, PRIMARY_NODE_ID);
+                                                                                               MASTER_NODE_ID, new_master, REAL_PRIMARY_NODE_ID);
                                        sync_required = true;
                                }
                        }