[pgpool-committers: 4396] pgpool: Fix bug reported in bug370.

Tatsuo Ishii ishii at postgresql.org
Tue Dec 12 16:24:16 JST 2017

Fix bug reported in bug370.

If an erroneous query is sent to primary and the next query requires a
catalog cache look up, Pgpool-II hangs in do_query().  do_query()
calls pool_push_pending_data() which expects response from backend
because it internally send CLOSE message and flush message. In normal
cases this guarantees some response from backend at least. However
since the backend is in error state, any command including CLOSE sent
by pool_push_pending_data() is ignored.

This only happens if the erroneous query is sent to primary and
without a sync message next query is sent *and* the query requires
catalog cache look up.

Fix is, let pool_push_pending_data() detect an error message and set
ignore_till_sync flag. This will let do_query() just pops the data
pushed in pool_push_pending_data(). pool_search_relcache(), caller of
do_query(), in turn checks the flag. If the flag is set, do not cache
the result. The caller of pool_search_relcache(), pool_select_walker()
may get wrong result, which may let where_to_send() (caller of
pool_select_walker) choose wrong db node, but this is harmless because
ignore_till_sync flag is set.



Modified Files
src/protocol/pool_process_query.c | 28 +++++++++++++++++++++++++++-
src/utils/pool_relcache.c         |  4 ++--
2 files changed, 29 insertions(+), 3 deletions(-)

More information about the pgpool-committers mailing list