pgpool2.git / summary / log / commit / refs

commit    4b4279451ec878ddcdb0ec5040d02a7319268b95
Author:   Tatsuo Ishii <ishii@postgresql.org>
Date:     Wed May 08 08:39:57 2013 +0000

    Fix %H in trigger_failover() to assign new primary node.
    
    Before it assigns the result of get_next_master_node(), which is not
    correct in streaming replication mode, which is not necessarily same
    as the primary node id. This causes problem in follow_master_command.
    Please note that %m(new master node) properly uses passed new
    master(or primary) node id. See [pgpool-hackers: 219] for more
    details.


main.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/main.c b/main.c index c16d7c982..6ebcbf302 100644 --- a/main.c +++ b/main.c @@ -109,7 +109,7 @@ static void reload_config(void); static int pool_pause(struct timeval *timeout); static void kill_all_children(int sig); static int get_next_master_node(void); -static pid_t fork_follow_child(int old_master, int new_master, int old_primary); +static pid_t fork_follow_child(int old_master, int new_primary, int old_primary); static RETSIGTYPE exit_handler(int sig); static RETSIGTYPE reap_handler(int sig); @@ -2034,7 +2034,7 @@ static void failover(void) { if ((follow_cnt > 0) && (*pool_config->follow_master_command != '\0')) { - follow_pid = fork_follow_child(Req_info->master_node_id, new_master, + follow_pid = fork_follow_child(Req_info->master_node_id, new_primary, Req_info->primary_node_id); } @@ -2689,7 +2689,7 @@ static int trigger_failover_command(int node, const char *command_line, break; case 'H': /* new master host name */ - newmaster = pool_get_node_info(get_next_master_node()); + newmaster = pool_get_node_info(new_master); if (newmaster) string_append_char(exec_cmd, newmaster->backend_hostname); else @@ -2882,7 +2882,7 @@ static int find_primary_node_repeatedly(void) /* * fork a follow child */ -pid_t fork_follow_child(int old_master, int new_master, int old_primary) +pid_t fork_follow_child(int old_master, int new_primary, int old_primary) { pid_t pid; int i; @@ -2898,7 +2898,7 @@ pid_t fork_follow_child(int old_master, int new_master, int old_primary) bkinfo = pool_get_node_info(i); if (bkinfo->backend_status == CON_DOWN) trigger_failover_command(i, pool_config->follow_master_command, - old_master, new_master, old_primary); + old_master, new_primary, old_primary); } exit(0); } [parent: c87d9d9d3b70]