summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoraelkin/andrei@mysql1000.(none) <>2008-03-05 12:25:55 +0200
committeraelkin/andrei@mysql1000.(none) <>2008-03-05 12:25:55 +0200
commit0958a508f87878b78d7655afc4193721b0e9501e (patch)
tree5e221730040ead034ab7780ff584ba3ace233e03
parent4cf75083803bdc74680846518f3d59332ca8aa0e (diff)
downloadmariadb-git-0958a508f87878b78d7655afc4193721b0e9501e.tar.gz
Bug #28780 report_host is not available through SELECT @@report_host
There was no way to see if report-{host,port,user,password} were set up. Fixed with introducing new global variables. The variables are made read-only because of a possible need to change them most probably require the slave server restart. Todo: transform the startup options to be CHANGE master parameters - i.e to deprecate `report-' options, and to change the new vars to be updatable at time of CHANGE master executes with new values.
-rw-r--r--mysql-test/suite/rpl/r/rpl_report.result27
-rw-r--r--mysql-test/suite/rpl/t/rpl_report-slave.opt2
-rw-r--r--mysql-test/suite/rpl/t/rpl_report.test18
-rw-r--r--sql/set_var.cc13
4 files changed, 60 insertions, 0 deletions
diff --git a/mysql-test/suite/rpl/r/rpl_report.result b/mysql-test/suite/rpl/r/rpl_report.result
new file mode 100644
index 00000000000..cc9c989dc80
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_report.result
@@ -0,0 +1,27 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+select * from Information_schema.GLOBAL_VARIABLES where variable_name regexp 'report_\(host\|port\|user\|password\)';
+VARIABLE_NAME VARIABLE_VALUE
+REPORT_HOST 127.0.0.1
+REPORT_PORT 9308
+REPORT_PASSWORD my_password
+REPORT_USER my_user
+show global variables like 'report_host';
+Variable_name Value
+report_host 127.0.0.1
+show global variables like 'report_port';
+Variable_name Value
+report_port 9308
+show global variables like 'report_user';
+Variable_name Value
+report_user my_user
+show global variables like 'report_password';
+Variable_name Value
+report_password my_password
+set @@global.report_host='my.new.address.net';
+ERROR HY000: Variable 'report_host' is a read only variable
+end of tests
diff --git a/mysql-test/suite/rpl/t/rpl_report-slave.opt b/mysql-test/suite/rpl/t/rpl_report-slave.opt
new file mode 100644
index 00000000000..123e5c272b9
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_report-slave.opt
@@ -0,0 +1,2 @@
+--report-host=127.0.0.1 --report-user='my_user' --report-password='my_password' --report-port=9308
+
diff --git a/mysql-test/suite/rpl/t/rpl_report.test b/mysql-test/suite/rpl/t/rpl_report.test
new file mode 100644
index 00000000000..ae7eea26d89
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_report.test
@@ -0,0 +1,18 @@
+# Verify that mysqld init time --report-{host,port,user,password} parameters
+# are SHOW-able and SELECT-able FROM INFORMATION_SCHEMA.global_variables
+
+source include/master-slave.inc;
+
+connection slave;
+select * from Information_schema.GLOBAL_VARIABLES where variable_name regexp 'report_\(host\|port\|user\|password\)';
+show global variables like 'report_host';
+show global variables like 'report_port';
+show global variables like 'report_user';
+show global variables like 'report_password';
+
+# to demonstrate that report global variables are read-only
+error ER_INCORRECT_GLOBAL_LOCAL_VAR;
+set @@global.report_host='my.new.address.net';
+
+
+--echo end of tests
diff --git a/sql/set_var.cc b/sql/set_var.cc
index 410608f154f..d44bfe4ae47 100644
--- a/sql/set_var.cc
+++ b/sql/set_var.cc
@@ -648,6 +648,19 @@ sys_var_thd_time_zone sys_time_zone(&vars, "time_zone");
/* Global read-only variable containing hostname */
static sys_var_const_str sys_hostname(&vars, "hostname", glob_hostname);
+static sys_var_const_str_ptr sys_repl_report_host(&vars, "report_host", &report_host);
+static sys_var_const_str_ptr sys_repl_report_user(&vars, "report_user", &report_user);
+static sys_var_const_str_ptr sys_repl_report_password(&vars, "report_password", &report_password);
+
+static uchar *slave_get_report_port(THD *thd)
+{
+ thd->sys_var_tmp.long_value= report_port;
+ return (uchar*) &thd->sys_var_tmp.long_value;
+}
+
+static sys_var_readonly sys_repl_report_port(&vars, "report_port", OPT_GLOBAL, SHOW_INT, slave_get_report_port);
+
+
sys_var_thd_bool sys_keep_files_on_create(&vars, "keep_files_on_create",
&SV::keep_files_on_create);