-
Notifications
You must be signed in to change notification settings - Fork 686
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix mixed Citus upgrade tests (#7218)
When testing rolling Citus upgrades, coordinator should not be upgraded until we upgrade all the workers. --------- Co-authored-by: Jelte Fennema-Nio <[email protected]>
- Loading branch information
Showing
7 changed files
with
147 additions
and
142 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
94 changes: 94 additions & 0 deletions
94
src/test/regress/expected/upgrade_basic_after_non_mixed.out
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
SELECT nextval('pg_dist_shardid_seq') > MAX(shardid) FROM pg_dist_shard; | ||
?column? | ||
--------------------------------------------------------------------- | ||
t | ||
(1 row) | ||
|
||
SELECT nextval('pg_dist_placement_placementid_seq') > MAX(placementid) FROM pg_dist_placement; | ||
?column? | ||
--------------------------------------------------------------------- | ||
t | ||
(1 row) | ||
|
||
SELECT nextval('pg_dist_groupid_seq') > MAX(groupid) FROM pg_dist_node; | ||
?column? | ||
--------------------------------------------------------------------- | ||
t | ||
(1 row) | ||
|
||
SELECT nextval('pg_dist_node_nodeid_seq') > MAX(nodeid) FROM pg_dist_node; | ||
?column? | ||
--------------------------------------------------------------------- | ||
t | ||
(1 row) | ||
|
||
SELECT nextval('pg_dist_colocationid_seq') > MAX(colocationid) FROM pg_dist_colocation; | ||
?column? | ||
--------------------------------------------------------------------- | ||
t | ||
(1 row) | ||
|
||
-- while testing sequences on pg_dist_cleanup, they return null in pg upgrade schedule | ||
-- but return a valid value in citus upgrade schedule | ||
-- that's why we accept both NULL and MAX()+1 here | ||
SELECT | ||
CASE WHEN MAX(operation_id) IS NULL | ||
THEN true | ||
ELSE nextval('pg_dist_operationid_seq') > MAX(operation_id) | ||
END AS check_operationid | ||
FROM pg_dist_cleanup; | ||
check_operationid | ||
--------------------------------------------------------------------- | ||
t | ||
(1 row) | ||
|
||
SELECT | ||
CASE WHEN MAX(record_id) IS NULL | ||
THEN true | ||
ELSE nextval('pg_dist_cleanup_recordid_seq') > MAX(record_id) | ||
END AS check_recordid | ||
FROM pg_dist_cleanup; | ||
check_recordid | ||
--------------------------------------------------------------------- | ||
t | ||
(1 row) | ||
|
||
SELECT nextval('pg_dist_background_job_job_id_seq') > COALESCE(MAX(job_id), 0) FROM pg_dist_background_job; | ||
?column? | ||
--------------------------------------------------------------------- | ||
t | ||
(1 row) | ||
|
||
SELECT nextval('pg_dist_background_task_task_id_seq') > COALESCE(MAX(task_id), 0) FROM pg_dist_background_task; | ||
?column? | ||
--------------------------------------------------------------------- | ||
t | ||
(1 row) | ||
|
||
SELECT last_value > 0 FROM pg_dist_clock_logical_seq; | ||
?column? | ||
--------------------------------------------------------------------- | ||
t | ||
(1 row) | ||
|
||
-- If this query gives output it means we've added a new sequence that should | ||
-- possibly be restored after upgrades. | ||
SELECT sequence_name FROM information_schema.sequences | ||
WHERE sequence_name LIKE 'pg_dist_%' | ||
AND sequence_name NOT IN ( | ||
-- these ones are restored above | ||
'pg_dist_shardid_seq', | ||
'pg_dist_placement_placementid_seq', | ||
'pg_dist_groupid_seq', | ||
'pg_dist_node_nodeid_seq', | ||
'pg_dist_colocationid_seq', | ||
'pg_dist_operationid_seq', | ||
'pg_dist_cleanup_recordid_seq', | ||
'pg_dist_background_job_job_id_seq', | ||
'pg_dist_background_task_task_id_seq', | ||
'pg_dist_clock_logical_seq' | ||
); | ||
sequence_name | ||
--------------------------------------------------------------------- | ||
(0 rows) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
SELECT nextval('pg_dist_shardid_seq') > MAX(shardid) FROM pg_dist_shard; | ||
SELECT nextval('pg_dist_placement_placementid_seq') > MAX(placementid) FROM pg_dist_placement; | ||
SELECT nextval('pg_dist_groupid_seq') > MAX(groupid) FROM pg_dist_node; | ||
SELECT nextval('pg_dist_node_nodeid_seq') > MAX(nodeid) FROM pg_dist_node; | ||
SELECT nextval('pg_dist_colocationid_seq') > MAX(colocationid) FROM pg_dist_colocation; | ||
|
||
-- while testing sequences on pg_dist_cleanup, they return null in pg upgrade schedule | ||
-- but return a valid value in citus upgrade schedule | ||
-- that's why we accept both NULL and MAX()+1 here | ||
SELECT | ||
CASE WHEN MAX(operation_id) IS NULL | ||
THEN true | ||
ELSE nextval('pg_dist_operationid_seq') > MAX(operation_id) | ||
END AS check_operationid | ||
FROM pg_dist_cleanup; | ||
SELECT | ||
CASE WHEN MAX(record_id) IS NULL | ||
THEN true | ||
ELSE nextval('pg_dist_cleanup_recordid_seq') > MAX(record_id) | ||
END AS check_recordid | ||
FROM pg_dist_cleanup; | ||
SELECT nextval('pg_dist_background_job_job_id_seq') > COALESCE(MAX(job_id), 0) FROM pg_dist_background_job; | ||
SELECT nextval('pg_dist_background_task_task_id_seq') > COALESCE(MAX(task_id), 0) FROM pg_dist_background_task; | ||
SELECT last_value > 0 FROM pg_dist_clock_logical_seq; | ||
|
||
-- If this query gives output it means we've added a new sequence that should | ||
-- possibly be restored after upgrades. | ||
SELECT sequence_name FROM information_schema.sequences | ||
WHERE sequence_name LIKE 'pg_dist_%' | ||
AND sequence_name NOT IN ( | ||
-- these ones are restored above | ||
'pg_dist_shardid_seq', | ||
'pg_dist_placement_placementid_seq', | ||
'pg_dist_groupid_seq', | ||
'pg_dist_node_nodeid_seq', | ||
'pg_dist_colocationid_seq', | ||
'pg_dist_operationid_seq', | ||
'pg_dist_cleanup_recordid_seq', | ||
'pg_dist_background_job_job_id_seq', | ||
'pg_dist_background_task_task_id_seq', | ||
'pg_dist_clock_logical_seq' | ||
); |