mirror of https://github.com/citusdata/citus.git
Fix flaky citus upgrade test
parent
684b4c6b96
commit
24758c39a1
|
@ -28,3 +28,12 @@ SELECT * FROM pg_dist_cleanup;
|
|||
CALL citus_cleanup_orphaned_resources();
|
||||
NOTICE: cleaned up 1 orphaned resources
|
||||
DROP TABLE table_with_orphaned_shards;
|
||||
-- Re-enable automatic shard cleanup by maintenance daemon as
|
||||
-- we have disabled it in upgrade_pg_dist_cleanup_before.sql
|
||||
ALTER SYSTEM RESET citus.defer_shard_delete_interval;
|
||||
SELECT pg_reload_conf();
|
||||
pg_reload_conf
|
||||
---------------------------------------------------------------------
|
||||
t
|
||||
(1 row)
|
||||
|
||||
|
|
|
@ -30,6 +30,23 @@ SELECT COUNT(*) FROM pg_dist_placement WHERE shardstate = 1 AND shardid IN (SELE
|
|||
(1 row)
|
||||
|
||||
-- create an orphaned placement based on an existing one
|
||||
--
|
||||
-- But before doing that, first disable automatic shard cleanup
|
||||
-- by maintenance daemon so that we can reliably test the cleanup
|
||||
-- in upgrade_pg_dist_cleanup_after.sql.
|
||||
ALTER SYSTEM SET citus.defer_shard_delete_interval TO -1;
|
||||
SELECT pg_reload_conf();
|
||||
pg_reload_conf
|
||||
---------------------------------------------------------------------
|
||||
t
|
||||
(1 row)
|
||||
|
||||
SELECT pg_sleep(0.1);
|
||||
pg_sleep
|
||||
---------------------------------------------------------------------
|
||||
|
||||
(1 row)
|
||||
|
||||
INSERT INTO pg_dist_placement(placementid, shardid, shardstate, shardlength, groupid)
|
||||
SELECT nextval('pg_dist_placement_placementid_seq'::regclass), shardid, 4, shardlength, 3-groupid
|
||||
FROM pg_dist_placement
|
||||
|
|
|
@ -13,3 +13,8 @@ SELECT COUNT(*) FROM pg_dist_placement WHERE shardid IN (SELECT shardid FROM pg_
|
|||
SELECT * FROM pg_dist_cleanup;
|
||||
CALL citus_cleanup_orphaned_resources();
|
||||
DROP TABLE table_with_orphaned_shards;
|
||||
|
||||
-- Re-enable automatic shard cleanup by maintenance daemon as
|
||||
-- we have disabled it in upgrade_pg_dist_cleanup_before.sql
|
||||
ALTER SYSTEM RESET citus.defer_shard_delete_interval;
|
||||
SELECT pg_reload_conf();
|
||||
|
|
|
@ -16,6 +16,16 @@ SELECT create_distributed_table('table_with_orphaned_shards', 'a');
|
|||
-- show all 32 placements are active
|
||||
SELECT COUNT(*) FROM pg_dist_placement WHERE shardstate = 1 AND shardid IN (SELECT shardid FROM pg_dist_shard WHERE logicalrelid='table_with_orphaned_shards'::regclass);
|
||||
-- create an orphaned placement based on an existing one
|
||||
--
|
||||
-- But before doing that, first disable automatic shard cleanup
|
||||
-- by maintenance daemon so that we can reliably test the cleanup
|
||||
-- in upgrade_pg_dist_cleanup_after.sql.
|
||||
|
||||
ALTER SYSTEM SET citus.defer_shard_delete_interval TO -1;
|
||||
SELECT pg_reload_conf();
|
||||
|
||||
SELECT pg_sleep(0.1);
|
||||
|
||||
INSERT INTO pg_dist_placement(placementid, shardid, shardstate, shardlength, groupid)
|
||||
SELECT nextval('pg_dist_placement_placementid_seq'::regclass), shardid, 4, shardlength, 3-groupid
|
||||
FROM pg_dist_placement
|
||||
|
|
Loading…
Reference in New Issue