diff --git a/mysql-test/suite/sys_vars/r/master_info_file_basic.result b/mysql-test/suite/sys_vars/r/master_info_file_basic.result new file mode 100644 index 00000000000..1252e81f50f --- /dev/null +++ b/mysql-test/suite/sys_vars/r/master_info_file_basic.result @@ -0,0 +1,17 @@ +# GLOBAL scope +SELECT @@GLOBAL.master_info_file; +@@GLOBAL.master_info_file +30189.info +SELECT @@master_info_file; +@@master_info_file +30189.info +# Not SESSION scope +SELECT @@SESSION.master_info_file; +ERROR HY000: Variable 'master_info_file' is a GLOBAL variable +# Read-only +SET @@master_info_file= 'master.info'; +ERROR HY000: Variable 'master_info_file' is a read only variable +SET @@GLOBAL.master_info_file= 'master.info'; +ERROR HY000: Variable 'master_info_file' is a read only variable +SET @@SESSION.master_info_file= 'master.info'; +ERROR HY000: Variable 'master_info_file' is a read only variable diff --git a/mysql-test/suite/sys_vars/r/replicate_same_server_id_basic.result b/mysql-test/suite/sys_vars/r/replicate_same_server_id_basic.result new file mode 100644 index 00000000000..8a6d11235a1 --- /dev/null +++ b/mysql-test/suite/sys_vars/r/replicate_same_server_id_basic.result @@ -0,0 +1,17 @@ +# GLOBAL scope +SELECT @@GLOBAL.replicate_same_server_id; +@@GLOBAL.replicate_same_server_id +1 +SELECT @@replicate_same_server_id; +@@replicate_same_server_id +1 +# Not SESSION scope +SELECT @@SESSION.replicate_same_server_id; +ERROR HY000: Variable 'replicate_same_server_id' is a GLOBAL variable +# Read-only +SET @@replicate_same_server_id= OFF; +ERROR HY000: Variable 'replicate_same_server_id' is a read only variable +SET @@GLOBAL.replicate_same_server_id= OFF; +ERROR HY000: Variable 'replicate_same_server_id' is a read only variable +SET @@SESSION.replicate_same_server_id= OFF; +ERROR HY000: Variable 'replicate_same_server_id' is a read only variable diff --git a/mysql-test/suite/sys_vars/r/show_slave_auth_info_basic.result b/mysql-test/suite/sys_vars/r/show_slave_auth_info_basic.result new file mode 100644 index 00000000000..24193a99154 --- /dev/null +++ b/mysql-test/suite/sys_vars/r/show_slave_auth_info_basic.result @@ -0,0 +1,17 @@ +# GLOBAL scope +SELECT @@GLOBAL.show_slave_auth_info; +@@GLOBAL.show_slave_auth_info +1 +SELECT @@show_slave_auth_info; +@@show_slave_auth_info +1 +# Not SESSION scope +SELECT @@SESSION.show_slave_auth_info; +ERROR HY000: Variable 'show_slave_auth_info' is a GLOBAL variable +# Read-only +SET @@show_slave_auth_info= OFF; +ERROR HY000: Variable 'show_slave_auth_info' is a read only variable +SET @@GLOBAL.show_slave_auth_info= OFF; +ERROR HY000: Variable 'show_slave_auth_info' is a read only variable +SET @@SESSION.show_slave_auth_info= OFF; +ERROR HY000: Variable 'show_slave_auth_info' is a read only variable diff --git a/mysql-test/suite/sys_vars/r/sysvars_server_notembedded.result b/mysql-test/suite/sys_vars/r/sysvars_server_notembedded.result index 0fbede708a0..9e4cfa7f07c 100644 --- a/mysql-test/suite/sys_vars/r/sysvars_server_notembedded.result +++ b/mysql-test/suite/sys_vars/r/sysvars_server_notembedded.result @@ -2072,6 +2072,16 @@ NUMERIC_BLOCK_SIZE NULL ENUM_VALUE_LIST OFF,ON READ_ONLY NO COMMAND_LINE_ARGUMENT OPTIONAL +VARIABLE_NAME MASTER_INFO_FILE +VARIABLE_SCOPE GLOBAL +VARIABLE_TYPE VARCHAR +VARIABLE_COMMENT The location and name of the file that remembers the master and where the I/O replication thread is in the master's binlogs. Defaults to master.info +NUMERIC_MIN_VALUE NULL +NUMERIC_MAX_VALUE NULL +NUMERIC_BLOCK_SIZE NULL +ENUM_VALUE_LIST NULL +READ_ONLY YES +COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME MASTER_VERIFY_CHECKSUM VARIABLE_SCOPE GLOBAL VARIABLE_TYPE BOOLEAN @@ -3752,6 +3762,16 @@ NUMERIC_BLOCK_SIZE NULL ENUM_VALUE_LIST NULL READ_ONLY NO COMMAND_LINE_ARGUMENT NULL +VARIABLE_NAME REPLICATE_SAME_SERVER_ID +VARIABLE_SCOPE GLOBAL +VARIABLE_TYPE BOOLEAN +VARIABLE_COMMENT In replication, if set to 1, do not skip events having our server id. Default value is 0 (to break infinite loops in circular replication). Can't be set to 1 if --log-slave-updates is used +NUMERIC_MIN_VALUE NULL +NUMERIC_MAX_VALUE NULL +NUMERIC_BLOCK_SIZE NULL +ENUM_VALUE_LIST OFF,ON +READ_ONLY YES +COMMAND_LINE_ARGUMENT OPTIONAL VARIABLE_NAME REPLICATE_WILD_DO_TABLE VARIABLE_SCOPE GLOBAL VARIABLE_TYPE VARCHAR @@ -4012,6 +4032,16 @@ NUMERIC_BLOCK_SIZE NULL ENUM_VALUE_LIST OFF,STATE,CHARACTERISTICS READ_ONLY NO COMMAND_LINE_ARGUMENT REQUIRED +VARIABLE_NAME SHOW_SLAVE_AUTH_INFO +VARIABLE_SCOPE GLOBAL +VARIABLE_TYPE BOOLEAN +VARIABLE_COMMENT Show user and password in SHOW SLAVE HOSTS on this master +NUMERIC_MIN_VALUE NULL +NUMERIC_MAX_VALUE NULL +NUMERIC_BLOCK_SIZE NULL +ENUM_VALUE_LIST OFF,ON +READ_ONLY YES +COMMAND_LINE_ARGUMENT OPTIONAL VARIABLE_NAME SKIP_EXTERNAL_LOCKING VARIABLE_SCOPE GLOBAL VARIABLE_TYPE BOOLEAN diff --git a/mysql-test/suite/sys_vars/t/master_info_file_basic.opt b/mysql-test/suite/sys_vars/t/master_info_file_basic.opt new file mode 100644 index 00000000000..ecb47fb25c7 --- /dev/null +++ b/mysql-test/suite/sys_vars/t/master_info_file_basic.opt @@ -0,0 +1 @@ +--master-info-file='30189.info' diff --git a/mysql-test/suite/sys_vars/t/master_info_file_basic.test b/mysql-test/suite/sys_vars/t/master_info_file_basic.test new file mode 100644 index 00000000000..42da6069d33 --- /dev/null +++ b/mysql-test/suite/sys_vars/t/master_info_file_basic.test @@ -0,0 +1,19 @@ +--source include/not_embedded.inc +# MDEV-30189: Test minimal correctness of `@@master_info_file` itself + +--echo # GLOBAL scope +# Expect different from default ('master.info') as configured by `.opt` +SELECT @@GLOBAL.master_info_file; +SELECT @@master_info_file; + +--echo # Not SESSION scope +--error ER_INCORRECT_GLOBAL_LOCAL_VAR +SELECT @@SESSION.master_info_file; + +--echo # Read-only +--error ER_INCORRECT_GLOBAL_LOCAL_VAR +SET @@master_info_file= 'master.info'; +--error ER_INCORRECT_GLOBAL_LOCAL_VAR +SET @@GLOBAL.master_info_file= 'master.info'; +--error ER_INCORRECT_GLOBAL_LOCAL_VAR +SET @@SESSION.master_info_file= 'master.info'; diff --git a/mysql-test/suite/sys_vars/t/replicate_same_server_id_basic.opt b/mysql-test/suite/sys_vars/t/replicate_same_server_id_basic.opt new file mode 100644 index 00000000000..d4fbb2a60ee --- /dev/null +++ b/mysql-test/suite/sys_vars/t/replicate_same_server_id_basic.opt @@ -0,0 +1 @@ +--replicate-same-server-id diff --git a/mysql-test/suite/sys_vars/t/replicate_same_server_id_basic.test b/mysql-test/suite/sys_vars/t/replicate_same_server_id_basic.test new file mode 100644 index 00000000000..85060aa8605 --- /dev/null +++ b/mysql-test/suite/sys_vars/t/replicate_same_server_id_basic.test @@ -0,0 +1,19 @@ +--source include/not_embedded.inc +# MDEV-30189: Test minimal correctness of `@@replicate_same_server_id` itself + +--echo # GLOBAL scope +# Expect different from default (OFF) as configured by `.opt` +SELECT @@GLOBAL.replicate_same_server_id; +SELECT @@replicate_same_server_id; + +--echo # Not SESSION scope +--error ER_INCORRECT_GLOBAL_LOCAL_VAR +SELECT @@SESSION.replicate_same_server_id; + +--echo # Read-only +--error ER_INCORRECT_GLOBAL_LOCAL_VAR +SET @@replicate_same_server_id= OFF; +--error ER_INCORRECT_GLOBAL_LOCAL_VAR +SET @@GLOBAL.replicate_same_server_id= OFF; +--error ER_INCORRECT_GLOBAL_LOCAL_VAR +SET @@SESSION.replicate_same_server_id= OFF; diff --git a/mysql-test/suite/sys_vars/t/show_slave_auth_info_basic.opt b/mysql-test/suite/sys_vars/t/show_slave_auth_info_basic.opt new file mode 100644 index 00000000000..209da1947fd --- /dev/null +++ b/mysql-test/suite/sys_vars/t/show_slave_auth_info_basic.opt @@ -0,0 +1 @@ +--show-slave-auth-info diff --git a/mysql-test/suite/sys_vars/t/show_slave_auth_info_basic.test b/mysql-test/suite/sys_vars/t/show_slave_auth_info_basic.test new file mode 100644 index 00000000000..7b887ba5dca --- /dev/null +++ b/mysql-test/suite/sys_vars/t/show_slave_auth_info_basic.test @@ -0,0 +1,19 @@ +--source include/not_embedded.inc +# MDEV-30189: Test minimal correctness of `@@show_slave_auth_info` itself + +--echo # GLOBAL scope +# Expect different from default (OFF) as configured by `.opt` +SELECT @@GLOBAL.show_slave_auth_info; +SELECT @@show_slave_auth_info; + +--echo # Not SESSION scope +--error ER_INCORRECT_GLOBAL_LOCAL_VAR +SELECT @@SESSION.show_slave_auth_info; + +--echo # Read-only +--error ER_INCORRECT_GLOBAL_LOCAL_VAR +SET @@show_slave_auth_info= OFF; +--error ER_INCORRECT_GLOBAL_LOCAL_VAR +SET @@GLOBAL.show_slave_auth_info= OFF; +--error ER_INCORRECT_GLOBAL_LOCAL_VAR +SET @@SESSION.show_slave_auth_info= OFF; diff --git a/sql/mysqld.cc b/sql/mysqld.cc index c0c1919ff06..9e843ff4ce2 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -6818,12 +6818,6 @@ struct my_option my_long_options[]= "more than one storage engine, when binary log is disabled)", &opt_tc_log_file, &opt_tc_log_file, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, - {"master-info-file", 0, - "The location and name of the file that remembers the master and where " - "the I/O replication thread is in the master's binlogs. Defaults to " - "master.info", - &master_info_file, &master_info_file, 0, GET_STR, - REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"master-retry-count", 0, "The number of tries the slave will make to connect to the master before giving up", &master_retry_count, &master_retry_count, 0, GET_ULONG, @@ -6874,14 +6868,6 @@ struct my_option my_long_options[]= "Updates to a database with a different name than the original. Example: " "replicate-rewrite-db=master_db_name->slave_db_name", 0, 0, 0, GET_STR | GET_ASK_ADDR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, -#ifdef HAVE_REPLICATION - {"replicate-same-server-id", 0, - "In replication, if set to 1, do not skip events having our server id. " - "Default value is 0 (to break infinite loops in circular replication). " - "Can't be set to 1 if --log-slave-updates is used", - &replicate_same_server_id, &replicate_same_server_id, - 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, -#endif {"replicate-wild-do-table", OPT_REPLICATE_WILD_DO_TABLE, "Tells the slave thread to restrict replication to the tables that match " "the specified wildcard pattern. To specify more than one table, use the " @@ -6904,10 +6890,6 @@ struct my_option my_long_options[]= "Don't allow new user creation by the user who has no write privileges to the mysql.user table", &opt_safe_user_create, &opt_safe_user_create, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, - {"show-slave-auth-info", 0, - "Show user and password in SHOW SLAVE HOSTS on this master", - &opt_show_slave_auth_info, &opt_show_slave_auth_info, 0, - GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, {"silent-startup", OPT_SILENT, "Don't print [Note] to the error log during startup", &opt_silent_startup, &opt_silent_startup, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, {"skip-host-cache", OPT_SKIP_HOST_CACHE, "Don't cache host names", 0, 0, 0, diff --git a/sql/sys_vars.cc b/sql/sys_vars.cc index 08b482f9487..f16b3dcc5e3 100644 --- a/sql/sys_vars.cc +++ b/sql/sys_vars.cc @@ -5306,6 +5306,12 @@ static Sys_var_uint Sys_repl_report_port( "to the slave. If not sure, leave this option unset", READ_ONLY GLOBAL_VAR(report_port), CMD_LINE(REQUIRED_ARG), VALID_RANGE(0, UINT_MAX), DEFAULT(0), BLOCK_SIZE(1)); + +static Sys_var_mybool Sys_show_slave_auth_info( + "show_slave_auth_info", + "Show user and password in SHOW SLAVE HOSTS on this master", + READ_ONLY GLOBAL_VAR(opt_show_slave_auth_info), CMD_LINE(OPT_ARG), + DEFAULT(FALSE)); #endif static Sys_var_mybool Sys_keep_files_on_create( @@ -5706,6 +5712,13 @@ static Sys_var_charptr_fscs Sys_relay_log_info_file( READ_ONLY GLOBAL_VAR(relay_log_info_file), CMD_LINE(REQUIRED_ARG), DEFAULT(0)); +static Sys_var_charptr_fscs Sys_master_info_file( + "master_info_file", "The location and name of the file that " + "remembers the master and where the I/O replication thread " + "is in the master's binlogs. Defaults to master.info", + READ_ONLY GLOBAL_VAR(master_info_file), CMD_LINE(REQUIRED_ARG), + DEFAULT(0)); + static Sys_var_on_access_global Sys_relay_log_purge( @@ -6979,6 +6992,14 @@ static Sys_var_mybool Sys_replicate_annotate_row_events( "to its own binary log. Ignored if log_slave_updates is not set", READ_ONLY GLOBAL_VAR(opt_replicate_annotate_row_events), CMD_LINE(OPT_ARG), DEFAULT(TRUE)); + +static Sys_var_mybool Sys_replicate_same_server_id( + "replicate_same_server_id", + "In replication, if set to 1, do not skip events having our server id. " + "Default value is 0 (to break infinite loops in circular replication). " + "Can't be set to 1 if --log-slave-updates is used", + READ_ONLY GLOBAL_VAR(replicate_same_server_id), + CMD_LINE(OPT_ARG), DEFAULT(FALSE)); #endif static Sys_var_ulonglong Sys_join_buffer_space_limit(