| From: | Tatsuo Ishii <ishii(at)postgresql(dot)org> |
|---|---|
| To: | pgpool-committers(at)lists(dot)postgresql(dot)org |
| Subject: | pgpool: Revert "Fix do_query to send sync rather than flush." |
| Date: | 2026-09-06 22:56:33 |
| Message-ID: | E1x3Lmq-00000000x7W-0jfC@gothos.postgresql.org |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgpool-committers |
Revert "Fix do_query to send sync rather than flush."
This reverts commit 1e6eb4e5bb3a2208a88dac8df0ad437fd17f819d.
This breaks implicit transaction behavior created by a pipeline.
-----------------------------------------------------------------
$ psql -p 11000 -a -f failure.sql test
DROP TABLE test;
DROP TABLE
-- start a pipeline
\startpipeline
-- CREATE a table
CREATE TABLE test(i int);
-- SELECT non-existent table, which raises an error,
-- and aborts the implicit transaction started by the pipeline.
SELECT * from a;
-- Recover from the error and closes the implicit transaction.
\syncpipeline
\endpipeline
CREATE TABLE
psql:failure.sql:11: ERROR: relation "a" does not exist
LINE 1: SELECT * from a;
^
-- Try to SELECT the table created in the previous pipeline.
-- This should fail because the creation of the table "test" was rollbacked.
SELECT * from test;
i
---
(0 rows)
-----------------------------------------------------------------
In this example, a table named "test" is created in a pipeline. Then
a SELECT is executed. Because the SELECT tries to retrieve rows from
non-existent table "a", it causes an error and a roll back of the
implicit transaction started by the pipeline. As a result, the table
"test" created in the pipeline does not exist at the end of the
pipeline. However, a "sync" message was issued by do_query() while
obtaining information regarding table "a". As the sync message caused
commit of the implicit transaction started by the pipeline, creation
of "test" was not roll backed by the subsequent erroneous SELECT.
IMO this is a serious data consistency issue because it breaks the
transaction semantics. If I directly connects to PostgreSQL or pgpool
by the previous commit, and run the script, it ends up with:
SELECT * from test;
psql:failure.sql:14: ERROR: relation "test" does not exist
LINE 1: SELECT * from test;
^
which is the expected behavior.
Discussion: https://www.postgresql.org/message-id/20260907.062521.1780975513572548706.ishii@postgresql.org
Backpatch-through: v4.3
Branch
------
V4_3_STABLE
Details
-------
https://git.postgresql.org/gitweb?p=pgpool2.git;a=commitdiff;h=bcc925f50579959c1830f42d80700d734df4d841
Modified Files
--------------
src/protocol/pool_process_query.c | 22 ++++++++++++----------
1 file changed, 12 insertions(+), 10 deletions(-)
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Tatsuo Ishii | 2026-09-06 22:56:37 | pgpool: Revert "Fix do_query to send sync rather than flush." |
| Previous Message | Tatsuo Ishii | 2026-08-31 06:15:03 | pgpool: Down grade debug log to DEBUG5 in get_health_check_stats(). |