Remove IF EXISTS from cleanup on failure test for subscription object (#6547)

Nothing critical. Just improving a DROP SUBSCRIPTION test for a cleanup
after failure scenario.
pull/6551/head
Ahmet Gedemenli 2022-12-07 17:51:36 +03:00 committed by GitHub
parent 7499c3073d
commit 3cc5d9842a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 8 deletions

View File

@ -316,15 +316,18 @@ SELECT citus.mitmproxy('conn.allow()');
(1 row)
-- first, manually drop the subscsription object. But the record for it will remain on pg_dist_cleanup
SELECT run_command_on_workers($$DROP SUBSCRIPTION IF EXISTS citus_shard_move_subscription_xxxxxxx_xxxxxxx$$);
run_command_on_workers
-- we expect the drop query will succeed on only one node
SELECT COUNT(*)
FROM run_command_on_workers(
$$DROP SUBSCRIPTION citus_shard_move_subscription_xxxxxxx_xxxxxxx$$)
WHERE success AND result = 'DROP SUBSCRIPTION';
count
---------------------------------------------------------------------
(localhost,9060,t,"DROP SUBSCRIPTION")
(localhost,57637,t,"DROP SUBSCRIPTION")
(2 rows)
1
(1 row)
-- cleanup leftovers
-- verify we don't see any error for already dropped subscription
-- then, verify we don't see any error for already dropped subscription
SET client_min_messages TO WARNING;
CALL citus_cleanup_orphaned_resources();
RESET client_min_messages;

View File

@ -131,9 +131,14 @@ SELECT master_move_shard_placement(101, 'localhost', :worker_1_port, 'localhost'
SELECT citus.mitmproxy('conn.allow()');
-- first, manually drop the subscsription object. But the record for it will remain on pg_dist_cleanup
SELECT run_command_on_workers($$DROP SUBSCRIPTION IF EXISTS citus_shard_move_subscription_10_15$$);
-- we expect the drop query will succeed on only one node
SELECT COUNT(*)
FROM run_command_on_workers(
$$DROP SUBSCRIPTION citus_shard_move_subscription_10_15$$)
WHERE success AND result = 'DROP SUBSCRIPTION';
-- cleanup leftovers
-- verify we don't see any error for already dropped subscription
-- then, verify we don't see any error for already dropped subscription
SET client_min_messages TO WARNING;
CALL citus_cleanup_orphaned_resources();
RESET client_min_messages;