健康檢查
通過創建到後端的連接實施健康檢查
main() PgpoolMain() processState = PERFORMING_HEALTH_CHECK; do_health_check() make_persistent_db_connection() discard_persistent_db_connection()
如果連接創建失敗,會拋出異常,進而跳轉到統一的異常處理點,如果超過重試次數,將後端降級,並最終調用pgpool.conf配置文件裡設置的failover_command。
main() PgpoolMain() if(processState == PERFORMING_HEALTH_CHECK) process_backend_health_check_failure() degenerate_backend_set(&health_check_node_id,1) degenerate_backend_set_ex() register_node_operation_request(NODE_DOWN_REQUEST) failover() trigger_failover_command()
failover()的切換過程