Fix failing tests

niupre/TestDeferredDropAndCleanup
Nitish Upreti 2022-08-27 21:23:17 -07:00
parent 21028434ce
commit 59aaed3e5c
5 changed files with 29 additions and 3 deletions

View File

@ -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;

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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()');