mirror of
https://github.com/postgres/postgres.git
synced 2025-08-28 18:48:04 +03:00
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
This commit is contained in:
@@ -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();}
|
||||
|
@@ -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
|
||||
|
@@ -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;
|
||||
|
Reference in New Issue
Block a user