3351 Georgi Kodinov 2010-10-28
Bug #44355: Need system variable for --bind-address option
Added a system variable for the bind_address command line
option.
added:
mysql-test/suite/sys_vars/r/bind_address_basic.result
mysql-test/suite/sys_vars/t/bind_address_basic.test
modified:
sql/mysqld.cc
sql/mysqld.h
sql/sys_vars.cc
3350 Tor Didriksen 2010-11-01 [merge]
Merge trunk-bugfixing => next-mr-bugfixing
Text conflict in client/mysqlbinlog.cc
Text conflict in mysql-test/t/mysqlbinlog.test
modified:
client/mysqlbinlog.cc
mysql-test/r/ctype_binary.result
mysql-test/r/ctype_cp1251.result
mysql-test/r/ctype_latin1.result
mysql-test/r/ctype_ucs.result
mysql-test/r/ctype_utf8.result
mysql-test/r/func_time.result
mysql-test/r/mysqlbinlog.result
mysql-test/r/type_blob.result
mysql-test/t/func_time.test
mysql-test/t/mysqlbinlog.test
mysql-test/t/type_blob.test
sql/item_timefunc.h
sql/log_event.h
sql/sql_select.cc
storage/innobase/os/os0sync.c
=== added file 'mysql-test/suite/sys_vars/r/bind_address_basic.result'
--- a/mysql-test/suite/sys_vars/r/bind_address_basic.result 1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/sys_vars/r/bind_address_basic.result 2010-10-28 19:25:16 +0000
@@ -0,0 +1,53 @@
+'#---------------------BS_STVARS_001_01----------------------#'
+SELECT COUNT(@@GLOBAL.bind_address);
+COUNT(@@GLOBAL.bind_address)
+0
+0 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)
+0
+0 Expected
+'#---------------------BS_STVARS_001_03----------------------#'
+SELECT VARIABLE_VALUE = ''
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='bind_address';
+VARIABLE_VALUE = ''
+1
+1 Expected
+SELECT COUNT(@@GLOBAL.bind_address);
+COUNT(@@GLOBAL.bind_address)
+0
+0 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
+1
+1 Expected
+'#---------------------BS_STVARS_001_05----------------------#'
+SELECT COUNT(@@bind_address);
+COUNT(@@bind_address)
+0
+0 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)
+0
+0 Expected
+SELECT bind_address = @@SESSION.bind_address;
+ERROR 42S22: Unknown column 'bind_address' in 'field list'
+Expected error 'Readonly variable'
=== added file 'mysql-test/suite/sys_vars/t/bind_address_basic.test'
--- a/mysql-test/suite/sys_vars/t/bind_address_basic.test 1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/sys_vars/t/bind_address_basic.test 2010-10-28 19:25:16 +0000
@@ -0,0 +1,86 @@
+
+
+################## mysql-test\t\bind_address_basic.test ############################
+# #
+# Variable Name: bind_address #
+# Scope: Global #
+# Access Type: Static #
+# Data Type: filename #
+###############################################################################
+
+--echo '#---------------------BS_STVARS_001_01----------------------#'
+####################################################################
+# Displaying default value #
+####################################################################
+SELECT COUNT(@@GLOBAL.bind_address);
+--echo 0 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 0 Expected
+
+
+
+
+--echo '#---------------------BS_STVARS_001_03----------------------#'
+#################################################################
+# Check if the value in GLOBAL Table matches value in variable #
+#################################################################
+
+SELECT VARIABLE_VALUE = ''
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='bind_address';
+--echo 1 Expected
+
+SELECT COUNT(@@GLOBAL.bind_address);
+--echo 0 Expected
+
+SELECT COUNT(VARIABLE_VALUE)
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='bind_address';
+--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 1 Expected
+
+
+
+--echo '#---------------------BS_STVARS_001_05----------------------#'
+################################################################################
+# Check if bind_address can be accessed with and without @@ sign #
+################################################################################
+
+SELECT COUNT(@@bind_address);
+--echo 0 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 0 Expected
+
+--Error ER_BAD_FIELD_ERROR
+SELECT bind_address = @@SESSION.bind_address;
+--echo Expected error 'Readonly variable'
+
+
=== modified file 'sql/mysqld.cc'
--- a/sql/mysqld.cc 2010-10-27 14:46:44 +0000
+++ b/sql/mysqld.cc 2010-10-28 19:25:16 +0000
@@ -335,7 +335,7 @@ static char *default_character_set_name;
static char *character_set_filesystem_name;
static char *lc_messages;
static char *lc_time_names_name;
-static char *my_bind_addr_str;
+char *my_bind_addr_str;
static char *default_collation_name;
char *default_storage_engine;
static char compiled_default_collation_name[]= MYSQL_DEFAULT_COLLATION_NAME;
@@ -5837,9 +5837,6 @@ struct my_option my_long_options[]=
{"ansi", 'a', "Use ANSI SQL syntax instead of MySQL syntax. This mode "
"will also set transaction isolation level 'serializable'.", 0, 0, 0,
GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
- {"bind-address", OPT_BIND_ADDRESS, "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.",
=== modified file 'sql/mysqld.h'
--- a/sql/mysqld.h 2010-10-25 09:20:53 +0000
+++ b/sql/mysqld.h 2010-10-28 19:25:16 +0000
@@ -143,6 +143,7 @@ extern char *opt_backup_history_logname,
extern const char *log_output_str;
extern const char *log_backup_output_str;
extern char *mysql_home_ptr, *pidfile_name_ptr;
+extern char *my_bind_addr_str;
extern char glob_hostname[FN_REFLEN], mysql_home[FN_REFLEN];
extern char pidfile_name[FN_REFLEN], system_time_zone[30], *opt_init_file;
extern char default_logfile_name[FN_REFLEN];
=== modified file 'sql/sys_vars.cc'
--- a/sql/sys_vars.cc 2010-10-26 09:10:59 +0000
+++ b/sql/sys_vars.cc 2010-10-28 19:25:16 +0000
@@ -244,6 +244,11 @@ static Sys_var_charptr Sys_basedir(
READ_ONLY GLOBAL_VAR(mysql_home_ptr), CMD_LINE(REQUIRED_ARG, 'b'),
IN_FS_CHARSET, DEFAULT(0));
+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));
+
static bool fix_binlog_cache_size(sys_var *self, THD *thd, enum_var_type type)
{
check_binlog_cache_size(thd);
No bundle (reason: useless for push emails).
| Thread |
|---|
| • bzr push into mysql-next-mr-bugfixing branch (Georgi.Kodinov:3350 to 3351)Bug#44355 | Georgi Kodinov | 1 Nov |