From 59aaed3e5cebc1306eeef7a9922f795249ffb837 Mon Sep 17 00:00:00 2001 From: Nitish Upreti Date: Sat, 27 Aug 2022 21:23:17 -0700 Subject: [PATCH] Fix failing tests --- .../distributed/sql/citus--11.0-4--11.1-1.sql | 2 +- .../expected/failure_tenant_isolation.out | 16 ++++++++++++++++ .../expected/multi_colocated_shard_rebalance.out | 2 +- src/test/regress/expected/multi_extension.out | 5 ++++- .../regress/sql/failure_tenant_isolation.sql | 7 +++++++ 5 files changed, 29 insertions(+), 3 deletions(-) diff --git a/src/backend/distributed/sql/citus--11.0-4--11.1-1.sql b/src/backend/distributed/sql/citus--11.0-4--11.1-1.sql index 24b08f2f0..3e6489999 100644 --- a/src/backend/distributed/sql/citus--11.0-4--11.1-1.sql +++ b/src/backend/distributed/sql/citus--11.0-4--11.1-1.sql @@ -95,7 +95,7 @@ GRANT SELECT ON pg_catalog.pg_dist_cleanup TO public; -- Sequence used to generate an operation ID for use in pg_dist_cleanup_record. -- Right now, move is hardcoded to 1 (this will change with parallel moves), so -- start with a higher number. -CREATE SEQUENCE citus.pg_dist_operationid_seq MINVALUE 101; +CREATE SEQUENCE citus.pg_dist_operationid_seq; ALTER SEQUENCE citus.pg_dist_operationid_seq SET SCHEMA pg_catalog; CREATE SEQUENCE citus.pg_dist_cleanup_recordid_seq; diff --git a/src/test/regress/expected/failure_tenant_isolation.out b/src/test/regress/expected/failure_tenant_isolation.out index 6b7fde064..c5b71c890 100644 --- a/src/test/regress/expected/failure_tenant_isolation.out +++ b/src/test/regress/expected/failure_tenant_isolation.out @@ -160,6 +160,14 @@ SELECT citus.mitmproxy('conn.onQuery(query="ALTER TABLE tenant_isolation.table_1 SELECT isolate_tenant_to_new_shard('table_1', 5, 'CASCADE', shard_transfer_mode => 'block_writes'); ERROR: canceling statement due to user request -- failure on dropping old colocated shard +-- Disable deferred drop otherwise we will skip the drop and operation will succeed instead of failing. +ALTER SYSTEM SET citus.defer_drop_after_shard_split TO false; +SELECT pg_reload_conf(); + pg_reload_conf +--------------------------------------------------------------------- + t +(1 row) + SELECT citus.mitmproxy('conn.onQuery(query="DROP TABLE IF EXISTS tenant_isolation.table_2").kill()'); mitmproxy --------------------------------------------------------------------- @@ -197,6 +205,14 @@ SELECT citus.mitmproxy('conn.onQuery(query="DROP TABLE IF EXISTS tenant_isolatio SELECT isolate_tenant_to_new_shard('table_1', 5, 'CASCADE', shard_transfer_mode => 'block_writes'); ERROR: canceling statement due to user request +-- Re-enable deferred drop for rest of the tests. +ALTER SYSTEM SET citus.defer_drop_after_shard_split TO true; +SELECT pg_reload_conf(); + pg_reload_conf +--------------------------------------------------------------------- + t +(1 row) + -- failure on foreign key creation SELECT citus.mitmproxy('conn.onQuery(query="ADD CONSTRAINT table_2_ref_id_fkey FOREIGN KEY").kill()'); mitmproxy diff --git a/src/test/regress/expected/multi_colocated_shard_rebalance.out b/src/test/regress/expected/multi_colocated_shard_rebalance.out index 68b8925ed..3730d9a06 100644 --- a/src/test/regress/expected/multi_colocated_shard_rebalance.out +++ b/src/test/regress/expected/multi_colocated_shard_rebalance.out @@ -724,7 +724,7 @@ DETAIL: from localhost:xxxxx (1 row) CALL citus_cleanup_orphaned_shards(); -LOG: dropping shard placement xxxxx of shard xxxxx on localhost:xxxxx after it was moved away +LOG: dropping shard public.test_with_pkey_13000042 for move on localhost:xxxxx NOTICE: cleaned up 1 orphaned shards SET client_min_messages TO DEFAULT; -- we don't support multiple shard moves in a single transaction diff --git a/src/test/regress/expected/multi_extension.out b/src/test/regress/expected/multi_extension.out index a0791472b..f0e061d1e 100644 --- a/src/test/regress/expected/multi_extension.out +++ b/src/test/regress/expected/multi_extension.out @@ -1135,11 +1135,14 @@ SELECT * FROM multi_extension.print_extension_changes(); | function worker_copy_table_to_node(regclass,integer) void | function worker_split_copy(bigint,split_copy_info[]) void | function worker_split_shard_replication_setup(split_shard_info[]) SETOF replication_slot_info + | sequence pg_dist_cleanup_recordid_seq + | sequence pg_dist_operationid_seq + | table pg_dist_cleanup | type replication_slot_info | type split_copy_info | type split_shard_info | view citus_locks -(34 rows) +(37 rows) DROP TABLE multi_extension.prev_objects, multi_extension.extension_diff; -- show running version diff --git a/src/test/regress/sql/failure_tenant_isolation.sql b/src/test/regress/sql/failure_tenant_isolation.sql index 00a75bc58..22a32448c 100644 --- a/src/test/regress/sql/failure_tenant_isolation.sql +++ b/src/test/regress/sql/failure_tenant_isolation.sql @@ -88,6 +88,10 @@ SELECT isolate_tenant_to_new_shard('table_1', 5, 'CASCADE', shard_transfer_mode -- failure on dropping old colocated shard +-- Disable deferred drop otherwise we will skip the drop and operation will succeed instead of failing. +ALTER SYSTEM SET citus.defer_drop_after_shard_split TO false; +SELECT pg_reload_conf(); + SELECT citus.mitmproxy('conn.onQuery(query="DROP TABLE IF EXISTS tenant_isolation.table_2").kill()'); SELECT isolate_tenant_to_new_shard('table_1', 5, 'CASCADE', shard_transfer_mode => 'block_writes'); @@ -103,6 +107,9 @@ SELECT isolate_tenant_to_new_shard('table_1', 5, 'CASCADE', shard_transfer_mode SELECT citus.mitmproxy('conn.onQuery(query="DROP TABLE IF EXISTS tenant_isolation.table_1").cancel(' || :pid || ')'); SELECT isolate_tenant_to_new_shard('table_1', 5, 'CASCADE', shard_transfer_mode => 'block_writes'); +-- Re-enable deferred drop for rest of the tests. +ALTER SYSTEM SET citus.defer_drop_after_shard_split TO true; +SELECT pg_reload_conf(); -- failure on foreign key creation SELECT citus.mitmproxy('conn.onQuery(query="ADD CONSTRAINT table_2_ref_id_fkey FOREIGN KEY").kill()');