Commit 30d78605 authored by Sergei Golubchik's avatar Sergei Golubchik

MDEV-6459 max_relay_log_size and sql_slave_skip_counter misbehave on PPC64

make slave_skip_counter and max_relay_log_size ulonglong
(sysvars should generally never be ulong)
parent b2c54a9a
......@@ -251,10 +251,11 @@ class Relay_log_info : public Slave_reporting_capability
errors, and have been manually applied by DBA already.
Must be ulong as it's refered to from set_var.cc
*/
volatile ulong slave_skip_counter;
volatile ulonglong slave_skip_counter;
ulonglong max_relay_log_size;
volatile ulong abort_pos_wait; /* Incremented on change master */
volatile ulong slave_run_id; /* Incremented on slave start */
ulong max_relay_log_size;
mysql_mutex_t log_space_lock;
mysql_cond_t log_space_cond;
/*
......
......@@ -519,6 +519,14 @@ typedef struct system_variables
ulonglong sortbuff_size;
ulonglong group_concat_max_len;
ulonglong default_regex_flags;
/**
Place holders to store Multi-source variables in sys_var.cc during
update and show of variables.
*/
ulonglong slave_skip_counter;
ulonglong max_relay_log_size;
ha_rows select_limit;
ha_rows max_join_size;
ha_rows expensive_subquery_limit;
......@@ -587,12 +595,6 @@ typedef struct system_variables
*/
uint32 gtid_domain_id;
uint64 gtid_seq_no;
/**
Place holders to store Multi-source variables in sys_var.cc during
update and show of variables.
*/
ulong slave_skip_counter;
ulong max_relay_log_size;
/**
Default transaction access mode. READ ONLY (true) or READ WRITE (false).
......
......@@ -4248,11 +4248,11 @@ static Sys_var_uint Sys_slave_net_timeout(
Return 0 + warning if it doesn't exist
*/
ulong Sys_var_multi_source_ulong::
get_master_info_ulong_value(THD *thd, ptrdiff_t offset)
ulonglong Sys_var_multi_source_ulonglong::
get_master_info_ulonglong_value(THD *thd, ptrdiff_t offset)
{
Master_info *mi;
ulong res= 0; // Default value
ulonglong res= 0; // Default value
mysql_mutex_unlock(&LOCK_global_system_variables);
mysql_mutex_lock(&LOCK_active_mi);
mi= master_info_index->
......@@ -4261,7 +4261,7 @@ get_master_info_ulong_value(THD *thd, ptrdiff_t offset)
if (mi)
{
mysql_mutex_lock(&mi->rli.data_lock);
res= *((ulong*) (((uchar*) mi) + master_info_offset));
res= *((ulonglong*) (((uchar*) mi) + master_info_offset));
mysql_mutex_unlock(&mi->rli.data_lock);
}
mysql_mutex_unlock(&LOCK_active_mi);
......@@ -4273,7 +4273,7 @@ get_master_info_ulong_value(THD *thd, ptrdiff_t offset)
bool update_multi_source_variable(sys_var *self_var, THD *thd,
enum_var_type type)
{
Sys_var_multi_source_ulong *self= (Sys_var_multi_source_ulong*) self_var;
Sys_var_multi_source_ulonglong *self= (Sys_var_multi_source_ulonglong*) self_var;
bool result= true;
Master_info *mi;
......@@ -4310,17 +4310,13 @@ static bool update_slave_skip_counter(sys_var *self, THD *thd, Master_info *mi)
return false;
}
static Sys_var_multi_source_ulong
Sys_slave_skip_counter("sql_slave_skip_counter",
"Skip the next N events from the master log",
SESSION_VAR(slave_skip_counter),
NO_CMD_LINE,
my_offsetof(Master_info, rli.slave_skip_counter),
static Sys_var_multi_source_ulonglong Sys_slave_skip_counter(
"sql_slave_skip_counter", "Skip the next N events from the master log",
SESSION_VAR(slave_skip_counter), NO_CMD_LINE,
MASTER_INFO_VAR(rli.slave_skip_counter),
VALID_RANGE(0, UINT_MAX), DEFAULT(0), BLOCK_SIZE(1),
ON_UPDATE(update_slave_skip_counter));
static bool update_max_relay_log_size(sys_var *self, THD *thd, Master_info *mi)
{
mi->rli.max_relay_log_size= thd->variables.max_relay_log_size;
......@@ -4328,16 +4324,13 @@ static bool update_max_relay_log_size(sys_var *self, THD *thd, Master_info *mi)
return false;
}
static Sys_var_multi_source_ulong
Sys_max_relay_log_size( "max_relay_log_size",
"relay log will be rotated automatically when the "
"size exceeds this value. If 0 are startup, it's "
"set to max_binlog_size",
SESSION_VAR(max_relay_log_size),
CMD_LINE(REQUIRED_ARG),
my_offsetof(Master_info, rli.max_relay_log_size),
VALID_RANGE(0, 1024L*1024*1024), DEFAULT(0),
BLOCK_SIZE(IO_SIZE),
static Sys_var_multi_source_ulonglong Sys_max_relay_log_size(
"max_relay_log_size",
"relay log will be rotated automatically when the size exceeds this "
"value. If 0 are startup, it's set to max_binlog_size",
SESSION_VAR(max_relay_log_size), CMD_LINE(REQUIRED_ARG),
MASTER_INFO_VAR(rli.max_relay_log_size),
VALID_RANGE(0, 1024L*1024*1024), DEFAULT(0), BLOCK_SIZE(IO_SIZE),
ON_UPDATE(update_max_relay_log_size));
static Sys_var_charptr Sys_slave_skip_errors(
......
......@@ -1993,7 +1993,8 @@ class Sys_var_replicate_events_marked_for_skip: public Sys_var_enum
like sql_slave_skip_counter are GLOBAL.
*/
class Sys_var_multi_source_ulong;
#define MASTER_INFO_VAR(X) my_offsetof(Master_info, X), sizeof(((Master_info *)0x10)->X)
class Sys_var_multi_source_ulonglong;
class Master_info;
typedef bool (*on_multi_source_update_function)(sys_var *self, THD *thd,
......@@ -2002,31 +2003,27 @@ bool update_multi_source_variable(sys_var *self,
THD *thd, enum_var_type type);
class Sys_var_multi_source_ulong :public Sys_var_ulong
class Sys_var_multi_source_ulonglong :public Sys_var_ulonglong
{
ptrdiff_t master_info_offset;
on_multi_source_update_function update_multi_source_variable_func;
public:
Sys_var_multi_source_ulong(const char *name_arg,
Sys_var_multi_source_ulonglong(const char *name_arg,
const char *comment, int flag_args,
ptrdiff_t off, size_t size,
CMD_LINE getopt,
ptrdiff_t master_info_offset_arg,
ulong min_val, ulong max_val, ulong def_val,
uint block_size,
size_t master_info_arg_size,
ulonglong min_val, ulonglong max_val,
ulonglong def_val, uint block_size,
on_multi_source_update_function on_update_func)
:Sys_var_ulong(name_arg, comment, flag_args, off, size,
:Sys_var_ulonglong(name_arg, comment, flag_args, off, size,
getopt, min_val, max_val, def_val, block_size,
0, VARIABLE_NOT_IN_BINLOG, 0, update_multi_source_variable),
master_info_offset(master_info_offset_arg),
update_multi_source_variable_func(on_update_func)
{
}
bool session_update(THD *thd, set_var *var)
{
session_var(thd, ulong)= (ulong) (var->save_result.ulonglong_value);
/* Value should be moved to multi_master in on_update_func */
return false;
SYSVAR_ASSERT(master_info_arg_size == size);
}
bool global_update(THD *thd, set_var *var)
{
......@@ -2039,9 +2036,9 @@ class Sys_var_multi_source_ulong :public Sys_var_ulong
}
uchar *session_value_ptr(THD *thd,LEX_STRING *base)
{
ulong *tmp, res;
tmp= (ulong*) (((uchar*)&(thd->variables)) + offset);
res= get_master_info_ulong_value(thd, master_info_offset);
ulonglong *tmp, res;
tmp= (ulonglong*) (((uchar*)&(thd->variables)) + offset);
res= get_master_info_ulonglong_value(thd, master_info_offset);
*tmp= res;
return (uchar*) tmp;
}
......@@ -2049,7 +2046,7 @@ class Sys_var_multi_source_ulong :public Sys_var_ulong
{
return session_value_ptr(thd, base);
}
ulong get_master_info_ulong_value(THD *thd, ptrdiff_t offset);
ulonglong get_master_info_ulonglong_value(THD *thd, ptrdiff_t offset);
bool update_variable(THD *thd, Master_info *mi)
{
return update_multi_source_variable_func(this, thd, mi);
......
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