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.
parent 4cf75083
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
--report-host=127.0.0.1 --report-user='my_user' --report-password='my_password' --report-port=9308
# 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
......@@ -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);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment