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

Tatsuo Ishii ishii at sraoss.co.jp
Tue May 31 20:07:40 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
------
master

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

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