-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
MDEV-28302 Configurable DEFAULTs for CHANGE MASTER
#4430
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 all commits
2f8cea4
e14601a
ee27c8c
9722e56
7a8834b
3ba73e6
0069e96
fa9b7ae
dc71fe8
e044efd
dde1c4c
a91537a
6f95640
2fd00ad
80b604f
61b2a4a
3bc2b77
34a16b3
de37744
d89517d
0010d44
cad3ca2
d00d4b2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
|
Contributor
Author
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. A question for the future (no need to answer immediately): Fields with trivial
|
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,102 @@ | ||
| CREATE PROCEDURE show_defaultable_fields() | ||
| SELECT connection_name, | ||
| connect_retry, | ||
| master_ssl_allowed, | ||
| master_ssl_ca_file, | ||
| master_ssl_ca_path, | ||
| master_ssl_cert, | ||
| master_ssl_cipher, | ||
| master_ssl_key, | ||
| `master_ssl_verify_server_cert`, # MDEV-38194 | ||
| master_ssl_crl, | ||
| master_ssl_crlpath, | ||
| using_gtid, | ||
| master_retry_count, | ||
| slave_heartbeat_period | ||
| FROM information_schema.slave_status ORDER BY connection_name; | ||
| CHANGE MASTER 'unset' TO master_host='127.0.1.1'; | ||
| CHANGE MASTER 'defaulted' TO | ||
| master_connect_retry= DEFAULT, | ||
| master_ssl= DEFAULT, | ||
| master_ssl_ca= DEFAULT, | ||
| master_ssl_capath= DEFAULT, | ||
| master_ssl_cert= DEFAULT, | ||
| master_ssl_cipher= DEFAULT, | ||
| master_ssl_key= DEFAULT, | ||
| master_ssl_verify_server_cert= DEFAULT, | ||
| master_ssl_crl= DEFAULT, | ||
| master_ssl_crlpath= DEFAULT, | ||
| master_use_gtid= DEFAULT, | ||
| master_retry_count= DEFAULT, | ||
| master_heartbeat_period= DEFAULT, | ||
| master_host= '127.0.1.2'; | ||
| CHANGE MASTER TO # Default master does not replace named masters | ||
| master_connect_retry= 90, | ||
| master_ssl= FALSE, | ||
| master_ssl_ca= 'specified_ca', | ||
| master_ssl_capath= 'specified_capath', | ||
| master_ssl_cert= 'specified_cert', | ||
| master_ssl_cipher= 'specified_cipher', | ||
| master_ssl_key= 'specified_key', | ||
| master_ssl_verify_server_cert= FALSE, | ||
| master_ssl_crl= 'specified_crl', | ||
| master_ssl_crlpath= 'specified_crlpath', | ||
| master_use_gtid= NO, | ||
| master_retry_count= 150000, | ||
| master_heartbeat_period= 45, | ||
| master_host='127.0.0.1'; | ||
| CALL show_defaultable_fields(); | ||
| connection_name connect_retry master_ssl_allowed master_ssl_ca_file master_ssl_ca_path master_ssl_cert master_ssl_cipher master_ssl_key master_ssl_verify_server_cert master_ssl_crl master_ssl_crlpath using_gtid master_retry_count slave_heartbeat_period | ||
| 90 No specified_ca specified_capath specified_cert specified_cipher specified_key No specified_crl specified_crlpath No 150000 45.000 | ||
| defaulted 60 Yes Yes Slave_Pos 100000 60.000 | ||
| unset 60 Yes Yes Slave_Pos 100000 60.000 | ||
| # restart: --skip-slave-start --master-connect-retry=30 --skip-master-ssl --master-ssl-ca=default_ca --master-ssl-capath=default_capath --master-ssl-cert=default_cert --master-ssl-cipher=default_cipher --master-ssl-key=default_key --skip-master-ssl-verify-server-cert --master-ssl-crl=default_crl --master-ssl-crlpath=default_crlpath --master-use-gtid=CURRENT_POS --master-retry-count=50000 --master-heartbeat-period=15 | ||
| CALL show_defaultable_fields(); | ||
| connection_name connect_retry master_ssl_allowed master_ssl_ca_file master_ssl_ca_path master_ssl_cert master_ssl_cipher master_ssl_key master_ssl_verify_server_cert master_ssl_crl master_ssl_crlpath using_gtid master_retry_count slave_heartbeat_period | ||
| 90 No specified_ca specified_capath specified_cert specified_cipher specified_key No specified_crl specified_crlpath No 150000 45.000 | ||
| defaulted 30 No default_ca default_capath default_cert default_cipher default_key No default_crl default_crlpath Current_Pos 50000 15.000 | ||
| unset 30 No default_ca default_capath default_cert default_cipher default_key No default_crl default_crlpath Current_Pos 50000 15.000 | ||
| SET @@GLOBAL.slave_net_timeout= 100; | ||
| SELECT connection_name, slave_heartbeat_period | ||
| FROM information_schema.slave_status ORDER BY connection_name; | ||
| connection_name slave_heartbeat_period | ||
| 45.000 | ||
| defaulted 15.000 | ||
| unset 15.000 | ||
| CHANGE MASTER TO | ||
| master_connect_retry= DEFAULT, | ||
| master_ssl= DEFAULT, | ||
| master_ssl_ca= DEFAULT, | ||
| master_ssl_capath= DEFAULT, | ||
| master_ssl_cert= DEFAULT, | ||
| master_ssl_cipher= DEFAULT, | ||
| master_ssl_key= DEFAULT, | ||
| master_ssl_verify_server_cert= DEFAULT, | ||
| master_ssl_crl= DEFAULT, | ||
| master_ssl_crlpath= DEFAULT, | ||
| master_use_gtid= DEFAULT, | ||
| master_retry_count= DEFAULT, | ||
| master_heartbeat_period= DEFAULT; | ||
| CALL show_defaultable_fields(); | ||
| connection_name connect_retry master_ssl_allowed master_ssl_ca_file master_ssl_ca_path master_ssl_cert master_ssl_cipher master_ssl_key master_ssl_verify_server_cert master_ssl_crl master_ssl_crlpath using_gtid master_retry_count slave_heartbeat_period | ||
| 30 No default_ca default_capath default_cert default_cipher default_key No default_crl default_crlpath Current_Pos 50000 15.000 | ||
| defaulted 30 No default_ca default_capath default_cert default_cipher default_key No default_crl default_crlpath Current_Pos 50000 15.000 | ||
| unset 30 No default_ca default_capath default_cert default_cipher default_key No default_crl default_crlpath Current_Pos 50000 15.000 | ||
| RESET REPLICA 'unset' ALL; | ||
| CHANGE MASTER 'unset' TO master_host='127.0.1.3'; | ||
| # restart_abort: --master-heartbeat-period='' | ||
| # restart_abort: --master-heartbeat-period=123abc | ||
| # restart_abort: --master-heartbeat-period=-1 | ||
| # restart_abort: --master-heartbeat-period=4294967.296 | ||
| # restart: --skip-slave-start --master-heartbeat-period=0.000499 | ||
| CALL mtr.add_suppression('.*master-heartbeat-period.+0.* disabl.+'); | ||
| # restart: --skip-slave-start --skip-master-ssl --master-ssl --skip-master-ssl-verify-server-cert --master-ssl-verify-server-cert --master-use-gtid=NO --autoset-master-use-gtid --master-heartbeat-period=45 --autoset-master-heartbeat-period | ||
| CALL show_defaultable_fields(); | ||
| connection_name connect_retry master_ssl_allowed master_ssl_ca_file master_ssl_ca_path master_ssl_cert master_ssl_cipher master_ssl_key master_ssl_verify_server_cert master_ssl_crl master_ssl_crlpath using_gtid master_retry_count slave_heartbeat_period | ||
| 60 Yes Yes Slave_Pos 100000 60.000 | ||
| defaulted 60 Yes Yes Slave_Pos 100000 60.000 | ||
| unset 60 Yes Yes Slave_Pos 100000 60.000 | ||
| DROP PROCEDURE show_defaultable_fields; | ||
| RESET REPLICA 'unset' ALL; | ||
| RESET REPLICA 'defaulted' ALL; | ||
| RESET REPLICA ALL; |
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,145 @@ | ||||||
| # MDEV-28302: Test how `CHANGE MASTER [named]` reads server | ||||||
| # options for its default values and the lack of those options. | ||||||
| # The test creates multiple CHANGE MASTER connections, | ||||||
| # where the defaultable fields of a connection are: | ||||||
| # * left unset | ||||||
| # * set to `DEFAULT` | ||||||
| # * configured with values | ||||||
|
|
||||||
| # only need CHANGE MASTER and IS.slave_status | ||||||
| --source include/have_binlog_format_mixed.inc | ||||||
|
|
||||||
| CREATE PROCEDURE show_defaultable_fields() | ||||||
| SELECT connection_name, | ||||||
| connect_retry, | ||||||
| master_ssl_allowed, | ||||||
| master_ssl_ca_file, | ||||||
| master_ssl_ca_path, | ||||||
| master_ssl_cert, | ||||||
| master_ssl_cipher, | ||||||
| master_ssl_key, | ||||||
| `master_ssl_verify_server_cert`, # MDEV-38194 | ||||||
| master_ssl_crl, | ||||||
| master_ssl_crlpath, | ||||||
| using_gtid, | ||||||
| master_retry_count, | ||||||
| slave_heartbeat_period | ||||||
| FROM information_schema.slave_status ORDER BY connection_name; | ||||||
|
|
||||||
| CHANGE MASTER 'unset' TO master_host='127.0.1.1'; | ||||||
|
|
||||||
| CHANGE MASTER 'defaulted' TO | ||||||
| master_connect_retry= DEFAULT, | ||||||
| master_ssl= DEFAULT, | ||||||
| master_ssl_ca= DEFAULT, | ||||||
| master_ssl_capath= DEFAULT, | ||||||
| master_ssl_cert= DEFAULT, | ||||||
| master_ssl_cipher= DEFAULT, | ||||||
| master_ssl_key= DEFAULT, | ||||||
| master_ssl_verify_server_cert= DEFAULT, | ||||||
| master_ssl_crl= DEFAULT, | ||||||
| master_ssl_crlpath= DEFAULT, | ||||||
| master_use_gtid= DEFAULT, | ||||||
| master_retry_count= DEFAULT, | ||||||
| master_heartbeat_period= DEFAULT, | ||||||
| master_host= '127.0.1.2'; | ||||||
|
|
||||||
| # This subject does not stay constant. | ||||||
|
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. I don't know what this comment is trying to say |
||||||
| CHANGE MASTER TO # Default master does not replace named masters | ||||||
| master_connect_retry= 90, | ||||||
| master_ssl= FALSE, | ||||||
| master_ssl_ca= 'specified_ca', | ||||||
| master_ssl_capath= 'specified_capath', | ||||||
| master_ssl_cert= 'specified_cert', | ||||||
| master_ssl_cipher= 'specified_cipher', | ||||||
| master_ssl_key= 'specified_key', | ||||||
| master_ssl_verify_server_cert= FALSE, | ||||||
| master_ssl_crl= 'specified_crl', | ||||||
| master_ssl_crlpath= 'specified_crlpath', | ||||||
| master_use_gtid= NO, | ||||||
| master_retry_count= 150000, | ||||||
| master_heartbeat_period= 45, | ||||||
| master_host='127.0.0.1'; | ||||||
|
|
||||||
| # Show freshly created configurations | ||||||
| CALL show_defaultable_fields(); | ||||||
|
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. Here and for the other
Suggested change
|
||||||
|
|
||||||
|
|
||||||
| # Those set or left as `DEFAULT` should pick up changes to defaults. | ||||||
|
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. Nice test! Also these kinds of statements which set up expectations/context for the results should be --echo'd, so one can read through just the .result file and understand what is happening. |
||||||
|
|
||||||
| --let $restart_parameters= --skip-slave-start --master-connect-retry=30 --skip-master-ssl --master-ssl-ca=default_ca --master-ssl-capath=default_capath --master-ssl-cert=default_cert --master-ssl-cipher=default_cipher --master-ssl-key=default_key --skip-master-ssl-verify-server-cert --master-ssl-crl=default_crl --master-ssl-crlpath=default_crlpath --master-use-gtid=CURRENT_POS --master-retry-count=50000 --master-heartbeat-period=15 | ||||||
| --source include/restart_mysqld.inc # not_embedded | ||||||
|
|
||||||
| CALL show_defaultable_fields(); | ||||||
|
|
||||||
|
|
||||||
| # The `DEFAULT` of `master_heartbeat_period` changes with `@@slave_net_timeout`. | ||||||
|
|
||||||
| SET @@GLOBAL.slave_net_timeout= 100; | ||||||
|
|
||||||
| SELECT connection_name, slave_heartbeat_period | ||||||
| FROM information_schema.slave_status ORDER BY connection_name; | ||||||
|
|
||||||
|
|
||||||
| # `DEFAULT` overwrites the existing configs only for the CHANGEd connection. | ||||||
|
|
||||||
| CHANGE MASTER TO | ||||||
| master_connect_retry= DEFAULT, | ||||||
| master_ssl= DEFAULT, | ||||||
| master_ssl_ca= DEFAULT, | ||||||
| master_ssl_capath= DEFAULT, | ||||||
| master_ssl_cert= DEFAULT, | ||||||
| master_ssl_cipher= DEFAULT, | ||||||
| master_ssl_key= DEFAULT, | ||||||
| master_ssl_verify_server_cert= DEFAULT, | ||||||
| master_ssl_crl= DEFAULT, | ||||||
| master_ssl_crlpath= DEFAULT, | ||||||
| master_use_gtid= DEFAULT, | ||||||
| master_retry_count= DEFAULT, | ||||||
| master_heartbeat_period= DEFAULT; | ||||||
|
|
||||||
| CALL show_defaultable_fields(); | ||||||
|
|
||||||
|
|
||||||
| # Recreate 'unset' to test that it saves `DEFAULT`, not the options' values | ||||||
| --disable_warnings | ||||||
| RESET REPLICA 'unset' ALL; | ||||||
| --enable_warnings | ||||||
| CHANGE MASTER 'unset' TO master_host='127.0.1.3'; | ||||||
|
|
||||||
| # Invalid `--master-heartbeat-period` values should abort the server | ||||||
| --source include/shutdown_mysqld.inc | ||||||
| --let $restart_parameters= --master-heartbeat-period='' | ||||||
| --echo # restart_abort: $restart_parameters | ||||||
| --write_line "restart_abort: $restart_parameters" $_expect_file_name | ||||||
| --let $restart_parameters= --master-heartbeat-period=123abc | ||||||
| --echo # restart_abort: $restart_parameters | ||||||
| --write_line "restart_abort: $restart_parameters" $_expect_file_name | ||||||
| --let $restart_parameters= --master-heartbeat-period=-1 | ||||||
| --echo # restart_abort: $restart_parameters | ||||||
| --write_line "restart_abort: $restart_parameters" $_expect_file_name | ||||||
| --let $restart_parameters= --master-heartbeat-period=4294967.296 | ||||||
| --echo # restart_abort: $restart_parameters | ||||||
| --write_line "restart_abort: $restart_parameters" $_expect_file_name | ||||||
|
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. I don't get what the above restart parameters are trying to test. It looks like some error testing setup, but I don't see the server being actually started or any error verification. |
||||||
|
|
||||||
| # Numbers between 0 and 0.5 exclusive should warn about rounding to 0 (disabled) | ||||||
| --let $restart_parameters= --skip-slave-start --master-heartbeat-period=0.000499 | ||||||
| --source include/start_mysqld.inc | ||||||
| CALL mtr.add_suppression('.*master-heartbeat-period.+0.* disabl.+'); | ||||||
|
|
||||||
| # Test prefixes: adding `auto-` and omitting `skip-` | ||||||
| --let $restart_parameters= --skip-slave-start --skip-master-ssl --master-ssl --skip-master-ssl-verify-server-cert --master-ssl-verify-server-cert --master-use-gtid=NO --autoset-master-use-gtid --master-heartbeat-period=45 --autoset-master-heartbeat-period | ||||||
| --source include/restart_mysqld.inc | ||||||
|
|
||||||
| CALL show_defaultable_fields(); | ||||||
|
|
||||||
|
|
||||||
| # Clean-up | ||||||
|
|
||||||
| DROP PROCEDURE show_defaultable_fields; | ||||||
|
|
||||||
| RESET REPLICA 'unset' ALL; | ||||||
| RESET REPLICA 'defaulted' ALL; | ||||||
| RESET REPLICA ALL; | ||||||
| # check-testcase | ||||||
| #CHANGE MASTER TO master_user= 'root', master_ssl_verify_server_cert= FALSE; | ||||||
|
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. Leftover Also the test needs an |
||||||
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.