Bug #43221 Test backup_logs fails on powermac platform.
Submitted: 26 Feb 2009 10:55 Modified: 28 Oct 2009 22:28
Reporter: Rafal Somla Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Backup Severity:S3 (Non-critical)
Version: OS:Any
Assigned to: Chuck Bell CPU Architecture:Any
Tags: pushbuild failure

[26 Feb 2009 10:55] Rafal Somla
Description:
Test fails in PB on powermacg5 platform with the following result missmatch:

@@ -236,7 +236,7 @@
 timediff(stop_time, validity_point_time) >=0
 from mysql.backup_history WHERE backup_id=500;
 timediff(validity_point_time, start_time) >= 0	timediff(stop_time, validity_point_time) >=0
-1	1
+NULL	NULL

This is because on that platform, after running BACKUP we got:

sql> SELECT validity_point_time, start_time FROM mysql.backup_history WHERE backup_id=500;

validity_point_time    start_time
1930-08-08 05:52:10    2009-02-26 10:43:38

sql> SELECT timediff(validity_point_time, start_time) FROM mysql.backup_history WHERE backup_id=500;

timediff(validity_point_time, start_time)
NULL

The problems are:

a) the value stored in mysql.backup_history(validiry_point_time) is incorrect (1930-08-08 05:52:10 is not a coorect time).

b) function timediff() returns NULL when comparing these two timestamps - it should not.

How to repeat:
Xref search results: http://tinyurl.com/dnm44q

This failure can be also repeated when manually running the test on powermacg5.
[13 Jun 2009 9:59] Patrick Crews
It should be noted that this test passes on my Intel Mac running 10.5.
[12 Aug 2009 21:58] Sveta Smirnova
This is still repeatable on powermacg5
[14 Aug 2009 1:17] Chuck Bell
I've run across this before in BUG#40807. That bug was subsequently closed as 'cannot repeat' because a subsequent pull from main fixed it. The problem then was the timezone value was incorrect on powermac and caused the calculation in the following to fail.

(image_info.h @905)

  return mktime(&time) - (time_t)timezone;

My suspicion is this problem has returned.

Note also that the backup code is the only part of the system that is using this variable/definition and it is my recommendation that the code be changed to use the same operations as the rest of the server -- specifically, getting the current timezone from the THD class. This may require changing or eliminating the backup-specific time structure.
[9 Sep 2009 19:10] Chuck Bell
From the 8 September backup meeting
-----------------------------------
We decided to change the internal storage of the time from the backup-specific broken out time (which requires conversion to/from other formats) to simply storing time_t in the backup code and backup image. 

This worklog then should effect that change and thus solve the bug report.
[11 Sep 2009 17:13] 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/83078

2868 Chuck Bell	2009-09-11
      BUG#43221 : Test backup_logs fails on powermac platform
      
      The backup_logs test fails on the powermac platform because the
      timezone variable is not set correctly thus the timezone
      calculation in the backup code in image_info.h (see below)
      fails.
      
      return mktime(&time) - (time_t)timezone;
      
      It was decided on 8 September 2009 to change the internal
      format for time in the backup stream from bstream_time_t 
      which was a special segmented format to the standard time_t
      format. 
      
      This patch effects this change and renenables the backup_logs 
      test. 
      
      Note: This is a patch 1 of 2 as it is necessary to apply
      this patch first with the backup_xpfm_compat_restore*
      tests disabled then submit a second patch that replaces
      the backup image files needed in those tests and reenable
      them.
      
      Note: This patch changes the backup image format.
     @ client/mysqlbackup.cc
        Corrected time printout using time_t conversion to time.
     @ mysql-test/suite/backup/r/backup_logs.result
        Corrected result file (we are storing 4 extra bytes for time values).
     @ mysql-test/suite/backup/t/backup_logs.test
        Reenable test for Mac platforms.
     @ mysql-test/suite/backup/t/disabled.def
        Added the bacup_xpfm_compat_restore* tests.
        
        This is necessary so that the backup_xpfm_backup* tests can
        generate the new backup image files needed for the restore
        tests. A new patch will be created once PB is finished that
        will reenable the tests and supply a new set of backup image
        files.
     @ sql/backup/image_info.h
        Remove bstream_time_t and related structures.
     @ sql/backup/stream_v1.c
        Add new methoda to read/write time from/to backup image.
        Change to time_t type for all time values.
     @ sql/backup/stream_v1.h
        Remove bstream_time_t and related structures.
        Add new method to read time from backup image.
        Change to time_t type for all time values.
[11 Sep 2009 17:16] Chuck Bell
The solution for this bug requires a two-pass effort to correctly fix the tests in pushbuild. This is because there are a set of backup image files used for the backup_xpfm_compat_restore* tests that must be replaced. But they cannot be regenerated until the patch that effects the time_t change. Thus, there will be two patches -- the first to effect the time_t change and disable the restore tests, the second to fix the backup image files and reenable the restore tests.

Documentation Notice: This patch changes the backup image format. The new code will not be able to restore backup images made by releases prior to this.
[12 Sep 2009 15:42] Ingo Strüwing
Approved pending changes. Please see email.
[14 Sep 2009 19:34] 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/83212

2868 Chuck Bell	2009-09-14
      BUG#43221 : Test backup_logs fails on powermac platform
      
      The backup_logs test fails on the powermac platform because the
      timezone variable is not set correctly thus the timezone
      calculation in the backup code in image_info.h (see below)
      fails.
      
      return mktime(&time) - (time_t)timezone;
      
      It was decided on 8 September 2009 to change the internal
      format for time in the backup stream from bstream_time_t 
      which was a special segmented format to the standard time_t
      format. 
      
      This patch effects this change and renenables the backup_logs 
      test. 
      
      Note: This is a patch 1 of 2 as it is necessary to apply
      this patch first with the backup_xpfm_compat_restore*
      tests disabled then submit a second patch that replaces
      the backup image files needed in those tests and reenable
      them.
      
      Note: This patch changes the backup image format.
     @ client/mysqlbackup.cc
        Corrected time printout using time_t conversion to time.
     @ mysql-test/suite/backup/r/backup_logs.result
        Corrected result file (we are storing 4 extra bytes for time values).
     @ mysql-test/suite/backup/t/backup_logs.test
        Reenable test for Mac platforms.
     @ mysql-test/suite/backup/t/disabled.def
        Added the bacup_xpfm_compat_restore* tests.
        
        This is necessary so that the backup_xpfm_backup* tests can
        generate the new backup image files needed for the restore
        tests. A new patch will be created once PB is finished that
        will reenable the tests and supply a new set of backup image
        files.
     @ sql/backup/image_info.h
        Remove bstream_time_t and related structures.
     @ sql/backup/stream_v1.c
        Add new methoda to read/write time from/to backup image.
        Change to time_t type for all time values.
     @ sql/backup/stream_v1.h
        Remove bstream_time_t and related structures.
        Add new method to read time from backup image.
        Change to time_t type for all time values.
[14 Sep 2009 20:06] 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/83215

2868 Chuck Bell	2009-09-14
      BUG#43221 : Test backup_logs fails on powermac platform
      
      The backup_logs test fails on the powermac platform because the
      timezone variable is not set correctly thus the timezone
      calculation in the backup code in image_info.h (see below)
      fails.
      
      return mktime(&time) - (time_t)timezone;
      
      It was decided on 8 September 2009 to change the internal
      format for time in the backup stream from bstream_time_t 
      which was a special segmented format to the standard time_t
      format. 
      
      This patch effects this change and renenables the backup_logs 
      test. 
      
      Note: This is a patch 1 of 2 as it is necessary to apply
      this patch first with the backup_xpfm_compat_restore*
      tests disabled then submit a second patch that replaces
      the backup image files needed in those tests and reenable
      them.
      
      Note: This patch changes the backup image format.
     @ client/mysqlbackup.cc
        Corrected time printout using time_t conversion to time.
     @ mysql-test/suite/backup/r/backup_logs.result
        Corrected result file (we are storing 4 extra bytes for time values).
     @ mysql-test/suite/backup/t/backup_logs.test
        Reenable test for Mac platforms.
        Added note about printing out datetime in local time once
        WL#5051 is fixed.
     @ mysql-test/suite/backup/t/disabled.def
        Added the bacup_xpfm_compat_restore* tests.
        
        This is necessary so that the backup_xpfm_backup* tests can
        generate the new backup image files needed for the restore
        tests. A new patch will be created once PB is finished that
        will reenable the tests and supply a new set of backup image
        files.
     @ sql/backup/image_info.h
        Remove bstream_time_t and related structures.
     @ sql/backup/stream_v1.c
        Add new methoda to read/write time from/to backup image.
        Change to time_t type for all time values.
     @ sql/backup/stream_v1.h
        Remove bstream_time_t and related structures.
        Add new method to read time from backup image.
        Change to time_t type for all time values.
[15 Sep 2009 7:45] Jørgen Løland
Good to push
[15 Sep 2009 15:03] 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/83301

2868 Chuck Bell	2009-09-15
      BUG#43221 : Test backup_logs fails on powermac platform
      
      The backup_logs test fails on the powermac platform because the
      timezone variable is not set correctly thus the timezone
      calculation in the backup code in image_info.h (see below)
      fails.
      
      return mktime(&time) - (time_t)timezone;
      
      It was decided on 8 September 2009 to change the internal
      format for time in the backup stream from bstream_time_t 
      which was a special segmented format to the standard time_t
      format. 
      
      This patch effects this change and renenables the backup_logs 
      test. 
      
      Note: This is a patch 1 of 2 as it is necessary to apply
      this patch first with the backup_xpfm_compat_restore*
      tests disabled then submit a second patch that replaces
      the backup image files needed in those tests and reenable
      them.
      
      Note: This patch changes the backup image format.
     @ client/mysqlbackup.cc
        Corrected time printout using time_t conversion to time.
     @ mysql-test/suite/backup/r/backup_logs.result
        Corrected result file (we are storing 4 extra bytes for time values).
     @ mysql-test/suite/backup/t/backup_logs.test
        Reenable test for Mac platforms.
        Added note about printing out datetime in local time once
        WL#5051 is fixed.
     @ mysql-test/suite/backup/t/disabled.def
        Added the bacup_xpfm_compat_restore* tests.
        
        This is necessary so that the backup_xpfm_backup* tests can
        generate the new backup image files needed for the restore
        tests. A new patch will be created once PB is finished that
        will reenable the tests and supply a new set of backup image
        files.
     @ sql/backup/image_info.h
        Remove bstream_time_t and related structures.
     @ sql/backup/stream_v1.c
        Add new methoda to read/write time from/to backup image.
        Change to time_t type for all time values.
     @ sql/backup/stream_v1.h
        Remove bstream_time_t and related structures.
        Add new method to read time from backup image.
        Change to time_t type for all time values.
[15 Sep 2009 15:05] 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/83302

2869 Chuck Bell	2009-09-15 [merge]
      Local merge prior to push of BUG#43221 patch 1 of 2
[15 Sep 2009 18:48] Chuck Bell
Patch 1 of 2 pushed.
[28 Sep 2009 15:51] 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/84893
[28 Sep 2009 16:42] Ingo Strüwing
Patch 2 of 2 queued to mysql-6.0-backup.
[25 Oct 2009 13:38] Bugs System
Pushed into 6.0.14-alpha (revid:alik@sun.com-20091025133616-ca4inerav4vpdnaz) (version source revid:ingo.struewing@sun.com-20090929164722-2bz8vvmf4of66g3t) (merge vers: 6.0.14-alpha) (pib:13)
[28 Oct 2009 22:28] Paul DuBois
Noted in 6.0.14 changelog.

Time zone calculation for backups was not correct on the powermac
platform because the timezone variable was not set correctly.

This fix involves a change to the internal format of times in backup
image files, so backups made prior to this release cannot be restored
using the current backup code.