Commit 54538b48 authored by Sergey Vojtovich's avatar Sergey Vojtovich

MDEV-6459 - max_relay_log_size and sql_slave_skip_counter

            misbehave on PPC64

There was a mix of ulong and uint casts/variables which caused
incorrect value to be passed to/retrieved from max_relay_log_size
and sql_slave_skip_counter.

This mix failed to work on big-endian PPC64 where sizeof(int)= 4,
sizeof(long)= 8. E.g. session_var(thd, uint)= 1 will in fact store
0x100000000.
parent c0ebb3f3
......@@ -4236,11 +4236,11 @@ static Sys_var_uint Sys_slave_net_timeout(
Return 0 + warning if it doesn't exist
*/
uint Sys_var_multi_source_ulong::
get_master_info_uint_value(THD *thd, ptrdiff_t offset)
ulong Sys_var_multi_source_ulong::
get_master_info_ulong_value(THD *thd, ptrdiff_t offset)
{
Master_info *mi;
uint res= 0; // Default value
ulong res= 0; // Default value
mysql_mutex_unlock(&LOCK_global_system_variables);
mysql_mutex_lock(&LOCK_active_mi);
mi= master_info_index->
......@@ -4249,7 +4249,7 @@ get_master_info_uint_value(THD *thd, ptrdiff_t offset)
if (mi)
{
mysql_mutex_lock(&mi->rli.data_lock);
res= *((uint*) (((uchar*) mi) + master_info_offset));
res= *((ulong*) (((uchar*) mi) + master_info_offset));
mysql_mutex_unlock(&mi->rli.data_lock);
}
mysql_mutex_unlock(&LOCK_active_mi);
......
......@@ -2012,7 +2012,7 @@ public:
ptrdiff_t off, size_t size,
CMD_LINE getopt,
ptrdiff_t master_info_offset_arg,
uint min_val, uint max_val, uint def_val,
ulong min_val, ulong max_val, ulong def_val,
uint block_size,
on_multi_source_update_function on_update_func)
:Sys_var_ulong(name_arg, comment, flag_args, off, size,
......@@ -2024,7 +2024,7 @@ public:
}
bool session_update(THD *thd, set_var *var)
{
session_var(thd, uint)= (uint) (var->save_result.ulonglong_value);
session_var(thd, ulong)= (ulong) (var->save_result.ulonglong_value);
/* Value should be moved to multi_master in on_update_func */
return false;
}
......@@ -2039,9 +2039,9 @@ public:
}
uchar *session_value_ptr(THD *thd,LEX_STRING *base)
{
uint *tmp, res;
tmp= (uint*) (((uchar*)&(thd->variables)) + offset);
res= get_master_info_uint_value(thd, master_info_offset);
ulong *tmp, res;
tmp= (ulong*) (((uchar*)&(thd->variables)) + offset);
res= get_master_info_ulong_value(thd, master_info_offset);
*tmp= res;
return (uchar*) tmp;
}
......@@ -2049,7 +2049,7 @@ public:
{
return session_value_ptr(thd, base);
}
uint get_master_info_uint_value(THD *thd, ptrdiff_t offset);
ulong get_master_info_ulong_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