Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix flakyness in citus_split_shard_by_split_points_deferred_drop #6819

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ SET citus.next_placement_id TO 8610000;
SET citus.shard_count TO 2;
SET citus.shard_replication_factor TO 1;
SET citus.next_operation_id TO 777;
SET citus.next_cleanup_record_id TO 511;
ALTER SEQUENCE pg_catalog.pg_dist_cleanup_recordid_seq RESTART 511;
SET ROLE test_split_role;
SET search_path TO "citus_split_shard_by_split_points_deferred_schema";
CREATE TABLE table_to_split(id int PRIMARY KEY, int_data int, data text);
Expand Down Expand Up @@ -64,10 +64,10 @@ SELECT pg_catalog.citus_split_shard_by_split_points(

-- The original shard is marked for deferred drop with policy_type = 2.
-- The previous shard should be dropped at the beginning of the second split call
SELECT * from pg_dist_cleanup;
SELECT * FROM pg_dist_cleanup WHERE policy_type = 2;
record_id | operation_id | object_type | object_name | node_group_id | policy_type
---------------------------------------------------------------------
512 | 778 | 1 | citus_split_shard_by_split_points_deferred_schema.table_to_split_8981001 | 16 | 2
526 | 778 | 1 | citus_split_shard_by_split_points_deferred_schema.table_to_split_8981001 | 16 | 2
(1 row)

-- One of the physical shards should not be deleted, the other one should.
Expand All @@ -90,8 +90,12 @@ SELECT relname FROM pg_class where relname LIKE '%table_to_split_%' AND relkind

-- Perform deferred drop cleanup.
\c - postgres - :master_port
CALL citus_cleanup_orphaned_resources();
NOTICE: cleaned up 1 orphaned resources
SELECT public.wait_for_resource_cleanup();
wait_for_resource_cleanup
---------------------------------------------------------------------

(1 row)

-- Clenaup has been done.
SELECT * from pg_dist_cleanup;
record_id | operation_id | object_type | object_name | node_group_id | policy_type
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ SET citus.next_placement_id TO 8610000;
SET citus.shard_count TO 2;
SET citus.shard_replication_factor TO 1;
SET citus.next_operation_id TO 777;
SET citus.next_cleanup_record_id TO 511;
ALTER SEQUENCE pg_catalog.pg_dist_cleanup_recordid_seq RESTART 511;
SET ROLE test_split_role;
SET search_path TO "citus_split_shard_by_split_points_deferred_schema";

Expand All @@ -51,7 +51,7 @@ SELECT pg_catalog.citus_split_shard_by_split_points(

-- The original shard is marked for deferred drop with policy_type = 2.
-- The previous shard should be dropped at the beginning of the second split call
SELECT * from pg_dist_cleanup;
SELECT * FROM pg_dist_cleanup WHERE policy_type = 2;

-- One of the physical shards should not be deleted, the other one should.
\c - - - :worker_1_port
Expand All @@ -62,7 +62,7 @@ SELECT relname FROM pg_class where relname LIKE '%table_to_split_%' AND relkind

-- Perform deferred drop cleanup.
\c - postgres - :master_port
CALL citus_cleanup_orphaned_resources();
SELECT public.wait_for_resource_cleanup();

-- Clenaup has been done.
SELECT * from pg_dist_cleanup;
Expand Down