mirror of
https://github.com/MariaDB/server.git
synced 2025-08-08 11:22:35 +03:00
Bug#28234 - global/session scope - documentation vs implementation
Several system variables did not behave like system variables should do. When trying to SET them or use them in SELECT, they were reported as "unknown system variable". But they appeared in SHOW VARIABLES. This has been fixed by removing the "fixed_vars" array of variables and integrating the variables into the normal system variables chain. All of these variables do now behave as read-only global-only variables. Trying to SET them tells they are read-only, trying to SELECT the session value tells they are global only. Selecting the global value works. It delivers the same value as SHOW VARIABLES.
This commit is contained in:
@@ -1660,64 +1660,38 @@ public:
|
||||
|
||||
static sys_var_chain vars = { NULL, NULL };
|
||||
|
||||
static sys_var_const sys_log_slave_updates(&vars, "log_slave_updates",
|
||||
OPT_GLOBAL, SHOW_MY_BOOL,
|
||||
(uchar*) &opt_log_slave_updates);
|
||||
static sys_var_const sys_relay_log(&vars, "relay_log",
|
||||
OPT_GLOBAL, SHOW_CHAR_PTR,
|
||||
(uchar*) &opt_relay_logname);
|
||||
static sys_var_const sys_relay_log_index(&vars, "relay_log_index",
|
||||
OPT_GLOBAL, SHOW_CHAR_PTR,
|
||||
(uchar*) &opt_relaylog_index_name);
|
||||
static sys_var_const sys_relay_log_info_file(&vars, "relay_log_info_file",
|
||||
OPT_GLOBAL, SHOW_CHAR_PTR,
|
||||
(uchar*) &relay_log_info_file);
|
||||
static sys_var_bool_ptr sys_relay_log_purge(&vars, "relay_log_purge",
|
||||
&relay_log_purge);
|
||||
static sys_var_const sys_relay_log_space_limit(&vars,
|
||||
"relay_log_space_limit",
|
||||
OPT_GLOBAL, SHOW_LONGLONG,
|
||||
(uchar*)
|
||||
&relay_log_space_limit);
|
||||
static sys_var_const sys_slave_load_tmpdir(&vars, "slave_load_tmpdir",
|
||||
OPT_GLOBAL, SHOW_CHAR_PTR,
|
||||
(uchar*) &slave_load_tmpdir);
|
||||
static sys_var_long_ptr sys_slave_net_timeout(&vars, "slave_net_timeout",
|
||||
&slave_net_timeout);
|
||||
static sys_var_const sys_slave_skip_errors(&vars, "slave_skip_errors",
|
||||
OPT_GLOBAL, SHOW_CHAR,
|
||||
(uchar*) slave_skip_error_names);
|
||||
static sys_var_long_ptr sys_slave_trans_retries(&vars, "slave_transaction_retries",
|
||||
&slave_trans_retries);
|
||||
static sys_var_sync_binlog_period sys_sync_binlog_period(&vars, "sync_binlog", &sync_binlog_period);
|
||||
static sys_var_slave_skip_counter sys_slave_skip_counter(&vars, "sql_slave_skip_counter");
|
||||
|
||||
static int show_slave_skip_errors(THD *thd, SHOW_VAR *var, char *buff);
|
||||
|
||||
|
||||
static SHOW_VAR fixed_vars[]= {
|
||||
{"log_slave_updates", (char*) &opt_log_slave_updates, SHOW_MY_BOOL},
|
||||
{"relay_log" , (char*) &opt_relay_logname, SHOW_CHAR_PTR},
|
||||
{"relay_log_index", (char*) &opt_relaylog_index_name, SHOW_CHAR_PTR},
|
||||
{"relay_log_info_file", (char*) &relay_log_info_file, SHOW_CHAR_PTR},
|
||||
{"relay_log_space_limit", (char*) &relay_log_space_limit, SHOW_LONGLONG},
|
||||
{"slave_load_tmpdir", (char*) &slave_load_tmpdir, SHOW_CHAR_PTR},
|
||||
{"slave_skip_errors", (char*) &show_slave_skip_errors, SHOW_FUNC},
|
||||
};
|
||||
|
||||
static int show_slave_skip_errors(THD *thd, SHOW_VAR *var, char *buff)
|
||||
{
|
||||
var->type=SHOW_CHAR;
|
||||
var->value= buff;
|
||||
if (!use_slave_mask || bitmap_is_clear_all(&slave_error_mask))
|
||||
{
|
||||
var->value= const_cast<char *>("OFF");
|
||||
}
|
||||
else if (bitmap_is_set_all(&slave_error_mask))
|
||||
{
|
||||
var->value= const_cast<char *>("ALL");
|
||||
}
|
||||
else
|
||||
{
|
||||
/* 10 is enough assuming errors are max 4 digits */
|
||||
int i;
|
||||
var->value= buff;
|
||||
for (i= 1;
|
||||
i < MAX_SLAVE_ERROR &&
|
||||
(buff - var->value) < SHOW_VAR_FUNC_BUFF_SIZE;
|
||||
i++)
|
||||
{
|
||||
if (bitmap_is_set(&slave_error_mask, i))
|
||||
{
|
||||
buff= int10_to_str(i, buff, 10);
|
||||
*buff++= ',';
|
||||
}
|
||||
}
|
||||
if (var->value != buff)
|
||||
buff--; // Remove last ','
|
||||
if (i < MAX_SLAVE_ERROR)
|
||||
buff= strmov(buff, "..."); // Couldn't show all errors
|
||||
*buff=0;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool sys_var_slave_skip_counter::check(THD *thd, set_var *var)
|
||||
{
|
||||
@@ -1765,8 +1739,6 @@ bool sys_var_sync_binlog_period::update(THD *thd, set_var *var)
|
||||
|
||||
int init_replication_sys_vars()
|
||||
{
|
||||
mysql_append_static_vars(fixed_vars, sizeof(fixed_vars) / sizeof(SHOW_VAR));
|
||||
|
||||
if (mysql_add_sys_var_chain(vars.first, my_long_options))
|
||||
{
|
||||
/* should not happen */
|
||||
|
Reference in New Issue
Block a user