MySQL Lists are EOL. Please join:

List:Commits« Previous MessageNext Message »
From:Ingo Struewing Date:December 16 2008 11:51am
Subject:bzr commit into mysql-6.0-backup branch (ingo.struewing:2740) Bug#39749
Bug#40808
View as plain text  
#At file:///home2/mydev/bzrroot/mysql-6.0-bug39749-2/ based on revid:jorgen.loland@stripped

 2740 Ingo Struewing	2008-12-16
      Bug#39749 - main.backup_timeout fails sporadically on OS X
      Bug#40808 - The backup_wait_timeout variable is not working
              on powermac platform
      
      backup_timeout.test failed on POWER processors. Due to word ordering
      within a long long variable, the code was not portable between
      different processor types.
      
      Fixed by reworking the implementation of sys_var_backup_wait_timeout.
      
      Re-enabled backup_timeout.test.
      
      Included are unrelated fixes to get rid of compiler warnings.
modified:
  mysql-test/suite/backup/t/disabled.def
  sql/mysql_priv.h
  sql/set_var.cc
  sql/sql_class.cc

per-file messages:
  mysql-test/suite/backup/t/disabled.def
    Bug#39749 - main.backup_timeout fails sporadically on OS X
    Bug#40808 - The backup_wait_timeout variable is not working
                on powermac platform
    Re-enabled backup_timeout.
  sql/mysql_priv.h
    Bug#39749 - main.backup_timeout fails sporadically on OS X
    Bug#40808 - The backup_wait_timeout variable is not working
                on powermac platform
    Fixed define syntax.
  sql/set_var.cc
    Bug#39749 - main.backup_timeout fails sporadically on OS X
    Bug#40808 - The backup_wait_timeout variable is not working
                on powermac platform
    Beautified and simplified sys_var_backup_wait_timeout.
    One of the simplifications removes unportable assignment to
    union.ulong and read from union.ulonglong.
    Changed ::update() to use ulonglong_value instead of ulong_value.
    Fixed a compiler warning about semicolon behind a for loop.
    Fixed two compiler warnings about assignment in if clause.
  sql/sql_class.cc
    Bug#39749 - main.backup_timeout fails sporadically on OS X
    Bug#40808 - The backup_wait_timeout variable is not working
                on powermac platform
    Changed numeric literal to constant.
=== modified file 'mysql-test/suite/backup/t/disabled.def'
--- a/mysql-test/suite/backup/t/disabled.def	2008-12-15 12:18:24 +0000
+++ b/mysql-test/suite/backup/t/disabled.def	2008-12-16 11:51:34 +0000
@@ -15,5 +15,4 @@ backup_triggers_and_events    : Bug#3776
 backup_no_data                : Bug#41008 2008-12-08 alik union.test does not cleanup
 backup_ddl_blocker            : Bug#41008 2008-12-08 alik union.test does not cleanup
 backup                        : Bug#40807 2008-11-18 hakank Test fails on big-endian architecture
-backup_timeout                : Bug#40808 2008-11-18 hakank Test fails on big-endian architecture
 backup_views                  : Bug#41360 2008-12-10 ingo Test fails after merge of main and backup trees

=== modified file 'sql/mysql_priv.h'
--- a/sql/mysql_priv.h	2008-12-08 11:29:15 +0000
+++ b/sql/mysql_priv.h	2008-12-16 11:51:34 +0000
@@ -634,7 +634,7 @@ extern void debug_sync(THD *thd, const c
 #define DEBUG_SYNC(_thd_, _sync_point_name_)    /* disabled DEBUG_SYNC */
 #endif /* defined(ENABLED_DEBUG_SYNC) */
 
-#define BACKUP_WAIT_TIMEOUT_DEFAULT 50;
+#define BACKUP_WAIT_TIMEOUT_DEFAULT 50
 
 /* BINLOG_DUMP options */
 

=== modified file 'sql/set_var.cc'
--- a/sql/set_var.cc	2008-12-10 11:39:22 +0000
+++ b/sql/set_var.cc	2008-12-16 11:51:34 +0000
@@ -3103,40 +3103,60 @@ bool sys_var_insert_id::update(THD *thd,
 
 
 /**
-  Get value.
+  Get value of backup_wait_timeout.
 
   Returns the value for the backup_wait_timeout session variable.
 
+  The variable is of type SHOW_LONG.
+
   @param[IN] thd    Thread object
-  @param[IN] type   Type of variable
-  @param[IN] base   Not used 
+  @param[IN] type   Type of variable (unused)
+  @param[IN] base   base name (unused)
 
-  @returns value of variable
+  @returns value of variable as address to ulong
 */
-uchar *sys_var_backup_wait_timeout::value_ptr(THD *thd, enum_var_type type,
-				   LEX_STRING *base)
+
+uchar *sys_var_backup_wait_timeout::value_ptr(THD *thd, enum_var_type type
+                                              __attribute__((unused)),
+                                              LEX_STRING *base
+                                              __attribute__((unused)))
 {
-  thd->sys_var_tmp.ulong_value= thd->backup_wait_timeout;
-  return (uchar*) &thd->sys_var_tmp.ulonglong_value;
+  return (uchar*) &thd->backup_wait_timeout;
 }
 
 
 /**
-  Update value.
+  Update value of backup_wait_timeout.
 
   Set the backup_wait_timeout variable.
 
+  The variable is of type SHOW_LONG.
+
   @param[IN] thd    Thread object
   @param[IN] var    Pointer to value from command.
 
   @returns 0
 */
+
 bool sys_var_backup_wait_timeout::update(THD *thd, set_var *var)
 {
-  if (var->save_result.ulong_value > (LONG_MAX/1000))
-    thd->backup_wait_timeout= LONG_MAX/1000;
+  /*
+    The default sys_var::check() method sets ulonglong_value.
+    This can corrupt other values on some platforms.
+    Since we don't redefine check() for backup_wait_timeout,
+    we need to use ulonglong_value. Since we assign to an ulong
+    variable, we better check the value and limit it.
+  */
+  if (var->save_result.ulonglong_value > ULONG_MAX)
+    thd->backup_wait_timeout= ULONG_MAX;
   else
-    thd->backup_wait_timeout= var->save_result.ulong_value;
+  {
+    /*
+      This cast is required for the Windows compiler. The assignment is
+      safe because we checked the range of the value above.
+    */
+    thd->backup_wait_timeout= (ulong) var->save_result.ulonglong_value;
+  }
   return 0;
 }
 
@@ -3144,16 +3164,16 @@ bool sys_var_backup_wait_timeout::update
 /**
   Set default value.
 
-  Set the backup_wait_timeout variable to the default value.
+  Set the backup_wait_timeout variable to their default value.
 
   @param[IN] thd    Thread object
-  @param[IN] type   Type of variable
-
-  @returns 0
+  @param[IN] type   Type of variable (unused)
 */
-void sys_var_backup_wait_timeout::set_default(THD *thd, enum_var_type type)
-{ 
-  thd->backup_wait_timeout= BACKUP_WAIT_TIMEOUT_DEFAULT; 
+
+void sys_var_backup_wait_timeout::set_default(THD *thd, enum_var_type type
+                                              __attribute__((unused)))
+{
+  thd->backup_wait_timeout= BACKUP_WAIT_TIMEOUT_DEFAULT;
 }
 
 
@@ -3750,7 +3770,7 @@ int set_var_init()
   uint count= 0;
   DBUG_ENTER("set_var_init");
   
-  for (sys_var *var=vars.first; var; var= var->next, count++);
+  for (sys_var *var=vars.first; var; var= var->next, count++) {}
 
   if (hash_init(&system_variable_hash, system_charset_info, count, 0,
                 0, (hash_get_key) get_sys_var_length, 0, HASH_UNIQUE))
@@ -4511,10 +4531,10 @@ bool sys_var_opt_readonly::update(THD *t
     can cause to wait on a read lock, it's required for the client application
     to unlock everything, and acceptable for the server to wait on all locks.
   */
-  if (result= close_cached_tables(thd, NULL, FALSE, TRUE))
+  if ((result= close_cached_tables(thd, NULL, FALSE, TRUE)))
     goto end_with_read_lock;
 
-  if (result= make_global_read_lock_block_commit(thd))
+  if ((result= make_global_read_lock_block_commit(thd)))
     goto end_with_read_lock;
 
   /* Change the opt_readonly system variable, safe because the lock is held */

=== modified file 'sql/sql_class.cc'
--- a/sql/sql_class.cc	2008-12-08 11:29:15 +0000
+++ b/sql/sql_class.cc	2008-12-16 11:51:34 +0000
@@ -421,7 +421,7 @@ THD::THD()
           when the DDL blocker is engaged.
   */
    DDL_exception(FALSE),
-   backup_wait_timeout(50),
+   backup_wait_timeout(BACKUP_WAIT_TIMEOUT_DEFAULT),
 #if defined(ENABLED_DEBUG_SYNC)
    debug_sync_control(0),
 #endif /* defined(ENABLED_DEBUG_SYNC) */

Thread
bzr commit into mysql-6.0-backup branch (ingo.struewing:2740) Bug#39749Bug#40808Ingo Struewing16 Dec