From d4bf25d7a27c25a8bf6d5aa502e146923a0c27a2 Mon Sep 17 00:00:00 2001 From: Tatsuo Ishii Date: Tue, 8 Feb 2022 14:56:13 +0900 Subject: [PATCH] Remove ifdef out code. Ancient health check is no longer needed to be preserved. --- src/main/pgpool_main.c | 99 ------------------------------------------ 1 file changed, 99 deletions(-) diff --git a/src/main/pgpool_main.c b/src/main/pgpool_main.c index 4dc58a518..a66be1009 100644 --- a/src/main/pgpool_main.c +++ b/src/main/pgpool_main.c @@ -1617,105 +1617,6 @@ failover(void) exec_notice_pcp_child(&failover_context); } -#ifdef NOT_USED -/* - * health check timer handler - */ -static RETSIGTYPE health_check_timer_handler(int sig) -{ - int save_errno = errno; - - POOL_SETMASK(&BlockSig); - health_check_timer_expired = 1; - POOL_SETMASK(&UnBlockSig); - errno = save_errno; -} - -/* - * do_health_check() performs the health check on all backend nodes. - * The inout parameter health_check_node_id is the starting backend - * node number for health check and when the function returns or - * exits with an error health_check_node_id contains the value - * of last backend node number on which health check was performed. - * - * Function returns false if all backend nodes are down and true if all - * backend nodes are in healthy state - */ -static bool -do_health_check(bool use_template_db, volatile int *health_check_node_id) -{ - POOL_CONNECTION_POOL_SLOT *slot; - BackendInfo *bkinfo; - static char *dbname; - int i; - bool all_nodes_healthy = false; - char *password = get_pgpool_config_user_password(pool_config->health_check_user, - pool_config->health_check_password); - - /* Do not execute health check during recovery */ - if (*InRecovery) - return false; - - if (!strcmp(pool_config->health_check_database, "")) - dbname = use_template_db ? "template1" : "postgres"; - else - dbname = pool_config->health_check_database; - - ereport(DEBUG1, - (errmsg("doing health check against database:%s user:%s", - dbname, pool_config->health_check_user))); - - /* - * Start checking the backed nodes starting from the previously failed - * node - */ - for (i = *health_check_node_id; i < pool_config->backend_desc->num_backends; i++) - { - *health_check_node_id = i; - - /* - * Make sure that health check timer has not been expired. Before - * called health_check(), health_check_timer_expired is set to 0. - * However it is possible that while processing DB nodes health check - * timer expired. - */ - if (health_check_timer_expired) - { - ereport(ERROR, - (errmsg("health check timer has been already expired before attempting to connect backend node %d", i))); - } - - bkinfo = pool_get_node_info(i); - - ereport(DEBUG1, - (errmsg("Backend DB node %d status is %d", i, bkinfo->backend_status))); - - - if (bkinfo->backend_status == CON_UNUSED || - bkinfo->backend_status == CON_DOWN) - continue; - - all_nodes_healthy = true; - ereport(DEBUG1, - (errmsg("Trying to make persistent DB connection to backend node %d having status %d", i, bkinfo->backend_status))); - - slot = make_persistent_db_connection(i, bkinfo->backend_hostname, - bkinfo->backend_port, - dbname, - pool_config->health_check_user, - password ? password : "", false); - - ereport(DEBUG1, - (errmsg("persistent DB connection to backend node %d having status %d is successful", i, bkinfo->backend_status))); - - discard_persistent_db_connection(slot); - } - if (password) - pfree(password); - return all_nodes_healthy; -} -#endif - /* * handle SIGCHLD */ -- 2.39.5