-
Notifications
You must be signed in to change notification settings - Fork 766
fix bug #8470 citus_activate_node with secondary nodes is not activate #8535
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
base: main
Are you sure you want to change the base?
Changes from 7 commits
3673e7e
e96b13d
fd60e7c
d43b4d3
a19ce52
2115d83
0ce4ac5
dc6545c
959fb73
071701e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,84 @@ | ||
| \c - - - :master_port | ||
| -- prepare testing | ||
| SELECT citus_set_coordinator_host('localhost', :master_port); | ||
| citus_set_coordinator_host | ||
| --------------------------------------------------------------------- | ||
|
|
||
| (1 row) | ||
|
|
||
| SET citus.metadata_sync_mode TO 'transactional'; | ||
| -- add inactive secondary node | ||
| SELECT 1 FROM citus_add_secondary_node('localhost', :follower_worker_2_port, 'localhost', :worker_2_port); | ||
| ?column? | ||
| --------------------------------------------------------------------- | ||
| 1 | ||
| (1 row) | ||
|
|
||
| SELECT 1 FROM citus_disable_node('localhost', :follower_worker_2_port); | ||
| ?column? | ||
| --------------------------------------------------------------------- | ||
| 1 | ||
| (1 row) | ||
|
|
||
| -- check inactive node | ||
| SELECT count(*) FROM pg_dist_node WHERE nodeport=:follower_worker_2_port AND nodename='localhost' AND NOT isactive; | ||
| count | ||
| --------------------------------------------------------------------- | ||
| 1 | ||
| (1 row) | ||
|
|
||
| SELECT start_metadata_sync_to_all_nodes(); | ||
| start_metadata_sync_to_all_nodes | ||
| --------------------------------------------------------------------- | ||
| t | ||
| (1 row) | ||
|
|
||
| -- error because the node does not exist | ||
| SELECT 1 FROM citus_activate_node('localhost', 7777); | ||
| ERROR: node at "localhost:xxxxx" does not exist | ||
| \c - - - :worker_2_port | ||
| -- check inactive node on worker | ||
| SELECT count(*) FROM pg_dist_node WHERE nodeport=:follower_worker_2_port AND nodename='localhost' AND NOT isactive; | ||
| count | ||
| --------------------------------------------------------------------- | ||
| 1 | ||
| (1 row) | ||
|
|
||
| \c - - - :master_port | ||
| -- main test: activate secondary node | ||
| SELECT 1 FROM citus_activate_node('localhost', :follower_worker_2_port); | ||
| ?column? | ||
| --------------------------------------------------------------------- | ||
| 1 | ||
| (1 row) | ||
|
|
||
| -- check is active node | ||
| SELECT count(*) FROM pg_dist_node WHERE nodeport=:follower_worker_2_port AND nodename='localhost' AND isactive; | ||
| count | ||
| --------------------------------------------------------------------- | ||
| 1 | ||
| (1 row) | ||
|
|
||
| \c - - - :worker_2_port | ||
| -- check is active node | ||
| SELECT count(*) FROM pg_dist_node WHERE nodeport=:follower_worker_2_port AND nodename='localhost' AND isactive; | ||
| count | ||
| --------------------------------------------------------------------- | ||
| 1 | ||
| (1 row) | ||
|
|
||
| \c - - - :worker_1_port | ||
| -- check active node | ||
| SELECT count(*) FROM pg_dist_node WHERE nodeport=:follower_worker_2_port AND nodename='localhost' AND isactive; | ||
| count | ||
| --------------------------------------------------------------------- | ||
| 1 | ||
| (1 row) | ||
|
|
||
| \c - - - :master_port | ||
| SET citus.metadata_sync_mode TO 'nontransactional'; | ||
| -- error this operation cannot be completed in nontransactional metadata sync mode | ||
| -- if the GUC citus.metadata_sync_mode set to 'nontransactional' | ||
| SELECT 1 FROM citus_activate_node('localhost', :follower_worker_2_port); | ||
| ERROR: this operation cannot be completed in nontransactional metadata sync mode | ||
| HINT: SET citus.metadata_sync_mode to 'transactional' |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,45 @@ | ||
| \c - - - :master_port | ||
| -- prepare testing | ||
| SELECT citus_set_coordinator_host('localhost', :master_port); | ||
|
|
||
| SET citus.metadata_sync_mode TO 'transactional'; | ||
|
|
||
| -- add inactive secondary node | ||
| SELECT 1 FROM citus_add_secondary_node('localhost', :follower_worker_2_port, 'localhost', :worker_2_port); | ||
| SELECT 1 FROM citus_disable_node('localhost', :follower_worker_2_port); | ||
|
|
||
| -- check inactive node | ||
| SELECT count(*) FROM pg_dist_node WHERE nodeport=:follower_worker_2_port AND nodename='localhost' AND NOT isactive; | ||
| SELECT start_metadata_sync_to_all_nodes(); | ||
|
|
||
| -- error because the node does not exist | ||
| SELECT 1 FROM citus_activate_node('localhost', 7777); | ||
|
|
||
|
|
||
| \c - - - :worker_2_port | ||
| -- check inactive node on worker | ||
| SELECT count(*) FROM pg_dist_node WHERE nodeport=:follower_worker_2_port AND nodename='localhost' AND NOT isactive; | ||
|
|
||
| \c - - - :master_port | ||
|
|
||
| -- main test: activate secondary node | ||
| SELECT 1 FROM citus_activate_node('localhost', :follower_worker_2_port); | ||
|
|
||
|
|
||
| -- check is active node | ||
| SELECT count(*) FROM pg_dist_node WHERE nodeport=:follower_worker_2_port AND nodename='localhost' AND isactive; | ||
|
|
||
| \c - - - :worker_2_port | ||
| -- check is active node | ||
| SELECT count(*) FROM pg_dist_node WHERE nodeport=:follower_worker_2_port AND nodename='localhost' AND isactive; | ||
|
|
||
| \c - - - :worker_1_port | ||
| -- check active node | ||
| SELECT count(*) FROM pg_dist_node WHERE nodeport=:follower_worker_2_port AND nodename='localhost' AND isactive; | ||
|
|
||
| \c - - - :master_port | ||
| SET citus.metadata_sync_mode TO 'nontransactional'; | ||
|
|
||
| -- error this operation cannot be completed in nontransactional metadata sync mode | ||
| -- if the GUC citus.metadata_sync_mode set to 'nontransactional' | ||
| SELECT 1 FROM citus_activate_node('localhost', :follower_worker_2_port); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The test adds a secondary node and activates it but doesn't clean up. Consider adding cleanup at the end to avoid polluting state for any future tests that might be added after this one in the schedule: |
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The new test is added after ensure_no_intermediate_data_leak, which has the comment "This should always be last."
Please move it before that line (e.g., before ensure_no_intermediate_data_leak, after multi_add_node_from_backup_sync_replica).