mirror of
https://github.com/MariaDB/server.git
synced 2025-08-01 03:47:19 +03:00
MDEV-12542 Add bind_address system variable.
bind_address variable added.
This commit is contained in:
57
mysql-test/suite/sys_vars/r/bind_address_basic.result
Normal file
57
mysql-test/suite/sys_vars/r/bind_address_basic.result
Normal file
@ -0,0 +1,57 @@
|
||||
'#---------------------BS_STVARS_001_01----------------------#'
|
||||
SELECT COUNT(@@GLOBAL.bind_address);
|
||||
COUNT(@@GLOBAL.bind_address)
|
||||
1
|
||||
1 Expected
|
||||
'#---------------------BS_STVARS_001_02----------------------#'
|
||||
SET @@GLOBAL.bind_address=1;
|
||||
ERROR HY000: Variable 'bind_address' is a read only variable
|
||||
Expected error 'Read only variable'
|
||||
SELECT COUNT(@@GLOBAL.bind_address);
|
||||
COUNT(@@GLOBAL.bind_address)
|
||||
1
|
||||
1 Expected
|
||||
'#---------------------BS_STVARS_001_03----------------------#'
|
||||
SELECT VARIABLE_VALUE = ''
|
||||
FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
|
||||
WHERE VARIABLE_NAME='bind_address';
|
||||
VARIABLE_VALUE = ''
|
||||
0
|
||||
0 Expected
|
||||
SELECT COUNT(@@GLOBAL.bind_address);
|
||||
COUNT(@@GLOBAL.bind_address)
|
||||
1
|
||||
1 Expected
|
||||
SELECT COUNT(VARIABLE_VALUE)
|
||||
FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
|
||||
WHERE VARIABLE_NAME='bind_address';
|
||||
COUNT(VARIABLE_VALUE)
|
||||
1
|
||||
1 Expected
|
||||
'#---------------------BS_STVARS_001_04----------------------#'
|
||||
SELECT @@bind_address is NULL AND @@GLOBAL.bind_address is NULL;
|
||||
@@bind_address is NULL AND @@GLOBAL.bind_address is NULL
|
||||
0
|
||||
0 Expected
|
||||
SELECT @@bind_address is NOT NULL AND @@GLOBAL.bind_address is NOT NULL;
|
||||
@@bind_address is NOT NULL AND @@GLOBAL.bind_address is NOT NULL
|
||||
1
|
||||
1 Expected
|
||||
'#---------------------BS_STVARS_001_05----------------------#'
|
||||
SELECT COUNT(@@bind_address);
|
||||
COUNT(@@bind_address)
|
||||
1
|
||||
1 Expected
|
||||
SELECT COUNT(@@local.bind_address);
|
||||
ERROR HY000: Variable 'bind_address' is a GLOBAL variable
|
||||
Expected error 'Variable is a GLOBAL variable'
|
||||
SELECT COUNT(@@SESSION.bind_address);
|
||||
ERROR HY000: Variable 'bind_address' is a GLOBAL variable
|
||||
Expected error 'Variable is a GLOBAL variable'
|
||||
SELECT COUNT(@@GLOBAL.bind_address);
|
||||
COUNT(@@GLOBAL.bind_address)
|
||||
1
|
||||
1 Expected
|
||||
SELECT bind_address = @@SESSION.bind_address;
|
||||
ERROR 42S22: Unknown column 'bind_address' in 'field list'
|
||||
Expected error 'Readonly variable'
|
@ -122,6 +122,20 @@ NUMERIC_BLOCK_SIZE NULL
|
||||
ENUM_VALUE_LIST OFF,ON
|
||||
READ_ONLY NO
|
||||
COMMAND_LINE_ARGUMENT OPTIONAL
|
||||
VARIABLE_NAME BIND_ADDRESS
|
||||
SESSION_VALUE NULL
|
||||
GLOBAL_VALUE 127.0.0.1
|
||||
GLOBAL_VALUE_ORIGIN CONFIG
|
||||
DEFAULT_VALUE
|
||||
VARIABLE_SCOPE GLOBAL
|
||||
VARIABLE_TYPE VARCHAR
|
||||
VARIABLE_COMMENT IP address to bind to.
|
||||
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 BINLOG_ANNOTATE_ROW_EVENTS
|
||||
SESSION_VALUE ON
|
||||
GLOBAL_VALUE ON
|
||||
|
95
mysql-test/suite/sys_vars/t/bind_address_basic.test
Normal file
95
mysql-test/suite/sys_vars/t/bind_address_basic.test
Normal file
@ -0,0 +1,95 @@
|
||||
|
||||
|
||||
################## mysql-test\t\bind_address_basic.test ############################
|
||||
# #
|
||||
# Variable Name: bind_address #
|
||||
# Scope: Global #
|
||||
# Access Type: Static #
|
||||
# Data Type: filename #
|
||||
###############################################################################
|
||||
|
||||
--source include/not_embedded.inc
|
||||
|
||||
--echo '#---------------------BS_STVARS_001_01----------------------#'
|
||||
####################################################################
|
||||
# Displaying default value #
|
||||
####################################################################
|
||||
SELECT COUNT(@@GLOBAL.bind_address);
|
||||
--echo 1 Expected
|
||||
|
||||
|
||||
--echo '#---------------------BS_STVARS_001_02----------------------#'
|
||||
####################################################################
|
||||
# Check if Value can set #
|
||||
####################################################################
|
||||
|
||||
--error ER_INCORRECT_GLOBAL_LOCAL_VAR
|
||||
SET @@GLOBAL.bind_address=1;
|
||||
--echo Expected error 'Read only variable'
|
||||
|
||||
SELECT COUNT(@@GLOBAL.bind_address);
|
||||
--echo 1 Expected
|
||||
|
||||
|
||||
|
||||
|
||||
--echo '#---------------------BS_STVARS_001_03----------------------#'
|
||||
#################################################################
|
||||
# Check if the value in GLOBAL Table matches value in variable #
|
||||
#################################################################
|
||||
|
||||
--disable_warnings
|
||||
SELECT VARIABLE_VALUE = ''
|
||||
FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
|
||||
WHERE VARIABLE_NAME='bind_address';
|
||||
--enable_warnings
|
||||
--echo 0 Expected
|
||||
|
||||
SELECT COUNT(@@GLOBAL.bind_address);
|
||||
--echo 1 Expected
|
||||
|
||||
--disable_warnings
|
||||
SELECT COUNT(VARIABLE_VALUE)
|
||||
FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
|
||||
WHERE VARIABLE_NAME='bind_address';
|
||||
--enable_warnings
|
||||
--echo 1 Expected
|
||||
|
||||
|
||||
|
||||
--echo '#---------------------BS_STVARS_001_04----------------------#'
|
||||
################################################################################
|
||||
# Check if accessing variable with and without GLOBAL point to same variable #
|
||||
################################################################################
|
||||
SELECT @@bind_address is NULL AND @@GLOBAL.bind_address is NULL;
|
||||
--echo 0 Expected
|
||||
|
||||
SELECT @@bind_address is NOT NULL AND @@GLOBAL.bind_address is NOT NULL;
|
||||
--echo 1 Expected
|
||||
|
||||
|
||||
|
||||
--echo '#---------------------BS_STVARS_001_05----------------------#'
|
||||
################################################################################
|
||||
# Check if bind_address can be accessed with and without @@ sign #
|
||||
################################################################################
|
||||
|
||||
SELECT COUNT(@@bind_address);
|
||||
--echo 1 Expected
|
||||
|
||||
--Error ER_INCORRECT_GLOBAL_LOCAL_VAR
|
||||
SELECT COUNT(@@local.bind_address);
|
||||
--echo Expected error 'Variable is a GLOBAL variable'
|
||||
|
||||
--Error ER_INCORRECT_GLOBAL_LOCAL_VAR
|
||||
SELECT COUNT(@@SESSION.bind_address);
|
||||
--echo Expected error 'Variable is a GLOBAL variable'
|
||||
|
||||
SELECT COUNT(@@GLOBAL.bind_address);
|
||||
--echo 1 Expected
|
||||
|
||||
--Error ER_BAD_FIELD_ERROR
|
||||
SELECT bind_address = @@SESSION.bind_address;
|
||||
--echo Expected error 'Readonly variable'
|
||||
|
||||
|
@ -7297,9 +7297,6 @@ struct my_option my_long_options[]=
|
||||
{"autocommit", 0, "Set default value for autocommit (0 or 1)",
|
||||
&opt_autocommit, &opt_autocommit, 0,
|
||||
GET_BOOL, OPT_ARG, 1, 0, 0, 0, 0, NULL},
|
||||
{"bind-address", 0, "IP address to bind to.",
|
||||
&my_bind_addr_str, &my_bind_addr_str, 0, GET_STR,
|
||||
REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
|
||||
{"binlog-do-db", OPT_BINLOG_DO_DB,
|
||||
"Tells the master it should log updates for the specified database, "
|
||||
"and exclude all others not explicitly mentioned.",
|
||||
|
@ -152,6 +152,7 @@ extern my_bool opt_enable_shared_memory;
|
||||
extern ulong opt_replicate_events_marked_for_skip;
|
||||
extern char *default_tz_name;
|
||||
extern Time_zone *default_tz;
|
||||
extern char *my_bind_addr_str;
|
||||
extern char *default_storage_engine, *default_tmp_storage_engine;
|
||||
extern char *enforced_storage_engine;
|
||||
extern char *gtid_pos_auto_engines;
|
||||
|
@ -382,6 +382,13 @@ static Sys_var_charptr Sys_basedir(
|
||||
READ_ONLY GLOBAL_VAR(mysql_home_ptr), CMD_LINE(REQUIRED_ARG, 'b'),
|
||||
IN_FS_CHARSET, DEFAULT(0));
|
||||
|
||||
#ifndef EMBEDDED_LIBRARY
|
||||
static Sys_var_charptr Sys_my_bind_addr(
|
||||
"bind_address", "IP address to bind to.",
|
||||
READ_ONLY GLOBAL_VAR(my_bind_addr_str), CMD_LINE(REQUIRED_ARG),
|
||||
IN_FS_CHARSET, DEFAULT(0));
|
||||
#endif
|
||||
|
||||
static Sys_var_ulonglong Sys_binlog_cache_size(
|
||||
"binlog_cache_size", "The size of the transactional cache for "
|
||||
"updates to transactional engines for the binary log. "
|
||||
|
Reference in New Issue
Block a user