diff --git a/tsl/test/expected/remote_txn.out b/tsl/test/expected/remote_txn.out index abbdb94c7bb..d6bd919eee1 100644 --- a/tsl/test/expected/remote_txn.out +++ b/tsl/test/expected/remote_txn.out @@ -623,8 +623,14 @@ SELECT count(*) FROM pg_prepared_xacts; 0 (1 row) ---below will fail the abort and thus ROLLBACK TRANSACTION will never be called leaving ---a prepared_xact that should be rolled back by heal server +-- Below will fail the abort and thus ROLLBACK TRANSACTION will never +-- be called leaving a prepared_xact that should be rolled back by +-- heal server. +-- +-- We set min message level to "error" since different warnings can be +-- generated due to timing issues but check that the transaction was +-- rolled back after the commit. +SET client_min_messages TO error; BEGIN; SELECT remote_node_killer_set_event('pre-abort', 'loopback'); remote_node_killer_set_event @@ -633,25 +639,20 @@ BEGIN; (1 row) SELECT test.remote_exec('{loopback}', $$ INSERT INTO "S 1"."T 1" VALUES (10011,1,'bleh', '2001-01-01', '2001-01-01', 'bleh') $$); -NOTICE: [loopback]: INSERT INTO "S 1"."T 1" VALUES (10011,1,'bleh', '2001-01-01', '2001-01-01', 'bleh') remote_exec ------------- (1 row) SELECT test.remote_exec('{loopback2}', $$ INSERT INTO "S 1"."T 1" VALUES (10001,1,'bleh', '2001-01-01', '2001-01-01', 'bleh') $$); -NOTICE: [loopback2]: INSERT INTO "S 1"."T 1" VALUES (10001,1,'bleh', '2001-01-01', '2001-01-01', 'bleh') remote_exec ------------- (1 row) COMMIT; -WARNING: kill event: pre-abort -WARNING: [loopback]: terminating connection due to administrator command -WARNING: [loopback]: SSL connection has been closed unexpectedly -WARNING: failure aborting remote transaction during local abort ERROR: [loopback2]: duplicate key value violates unique constraint "t1_pkey" +RESET client_min_messages; SELECT count(*) FROM "S 1"."T 1" WHERE "C 1" = 10011; count ------- @@ -734,7 +735,12 @@ SELECT count(*) FROM pg_prepared_xacts; 0 (1 row) ---test comm error in subtrans abort +-- Test comm error in subtrans abort +-- +-- We set min message level to "error" since different warnings can be +-- generated due to timing issues but check that the transaction was +-- rolled back after the commit. +SET client_min_messages TO error; BEGIN; SELECT remote_node_killer_set_event('subxact-abort', 'loopback'); remote_node_killer_set_event @@ -743,14 +749,12 @@ BEGIN; (1 row) SELECT test.remote_exec('{loopback}', $$ INSERT INTO "S 1"."T 1" VALUES (10017,1,'bleh', '2001-01-01', '2001-01-01', 'bleh') $$); -NOTICE: [loopback]: INSERT INTO "S 1"."T 1" VALUES (10017,1,'bleh', '2001-01-01', '2001-01-01', 'bleh') remote_exec ------------- (1 row) SELECT test.remote_exec('{loopback2}', $$ INSERT INTO "S 1"."T 1" VALUES (10018,1,'bleh', '2001-01-01', '2001-01-01', 'bleh') $$); -NOTICE: [loopback2]: INSERT INTO "S 1"."T 1" VALUES (10018,1,'bleh', '2001-01-01', '2001-01-01', 'bleh') remote_exec ------------- @@ -758,21 +762,18 @@ NOTICE: [loopback2]: INSERT INTO "S 1"."T 1" VALUES (10018,1,'bleh', '2001-01- SAVEPOINT save_1; SELECT test.remote_exec('{loopback}', $$ INSERT INTO "S 1"."T 1" VALUES (10001,1,'bleh', '2001-01-01', '2001-01-01', 'bleh') $$); -NOTICE: [loopback]: INSERT INTO "S 1"."T 1" VALUES (10001,1,'bleh', '2001-01-01', '2001-01-01', 'bleh') remote_exec ------------- (1 row) ROLLBACK TO SAVEPOINT save_1; -WARNING: kill event: subxact-abort -WARNING: [loopback]: terminating connection due to administrator command -WARNING: [loopback]: SSL connection has been closed unexpectedly SELECT test.remote_exec('{loopback}', $$ INSERT INTO "S 1"."T 1" VALUES (10019,1,'bleh', '2001-01-01', '2001-01-01', 'bleh') $$); ERROR: connection to data node "loopback" was lost SELECT test.remote_exec('{loopback2}', $$ INSERT INTO "S 1"."T 1" VALUES (10020,1,'bleh', '2001-01-01', '2001-01-01', 'bleh') $$); ERROR: current transaction is aborted, commands ignored until end of transaction block COMMIT; +RESET client_min_messages; SELECT count(*) FROM "S 1"."T 1" WHERE "C 1" > 10016; count ------- diff --git a/tsl/test/sql/remote_txn.sql b/tsl/test/sql/remote_txn.sql index 096933681b0..60b027240b0 100644 --- a/tsl/test/sql/remote_txn.sql +++ b/tsl/test/sql/remote_txn.sql @@ -264,13 +264,21 @@ COMMIT; SELECT count(*) FROM "S 1"."T 1" WHERE "C 1" = 10010; SELECT count(*) FROM pg_prepared_xacts; ---below will fail the abort and thus ROLLBACK TRANSACTION will never be called leaving ---a prepared_xact that should be rolled back by heal server +-- Below will fail the abort and thus ROLLBACK TRANSACTION will never +-- be called leaving a prepared_xact that should be rolled back by +-- heal server. +-- +-- We set min message level to "error" since different warnings can be +-- generated due to timing issues but check that the transaction was +-- rolled back after the commit. +SET client_min_messages TO error; BEGIN; SELECT remote_node_killer_set_event('pre-abort', 'loopback'); SELECT test.remote_exec('{loopback}', $$ INSERT INTO "S 1"."T 1" VALUES (10011,1,'bleh', '2001-01-01', '2001-01-01', 'bleh') $$); SELECT test.remote_exec('{loopback2}', $$ INSERT INTO "S 1"."T 1" VALUES (10001,1,'bleh', '2001-01-01', '2001-01-01', 'bleh') $$); COMMIT; +RESET client_min_messages; + SELECT count(*) FROM "S 1"."T 1" WHERE "C 1" = 10011; SELECT count(*) FROM pg_prepared_xacts; SELECT _timescaledb_internal.remote_txn_heal_data_node((SELECT OID FROM pg_foreign_server WHERE srvname = 'loopback')); @@ -291,7 +299,12 @@ COMMIT; SELECT count(*) FROM "S 1"."T 1" WHERE "C 1" > 10011; SELECT count(*) FROM pg_prepared_xacts; ---test comm error in subtrans abort +-- Test comm error in subtrans abort +-- +-- We set min message level to "error" since different warnings can be +-- generated due to timing issues but check that the transaction was +-- rolled back after the commit. +SET client_min_messages TO error; BEGIN; SELECT remote_node_killer_set_event('subxact-abort', 'loopback'); SELECT test.remote_exec('{loopback}', $$ INSERT INTO "S 1"."T 1" VALUES (10017,1,'bleh', '2001-01-01', '2001-01-01', 'bleh') $$); @@ -302,6 +315,7 @@ BEGIN; SELECT test.remote_exec('{loopback}', $$ INSERT INTO "S 1"."T 1" VALUES (10019,1,'bleh', '2001-01-01', '2001-01-01', 'bleh') $$); SELECT test.remote_exec('{loopback2}', $$ INSERT INTO "S 1"."T 1" VALUES (10020,1,'bleh', '2001-01-01', '2001-01-01', 'bleh') $$); COMMIT; +RESET client_min_messages; SELECT count(*) FROM "S 1"."T 1" WHERE "C 1" > 10016; SELECT count(*) FROM pg_prepared_xacts;