Skip to content

Commit 54538b4

Browse files
committed
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.
1 parent c0ebb3f commit 54538b4

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

sql/sys_vars.cc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4236,11 +4236,11 @@ static Sys_var_uint Sys_slave_net_timeout(
42364236
Return 0 + warning if it doesn't exist
42374237
*/
42384238

4239-
uint Sys_var_multi_source_ulong::
4240-
get_master_info_uint_value(THD *thd, ptrdiff_t offset)
4239+
ulong Sys_var_multi_source_ulong::
4240+
get_master_info_ulong_value(THD *thd, ptrdiff_t offset)
42414241
{
42424242
Master_info *mi;
4243-
uint res= 0; // Default value
4243+
ulong res= 0; // Default value
42444244
mysql_mutex_unlock(&LOCK_global_system_variables);
42454245
mysql_mutex_lock(&LOCK_active_mi);
42464246
mi= master_info_index->
@@ -4249,7 +4249,7 @@ get_master_info_uint_value(THD *thd, ptrdiff_t offset)
42494249
if (mi)
42504250
{
42514251
mysql_mutex_lock(&mi->rli.data_lock);
4252-
res= *((uint*) (((uchar*) mi) + master_info_offset));
4252+
res= *((ulong*) (((uchar*) mi) + master_info_offset));
42534253
mysql_mutex_unlock(&mi->rli.data_lock);
42544254
}
42554255
mysql_mutex_unlock(&LOCK_active_mi);

sql/sys_vars.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2012,7 +2012,7 @@ class Sys_var_multi_source_ulong :public Sys_var_ulong
20122012
ptrdiff_t off, size_t size,
20132013
CMD_LINE getopt,
20142014
ptrdiff_t master_info_offset_arg,
2015-
uint min_val, uint max_val, uint def_val,
2015+
ulong min_val, ulong max_val, ulong def_val,
20162016
uint block_size,
20172017
on_multi_source_update_function on_update_func)
20182018
:Sys_var_ulong(name_arg, comment, flag_args, off, size,
@@ -2024,7 +2024,7 @@ class Sys_var_multi_source_ulong :public Sys_var_ulong
20242024
}
20252025
bool session_update(THD *thd, set_var *var)
20262026
{
2027-
session_var(thd, uint)= (uint) (var->save_result.ulonglong_value);
2027+
session_var(thd, ulong)= (ulong) (var->save_result.ulonglong_value);
20282028
/* Value should be moved to multi_master in on_update_func */
20292029
return false;
20302030
}
@@ -2039,17 +2039,17 @@ class Sys_var_multi_source_ulong :public Sys_var_ulong
20392039
}
20402040
uchar *session_value_ptr(THD *thd,LEX_STRING *base)
20412041
{
2042-
uint *tmp, res;
2043-
tmp= (uint*) (((uchar*)&(thd->variables)) + offset);
2044-
res= get_master_info_uint_value(thd, master_info_offset);
2042+
ulong *tmp, res;
2043+
tmp= (ulong*) (((uchar*)&(thd->variables)) + offset);
2044+
res= get_master_info_ulong_value(thd, master_info_offset);
20452045
*tmp= res;
20462046
return (uchar*) tmp;
20472047
}
20482048
uchar *global_value_ptr(THD *thd, LEX_STRING *base)
20492049
{
20502050
return session_value_ptr(thd, base);
20512051
}
2052-
uint get_master_info_uint_value(THD *thd, ptrdiff_t offset);
2052+
ulong get_master_info_ulong_value(THD *thd, ptrdiff_t offset);
20532053
bool update_variable(THD *thd, Master_info *mi)
20542054
{
20552055
return update_multi_source_variable_func(this, thd, mi);

0 commit comments

Comments
 (0)