Bug #40808 The backup_wait_timeout variable is not working on powermac platform
Submitted: 18 Nov 2008 1:48 Modified: 2 Feb 2009 17:23
Reporter: Chuck Bell Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Backup Severity:S3 (Non-critical)
Version:6.0, 6.0-falcon tree OS:Mac OS X (powermacg5)
Assigned to: Ingo Strüwing CPU Architecture:Any

[18 Nov 2008 1:48] Chuck Bell
Description:
The variable backup_wait_timeout is not getting set correctly in the code. This can be seen in the test run:

 SET backup_wait_timeout = 1;
 SHOW VARIABLES LIKE 'backup_wait%';
 Variable_name  Value
-backup_wait_timeout    1
+backup_wait_timeout    0
 con2: Try a ddl operation and watch it expire
 CREATE TABLE bup_ddl_blocker.t2 (col_a CHAR(40)) ENGINE=MEMORY;
 ERROR HY000: The backup wait timeout has expired for query 'CREATE TABLE bup_dd
l_blocker.t2 (col_a CHAR(40)) ENGINE=MEMORY'.
@@ -43,10 +43,10 @@
 con2: Try a ddl operation and it should expire
 CREATE TABLE bup_ddl_blocker.t3 (col_a CHAR(40)) ENGINE=MEMORY;
 ERROR HY000: The backup wait timeout has expired for query 'CREATE TABLE bup_dd
l_blocker.t3 (col_a CHAR(40)) ENGINE=MEMORY'.
-SET backup_wait_timeout = 100;
+SET backup_wait_timeout = DEFAULT;
 SHOW VARIABLES LIKE 'backup_wait%';
 Variable_name  Value
-backup_wait_timeout    100
+backup_wait_timeout    50
 con3: Try a ddl operation and it should not expire
 CREATE TABLE bup_ddl_blocker.t3 (col_a CHAR(40)) ENGINE=MEMORY;
 release the lock.
@@ -65,7 +65,7 @@
 SET backup_wait_timeout = 1;
 SHOW VARIABLES LIKE 'backup_wait%';
 Variable_name  Value
-backup_wait_timeout    1
+backup_wait_timeout    0
 SET backup_wait_timeout = DEFAULT;
 SHOW VARIABLES LIKE 'backup_wait%';
 Variable_name  Value

The problem can also be seen if you add dump statement such as the following to the update method in set_var.cc:

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;
  else
    thd->backup_wait_timeout= var->save_result.ulong_value;
  printf("val=%d ", var->save_result.ulong_value);
    printf ("bwt=%d\n", thd->backup_wait_timeout);

  return 0;
}

This generates this output in master.err:

val=0 bwt=0
val=0 bwt=0
val=0 bwt=0

However, the equivalent run on Windows generates this output in master.err:

val=1 bwt=1
val=0 bwt=0
val=100 bwt=100

How to repeat:
Apply this patch first:
--- mysql-test/suite/backup/t/backup_timeout.test	2008-10-07 17:15:44 +0000
+++ mysql-test/suite/backup/t/backup_timeout.test	2008-11-18 01:43:39 +0000
@@ -120,7 +120,7 @@
 
 connection con3;
 
-SET backup_wait_timeout = 100;
+SET backup_wait_timeout = DEFAULT;
 SHOW VARIABLES LIKE 'backup_wait%';
 
 --echo con3: Try a ddl operation and it should not expire

then...

./mysql-test-run.pl backup_timeout
[18 Nov 2008 2:41] Chuck Bell
Test failure can be seen in mysql-6.0-falcon tree.
[19 Nov 2008 10:26] Sveta Smirnova
Thank you for the report.

Verified as described.
[4 Dec 2008 13:16] Ingo Strüwing
Taking this one as it probably has the same cause as Bug#39749 (main.backup_timeout fails sporadically on OS X).
[4 Dec 2008 13:26] Øystein Grøvlen
Thanks for taking this Ingo.  I see that in disabled.def, Hankan blaims the failure on big-endian architectures.  However, I have not been able to reproduce this on Solaris Sparc.
[4 Dec 2008 19:40] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/60649

2737 Ingo Struewing	2008-12-04
      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.
[5 Dec 2008 20:31] Chuck Bell
Patch approved. Did not test on powermacg5, but patch looks good for the problem statements.
[5 Dec 2008 20:54] Ingo Strüwing
Sorry, the patch doesn't work on sparc. Working on a new one.
[5 Dec 2008 21:38] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/60781

2737 Ingo Struewing	2008-12-05
      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.
[8 Dec 2008 20:46] Chuck Bell
Patch approved pending fix of compiler warning on Windows.

set_var.cc(3073) : warning C4244: '=' : conversion from 'ulonglong' to 'ulong', possible loss of data
[15 Dec 2008 10:01] Jørgen Løland
Good to push.
[16 Dec 2008 11:52] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/61753

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.
[16 Dec 2008 11:56] Ingo Strüwing
Patch queued to 6.0-backup.
[2 Feb 2009 16:06] Bugs System
Pushed into 6.0.10-alpha (revid:sergefp@mysql.com-20090202090240-dlkxhmc1asrar5rl) (version source revid:sergefp@mysql.com-20090129100938-qvke7a9krg24l8pl) (merge vers: 6.0.10-alpha) (pib:6)
[2 Feb 2009 17:22] Paul DuBois
Noted in 6.0.10 changelog.

The implementation of the backup_wait_timeout system variable was 
machine dependent and did not work correctly on big-endian machines.

Also revised the documentation for backup_wait_timeout to say:
The number of seconds DDL statements wait for a BACKUP DATABASE or
RESTORE operation before aborting with an error. The default value is
50. A value of 0 means "immediate timeout."