[pgpool-committers: 8386] pgpool: Refactor failover().

Tatsuo Ishii ishii at sraoss.co.jp
Tue Feb 8 14:38:28 JST 2022


Refactor failover().

failover() was too large and hard to maintain. By refactoring it, the
size is reduced from 798 lines to 215 lines.  It is now splitted into
following subroutines. failover() just calls them.

static int handle_failback_request(FAILOVER_CONTEXT *failover_context, int node_id);
static int handle_failover_request(FAILOVER_CONTEXT *failover_context, int node_id);
static void kill_failover_children(FAILOVER_CONTEXT *failover_context, int node_id);
static void exec_failover_command(FAILOVER_CONTEXT *failover_context, int new_main_node_id, int promote_node_id);
static int determine_new_primary_node(FAILOVER_CONTEXT *failover_context, int node_id);
static int exec_follow_primary_command(FAILOVER_CONTEXT *failover_context, int node_id, int new_primary_node_id);
static void save_node_info(FAILOVER_CONTEXT *failover_context, int new_primary_node_id, int new_main_node_id);
static void exec_child_restart(FAILOVER_CONTEXT *failover_context, int node_id);
static void exec_notice_pcp_child(FAILOVER_CONTEXT *failover_context);

Branch
------
master

Details
-------
https://git.postgresql.org/gitweb?p=pgpool2.git;a=commitdiff;h=6df397cea1f4d86ab5292a3f703b706e3c3c979e

Modified Files
--------------
src/main/pgpool_main.c | 1596 +++++++++++++++++++++++++++---------------------
1 file changed, 885 insertions(+), 711 deletions(-)



More information about the pgpool-committers mailing list