Skip to content

Commit c29e83f

Browse files
committed
MDEV-30189 Add remaining replication options as system variables
Promote the last few SQL-inaccessible replication options (command line or `mariadb.cnf`) as these GLOBAL read-only system variables: ``` @@master_info_file @@replicate_same_server_id @@show_slave_auth_info ``` Side effect: The latter two options changed from no argument to optional argument. Quote `include/my_getopt.h`: > It should be noted that for historical reasons variables with the > combination arg_type=NO_ARG, my_option::var_type=GET_BOOL still > accepts arguments. This is someone counter intuitive and care should > be taken if the code is refactored. Reviewed-by: Brandon Nesterenko <brandon.nesterenko@mariadb.com>
1 parent 74c189c commit c29e83f

12 files changed

+162
-18
lines changed
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# GLOBAL scope
2+
SELECT @@GLOBAL.master_info_file;
3+
@@GLOBAL.master_info_file
4+
30189.info
5+
SELECT @@master_info_file;
6+
@@master_info_file
7+
30189.info
8+
# Not SESSION scope
9+
SELECT @@SESSION.master_info_file;
10+
ERROR HY000: Variable 'master_info_file' is a GLOBAL variable
11+
# Read-only
12+
SET @@master_info_file= 'master.info';
13+
ERROR HY000: Variable 'master_info_file' is a read only variable
14+
SET @@GLOBAL.master_info_file= 'master.info';
15+
ERROR HY000: Variable 'master_info_file' is a read only variable
16+
SET @@SESSION.master_info_file= 'master.info';
17+
ERROR HY000: Variable 'master_info_file' is a read only variable
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# GLOBAL scope
2+
SELECT @@GLOBAL.replicate_same_server_id;
3+
@@GLOBAL.replicate_same_server_id
4+
1
5+
SELECT @@replicate_same_server_id;
6+
@@replicate_same_server_id
7+
1
8+
# Not SESSION scope
9+
SELECT @@SESSION.replicate_same_server_id;
10+
ERROR HY000: Variable 'replicate_same_server_id' is a GLOBAL variable
11+
# Read-only
12+
SET @@replicate_same_server_id= OFF;
13+
ERROR HY000: Variable 'replicate_same_server_id' is a read only variable
14+
SET @@GLOBAL.replicate_same_server_id= OFF;
15+
ERROR HY000: Variable 'replicate_same_server_id' is a read only variable
16+
SET @@SESSION.replicate_same_server_id= OFF;
17+
ERROR HY000: Variable 'replicate_same_server_id' is a read only variable
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# GLOBAL scope
2+
SELECT @@GLOBAL.show_slave_auth_info;
3+
@@GLOBAL.show_slave_auth_info
4+
1
5+
SELECT @@show_slave_auth_info;
6+
@@show_slave_auth_info
7+
1
8+
# Not SESSION scope
9+
SELECT @@SESSION.show_slave_auth_info;
10+
ERROR HY000: Variable 'show_slave_auth_info' is a GLOBAL variable
11+
# Read-only
12+
SET @@show_slave_auth_info= OFF;
13+
ERROR HY000: Variable 'show_slave_auth_info' is a read only variable
14+
SET @@GLOBAL.show_slave_auth_info= OFF;
15+
ERROR HY000: Variable 'show_slave_auth_info' is a read only variable
16+
SET @@SESSION.show_slave_auth_info= OFF;
17+
ERROR HY000: Variable 'show_slave_auth_info' is a read only variable

mysql-test/suite/sys_vars/r/sysvars_server_notembedded.result

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2072,6 +2072,16 @@ NUMERIC_BLOCK_SIZE NULL
20722072
ENUM_VALUE_LIST OFF,ON
20732073
READ_ONLY NO
20742074
COMMAND_LINE_ARGUMENT OPTIONAL
2075+
VARIABLE_NAME MASTER_INFO_FILE
2076+
VARIABLE_SCOPE GLOBAL
2077+
VARIABLE_TYPE VARCHAR
2078+
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
2079+
NUMERIC_MIN_VALUE NULL
2080+
NUMERIC_MAX_VALUE NULL
2081+
NUMERIC_BLOCK_SIZE NULL
2082+
ENUM_VALUE_LIST NULL
2083+
READ_ONLY YES
2084+
COMMAND_LINE_ARGUMENT REQUIRED
20752085
VARIABLE_NAME MASTER_VERIFY_CHECKSUM
20762086
VARIABLE_SCOPE GLOBAL
20772087
VARIABLE_TYPE BOOLEAN
@@ -3752,6 +3762,16 @@ NUMERIC_BLOCK_SIZE NULL
37523762
ENUM_VALUE_LIST NULL
37533763
READ_ONLY NO
37543764
COMMAND_LINE_ARGUMENT NULL
3765+
VARIABLE_NAME REPLICATE_SAME_SERVER_ID
3766+
VARIABLE_SCOPE GLOBAL
3767+
VARIABLE_TYPE BOOLEAN
3768+
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
3769+
NUMERIC_MIN_VALUE NULL
3770+
NUMERIC_MAX_VALUE NULL
3771+
NUMERIC_BLOCK_SIZE NULL
3772+
ENUM_VALUE_LIST OFF,ON
3773+
READ_ONLY YES
3774+
COMMAND_LINE_ARGUMENT OPTIONAL
37553775
VARIABLE_NAME REPLICATE_WILD_DO_TABLE
37563776
VARIABLE_SCOPE GLOBAL
37573777
VARIABLE_TYPE VARCHAR
@@ -4012,6 +4032,16 @@ NUMERIC_BLOCK_SIZE NULL
40124032
ENUM_VALUE_LIST OFF,STATE,CHARACTERISTICS
40134033
READ_ONLY NO
40144034
COMMAND_LINE_ARGUMENT REQUIRED
4035+
VARIABLE_NAME SHOW_SLAVE_AUTH_INFO
4036+
VARIABLE_SCOPE GLOBAL
4037+
VARIABLE_TYPE BOOLEAN
4038+
VARIABLE_COMMENT Show user and password in SHOW SLAVE HOSTS on this master
4039+
NUMERIC_MIN_VALUE NULL
4040+
NUMERIC_MAX_VALUE NULL
4041+
NUMERIC_BLOCK_SIZE NULL
4042+
ENUM_VALUE_LIST OFF,ON
4043+
READ_ONLY YES
4044+
COMMAND_LINE_ARGUMENT OPTIONAL
40154045
VARIABLE_NAME SKIP_EXTERNAL_LOCKING
40164046
VARIABLE_SCOPE GLOBAL
40174047
VARIABLE_TYPE BOOLEAN
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
--master-info-file='30189.info'
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
--source include/not_embedded.inc
2+
# MDEV-30189: Test minimal correctness of `@@master_info_file` itself
3+
4+
--echo # GLOBAL scope
5+
# Expect different from default ('master.info') as configured by `.opt`
6+
SELECT @@GLOBAL.master_info_file;
7+
SELECT @@master_info_file;
8+
9+
--echo # Not SESSION scope
10+
--error ER_INCORRECT_GLOBAL_LOCAL_VAR
11+
SELECT @@SESSION.master_info_file;
12+
13+
--echo # Read-only
14+
--error ER_INCORRECT_GLOBAL_LOCAL_VAR
15+
SET @@master_info_file= 'master.info';
16+
--error ER_INCORRECT_GLOBAL_LOCAL_VAR
17+
SET @@GLOBAL.master_info_file= 'master.info';
18+
--error ER_INCORRECT_GLOBAL_LOCAL_VAR
19+
SET @@SESSION.master_info_file= 'master.info';
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
--replicate-same-server-id
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
--source include/not_embedded.inc
2+
# MDEV-30189: Test minimal correctness of `@@replicate_same_server_id` itself
3+
4+
--echo # GLOBAL scope
5+
# Expect different from default (OFF) as configured by `.opt`
6+
SELECT @@GLOBAL.replicate_same_server_id;
7+
SELECT @@replicate_same_server_id;
8+
9+
--echo # Not SESSION scope
10+
--error ER_INCORRECT_GLOBAL_LOCAL_VAR
11+
SELECT @@SESSION.replicate_same_server_id;
12+
13+
--echo # Read-only
14+
--error ER_INCORRECT_GLOBAL_LOCAL_VAR
15+
SET @@replicate_same_server_id= OFF;
16+
--error ER_INCORRECT_GLOBAL_LOCAL_VAR
17+
SET @@GLOBAL.replicate_same_server_id= OFF;
18+
--error ER_INCORRECT_GLOBAL_LOCAL_VAR
19+
SET @@SESSION.replicate_same_server_id= OFF;
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
--show-slave-auth-info
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
--source include/not_embedded.inc
2+
# MDEV-30189: Test minimal correctness of `@@show_slave_auth_info` itself
3+
4+
--echo # GLOBAL scope
5+
# Expect different from default (OFF) as configured by `.opt`
6+
SELECT @@GLOBAL.show_slave_auth_info;
7+
SELECT @@show_slave_auth_info;
8+
9+
--echo # Not SESSION scope
10+
--error ER_INCORRECT_GLOBAL_LOCAL_VAR
11+
SELECT @@SESSION.show_slave_auth_info;
12+
13+
--echo # Read-only
14+
--error ER_INCORRECT_GLOBAL_LOCAL_VAR
15+
SET @@show_slave_auth_info= OFF;
16+
--error ER_INCORRECT_GLOBAL_LOCAL_VAR
17+
SET @@GLOBAL.show_slave_auth_info= OFF;
18+
--error ER_INCORRECT_GLOBAL_LOCAL_VAR
19+
SET @@SESSION.show_slave_auth_info= OFF;

0 commit comments

Comments
 (0)