diff options
author | Michael Paquier | 2024-04-29 12:10:41 +0000 |
---|---|---|
committer | Michael Paquier | 2024-04-29 12:10:41 +0000 |
commit | 7e61e4cc7cfcf2a34f063094aeab01fdba7b65f6 (patch) | |
tree | 48d53551f0c095360b656d7eaeb9abe20e9ddece /src/interfaces/ecpg/test | |
parent | 3c184092651b0b15ca1207c154ab3fd055e1e9fe (diff) |
Make two-phase tests of ECPG and main suite more concurrent-proof
The ECPG and main 2PC tests have been using rather-generic names for the
prepared transactions they generate. This commit switches the 2PC
transactions to use more complex GIDs, reducing the risk of naming
conflicts.
The main 2PC tests also include scans of pg_prepared_xacts that do not
apply filters on the GID of the prepared transactions, making it
possible to fail the test when any 2PC transaction runs concurrently.
The CI has been able to see such failures with an installcheck
running the ECPG and the main regression test suites in parallel. The
queries on pg_prepared_xacts gain quals to only look after the GIDs
generated locally.
The race is very hard to reproduce, so no backbatch is done for now.
Reported-by: Richard Guo
Discussion: https://postgr.es/m/CAMbWs4-mWCGbbE_bne5=AfqjYGDaUZmjCw2+soLjrdNA0xUDFw@mail.gmail.com
Diffstat (limited to 'src/interfaces/ecpg/test')
-rw-r--r-- | src/interfaces/ecpg/test/expected/sql-twophase.c | 4 | ||||
-rw-r--r-- | src/interfaces/ecpg/test/expected/sql-twophase.stderr | 4 | ||||
-rw-r--r-- | src/interfaces/ecpg/test/sql/twophase.pgc | 4 |
3 files changed, 6 insertions, 6 deletions
diff --git a/src/interfaces/ecpg/test/expected/sql-twophase.c b/src/interfaces/ecpg/test/expected/sql-twophase.c index 20b54d35e56..1e825257122 100644 --- a/src/interfaces/ecpg/test/expected/sql-twophase.c +++ b/src/interfaces/ecpg/test/expected/sql-twophase.c @@ -79,7 +79,7 @@ if (sqlca.sqlcode < 0) sqlprint();} strcpy(msg, "prepare transaction"); - { ECPGtrans(__LINE__, NULL, "prepare transaction 'gxid'"); + { ECPGtrans(__LINE__, NULL, "prepare transaction 'ecpg_twophase'"); #line 32 "twophase.pgc" if (sqlca.sqlcode < 0) sqlprint();} @@ -87,7 +87,7 @@ if (sqlca.sqlcode < 0) sqlprint();} strcpy(msg, "commit prepared"); - { ECPGtrans(__LINE__, NULL, "commit prepared 'gxid'"); + { ECPGtrans(__LINE__, NULL, "commit prepared 'ecpg_twophase'"); #line 35 "twophase.pgc" if (sqlca.sqlcode < 0) sqlprint();} diff --git a/src/interfaces/ecpg/test/expected/sql-twophase.stderr b/src/interfaces/ecpg/test/expected/sql-twophase.stderr index 18415ff5a3d..7d19ac3cbf2 100644 --- a/src/interfaces/ecpg/test/expected/sql-twophase.stderr +++ b/src/interfaces/ecpg/test/expected/sql-twophase.stderr @@ -20,9 +20,9 @@ [NO_PID]: sqlca: code: 0, state: 00000 [NO_PID]: ecpg_process_output on line 29: OK: INSERT 0 1 [NO_PID]: sqlca: code: 0, state: 00000 -[NO_PID]: ECPGtrans on line 32: action "prepare transaction 'gxid'"; connection "ecpg1_regression" +[NO_PID]: ECPGtrans on line 32: action "prepare transaction 'ecpg_twophase'"; connection "ecpg1_regression" [NO_PID]: sqlca: code: 0, state: 00000 -[NO_PID]: ECPGtrans on line 35: action "commit prepared 'gxid'"; connection "ecpg1_regression" +[NO_PID]: ECPGtrans on line 35: action "commit prepared 'ecpg_twophase'"; connection "ecpg1_regression" [NO_PID]: sqlca: code: 0, state: 00000 [NO_PID]: ecpg_execute on line 38: query: drop table t1; with 0 parameter(s) on connection ecpg1_regression [NO_PID]: sqlca: code: 0, state: 00000 diff --git a/src/interfaces/ecpg/test/sql/twophase.pgc b/src/interfaces/ecpg/test/sql/twophase.pgc index 38913d7af2d..13106ffc638 100644 --- a/src/interfaces/ecpg/test/sql/twophase.pgc +++ b/src/interfaces/ecpg/test/sql/twophase.pgc @@ -29,10 +29,10 @@ int main(void) exec sql insert into t1 values(1); strcpy(msg, "prepare transaction"); - exec sql prepare transaction 'gxid'; + exec sql prepare transaction 'ecpg_twophase'; strcpy(msg, "commit prepared"); - exec sql commit prepared 'gxid'; + exec sql commit prepared 'ecpg_twophase'; strcpy(msg, "drop"); exec sql drop table t1; |