[Commits] Rev 4293: MDEV-6459 - max_relay_log_size and sql_slave_skip_counter in lp:maria/10.0

Sergey Vojtovich svoj at mariadb.org
Fri Jul 18 18:45:30 EEST 2014


At lp:maria/10.0

------------------------------------------------------------
revno: 4293
revision-id: svoj at mariadb.org-20140718154521-mwoz6ezimga0axcj
parent: svoj at mariadb.org-20140718111625-uch1ssbh8kf6i4ib
committer: Sergey Vojtovich <svoj at mariadb.org>
branch nick: 10.0
timestamp: Fri 2014-07-18 19:45:21 +0400
message:
  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.
=== modified file 'sql/sys_vars.cc'
--- a/sql/sys_vars.cc	2014-06-25 13:24:11 +0000
+++ b/sql/sys_vars.cc	2014-07-18 15:45:21 +0000
@@ -4236,11 +4236,11 @@ static Sys_var_uint Sys_slave_net_timeou
   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, ptr
   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);    

=== modified file 'sql/sys_vars.h'
--- a/sql/sys_vars.h	2014-02-10 14:12:17 +0000
+++ b/sql/sys_vars.h	2014-07-18 15:45:21 +0000
@@ -2012,7 +2012,7 @@ class Sys_var_multi_source_ulong :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 @@ class Sys_var_multi_source_ulong :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 @@ class Sys_var_multi_source_ulong :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 @@ class Sys_var_multi_source_ulong :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);



More information about the commits mailing list