[pgpool-committers: 8649] pgpool: Fix internal transaction handling bug in snapshot isolation mod

Tatsuo Ishii ishii at sraoss.co.jp
Tue May 31 20:10:54 JST 2022


Fix internal transaction handling bug in snapshot isolation mode.

When SELECT is executed in snapshot isolation mode, it is surrounded
in an "internal transaction".  For example if there are 3 backends,
each backend starts an internal transaction with "BEGIN" command.
However, there was an oversight in end_internal_transaction(), which
is responsible for closing the transaction. It only closed the
transaction on "load balance node". This causes a problem with certain
query following SELECT, for example VACUUM. Suppose the SELECT is
executed on backend node 2, then transaction on node 0 and node 1 were
not closed. If VACUUM is executed on node 0, it fails because the
transaction is not closed on node 0 (remember, VACUUM cannot be
executed in an explicit transaction).

Also add a test case for this to the 030.snapshot_isolation test.

Branch
------
V4_2_STABLE

Details
-------
https://git.postgresql.org/gitweb?p=pgpool2.git;a=commitdiff;h=102517e30022162b111633510f849a49d1c53e0f

Modified Files
--------------
src/protocol/pool_process_query.c                  | 45 +++++++++++++++++++---
.../tests/030.snapshot_isolation/expected.txt      |  6 +++
.../tests/030.snapshot_isolation/test.sh           | 14 +++++++
3 files changed, 59 insertions(+), 6 deletions(-)



More information about the pgpool-committers mailing list