diff --git a/src/test/regress/expected/failure_create_distributed_table_non_empty.out b/src/test/regress/expected/failure_create_distributed_table_non_empty.out index 3de2cd874..13f6cdffa 100644 --- a/src/test/regress/expected/failure_create_distributed_table_non_empty.out +++ b/src/test/regress/expected/failure_create_distributed_table_non_empty.out @@ -872,6 +872,18 @@ SELECT count(*) FROM pg_dist_shard WHERE logicalrelid='create_distributed_table_ 4 (1 row) +SELECT citus.mitmproxy('conn.allow()'); + mitmproxy +--------------------------------------------------------------------- + +(1 row) + +SELECT recover_prepared_transactions(); + recover_prepared_transactions +--------------------------------------------------------------------- + 2 +(1 row) + DROP TABLE test_table; CREATE TABLE test_table(id int, value_1 int); INSERT INTO test_table VALUES (1,1),(2,2),(3,3),(4,4); diff --git a/src/test/regress/expected/failure_create_table.out b/src/test/regress/expected/failure_create_table.out index e37060735..14b3daa66 100644 --- a/src/test/regress/expected/failure_create_table.out +++ b/src/test/regress/expected/failure_create_table.out @@ -289,6 +289,12 @@ SELECT citus.mitmproxy('conn.allow()'); (1 row) +SELECT recover_prepared_transactions(); + recover_prepared_transactions +--------------------------------------------------------------------- + 1 +(1 row) + SELECT count(*) FROM pg_dist_shard; count --------------------------------------------------------------------- @@ -421,7 +427,7 @@ COMMIT; SELECT recover_prepared_transactions(); recover_prepared_transactions --------------------------------------------------------------------- - 4 + 0 (1 row) SELECT citus.mitmproxy('conn.allow()'); diff --git a/src/test/regress/expected/failure_single_select.out b/src/test/regress/expected/failure_single_select.out index c7ee9d9d1..4cfa1252b 100644 --- a/src/test/regress/expected/failure_single_select.out +++ b/src/test/regress/expected/failure_single_select.out @@ -12,6 +12,8 @@ SELECT citus.clear_network_traffic(); SET citus.shard_count = 2; SET citus.shard_replication_factor = 2; +-- this test is designed such that no modification lock is acquired +SET citus.allow_modifications_from_workers_to_replicated_tables TO false; CREATE TABLE select_test (key int, value text); SELECT create_distributed_table('select_test', 'key'); create_distributed_table @@ -60,6 +62,12 @@ ERROR: connection to the remote node localhost:xxxxx failed with the following This probably means the server terminated abnormally before or while processing the request. COMMIT; +SELECT citus.mitmproxy('conn.allow()'); + mitmproxy +--------------------------------------------------------------------- + +(1 row) + TRUNCATE select_test; -- now the same tests with query cancellation -- put data in shard for which mitm node is first placement @@ -96,6 +104,12 @@ WHERE shardid IN ( 1 (1 row) +SELECT citus.mitmproxy('conn.allow()'); + mitmproxy +--------------------------------------------------------------------- + +(1 row) + TRUNCATE select_test; -- cancel the second query -- error after second SELECT; txn should fail diff --git a/src/test/regress/failure_schedule b/src/test/regress/failure_schedule index 550544a7f..18a45fd26 100644 --- a/src/test/regress/failure_schedule +++ b/src/test/regress/failure_schedule @@ -16,12 +16,9 @@ test: failure_add_disable_node test: failure_copy_to_reference test: failure_copy_on_hash test: failure_create_reference_table -test: check_mx -test: turn_mx_off test: failure_create_distributed_table_non_empty test: failure_create_table test: failure_single_select -test: turn_mx_on test: failure_multi_shard_update_delete test: failure_cte_subquery diff --git a/src/test/regress/sql/failure_create_distributed_table_non_empty.sql b/src/test/regress/sql/failure_create_distributed_table_non_empty.sql index 21350aee5..29dc7a2d7 100644 --- a/src/test/regress/sql/failure_create_distributed_table_non_empty.sql +++ b/src/test/regress/sql/failure_create_distributed_table_non_empty.sql @@ -304,6 +304,10 @@ BEGIN; SELECT create_distributed_table('test_table', 'id'); COMMIT; SELECT count(*) FROM pg_dist_shard WHERE logicalrelid='create_distributed_table_non_empty_failure.test_table'::regclass; + +SELECT citus.mitmproxy('conn.allow()'); +SELECT recover_prepared_transactions(); + DROP TABLE test_table; CREATE TABLE test_table(id int, value_1 int); INSERT INTO test_table VALUES (1,1),(2,2),(3,3),(4,4); @@ -314,7 +318,9 @@ SELECT citus.mitmproxy('conn.onQuery(query="^COMMIT").cancel(' || pg_backend_pi BEGIN; SELECT create_distributed_table('test_table', 'id'); COMMIT; + SELECT citus.mitmproxy('conn.allow()'); + SELECT count(*) FROM pg_dist_shard WHERE logicalrelid='create_distributed_table_non_empty_failure.test_table'::regclass; DROP TABLE test_table; CREATE TABLE test_table(id int, value_1 int); diff --git a/src/test/regress/sql/failure_create_table.sql b/src/test/regress/sql/failure_create_table.sql index c10c16c30..a4035b431 100644 --- a/src/test/regress/sql/failure_create_table.sql +++ b/src/test/regress/sql/failure_create_table.sql @@ -99,6 +99,7 @@ SELECT citus.mitmproxy('conn.onCommandComplete(command="PREPARE TRANSACTION").ki SELECT create_distributed_table('test_table','id',colocate_with=>'temp_table'); SELECT citus.mitmproxy('conn.allow()'); +SELECT recover_prepared_transactions(); SELECT count(*) FROM pg_dist_shard; SELECT run_command_on_workers($$SELECT count(*) FROM information_schema.tables WHERE table_schema = 'failure_create_table' and table_name LIKE 'test_table%' ORDER BY 1$$); diff --git a/src/test/regress/sql/failure_single_select.sql b/src/test/regress/sql/failure_single_select.sql index f39677e1e..9a4a82d12 100644 --- a/src/test/regress/sql/failure_single_select.sql +++ b/src/test/regress/sql/failure_single_select.sql @@ -4,6 +4,9 @@ SELECT citus.clear_network_traffic(); SET citus.shard_count = 2; SET citus.shard_replication_factor = 2; +-- this test is designed such that no modification lock is acquired +SET citus.allow_modifications_from_workers_to_replicated_tables TO false; + CREATE TABLE select_test (key int, value text); SELECT create_distributed_table('select_test', 'key'); @@ -23,6 +26,8 @@ INSERT INTO select_test VALUES (3, 'more data'); SELECT * FROM select_test WHERE key = 3; COMMIT; +SELECT citus.mitmproxy('conn.allow()'); + TRUNCATE select_test; -- now the same tests with query cancellation @@ -47,6 +52,8 @@ SELECT DISTINCT shardstate FROM pg_dist_shard_placement WHERE shardid IN ( SELECT shardid FROM pg_dist_shard WHERE logicalrelid = 'select_test'::regclass ); + +SELECT citus.mitmproxy('conn.allow()'); TRUNCATE select_test; -- cancel the second query