pgpool2.git / summary / log / commit / refs

commit    034476f4ba2c4bc4a10204f1097249aa4baee8b0
Author:   Tatsuo Ishii <ishii at sraoss.co.jp>
Date:     Thu Jan 22 00:50:26 2009 +0000

    Remove unnecessary function declaration for child_exit()
    
    Add comments to child_exit() which had no comments at all
    
    Modify child_exit() so that it sends terminate mesagges before
    exiting. This will prevent backend process from being idle
    waiting for TCP keepalive event occurs.
    This is not good since a backend process may hold locking on
    certain tables.


child.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/child.c b/child.c index d83e909bc..fdc2cac86 100644 --- a/child.c +++ b/child.c @@ -57,8 +57,6 @@ #include "pool_ip.h" #include "md5.h" -void child_exit(int code); - static POOL_CONNECTION *do_accept(int unix_fd, int inet_fd, struct timeval *timeout); static StartupPacket *read_startup_packet(POOL_CONNECTION *cp); static POOL_CONNECTION_POOL *connect_backend(StartupPacket *sp, POOL_CONNECTION *frontend); @@ -1287,8 +1285,9 @@ static RETSIGTYPE authentication_timeout(int sig) } /* - * send frontend exiting messages to all connections. - * this is called when child life time expires or child max connections expires. + * send frontend exiting messages to all connections. this is called + * in any case when child process exits, for example failover, child + * life time expires or child max connections expires. */ static void send_frontend_exits(void) { @@ -1354,11 +1353,16 @@ void pool_free_startup_packet(StartupPacket *sp) } } +/* + * Do house keeping works when pgpool child process exits + */ void child_exit(int code) { + /* count down global connection counter */ if (accepted) connection_count_down(); + /* prepare to shutdown connections to system db */ if(pool_config->parallel_mode || pool_config->enable_query_cache) { if (system_db_info->pgconn) @@ -1366,6 +1370,10 @@ void child_exit(int code) if (pool_system_db_connection()) pool_close(pool_system_db_connection()->con); } + + /* let backend know now we are exiting */ + send_frontend_exits(); + exit(code); } [parent: 7ab8cea9c790]