From e25a1c49be9f3f57d294721f14c31926abda9c6a Mon Sep 17 00:00:00 2001 From: Jelte Fennema Date: Fri, 7 Oct 2022 10:48:43 +0200 Subject: [PATCH] Order parallel move output --- .../isolation_shard_rebalancer_progress.out | 24 ++++++++------- .../isolation_shard_rebalancer_progress.spec | 30 +++++++++++++++++-- 2 files changed, 42 insertions(+), 12 deletions(-) diff --git a/src/test/regress/expected/isolation_shard_rebalancer_progress.out b/src/test/regress/expected/isolation_shard_rebalancer_progress.out index dec65bb92..1d73a23c0 100644 --- a/src/test/regress/expected/isolation_shard_rebalancer_progress.out +++ b/src/test/regress/expected/isolation_shard_rebalancer_progress.out @@ -1012,7 +1012,7 @@ table_name|shardid|shard_size|sourcename|sourceport|source_shard_size|targetname (0 rows) -starting permutation: s2-lock-1-start s1-shard-move-c1-block-writes s4-shard-move-sep-block-writes-without-advisory-locks s7-get-progress s2-unlock-1-start s1-wait s4-commit s7-get-progress +starting permutation: s2-lock-1-start s1-shard-move-c1-block-writes s4-shard-move-sep-block-writes-without-advisory-locks s7-get-progress-ordered s2-unlock-1-start s1-wait s4-commit s7-get-progress-ordered master_set_node_property --------------------------------------------------------------------- @@ -1031,7 +1031,7 @@ step s4-shard-move-sep-block-writes-without-advisory-locks: SET LOCAL citus.running_under_isolation_test = false; SELECT citus_move_shard_placement(1500009, 'localhost', 57637, 'localhost', 57638, shard_transfer_mode:='block_writes'); -step s7-get-progress: +step s7-get-progress-ordered: set LOCAL client_min_messages=NOTICE; WITH possible_sizes(size) as (VALUES (0), (8000), (50000), (200000), (400000)) SELECT @@ -1049,7 +1049,8 @@ step s7-get-progress: source_lsn >= target_lsn as lsn_sanity_check, source_lsn > '0/0' as source_lsn_available, target_lsn > '0/0' as target_lsn_available - FROM get_rebalance_progress(); + FROM get_rebalance_progress() + ORDER BY 1, 2, 3, 4, 5; table_name|shardid|shard_size|sourcename|sourceport|source_shard_size|targetname|targetport|target_shard_size|progress|operation_type|lsn_sanity_check|source_lsn_available|target_lsn_available --------------------------------------------------------------------- @@ -1077,7 +1078,7 @@ step s1-wait: step s4-commit: COMMIT; -step s7-get-progress: +step s7-get-progress-ordered: set LOCAL client_min_messages=NOTICE; WITH possible_sizes(size) as (VALUES (0), (8000), (50000), (200000), (400000)) SELECT @@ -1095,14 +1096,15 @@ step s7-get-progress: source_lsn >= target_lsn as lsn_sanity_check, source_lsn > '0/0' as source_lsn_available, target_lsn > '0/0' as target_lsn_available - FROM get_rebalance_progress(); + FROM get_rebalance_progress() + ORDER BY 1, 2, 3, 4, 5; table_name|shardid|shard_size|sourcename|sourceport|source_shard_size|targetname|targetport|target_shard_size|progress|operation_type|lsn_sanity_check|source_lsn_available|target_lsn_available --------------------------------------------------------------------- (0 rows) -starting permutation: s6-acquire-advisory-lock s1-shard-move-c1-block-writes s4-shard-move-sep-block-writes s7-get-progress s6-release-advisory-lock s1-wait s4-commit s7-get-progress +starting permutation: s6-acquire-advisory-lock s1-shard-move-c1-block-writes s4-shard-move-sep-block-writes s7-get-progress-ordered s6-release-advisory-lock s1-wait s4-commit s7-get-progress-ordered master_set_node_property --------------------------------------------------------------------- @@ -1123,7 +1125,7 @@ step s4-shard-move-sep-block-writes: BEGIN; SELECT citus_move_shard_placement(1500009, 'localhost', 57637, 'localhost', 57638, shard_transfer_mode:='block_writes'); -step s7-get-progress: +step s7-get-progress-ordered: set LOCAL client_min_messages=NOTICE; WITH possible_sizes(size) as (VALUES (0), (8000), (50000), (200000), (400000)) SELECT @@ -1141,7 +1143,8 @@ step s7-get-progress: source_lsn >= target_lsn as lsn_sanity_check, source_lsn > '0/0' as source_lsn_available, target_lsn > '0/0' as target_lsn_available - FROM get_rebalance_progress(); + FROM get_rebalance_progress() + ORDER BY 1, 2, 3, 4, 5; table_name|shardid|shard_size|sourcename|sourceport|source_shard_size|targetname|targetport|target_shard_size|progress|operation_type|lsn_sanity_check|source_lsn_available|target_lsn_available --------------------------------------------------------------------- @@ -1174,7 +1177,7 @@ step s1-wait: step s4-commit: COMMIT; -step s7-get-progress: +step s7-get-progress-ordered: set LOCAL client_min_messages=NOTICE; WITH possible_sizes(size) as (VALUES (0), (8000), (50000), (200000), (400000)) SELECT @@ -1192,7 +1195,8 @@ step s7-get-progress: source_lsn >= target_lsn as lsn_sanity_check, source_lsn > '0/0' as source_lsn_available, target_lsn > '0/0' as target_lsn_available - FROM get_rebalance_progress(); + FROM get_rebalance_progress() + ORDER BY 1, 2, 3, 4, 5; table_name|shardid|shard_size|sourcename|sourceport|source_shard_size|targetname|targetport|target_shard_size|progress|operation_type|lsn_sanity_check|source_lsn_available|target_lsn_available --------------------------------------------------------------------- diff --git a/src/test/regress/spec/isolation_shard_rebalancer_progress.spec b/src/test/regress/spec/isolation_shard_rebalancer_progress.spec index 8947233cb..636723181 100644 --- a/src/test/regress/spec/isolation_shard_rebalancer_progress.spec +++ b/src/test/regress/spec/isolation_shard_rebalancer_progress.spec @@ -174,6 +174,32 @@ step "s7-get-progress" FROM get_rebalance_progress(); } +// When getting progress from multiple monitors at the same time it can result +// in random order of the tuples, because there's no defined order of the +// monitors. So in those cases we need to order the output for consistent results. +step "s7-get-progress-ordered" +{ + set LOCAL client_min_messages=NOTICE; + WITH possible_sizes(size) as (VALUES (0), (8000), (50000), (200000), (400000)) + SELECT + table_name, + shardid, + ( SELECT size FROM possible_sizes WHERE ABS(size - shard_size) = (SELECT MIN(ABS(size - shard_size)) FROM possible_sizes )) shard_size, + sourcename, + sourceport, + ( SELECT size FROM possible_sizes WHERE ABS(size - source_shard_size) = (SELECT MIN(ABS(size - source_shard_size)) FROM possible_sizes )) source_shard_size, + targetname, + targetport, + ( SELECT size FROM possible_sizes WHERE ABS(size - target_shard_size) = (SELECT MIN(ABS(size - target_shard_size)) FROM possible_sizes )) target_shard_size, + progress, + operation_type, + source_lsn >= target_lsn as lsn_sanity_check, + source_lsn > '0/0' as source_lsn_available, + target_lsn > '0/0' as target_lsn_available + FROM get_rebalance_progress() + ORDER BY 1, 2, 3, 4, 5; +} + // blocking rebalancer does what it should permutation "s2-lock-1-start" "s1-rebalance-c1-block-writes" "s7-get-progress" "s2-unlock-1-start" "s1-wait" "s7-get-progress" permutation "s3-lock-2-start" "s1-rebalance-c1-block-writes" "s7-get-progress" "s3-unlock-2-start" "s1-wait" "s7-get-progress" @@ -200,5 +226,5 @@ permutation "s5-acquire-advisory-lock" "s1-shard-copy-c1-online" "s7-get-progres permutation "s6-acquire-advisory-lock" "s1-shard-copy-c1-online" "s7-get-progress" "s6-release-advisory-lock" "s1-wait" "s7-get-progress" // parallel blocking shard move -permutation "s2-lock-1-start" "s1-shard-move-c1-block-writes" "s4-shard-move-sep-block-writes-without-advisory-locks"("s1-shard-move-c1-block-writes") "s7-get-progress" "s2-unlock-1-start" "s1-wait" "s4-commit" "s7-get-progress" -permutation "s6-acquire-advisory-lock" "s1-shard-move-c1-block-writes" "s4-shard-move-sep-block-writes"("s1-shard-move-c1-block-writes") "s7-get-progress" "s6-release-advisory-lock" "s1-wait" "s4-commit" "s7-get-progress" +permutation "s2-lock-1-start" "s1-shard-move-c1-block-writes" "s4-shard-move-sep-block-writes-without-advisory-locks"("s1-shard-move-c1-block-writes") "s7-get-progress-ordered" "s2-unlock-1-start" "s1-wait" "s4-commit" "s7-get-progress-ordered" +permutation "s6-acquire-advisory-lock" "s1-shard-move-c1-block-writes" "s4-shard-move-sep-block-writes"("s1-shard-move-c1-block-writes") "s7-get-progress-ordered" "s6-release-advisory-lock" "s1-wait" "s4-commit" "s7-get-progress-ordered"