MySQL Lists are EOL. Please join:

List:Commits« Previous MessageNext Message »
From:cbell Date:June 21 2007 4:33am
Subject:bk commit into 5.1 tree (cbell:1.2540)
View as plain text  
Below is the list of changes that have just been committed into a local
5.1 repository of cbell. When cbell does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html

ChangeSet@stripped, 2007-06-21 00:33:46-04:00, cbell@stripped +11 -0
  WL#3776 : Consistent snapshot backup for MVCC
    
  This patch adds consistent snapshot algorithm for online backup. The 
  consistent snapshot algorithm is designed to work with any storage engine
  that supports a consistent read operation (transaction). Currently, this
  is limited to InnoDB but the code was written to allow the use of any 
  storage engine that supposts consistent read via the consistent shapshot 
  method in the handler.

  mysql-test/r/backup_snapshot.result@stripped, 2007-06-21 00:33:43-04:00, cbell@stripped +51 -0
    WL#3776 : Consistent snapshot backup for MVCC
            
    This patch adds the result file for the backup_snapshot test.
    

  mysql-test/r/backup_snapshot.result@stripped, 2007-06-21 00:33:43-04:00, cbell@stripped +0 -0

  mysql-test/t/backup_snapshot.opt@stripped, 2007-06-21 00:33:43-04:00, cbell@stripped +1 -0
    WL#3776 : Consistent snapshot backup for MVCC
        
    This patch adds the option file for the backup_snapshot test.
    

  mysql-test/t/backup_snapshot.opt@stripped, 2007-06-21 00:33:43-04:00, cbell@stripped +0 -0

  mysql-test/t/backup_snapshot.test@stripped, 2007-06-21 00:33:43-04:00, cbell@stripped +72 -0
    WL#3776 : Consistent snapshot backup for MVCC
        
    This patch adds a test file for the consistent snapshot algorithm. The test uses
    control insertion to ensure there are simultaneous inserts and deletes occuring at the
    same time as the backup.
    

  mysql-test/t/backup_snapshot.test@stripped, 2007-06-21 00:33:43-04:00, cbell@stripped +0 -0

  sql/CMakeLists.txt@stripped, 2007-06-21 00:33:42-04:00, cbell@stripped +1 -0
    WL#3776 : Consistent snapshot backup for MVCC
            
    This patch adds the consistent snapshot files to the CMakeLists.txt file.

  sql/backup/Makefile.am@stripped, 2007-06-21 00:33:42-04:00, cbell@stripped +2 -0
    WL#3776 : Consistent snapshot backup for MVCC
            
    This patch adds the consistent snapshot files to the makefile for the backup
    directory.

  sql/backup/archive.cc@stripped, 2007-06-21 00:33:42-04:00, cbell@stripped +4 -0
    WL#3776 : Consistent snapshot backup for MVCC
            
    This patch adds the consistent snapshot class to the Image_info struct.

  sql/backup/archive.h@stripped, 2007-06-21 00:33:42-04:00, cbell@stripped +1 -1
    WL#3776 : Consistent snapshot backup for MVCC
        
    This patch adds the consistent snapshot class to the image types for
    the Image_info struct.

  sql/backup/backup_kernel.h@stripped, 2007-06-21 00:33:42-04:00, cbell@stripped +1 -0
    WL#3776 : Consistent snapshot backup for MVCC
        
    This patch adds a variable to store the index for the consistent snapshot
    driver in the images array.

  sql/backup/be_snapshot.cc@stripped, 2007-06-21 00:33:42-04:00, cbell@stripped +165 -0
    WL#3776 : Consistent snapshot backup for MVCC
        
    This patch adds the consistent snapshot source file. This file contains 
    the consistent snapshot algorithm.
    

  sql/backup/be_snapshot.cc@stripped, 2007-06-21 00:33:42-04:00, cbell@stripped +0 -0

  sql/backup/be_snapshot.h@stripped, 2007-06-21 00:33:43-04:00, cbell@stripped +140 -0
    WL#3776 : Consistent snapshot backup for MVCC
        
    This patch adds the buffer_iterator class for buffering the blob fields for the 
    consistent snapshot and default drivers. This file contains the source code for the
    buffer iterator class.
    

  sql/backup/be_snapshot.h@stripped, 2007-06-21 00:33:43-04:00, cbell@stripped +0 -0

  sql/backup/sql_backup.cc@stripped, 2007-06-21 00:33:42-04:00, cbell@stripped +44 -22
    WL#3776 : Consistent snapshot backup for MVCC
        
    This patch adds the consistent snapshot option to the kernel backup image 
    generator.

# This is a BitKeeper patch.  What follows are the unified diffs for the
# set of deltas contained in the patch.  The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User:	cbell
# Host:	suse.vabb.com
# Root:	/home/Chuck/source/mysql-5.1_WL_3776
--- New file ---
+++ mysql-test/r/backup_snapshot.result	07/06/21 00:33:43
DROP DATABASE IF EXISTS bup_snapshot;
CREATE DATABASE bup_snapshot;
CREATE TABLE bup_snapshot.t1 (word CHAR(20)) ENGINE=INNODB;
INSERT INTO bup_snapshot.t1 VALUES ("01 Some data to test");
INSERT INTO bup_snapshot.t1 VALUES ("02 Some data to test");
INSERT INTO bup_snapshot.t1 VALUES ("03 Some data to test");
INSERT INTO bup_snapshot.t1 VALUES ("04 Some data to test");
INSERT INTO bup_snapshot.t1 VALUES ("05 Some data to test");
INSERT INTO bup_snapshot.t1 VALUES ("06 Some data to test");
INSERT INTO bup_snapshot.t1 VALUES ("07 Some data to test");
INSERT INTO bup_snapshot.t1 VALUES ("08 Some data to test");
INSERT INTO bup_snapshot.t1 VALUES ("09 Some data to test");
INSERT INTO bup_snapshot.t1 VALUES ("10 Some data to test");
SELECT * FROM bup_snapshot.t1 WHERE word LIKE '-%';
word
SELECT COUNT(*) FROM bup_snapshot.t1;
COUNT(*)
10
BACKUP DATABASE bup_snapshot TO "bup_snapshot.bak";
Backup Summary
 header     =       22 bytes
 meta-data  =       95 bytes
 data       =      260 bytes
              --------------
 total             377 bytes
INSERT INTO bup_snapshot.t1 VALUES("- Dave Mathews");
INSERT INTO bup_snapshot.t1 VALUES("- Yes");
INSERT INTO bup_snapshot.t1 VALUES("- Jethro Tull");
DELETE FROM bup_snapshot.t1 WHERE word LIKE '10%';
SELECT * FROM bup_snapshot.t1 WHERE word LIKE '-%';
word
- Dave Mathews
- Yes
- Jethro Tull
SELECT COUNT(*) FROM bup_snapshot.t1;
COUNT(*)
12
DROP TABLE bup_snapshot.t1;
RESTORE FROM "bup_snapshot.bak";
Restore Summary
 header     =       22 bytes
 meta-data  =       95 bytes
 data       =      260 bytes
              --------------
 total             377 bytes
SELECT * FROM bup_snapshot.t1 WHERE word LIKE '-%';
word
SELECT COUNT(*) FROM bup_snapshot.t1;
COUNT(*)
10
DROP DATABASE IF EXISTS bup_snapshot;

--- New file ---
+++ mysql-test/t/backup_snapshot.opt	07/06/21 00:33:43
--loose-debug=d,SLEEP_SNAPSHOT

--- New file ---
+++ mysql-test/t/backup_snapshot.test	07/06/21 00:33:43
#
# This test is for the consistent snapshot online backup driver
# The test is designed to show that a consistent snapshot
# backup can be taken while data is being inserted and deleted.
#

--source include/have_innodb.inc
--source include/have_debug.inc

--disable_warnings
DROP DATABASE IF EXISTS bup_snapshot;
--enable_warnings

CREATE DATABASE bup_snapshot;

connect (con1,localhost,root,,);
connect (con2,localhost,root,,);

connection con1;

# Create a table and load it with lots of data.

CREATE TABLE bup_snapshot.t1 (word CHAR(20)) ENGINE=INNODB;

INSERT INTO bup_snapshot.t1 VALUES ("01 Some data to test");
INSERT INTO bup_snapshot.t1 VALUES ("02 Some data to test");
INSERT INTO bup_snapshot.t1 VALUES ("03 Some data to test");
INSERT INTO bup_snapshot.t1 VALUES ("04 Some data to test");
INSERT INTO bup_snapshot.t1 VALUES ("05 Some data to test");
INSERT INTO bup_snapshot.t1 VALUES ("06 Some data to test");
INSERT INTO bup_snapshot.t1 VALUES ("07 Some data to test");
INSERT INTO bup_snapshot.t1 VALUES ("08 Some data to test");
INSERT INTO bup_snapshot.t1 VALUES ("09 Some data to test");
INSERT INTO bup_snapshot.t1 VALUES ("10 Some data to test");

SELECT * FROM bup_snapshot.t1 WHERE word LIKE '-%';
SELECT COUNT(*) FROM bup_snapshot.t1;

# While a consistent snapshot backup is executed,
# no external inserts should be visible to the transaction.

BACKUP DATABASE bup_snapshot TO "bup_snapshot.bak";

connection con2;

INSERT INTO bup_snapshot.t1 VALUES("- Dave Mathews");
INSERT INTO bup_snapshot.t1 VALUES("- Yes");
INSERT INTO bup_snapshot.t1 VALUES("- Jethro Tull");
DELETE FROM bup_snapshot.t1 WHERE word LIKE '10%';

SELECT * FROM bup_snapshot.t1 WHERE word LIKE '-%';
SELECT COUNT(*) FROM bup_snapshot.t1;

connection con1;

# Now restore the database and then check to make sure the new rows
# were not backed up.

DROP TABLE bup_snapshot.t1;

RESTORE FROM "bup_snapshot.bak";

SELECT * FROM bup_snapshot.t1 WHERE word LIKE '-%';
SELECT COUNT(*) FROM bup_snapshot.t1;

--disable_warnings
DROP DATABASE IF EXISTS bup_snapshot;
--enable_warnings

--exec rm $MYSQLTEST_VARDIR/master-data/bup_snapshot.bak



--- New file ---
+++ sql/backup/be_snapshot.cc	07/06/21 00:33:42
/* Copyright (C) 2004-2007 MySQL AB

   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
   the Free Software Foundation; version 2 of the License.

   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU General Public License for more details.

   You should have received a copy of the GNU General Public License
   along with this program; if not, write to the Free Software
   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
*/

/**
 * @file
 *
 * @brief Contains the snapshot backup algorithm driver.
 *
 * This file contains the snapshot backup algorithm (also called a "driver"
 * in the online backup terminology. The snapshot backup algorithm may be
 * used in place of an engine-specific driver if one does not exist or if
 * chosen by the user.
 *
 * The snapshot backup algorithm is a non-blocking algorithm that enables a
 * consistent read of the tables given at the start of the backup/restore 
 * process. This is accomplished by using a consistent snapshot transaction
 * and table locks. Once all of the data is backed up or restored, the locks 
 * are removed. The snapshot backup is a row-level backup and therefore does 
 * not backup the indexes or any of the engine-specific files.
 *
 * The classes in this file use the namespace "snapshot_backup" to distinguish
 * these classes from other backup drivers. The backup functionality is
 * contained in the backup class shown below. Similarly, the restore
 * functionality is contained in the restore class below.
 *
 * The format of the backup is the same as the default backup driver.
 * Please see <code> be_default.cc </code> for a complete description.
 */

#include "mysql_priv.h"
#include "backup_engine.h"
#include "be_snapshot.h"
#include "backup_aux.h"

namespace snapshot_backup {

using backup::byte;
using backup::result_t;
using backup::version_t;
using backup::Table_list;
using backup::Table_ref;
using backup::Buffer;

/**
 * Create a snapshot backup backup driver.
 *
 * Given a list of tables to be backed-up, create instance of backup
 * driver which will create backup image of these tables.
 *
 * @param  tables (in) list of tables to be backed-up.
 * @param  eng    (out) pointer to backup driver instance.
 *
 * @retval Error code or backup::OK on success.
 */
result_t Engine::get_backup(const uint32, const Table_list &tables, Backup_driver* &drv)
{
  DBUG_ENTER("Engine::get_backup");
  Backup *ptr= new snapshot_backup::Backup(tables, m_thd);
  if (!ptr)
    DBUG_RETURN(backup::ERROR);
  drv= (backup::Backup_driver *)ptr;
  DBUG_RETURN(backup::OK);
}

/**
 * @brief Start backup process.
 *
 * This method locks all of the tables for reading.
 *
 * @retval backup::OK     all tables locked properly.
 * @retval backup::Error  problem with locking tables.
 */
result_t Backup::begin(const size_t)
{
  DBUG_ENTER("Snapshot_backup::start_backup");
  if (all_tables)
  {
    for (TABLE_LIST *tbl= all_tables; tbl != NULL; tbl= tbl->next_global)
      tbl->lock_type= TL_READ;
    if (open_and_lock_tables(m_thd, all_tables))
    {
      DBUG_PRINT("backup", ( "error!" ));
      DBUG_RETURN(backup::ERROR); 
    }
  }
  DBUG_RETURN(backup::OK);
}

/**
 * @brief End backup process.
 *
 * This method unlocks all of the tables.
 *
 * @retval backup::OK    all tables unlocked.
 */
result_t Backup::end()
{
  DBUG_ENTER("Snapshot_backup::end");
  end_active_trans(m_thd);
  DBUG_RETURN(backup::OK);
}

result_t Backup::prelock()
{
  DBUG_ENTER("Snapshot_backup::prelock()");
  DBUG_RETURN(backup::READY);
}

result_t Backup::lock()
{
  DBUG_ENTER("Snapshot_backup::lock()");
  /*
    We must fool the locking code to think this is a select because
    any other command type places the engine in a non-consistent read
    state. 
  */
  m_thd->lex->sql_command= SQLCOM_SELECT; 
  m_thd->lex->start_transaction_opt|= MYSQL_START_TRANS_OPT_WITH_CONS_SNAPSHOT;
  begin_trans(m_thd);
  DBUG_RETURN(backup::OK);
}

result_t Backup::unlock()
{
  DBUG_ENTER("Snapshot_backup::unlock()");
  DBUG_RETURN(backup::OK);
}

/**
 * Create a snapshot backup restore driver.
 *
 * Given a list of tables to be restored, create instance of restore
 * driver which will restore these tables from a backup image.
 *
 * @param  version  (in) version of the backup image.
 * @param  tables   (in) list of tables to be restored.
 * @param  eng      (out) pointer to restore driver instance.
 *
 * @retval Error code or backup::OK on success.
 */
result_t Engine::get_restore(version_t ver, const uint32, const Table_list &tables, Restore_driver* &drv)
{
  DBUG_ENTER("Engine::get_restore");
  Restore *ptr= new snapshot_backup::Restore(tables, m_thd);
  if (!ptr)
    DBUG_RETURN(backup::ERROR);
  drv= ptr;
  DBUG_RETURN(backup::OK);
}

} /* snapshot_backup namespace */


--- New file ---
+++ sql/backup/be_snapshot.h	07/06/21 00:33:43
#ifndef _SNAPSHOT_BACKUP_H
#define _SNAPSHOT_BACKUP_H

#include "archive.h"        
#include "buffer_iterator.h"
#include "be_default.h"

namespace snapshot_backup {

using backup::byte;
using backup::result_t;
using backup::version_t;
using backup::Table_list;
using backup::Table_ref;
using backup::Buffer;

const uint META_SIZE= 8;

/**
 * @class Engine
 *
 * @brief Encapsulates snapshot online backup/restore functionality.
 *
 * This class is used to initiate the snapshot backup algorithm, which is used
 * by the backup kernel to create a backup image of data stored in any
 * engine that does not have a native backup driver but supports consisten reads.
 * It may also be used as an option by the user.
 *
 * Using this class, the caller can create an instance of the snapshot backup
 * backup and restore class. The backup class is used to backup data for a
 * list of tables. The restore class is used to restore data from a
 * previously created snapshot backup image.
 */
class Engine: public Backup_engine
{
  public:
    Engine(THD *t_thd) { m_thd= t_thd; }

    /// Return version of backup images created by this engine.
    const version_t version() const { return 0; };
    result_t get_backup(const uint32, const Table_list &tables, Backup_driver* &drv);
    result_t get_restore(version_t ver, const uint32, const Table_list &tables,
                         Restore_driver* &drv);
  private:
    THD *m_thd;     ///< Pointer to the current thread.
};

/**
 * @class Backup
 *
 * @brief Contains the snapshot backup algorithm backup functionality.
 *
 * The backup class is a row-level backup mechanism designed to perform
 * a table scan on each table reading the rows and saving the data to the
 * buffer from the backup algorithm using a consistent read transaction.
 *
 * @see <backup driver>
 */
class Backup: public default_backup::Backup
{
  public:
    Backup(const Table_list &tables, THD *t_thd): 
     default_backup::Backup(tables, t_thd){};
    virtual ~Backup(){};
    result_t begin(const size_t);
    result_t end();
    result_t prelock();
    result_t lock();
    result_t unlock();
};

/**
 * @class Restore
 *
 * @brief Contains the snapshot backup algorithm restore functionality.
 *
 * The restore class is a row-level backup mechanism designed to restore
 * data for each table by writing the data for the rows from the
 * buffer given by the backup algorithm.
 *
 * @see <restore driver>
 */
class Restore: public default_backup::Restore
{
  public:
    Restore(const Table_list &tables, THD *t_thd):
      default_backup::Restore(tables, t_thd){};
    virtual ~Restore(){};
    void free() { delete this; };
};
} // snapshot_backup namespace


/*********************************************************************

  Snapshot image class

 *********************************************************************/

namespace backup {


class Snapshot_image: public Image_info
{
 public:

  Snapshot_image(Archive_info &info): Image_info(info)
  { ver= 1; }

  image_type type() const
  { return SNAPSHOT_IMAGE; }

  const char* name() const
  { return "Snapshot driver"; }

  bool accept(const Table_ref&, const ::handlerton* h)
  { 
    return (h->start_consistent_snapshot != NULL); 
  }; // accept all tables

  Backup_driver* get_backup_driver()
  { return new snapshot_backup::Backup(tables,::current_thd); }

  Restore_driver* get_restore_driver()
  { return new snapshot_backup::Restore(tables,::current_thd); }

  stream_result::value do_write_description(OStream&)
  { return stream_result::OK; }; // nothing to write

  static Snapshot_image*
  create_from_stream(version_t ver, Archive_info &info,
                     IStream&)
  { return new Snapshot_image(info); };  // TODO: check format version
};

} // backup namespace


#endif



--- 1.32/sql/backup/sql_backup.cc	2007-06-14 11:07:31 -04:00
+++ 1.33/sql/backup/sql_backup.cc	2007-06-21 00:33:42 -04:00
@@ -25,6 +25,7 @@
 #include "meta_backup.h"
 #include "archive.h"
 #include "be_default.h"
+#include "be_snapshot.h"
 #include "debug.h"
 
 //int sortcmp(const String *s,const String *t, CHARSET_INFO *cs);
@@ -219,14 +220,18 @@
    1. If tables from that location have been already stored in one of the
       sub-images then choose that subimage.
 
-   2. If location has "native" backup format, put it in a new sub-image with
-      that format.
-
-   3. Otherwise check if one of the existing sub-images would accept table from
+   2. Otherwise check if one of the existing sub-images would accept table from
       this location.
 
-   4. When everything else fails, use default backup format.
- */
+   3. If not and location has "native" backup format, put it in a new sub-image
+      using that format.
+
+   4. If table has no native backup engine, try a consistent snapshot one.
+
+   5. When everything else fails, use default (blocking) backup driver.
+
+   @TODO implement point 1 above.
+*/
 
 namespace backup {
 
@@ -267,13 +272,16 @@
 
    #ifndef USE_DEFAULT_BACKUP
 
-   // Point 3: try existing images but not the default one.
+   // Point 2: try existing native images
 
    for (uint no=0; no < img_count && no < 256 ; ++no)
    {
      if (default_image_no >= 0 && no == (uint)default_image_no)
        continue;
 
+     if (snapshot_image_no >= 0 && no == (uint)snapshot_image_no)
+       continue;
+
      img= images[no];
 
      // An image object decides if it can handle given table or not
@@ -281,7 +289,7 @@
        DBUG_RETURN(no);
    }
 
-   // Point 2: try native backup of table's storage engine.
+   // Point 3: try native backup of table's storage engine.
 
    if (hton->get_backup_engine)
    {
@@ -304,22 +312,35 @@
 
    #endif
 
-   // Point 4: try default backup engine.
+   // Points 4 & 5: try consistent snapshot and default drivers..
 
-   if (default_image_no < 0)
-   {
-     default_image_no= img_count;
+   int *ino= &snapshot_image_no; // try snapshot driver first
 
-     images[default_image_no]= new Default_image(*this);
-     DBUG_PRINT("backup",("Default image added to archive"));
+   while (ino)
+   {
+     if (*ino < 0) // create missing driver
+     {
+       *ino= img_count;
+       if ((ino == &snapshot_image_no) &&
+                (hton->start_consistent_snapshot != NULL))
+         images[*ino]= new Snapshot_image(*this);
+       else 
+         images[*ino]= new Default_image(*this);
+     }
      img_count++;
-   }
-
-   img= images[default_image_no];
-   DBUG_ASSERT(img);
+     DBUG_PRINT("backup",("%s image added to archive",
+                        ino == &default_image_no ? "Default" : "Snapshot"));
 
-   if (img->accept(tbl,hton))
-    DBUG_RETURN(default_image_no);
+     img= images[*ino];
+     DBUG_ASSERT(img);
+     if (img->accept(tbl,hton))
+       DBUG_RETURN(*ino); // table accepted
+      
+     if (ino == &snapshot_image_no)
+       ino= &default_image_no; // try default driver next
+     else
+       ino= NULL; // finish loop
+  }
 
    DBUG_PRINT("backup",("Table ignored."));
    DBUG_RETURN(-1);
@@ -349,8 +370,9 @@
   closed when the structure is closed with the @c close() method.
  */
 Backup_info::Backup_info(THD *thd):
-  default_image_no(-1), m_thd(thd), i_s_tables(NULL), m_state(INIT),
-  m_items(NULL), m_last_item(NULL), m_last_db(NULL)
+  default_image_no(-1), snapshot_image_no(-1), m_thd(thd), 
+  i_s_tables(NULL), m_state(INIT), m_items(NULL), m_last_item(NULL), 
+  m_last_db(NULL)
 {
   i_s_tables= get_schema_table(m_thd, ::get_schema_table(SCH_TABLES));
 }

--- 1.8/sql/backup/Makefile.am	2007-06-20 16:03:23 -04:00
+++ 1.9/sql/backup/Makefile.am	2007-06-21 00:33:42 -04:00
@@ -28,6 +28,7 @@
 	meta_backup.cc \
 	sql_backup.cc \
 	be_default.cc \
+	be_snapshot.cc \
 	buffer_iterator.cc \
 	be_nodata.cc \
 	archive.cc \
@@ -41,6 +42,7 @@
 	meta_backup.h \
 	backup_aux.h \
 	be_default.h \
+	be_snapshot.h \
 	buffer_iterator.h \
 	be_nodata.h \
 	archive.h \

--- 1.6/sql/backup/archive.cc	2007-05-10 18:20:24 -04:00
+++ 1.7/sql/backup/archive.cc	2007-06-21 00:33:42 -04:00
@@ -20,6 +20,7 @@
 
 #include "backup_engine.h"
 #include "be_default.h"
+#include "be_snapshot.h"
 #include "backup_aux.h"
 #include "archive.h"
 
@@ -260,6 +261,9 @@
 
   case DEFAULT_IMAGE:
     return Default_image::create_from_stream(ver,info,s);
+
+  case SNAPSHOT_IMAGE:
+    return Snapshot_image::create_from_stream(ver,info,s);
 
   case NATIVE_IMAGE:
     return Native_image::create_from_stream(ver,info,s);

--- 1.11/sql/backup/archive.h	2007-05-29 05:50:19 -04:00
+++ 1.12/sql/backup/archive.h	2007-06-21 00:33:42 -04:00
@@ -112,7 +112,7 @@
  */
 struct Image_info
 {
-  enum image_type {NATIVE_IMAGE, DEFAULT_IMAGE};
+  enum image_type {NATIVE_IMAGE, DEFAULT_IMAGE, SNAPSHOT_IMAGE};
 
   virtual image_type type() const =0; ///< Return type of the image.
   version_t ver;  ///< Image format version.

--- 1.6/sql/backup/backup_kernel.h	2007-05-29 05:50:19 -04:00
+++ 1.7/sql/backup/backup_kernel.h	2007-06-21 00:33:42 -04:00
@@ -135,6 +135,7 @@
   int find_image(const Table_ref&);
 
   int default_image_no; ///< Position of the default image in @c images list, -1 if not used.
+  int snapshot_image_no; ///< Position of the snapshot image in @c images list, -1 if not used.
 
   Db_item*    add_db(const backup::Db_ref&);
   Table_item* add_table(Db_item&, const Table_ref&);

--- 1.39/sql/CMakeLists.txt	2007-06-20 16:03:22 -04:00
+++ 1.40/sql/CMakeLists.txt	2007-06-21 00:33:42 -04:00
@@ -74,6 +74,7 @@
                backup/archive.cc backup/be_default.cc backup/data_backup.cc 
                backup/meta_backup.cc backup/sql_backup.cc backup/stream.cc 
                backup/string_pool.cc backup/buffer_iterator.cc
+               backup/be_snapshot.cc
                      ${PROJECT_SOURCE_DIR}/sql/sql_yacc.cc
   			   ${PROJECT_SOURCE_DIR}/sql/sql_yacc.h
 			   ${PROJECT_SOURCE_DIR}/include/mysqld_error.h
Thread
bk commit into 5.1 tree (cbell:1.2540)cbell21 Jun