| Bug #42959 | Wrong logic in backup stream library when saving object metadata | ||
|---|---|---|---|
| Submitted: | 18 Feb 2009 7:53 | Modified: | 30 Mar 2009 1:51 | 
| Reporter: | Rafal Somla | Email Updates: | |
| Status: | Closed | Impact on me: | |
| Category: | MySQL Server: Backup | Severity: | S3 (Non-critical) | 
| Version: | OS: | Any | |
| Assigned to: | Rafal Somla | CPU Architecture: | Any | 
   [18 Feb 2009 8:00]
   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/66716 2773 Rafal Somla 2009-02-18 Bug#42959 - Wrong logic in backup stream library when saving object metadata Fixing the logic by removing incorrect gotos. Also uncommenting the call to bcat_get_item_create_data() function.
   [18 Feb 2009 8:16]
   Rafal Somla        
  This is more complicated that it seemed. In the original design functions bcat_get_item_create_{query,data}() can not report errors. But this is a wrong design - there must be a way to inform that error has happened when collecting object metadata, so that an appropriate action can be taken.
 
   [4 Mar 2009 9:48]
   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/68190 2784 Rafal Somla 2009-03-04 Bug#42959 - Wrong logic in backup stream library when saving object metadata Changed specification of bcat_get_item_create_*() function so that they can either report error or signal that there is no data. Updated the logic in stream_v1.c accordingly.
   [4 Mar 2009 12:55]
   Jørgen Løland        
  Good to push
   [5 Mar 2009 7:23]
   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/68314 2784 Rafal Somla 2009-03-05 Bug#42959 - Wrong logic in backup stream library when saving object metadata Changed specifications of bcat_get_item_create_*() functions so that they can either report error or signal that there is no data. Updated the logic in stream_v1.c accordingly.
   [5 Mar 2009 21:17]
   Chuck Bell        
  Patch approved.
   [9 Mar 2009 16:19]
   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/68683 2789 Rafal Somla 2009-03-09 Bug#42959 - Wrong logic in backup stream library when saving object metadata Changed specifications of bcat_get_item_create_*() functions so that they can either report error or signal that there is no data. Updated the logic in stream_v1.c accordingly.
   [10 Mar 2009 18:20]
   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/68813 2795 Rafal Somla 2009-03-10 Bug#42959 - Wrong logic in backup stream library when saving object metadata Changed specifications of bcat_get_item_create_*() functions so that they can either report error or signal that there is no data. Updated the logic in stream_v1.c accordingly.
   [11 Mar 2009 6:28]
   Rafal Somla        
  Pushed to mysql-6.0-backup tree.
   [26 Mar 2009 12:35]
   Bugs System        
  Pushed into 6.0.11-alpha (revid:alik@sun.com-20090326121822-pt84kzxxayzho4mn) (version source revid:charles.bell@sun.com-20090310202133-m0cab6yr4sdhxvxg) (merge vers: 6.0.11-alpha) (pib:6)
   [30 Mar 2009 1:51]
   Paul DuBois        
  Noted in 6.0.11 changelog. The MySQL Backup library had incorrect logic and error reporting for metadata saving.


Description: The following code from stream_v1.c, function bstream_wr_item_def() is incorrect: ret= bcat_get_item_create_query(cat,item,&query); if (ret == BSTREAM_OK) flags |= BSTREAM_FLAG_HAS_CREATE_STMT; else if (ret == BSTREAM_ERROR) goto wr_error; /* bcat_get_item_create_data not in use yet. */ /* ret= bcat_get_item_create_data(cat,item,&data); if (ret == BSTREAM_OK) flags |= BSTREAM_FLAG_HAS_EXTRA_DATA; else if (ret == BSTREAM_ERROR) goto wr_error; */ This is because, according to the documentation of bcat_get_item_*() function in stream_v1_services.h, return value BSTREAM_ERROR does not indicate an error, but lack of relevant piece of metadata. Thus, in case of BSTREAM_ERROR the code should not jump to wr_error but continue leaving this part of metadata empty. Also, the call to bcat_get_item_create_data() should not be commented-out. This is a valid part of backup image and the library should support it, even though the extra metadata is not used now. How to repeat: Look at code in sql/backup/stream_v1.c around line 1640. Suggested fix: Replace the code with: ret= bcat_get_item_create_query(cat,item,&query); if (ret == BSTREAM_OK) flags |= BSTREAM_FLAG_HAS_CREATE_STMT; ret= bcat_get_item_create_data(cat,item,&data); if (ret == BSTREAM_OK) flags |= BSTREAM_FLAG_HAS_EXTRA_DATA;