[pgpool-general: 3679] Re: How to terminate pgpool process ?

Tatsuo Ishii ishii at postgresql.org
Mon May 4 19:29:58 JST 2015


> Hi Team,
> 
> Am using pgpool version 3.3.3 with load-balancing feature.
> 
> My question is, during month end, users are executing long running queries
> via pgpool and those queries are running on Slave node(which is good).
> Sometimes we
> get request from same user to stop those queries, in such cases we cannot
> stop those queries using pg_cancel_backend()

Why you cannot use pg_cancel_backend()? You can directly connect to
the PostgreSQL backend and by using pg_stat_activity to get the
process id of the backend which runs the user's query. Then you can
issue "select pg_cancel_backend(pid)" to cancel the query.

> and we are forced to terminate
> those
> those session using pg_termiante_backend. But this is also not recommended
> because
> as per doc's pg_terminate_backend is not honoured by pgpool.

Yes, PostgreSQL returns the same error code as the one when PostgreSQL
shuts down. Thus pgpool-II detaches the PostgreSQL server because it
thinks the PostgreSQL is going down.

> We also noticed on terminating pgpool session using pg_terminate_backend
> pgpool
> becomes unresponsive and there will change in status_node as below.
> 
> node_id |    hostname    | port | status | lb_weight |  role
> ---------+----------------+------+--------+-----------+---------
> 0       | 192.168.20.103 | 5444 | 3      | 0.500000  | standby
> 1       | 192.168.20.104 | 5444 | 2      | 0.500000  | standby

You didn't tell us which backend you sent pg_terminate_backend to but
I guess node 0 is the one and apparently it was detached since the
status is 3.

> So,my question here, is there a way to terminate the pgpool processes ?

What you need to do is, not killing the pgpool process but canceling
the query by using pg_cancel_backend().

Best regards,
--
Tatsuo Ishii
SRA OSS, Inc. Japan
English: http://www.sraoss.co.jp/index_en.php
Japanese:http://www.sraoss.co.jp


More information about the pgpool-general mailing list