Bug #35240 RESTORE command doesn't write binlog position to online_backup table
Submitted: 12 Mar 2008 7:06 Modified: 18 Oct 2008 15:40
Reporter: Rafal Somla Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Backup Severity:S3 (Non-critical)
Version:6.0-backup OS:Any
Assigned to: Rafal Somla CPU Architecture:Any

[12 Mar 2008 7:06] Rafal Somla
Description:
When DBA says "RESTORE FROM 'backup_image'" a row in mysql.online_backup table is created showing status of that operation. This row has fields validity_point_time, binlog_pos and binlog_file which should be filled with information read from backup image but they are left empty. 

This is for example important for point-in-time recovery where DBA must know from which position to replay binary logs after a successful restore.

How to repeat:
Run BACKUP, then RESTORE, then SELECT * FROM mysql.online_backup and see that the relevant fields are NULL in the row corresponding to the RESTORE operation.
[10 Sep 2008 12:04] 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/53685

2697 Rafal Somla	2008-09-10
      Bug#35240 (RESTORE command doesn't write binlog position to online_backup table)
      
      Problem: 
      
      The time and binlog position at the backup validity point which is stored inside 
      backup image and read during RESTORE operation was not reported in backup logs.
      
      Solution: 
      
      Added code for reporting VP time and binlog position inside 
      Backup_restore_ctx::do_restore() (kernel.cc).
      
      Limitation: 
      
      The fact that binlog information is recorded inside backup image is indicated by 
      BSTREAM_FLAG_BINLOG flag stored in image's header. The header is written at the 
      very beginning of BACKUP operation and thus the flag must be set at that time. 
      But it can happen that binlog becomes disabled between the time the header has 
      been written and the time of the validity point. In that case the flag will be 
      set but there will be no binlog information stored in the image.
      
      This is bad, but it can not be easily fixed without changing the format of the 
      backup image. This patch doesn't solve this problem - it just assumes that a 
      binlog is either enabled or disabled during whole BACKUP operation.
      
      Comments:
      
      - Setting of the BSTREAM_FLAG_BINLOG flag was moved to 
      Backup_restore_ctx::prepare_for_backup() as otherwise the flag was not saved in 
      image's header.
      
      - When VP time is reported during BACKUP command, it is stored in backup_history 
      record but also an entry is added to the backup_progress log informing that VP 
      has been reached. But during RESTORE we want only to store the VP time in the 
      backup_history record without logging anything into backup_progress log. 
      Therefore a flag was added to Backup_log::vp_time() and 
      backup::Logger::report_vp_time() which determines if entry is added to 
      backup_progress log.
      
      - Function bstream_rd_int4() in stream_v1.c was broken. This patch fixes it.
      
      - Backup test was extended to check that VP info is stored during BACKUP and 
      correctly read during RESTORE.
[29 Sep 2008 7:51] Jørgen Løland
Good to push
[30 Sep 2008 7:53] 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/54725

2699 Rafal Somla	2008-09-30
       Bug#35240 (RESTORE command doesn't write binlog position to online_backup table)
            
       Problem: 
            
       The time and binlog position at the backup validity point which is stored inside 
       backup image and read during RESTORE operation was not reported in backup logs.
            
       Solution: 
            
       Added code for reporting VP time and binlog position inside 
       Backup_restore_ctx::do_restore() (kernel.cc).
            
       Limitation: 
           
       The fact that binlog information is recorded inside backup image is indicated by 
       BSTREAM_FLAG_BINLOG flag stored in image's header. The header is written at the 
       very beginning of BACKUP operation and thus the flag must be set at that time. 
       But it can happen that binlog becomes disabled between the time the header has 
       been written and the time of the validity point. In that case the flag will be 
       set but there will be no binlog information stored in the image.
            
       This is bad, but it can not be easily fixed without changing the format of the 
       backup image. This patch doesn't solve this problem - it just assumes that a 
       binlog is either enabled or disabled during whole BACKUP operation.
            
       Comments:
            
       - Setting of the BSTREAM_FLAG_BINLOG flag was moved to 
         Backup_restore_ctx::prepare_for_backup() as otherwise the flag was not saved in 
         image's header.
            
       - When VP time is reported during BACKUP command, it is stored in backup_history 
         record but also an entry is added to the backup_progress log informing that VP 
         has been reached. But during RESTORE we want only to store the VP time in the 
         backup_history record without logging anything into backup_progress log. 
         Therefore a flag was added to Backup_log::vp_time() and 
         backup::Logger::report_vp_time() which determines if entry is added to 
         backup_progress log.
            
      - Function bstream_rd_int4() in stream_v1.c was broken. This patch fixes it.
            
      - Backup test was extended to check that VP info is stored during BACKUP and 
        correctly read during RESTORE.
[30 Sep 2008 8:09] 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/54728

2697 Rafal Somla	2008-09-30 [merge]
      BUG#35240 - merge into team tree.
[30 Sep 2008 8:15] 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/54730

2697 Rafal Somla	2008-09-30 [merge]
      BUG#35240 - merge into team tree.
[1 Oct 2008 6:42] Rafal Somla
Pushed into 6.0-backup tree.
[17 Oct 2008 17:24] Bugs System
Pushed into 6.0.8-alpha  (revid:rafal.somla@sun.com-20080930080816-84w3br4ko8slgwd5) (version source revid:oystein.grovlen@sun.com-20080930094956-3qxly6h7nyc2r253) (pib:5)
[18 Oct 2008 15:40] Paul DuBois
Noted in 6.0.8 changelog.

RESTORE did not set the validity_point_time, binlog_pos, and
binlog_file fields of the backup_history log table row.