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

Fixes flakiness in multi_metadata_sync test #6824

Merged
merged 2 commits into from
Apr 6, 2023
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
28 changes: 17 additions & 11 deletions src/test/regress/expected/multi_metadata_sync.out
Original file line number Diff line number Diff line change
Expand Up @@ -497,7 +497,7 @@ SELECT * FROM pg_dist_node ORDER BY nodeid;
5 | 1 | localhost | 8889 | default | f | t | secondary | second-cluster | f | t
(4 rows)

SELECT * FROM pg_dist_partition WHERE logicalrelid::text LIKE 'mx_testing_schema%' ORDER BY logicalrelid;
SELECT * FROM pg_dist_partition WHERE logicalrelid::text LIKE 'mx_testing_schema%' ORDER BY logicalrelid::text;
logicalrelid | partmethod | partkey | colocationid | repmodel | autoconverted
---------------------------------------------------------------------
mx_testing_schema.mx_test_table | h | {VAR :varno 1 :varattno 1 :vartype 23 :vartypmod -1 :varcollid 0 :varlevelsup 0 :varnosyn 1 :varattnosyn 1 :location -1} | 2 | s | f
Expand Down Expand Up @@ -635,7 +635,7 @@ SELECT * FROM pg_dist_node ORDER BY nodeid;
5 | 1 | localhost | 8889 | default | f | t | secondary | second-cluster | f | t
(4 rows)

SELECT * FROM pg_dist_partition WHERE logicalrelid::text LIKE 'mx_testing_schema%' ORDER BY logicalrelid;
SELECT * FROM pg_dist_partition WHERE logicalrelid::text LIKE 'mx_testing_schema%' ORDER BY logicalrelid::text;
logicalrelid | partmethod | partkey | colocationid | repmodel | autoconverted
---------------------------------------------------------------------
mx_testing_schema.mx_test_table | h | {VAR :varno 1 :varattno 1 :vartype 23 :vartypmod -1 :varcollid 0 :varlevelsup 0 :varnosyn 1 :varattnosyn 1 :location -1} | 2 | s | f
Expand Down Expand Up @@ -872,7 +872,7 @@ WHERE
logicalrelid = 'mx_test_schema_1.mx_table_1'::regclass
OR logicalrelid = 'mx_test_schema_2.mx_table_2'::regclass
ORDER BY
logicalrelid;
logicalrelid::text;
logicalrelid | repmodel
---------------------------------------------------------------------
mx_test_schema_1.mx_table_1 | s
Expand All @@ -888,7 +888,7 @@ WHERE
logicalrelid = 'mx_test_schema_1.mx_table_1'::regclass
OR logicalrelid = 'mx_test_schema_2.mx_table_2'::regclass
ORDER BY
logicalrelid, shardid;
logicalrelid::text, shardid;
logicalrelid | shardid | nodename | nodeport
---------------------------------------------------------------------
mx_test_schema_1.mx_table_1 | 1310020 | localhost | 57637
Expand Down Expand Up @@ -921,7 +921,9 @@ FROM
pg_dist_partition
WHERE
logicalrelid = 'mx_test_schema_1.mx_table_1'::regclass
OR logicalrelid = 'mx_test_schema_2.mx_table_2'::regclass;
OR logicalrelid = 'mx_test_schema_2.mx_table_2'::regclass
ORDER BY
logicalrelid::text;
logicalrelid | repmodel
---------------------------------------------------------------------
mx_test_schema_1.mx_table_1 | s
Expand All @@ -937,7 +939,7 @@ WHERE
logicalrelid = 'mx_test_schema_1.mx_table_1'::regclass
OR logicalrelid = 'mx_test_schema_2.mx_table_2'::regclass
ORDER BY
logicalrelid, shardid;
logicalrelid::text, shardid;
logicalrelid | shardid | nodename | nodeport
---------------------------------------------------------------------
mx_test_schema_1.mx_table_1 | 1310020 | localhost | 57637
Expand Down Expand Up @@ -1081,7 +1083,7 @@ FROM
WHERE
logicalrelid = 'mx_colocation_test_1'::regclass
OR logicalrelid = 'mx_colocation_test_2'::regclass
ORDER BY logicalrelid;
ORDER BY logicalrelid::text;
logicalrelid | colocationid
---------------------------------------------------------------------
mx_colocation_test_1 | 10000
Expand All @@ -1101,11 +1103,13 @@ FROM
pg_dist_partition
WHERE
logicalrelid = 'mx_colocation_test_1'::regclass
OR logicalrelid = 'mx_colocation_test_2'::regclass;
OR logicalrelid = 'mx_colocation_test_2'::regclass
ORDER BY
logicalrelid::text;
logicalrelid | colocationid
---------------------------------------------------------------------
mx_colocation_test_2 | 10001
mx_colocation_test_1 | 10001
mx_colocation_test_2 | 10001
(2 rows)

\c - - - :worker_1_port
Expand All @@ -1115,11 +1119,13 @@ FROM
pg_dist_partition
WHERE
logicalrelid = 'mx_colocation_test_1'::regclass
OR logicalrelid = 'mx_colocation_test_2'::regclass;
OR logicalrelid = 'mx_colocation_test_2'::regclass
ORDER BY
logicalrelid::text;
logicalrelid | colocationid
---------------------------------------------------------------------
mx_colocation_test_2 | 10001
mx_colocation_test_1 | 10001
mx_colocation_test_2 | 10001
(2 rows)

\c - - - :master_port
Expand Down
28 changes: 17 additions & 11 deletions src/test/regress/expected/multi_metadata_sync_0.out
Original file line number Diff line number Diff line change
Expand Up @@ -497,7 +497,7 @@ SELECT * FROM pg_dist_node ORDER BY nodeid;
5 | 1 | localhost | 8889 | default | f | t | secondary | second-cluster | f | t
(4 rows)

SELECT * FROM pg_dist_partition WHERE logicalrelid::text LIKE 'mx_testing_schema%' ORDER BY logicalrelid;
SELECT * FROM pg_dist_partition WHERE logicalrelid::text LIKE 'mx_testing_schema%' ORDER BY logicalrelid::text;
logicalrelid | partmethod | partkey | colocationid | repmodel | autoconverted
---------------------------------------------------------------------
mx_testing_schema.mx_test_table | h | {VAR :varno 1 :varattno 1 :vartype 23 :vartypmod -1 :varcollid 0 :varlevelsup 0 :varnosyn 1 :varattnosyn 1 :location -1} | 2 | s | f
Expand Down Expand Up @@ -635,7 +635,7 @@ SELECT * FROM pg_dist_node ORDER BY nodeid;
5 | 1 | localhost | 8889 | default | f | t | secondary | second-cluster | f | t
(4 rows)

SELECT * FROM pg_dist_partition WHERE logicalrelid::text LIKE 'mx_testing_schema%' ORDER BY logicalrelid;
SELECT * FROM pg_dist_partition WHERE logicalrelid::text LIKE 'mx_testing_schema%' ORDER BY logicalrelid::text;
logicalrelid | partmethod | partkey | colocationid | repmodel | autoconverted
---------------------------------------------------------------------
mx_testing_schema.mx_test_table | h | {VAR :varno 1 :varattno 1 :vartype 23 :vartypmod -1 :varcollid 0 :varlevelsup 0 :varnosyn 1 :varattnosyn 1 :location -1} | 2 | s | f
Expand Down Expand Up @@ -872,7 +872,7 @@ WHERE
logicalrelid = 'mx_test_schema_1.mx_table_1'::regclass
OR logicalrelid = 'mx_test_schema_2.mx_table_2'::regclass
ORDER BY
logicalrelid;
logicalrelid::text;
logicalrelid | repmodel
---------------------------------------------------------------------
mx_test_schema_1.mx_table_1 | s
Expand All @@ -888,7 +888,7 @@ WHERE
logicalrelid = 'mx_test_schema_1.mx_table_1'::regclass
OR logicalrelid = 'mx_test_schema_2.mx_table_2'::regclass
ORDER BY
logicalrelid, shardid;
logicalrelid::text, shardid;
logicalrelid | shardid | nodename | nodeport
---------------------------------------------------------------------
mx_test_schema_1.mx_table_1 | 1310020 | localhost | 57637
Expand Down Expand Up @@ -921,7 +921,9 @@ FROM
pg_dist_partition
WHERE
logicalrelid = 'mx_test_schema_1.mx_table_1'::regclass
OR logicalrelid = 'mx_test_schema_2.mx_table_2'::regclass;
OR logicalrelid = 'mx_test_schema_2.mx_table_2'::regclass
ORDER BY
logicalrelid::text;
logicalrelid | repmodel
---------------------------------------------------------------------
mx_test_schema_1.mx_table_1 | s
Expand All @@ -937,7 +939,7 @@ WHERE
logicalrelid = 'mx_test_schema_1.mx_table_1'::regclass
OR logicalrelid = 'mx_test_schema_2.mx_table_2'::regclass
ORDER BY
logicalrelid, shardid;
logicalrelid::text, shardid;
logicalrelid | shardid | nodename | nodeport
---------------------------------------------------------------------
mx_test_schema_1.mx_table_1 | 1310020 | localhost | 57637
Expand Down Expand Up @@ -1081,7 +1083,7 @@ FROM
WHERE
logicalrelid = 'mx_colocation_test_1'::regclass
OR logicalrelid = 'mx_colocation_test_2'::regclass
ORDER BY logicalrelid;
ORDER BY logicalrelid::text;
logicalrelid | colocationid
---------------------------------------------------------------------
mx_colocation_test_1 | 10000
Expand All @@ -1101,11 +1103,13 @@ FROM
pg_dist_partition
WHERE
logicalrelid = 'mx_colocation_test_1'::regclass
OR logicalrelid = 'mx_colocation_test_2'::regclass;
OR logicalrelid = 'mx_colocation_test_2'::regclass
ORDER BY
logicalrelid::text;
logicalrelid | colocationid
---------------------------------------------------------------------
mx_colocation_test_2 | 10001
mx_colocation_test_1 | 10001
mx_colocation_test_2 | 10001
(2 rows)

\c - - - :worker_1_port
Expand All @@ -1115,11 +1119,13 @@ FROM
pg_dist_partition
WHERE
logicalrelid = 'mx_colocation_test_1'::regclass
OR logicalrelid = 'mx_colocation_test_2'::regclass;
OR logicalrelid = 'mx_colocation_test_2'::regclass
ORDER BY
logicalrelid::text;
logicalrelid | colocationid
---------------------------------------------------------------------
mx_colocation_test_2 | 10001
mx_colocation_test_1 | 10001
mx_colocation_test_2 | 10001
(2 rows)

\c - - - :master_port
Expand Down
24 changes: 15 additions & 9 deletions src/test/regress/sql/multi_metadata_sync.sql
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ SELECT nodeid, hasmetadata FROM pg_dist_node WHERE nodename='localhost' AND node
\c - - - :worker_1_port
SELECT * FROM pg_dist_local_group;
SELECT * FROM pg_dist_node ORDER BY nodeid;
SELECT * FROM pg_dist_partition WHERE logicalrelid::text LIKE 'mx_testing_schema%' ORDER BY logicalrelid;
SELECT * FROM pg_dist_partition WHERE logicalrelid::text LIKE 'mx_testing_schema%' ORDER BY logicalrelid::text;
SELECT * FROM pg_dist_shard WHERE logicalrelid::text LIKE 'mx_testing_schema%' ORDER BY shardid;
SELECT * FROM pg_dist_shard_placement WHERE shardid IN (SELECT shardid FROM pg_dist_shard WHERE logicalrelid::text LIKE 'mx_testing_schema%') ORDER BY shardid, nodename, nodeport;
SELECT "Column", "Type", "Modifiers" FROM table_desc WHERE relid='mx_testing_schema.mx_test_table'::regclass;
Expand Down Expand Up @@ -161,7 +161,7 @@ SELECT 1 FROM citus_activate_node('localhost', :worker_1_port);
\c - - - :worker_1_port
SELECT * FROM pg_dist_local_group;
SELECT * FROM pg_dist_node ORDER BY nodeid;
SELECT * FROM pg_dist_partition WHERE logicalrelid::text LIKE 'mx_testing_schema%' ORDER BY logicalrelid;
SELECT * FROM pg_dist_partition WHERE logicalrelid::text LIKE 'mx_testing_schema%' ORDER BY logicalrelid::text;
SELECT * FROM pg_dist_shard WHERE logicalrelid::text LIKE 'mx_testing_schema%' ORDER BY shardid;
SELECT * FROM pg_dist_shard_placement WHERE shardid IN (SELECT shardid FROM pg_dist_shard WHERE logicalrelid::text LIKE 'mx_testing_schema%') ORDER BY shardid, nodename, nodeport;
SELECT "Column", "Type", "Modifiers" FROM table_desc WHERE relid='mx_testing_schema.mx_test_table'::regclass;
Expand Down Expand Up @@ -252,7 +252,7 @@ WHERE
logicalrelid = 'mx_test_schema_1.mx_table_1'::regclass
OR logicalrelid = 'mx_test_schema_2.mx_table_2'::regclass
ORDER BY
logicalrelid;
logicalrelid::text;

-- See the shards and placements of the mx tables
SELECT
Expand All @@ -263,7 +263,7 @@ WHERE
logicalrelid = 'mx_test_schema_1.mx_table_1'::regclass
OR logicalrelid = 'mx_test_schema_2.mx_table_2'::regclass
ORDER BY
logicalrelid, shardid;
logicalrelid::text, shardid;

-- Check that metadata of MX tables exist on the metadata worker
\c - - - :worker_1_port
Expand All @@ -278,7 +278,9 @@ FROM
pg_dist_partition
WHERE
logicalrelid = 'mx_test_schema_1.mx_table_1'::regclass
OR logicalrelid = 'mx_test_schema_2.mx_table_2'::regclass;
OR logicalrelid = 'mx_test_schema_2.mx_table_2'::regclass
ORDER BY
logicalrelid::text;

-- Check that shard and placement data are created
SELECT
Expand All @@ -289,7 +291,7 @@ WHERE
logicalrelid = 'mx_test_schema_1.mx_table_1'::regclass
OR logicalrelid = 'mx_test_schema_2.mx_table_2'::regclass
ORDER BY
logicalrelid, shardid;
logicalrelid::text, shardid;

-- Check that metadata of MX tables don't exist on the non-metadata worker
\c - - - :worker_2_port
Expand Down Expand Up @@ -381,7 +383,7 @@ FROM
WHERE
logicalrelid = 'mx_colocation_test_1'::regclass
OR logicalrelid = 'mx_colocation_test_2'::regclass
ORDER BY logicalrelid;
ORDER BY logicalrelid::text;

-- Update colocation and see the changes on the master and the worker
SELECT update_distributed_table_colocation('mx_colocation_test_1', colocate_with => 'mx_colocation_test_2');
Expand All @@ -391,15 +393,19 @@ FROM
pg_dist_partition
WHERE
logicalrelid = 'mx_colocation_test_1'::regclass
OR logicalrelid = 'mx_colocation_test_2'::regclass;
OR logicalrelid = 'mx_colocation_test_2'::regclass
ORDER BY
logicalrelid::text;
\c - - - :worker_1_port
SELECT
logicalrelid, colocationid
FROM
pg_dist_partition
WHERE
logicalrelid = 'mx_colocation_test_1'::regclass
OR logicalrelid = 'mx_colocation_test_2'::regclass;
OR logicalrelid = 'mx_colocation_test_2'::regclass
ORDER BY
logicalrelid::text;

\c - - - :master_port

Expand Down