List:Commits« Previous MessageNext Message »
From:Chuck Bell Date:October 29 2008 12:10am
Subject:bzr commit into mysql-6.0-backup branch (cbell:2720) WL#4209
View as plain text  
#At file:///C:/source/bzr/mysql-6.0-wl-4209/

 2720 Chuck Bell	2008-10-28
      WL#4209 : Integrate Backup with Replication 
      
      This patch makes changes to the backup system to allow backup to
      be used with replication.		
added:
  mysql-test/suite/rpl/r/rpl_backup.result
  mysql-test/suite/rpl/t/rpl_backup.test
modified:
  sql/backup/backup_kernel.h
  sql/backup/data_backup.cc
  sql/backup/kernel.cc
  sql/backup/logger.h
  sql/log.cc
  sql/share/errmsg.txt

per-file messages:
  mysql-test/suite/rpl/r/rpl_backup.result
    New result file.
  mysql-test/suite/rpl/t/rpl_backup.test
    New test for backup and replication integration.
  sql/backup/backup_kernel.h
    Added attribute to allow close() to reengage the binlog if it was turned off.
  sql/backup/data_backup.cc
    Add code to record master's binlog information when backup run on a slave.
  sql/backup/kernel.cc
    Add calls to service interface to allow the following during restore:
    * Disable slave connections when running with connected slaves
    * Issue incident report when binlog is engaged
    * Issue error if restore run on a slave
    * Enable slave connections after restore
    * Save master's binlog information when restore run on a (disconnected) slave :
      used when slave is connected to master after restore begins.
  sql/backup/logger.h
    Added new method to report master's binlog position in backup_progress log.
  sql/log.cc
    Add code to disable binlog of backup log entries.
  sql/share/errmsg.txt
    
    New error message added.
=== added file 'mysql-test/suite/rpl/r/rpl_backup.result'
--- a/mysql-test/suite/rpl/r/rpl_backup.result	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/rpl/r/rpl_backup.result	2008-10-29 00:10:42 +0000
@@ -0,0 +1,182 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+Create some data...
+CREATE DATABASE rpl_backup;
+CREATE TABLE rpl_backup.t1 (a int) ENGINE=MEMORY;
+INSERT INTO rpl_backup.t1 VALUES (1), (2), (3), (4), (5);
+Remove all entries in the backup logs.
+FLUSH BACKUP LOGS;
+PURGE BACKUP LOGS;
+Remove all entries in the backup logs.
+FLUSH BACKUP LOGS;
+PURGE BACKUP LOGS;
+SET SESSION debug="d,set_backup_id";
+Backup_id = 500.
+BACKUP DATABASE rpl_backup TO 'rpl_bup_m1.bak';
+backup_id
+500
+SET SESSION debug="d";
+Should have count(*) = 0.
+SELECT count(*) FROM mysql.backup_history;
+count(*)
+0
+Check backup log. Compare should be 1
+Perform backup on slave and examine backup log.
+Check backup log. Compare should be NULL
+FLUSH BACKUP LOGS;
+PURGE BACKUP LOGS;
+SET SESSION debug="d,set_backup_id";
+Backup_id = 600.
+BACKUP DATABASE rpl_backup TO 'rpl_bup_s1.bak';
+backup_id
+600
+SET SESSION debug="d";
+Check saving of master's binlog information.
+Should have count(*) = 1.
+SELECT count(*) FROM mysql.backup_progress 
+WHERE backup_id = 600 AND notes LIKE 'Recording master binlog information%';
+count(*)
+1
+Should have count(*) = 1.
+SELECT count(*) FROM mysql.backup_history;
+count(*)
+1
+Verify backup run on master does not advance binlog pos.
+Get binlog position before backup.
+Backup_id = 501.
+BACKUP DATABASE rpl_backup TO 'rpl_bup_m2.bak';
+backup_id
+501
+Get binlog position after backup.
+Compute the difference of the binlog positions.
+Result should be 0.
+Delta
+0
+Ensure replication is still working...
+INSERT INTO rpl_backup.t1 VALUES (10), (20), (30);
+Backup_id = 502.
+BACKUP DATABASE rpl_backup TO 'rpl_bup_m3.bak';
+backup_id
+502
+SELECT count(*) FROM rpl_backup.t1;
+count(*)
+8
+SELECT count(*) FROM rpl_backup.t1;
+count(*)
+8
+Make a backup for later use.
+backup_id = 601.
+BACKUP DATABASE rpl_backup TO 'rpl_bup_s2.bak';
+backup_id
+601
+DROP DATABASE rpl_backup;
+backup_id = 503.
+RESTORE FROM 'rpl_bup_m3.bak';
+backup_id
+503
+Showing databases on master.
+SHOW DATABASES LIKE 'rpl_backup%';
+Database (rpl_backup%)
+rpl_backup
+SELECT count(*) FROM rpl_backup.t1;
+count(*)
+8
+STOP SLAVE;
+SET global sql_slave_skip_counter=1;
+START SLAVE;
+Showing databases on slave.
+SHOW DATABASES LIKE 'rpl_backup%';
+Database (rpl_backup%)
+STOP SLAVE;
+backup_id = 602.
+RESTORE FROM 'rpl_bup_s2.bak';
+backup_id
+602
+Showing databases on slave.
+SHOW DATABASES LIKE 'rpl_backup%';
+Database (rpl_backup%)
+rpl_backup
+SELECT count(*) FROM rpl_backup.t1;
+count(*)
+8
+START SLAVE;
+Ensure replication is still working...
+Cleanup from last error on master and slave.
+DROP TABLE rpl_backup.t1;
+CREATE TABLE rpl_backup.t1 (a int) ENGINE=MEMORY;
+INSERT INTO rpl_backup.t1 VALUES (11), (22), (33);
+SELECT count(*) FROM rpl_backup.t1;
+count(*)
+3
+SELECT count(*) FROM rpl_backup.t1;
+count(*)
+3
+Make a backup for later use.
+backup_id = 603.
+BACKUP DATABASE rpl_backup TO 'rpl_bup_s3.bak';
+backup_id
+603
+Test restore on slave while replication turned on.
+RESTORE FROM 'rpl_bup_s1.bak';
+ERROR HY000: A restore operation was attempted on a slave during replication. You must stop the slave prior to running a restore.
+Stop slave and restart after restore.
+STOP SLAVE;
+RESTORE FROM 'rpl_bup_s3.bak';
+backup_id
+#
+START SLAVE;
+Checking affect on replication.
+INSERT INTO rpl_backup.t1 VALUES (44), (55), (66);
+SELECT count(*) FROM rpl_backup.t1;
+count(*)
+6
+SELECT * FROM rpl_backup.t1 ORDER BY a;
+a
+11
+22
+33
+44
+55
+66
+SELECT count(*) FROM rpl_backup.t1;
+count(*)
+6
+SELECT * FROM rpl_backup.t1 ORDER BY a;
+a
+11
+22
+33
+44
+55
+66
+Stop replication and turn off binary log.
+STOP SLAVE;
+SET @orig_sql_log_bin= @@sql_log_bin;
+Turn off binlog.
+SET @@sql_log_bin= 0;
+SHOW VARIABLES LIKE '%log_bin';
+Variable_name	Value
+log_bin	ON
+sql_log_bin	OFF
+backup_id = 504.
+BACKUP DATABASE rpl_backup TO 'rpl_bup_m4.bak';
+backup_id
+504
+Turn on binlog;
+SET @@sql_log_bin= @orig_sql_log_bin;
+SHOW VARIABLES LIKE '%log_bin';
+Variable_name	Value
+log_bin	ON
+sql_log_bin	ON
+backup_id = 505.
+RESTORE FROM 'rpl_bup_m4.bak';
+backup_id
+505
+PURGE BACKUP LOGS;
+DROP DATABASE rpl_backup;
+PURGE BACKUP LOGS;
+DROP DATABASE rpl_backup;

=== added file 'mysql-test/suite/rpl/t/rpl_backup.test'
--- a/mysql-test/suite/rpl/t/rpl_backup.test	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/rpl/t/rpl_backup.test	2008-10-29 00:10:42 +0000
@@ -0,0 +1,284 @@
+#
+# Test backup and replication integration.
+#
+
+--source include/master-slave.inc
+--source include/not_embedded.inc
+--source include/have_debug_sync.inc
+--source include/have_debug.inc
+
+connection master;
+
+--echo Create some data...
+CREATE DATABASE rpl_backup;
+CREATE TABLE rpl_backup.t1 (a int) ENGINE=MEMORY;
+INSERT INTO rpl_backup.t1 VALUES (1), (2), (3), (4), (5);
+
+#
+# Use Case 1 - Backup performed on a master.
+#   When a backup is performed on a master, the master shall not log 
+#   the backup event nor shall the master replicate any data produced
+#   (logged) by the backup. 
+
+--echo Remove all entries in the backup logs.
+FLUSH BACKUP LOGS;
+PURGE BACKUP LOGS;
+
+connection slave;
+
+--echo Remove all entries in the backup logs.
+FLUSH BACKUP LOGS;
+PURGE BACKUP LOGS;
+
+connection master;
+
+#
+# Now test read of backupid with known id using debug insertion
+#
+SET SESSION debug="d,set_backup_id";
+
+# We are using debug insertion to set the first backup_id to
+# 500 so we can expect the output of this operation to be 500.
+--echo Backup_id = 500.
+BACKUP DATABASE rpl_backup TO 'rpl_bup_m1.bak';
+
+SET SESSION debug="d";
+
+#
+# Now check slave to see if backup logs are affected.
+#
+connection slave;
+
+--echo Should have count(*) = 0.
+SELECT count(*) FROM mysql.backup_history;
+
+--echo Check backup log. Compare should be 1
+--echo Perform backup on slave and examine backup log.
+--echo Check backup log. Compare should be NULL
+FLUSH BACKUP LOGS;
+PURGE BACKUP LOGS;
+
+#
+#  Use Case 3 - Backup performed on a slave (part 1 of 2)
+#    Test backup on slave but slave has not slaves.
+#
+
+#
+# Now test read of backupid with known id using debug insertion
+#
+
+SET SESSION debug="d,set_backup_id";
+
+# We are using debug insertion to set the first backup_id to
+# 600 so we can expect the output of this operation to be 500.
+--echo Backup_id = 600.
+BACKUP DATABASE rpl_backup TO 'rpl_bup_s1.bak';
+
+SET SESSION debug="d";
+
+--echo Check saving of master's binlog information.
+--echo Should have count(*) = 1.
+SELECT count(*) FROM mysql.backup_progress 
+WHERE backup_id = 600 AND notes LIKE 'Recording master binlog information%';
+
+--echo Should have count(*) = 1.
+SELECT count(*) FROM mysql.backup_history;
+
+--echo Verify backup run on master does not advance binlog pos.
+connection master;
+
+--echo Get binlog position before backup.
+let $before_pos = query_get_value("SHOW MASTER STATUS", Position, 1);
+
+--echo Backup_id = 501.
+BACKUP DATABASE rpl_backup TO 'rpl_bup_m2.bak';
+
+--echo Get binlog position after backup.
+let $after_pos = query_get_value("SHOW MASTER STATUS", Position, 1);
+
+--echo Compute the difference of the binlog positions.
+--echo Result should be 0.
+--disable_query_log
+eval SELECT $after_pos - $before_pos AS Delta;
+--enable_query_log
+
+--echo Ensure replication is still working...
+
+INSERT INTO rpl_backup.t1 VALUES (10), (20), (30);
+
+--echo Backup_id = 502.
+BACKUP DATABASE rpl_backup TO 'rpl_bup_m3.bak';
+
+SELECT count(*) FROM rpl_backup.t1;
+
+sync_slave_with_master;
+connection slave;
+
+SELECT count(*) FROM rpl_backup.t1;
+
+--echo Make a backup for later use.
+--echo backup_id = 601.
+BACKUP DATABASE rpl_backup TO 'rpl_bup_s2.bak';
+
+#
+#  Use Case 2 - Restore performed on a master.
+#
+
+# To ensure the master does not log anything in the binary log
+# during a restore, we first drop the database on the slave
+# then run the restore and after slave is restarted check to
+# see if database is still missing (it should be).
+
+connection slave;
+
+DROP DATABASE rpl_backup;
+
+connection master;
+
+--echo backup_id = 503.
+RESTORE FROM 'rpl_bup_m3.bak';
+
+--echo Showing databases on master.
+SHOW DATABASES LIKE 'rpl_backup%';
+
+SELECT count(*) FROM rpl_backup.t1;
+
+connection slave;
+
+STOP SLAVE;
+
+SET global sql_slave_skip_counter=1;
+
+START SLAVE;
+--source include/wait_for_slave_to_start.inc
+
+--echo Showing databases on slave.
+SHOW DATABASES LIKE 'rpl_backup%';
+
+# Now stop the slave, do the restore, then restart.
+STOP SLAVE;
+--source include/wait_for_slave_to_stop.inc
+
+--echo backup_id = 602.
+RESTORE FROM 'rpl_bup_s2.bak';
+
+--echo Showing databases on slave.
+SHOW DATABASES LIKE 'rpl_backup%';
+
+SELECT count(*) FROM rpl_backup.t1;
+
+START SLAVE;
+--source include/wait_for_slave_to_start.inc
+
+connection master;
+
+--echo Ensure replication is still working...
+--echo Cleanup from last error on master and slave.
+DROP TABLE rpl_backup.t1;
+
+CREATE TABLE rpl_backup.t1 (a int) ENGINE=MEMORY;
+
+INSERT INTO rpl_backup.t1 VALUES (11), (22), (33);
+
+SELECT count(*) FROM rpl_backup.t1;
+
+sync_slave_with_master;
+connection slave;
+
+SELECT count(*) FROM rpl_backup.t1;
+
+--echo Make a backup for later use.
+--echo backup_id = 603.
+BACKUP DATABASE rpl_backup TO 'rpl_bup_s3.bak';
+
+#
+#  Use Case 4 - Restore performed on a slave.
+#
+
+connection slave;
+
+--echo Test restore on slave while replication turned on.
+
+--error ER_RESTORE_ON_SLAVE
+RESTORE FROM 'rpl_bup_s1.bak';
+
+--echo Stop slave and restart after restore.
+STOP SLAVE;
+
+--replace_column 1 #
+RESTORE FROM 'rpl_bup_s3.bak';
+
+START SLAVE;
+--source include/wait_for_slave_to_start.inc
+
+connection master;
+
+--echo Checking affect on replication.
+INSERT INTO rpl_backup.t1 VALUES (44), (55), (66);
+SELECT count(*) FROM rpl_backup.t1;
+SELECT * FROM rpl_backup.t1 ORDER BY a;
+
+sync_slave_with_master;
+connection slave;
+SELECT count(*) FROM rpl_backup.t1;
+SELECT * FROM rpl_backup.t1 ORDER BY a;
+
+#
+#  Use Case 3 - Backup performed on a slave (part 2 of 2)
+#    Test backup on slave with another slave attached.
+#
+#  Note: To be added as part of WL#4612
+
+#
+#  Use Case 5 - Backup run with no binary log.
+#
+
+--echo Stop replication and turn off binary log.
+connection slave;
+
+STOP SLAVE;
+
+connection master;
+
+SET @orig_sql_log_bin= @@sql_log_bin;
+
+--echo Turn off binlog.
+SET @@sql_log_bin= 0;
+SHOW VARIABLES LIKE '%log_bin';
+
+--echo backup_id = 504.
+BACKUP DATABASE rpl_backup TO 'rpl_bup_m4.bak';
+
+--echo Turn on binlog;
+SET @@sql_log_bin= @orig_sql_log_bin;
+SHOW VARIABLES LIKE '%log_bin';
+
+#
+#  Use Case 6 - Restore run with binary log turned on but no slaves attached.
+#
+
+--echo backup_id = 505.
+RESTORE FROM 'rpl_bup_m4.bak';
+
+#
+# Cleanup
+#
+connection master;
+
+PURGE BACKUP LOGS;
+DROP DATABASE rpl_backup;
+
+--remove_file $MYSQLTEST_VARDIR/master-data/rpl_bup_m1.bak
+--remove_file $MYSQLTEST_VARDIR/master-data/rpl_bup_m2.bak
+--remove_file $MYSQLTEST_VARDIR/master-data/rpl_bup_m3.bak
+--remove_file $MYSQLTEST_VARDIR/master-data/rpl_bup_m4.bak
+
+connection slave;
+
+PURGE BACKUP LOGS;
+DROP DATABASE rpl_backup;
+
+--remove_file $MYSQLTEST_VARDIR/slave-data/rpl_bup_s1.bak
+--remove_file $MYSQLTEST_VARDIR/slave-data/rpl_bup_s2.bak
+--remove_file $MYSQLTEST_VARDIR/slave-data/rpl_bup_s3.bak
+

=== modified file 'sql/backup/backup_kernel.h'
--- a/sql/backup/backup_kernel.h	2008-10-27 13:06:21 +0000
+++ b/sql/backup/backup_kernel.h	2008-10-29 00:10:42 +0000
@@ -134,6 +134,12 @@ class Backup_restore_ctx: public backup:
   */
   bool m_tables_locked; 
 
+  /**
+    Indicates we must turn binlog back on in the close method. This is
+    set to TRUE in the prepare_for_restore() method.
+  */
+  bool m_engage_binlog;
+
   int lock_tables_for_restore();
   void unlock_tables();
   

=== modified file 'sql/backup/data_backup.cc'
--- a/sql/backup/data_backup.cc	2008-10-14 12:08:56 +0000
+++ b/sql/backup/data_backup.cc	2008-10-29 00:10:42 +0000
@@ -627,6 +627,13 @@ int write_table_data(THD* thd, Backup_in
       info.m_ctx.report_binlog_pos(info.binlog_pos);
     }
 
+    /*
+      If we are a connected slave, write master's binlog information to
+      the progress log for later use.
+    */
+    if (obs::is_slave())
+      info.m_ctx.report_master_binlog_pos(active_mi);
+
     info.m_ctx.report_state(BUP_RUNNING);
     DEBUG_SYNC(thd, "after_backup_binlog");
 

=== modified file 'sql/backup/kernel.cc'
--- a/sql/backup/kernel.cc	2008-10-28 14:17:05 +0000
+++ b/sql/backup/kernel.cc	2008-10-29 00:10:42 +0000
@@ -211,6 +211,14 @@ execute_backup_command(THD *thd, LEX *le
 
   case SQLCOM_RESTORE:
   {
+    bool turn_on_binlog= FALSE;
+
+    /*
+      Restore cannot be run on a slave while connected to a master.
+    */
+    if (obs::is_slave())
+      DBUG_RETURN(send_error(context, ER_RESTORE_ON_SLAVE));
+
     Restore_info *info= context.prepare_for_restore(backupdir, lex->backup_dir, 
                                                     thd->query);
     
@@ -378,7 +386,8 @@ pthread_mutex_t Backup_restore_ctx::run_
 Backup_restore_ctx::Backup_restore_ctx(THD *thd)
  :Logger(thd), m_state(CREATED), m_thd_options(thd->options),
   m_error(0), m_remove_loc(FALSE), m_stream(NULL),
-  m_catalog(NULL), mem_alloc(NULL), m_tables_locked(FALSE)
+  m_catalog(NULL), mem_alloc(NULL), m_tables_locked(FALSE),
+  m_engage_binlog(FALSE)
 {
   /*
     Check for progress tables.
@@ -785,6 +794,30 @@ Backup_restore_ctx::prepare_for_restore(
 
   m_state= PREPARED_FOR_RESTORE;
 
+  /*
+    Do not allow slaves to connect during a restore.
+  */
+  if (obs::is_binlog_engaged())
+    obs::disable_slave_connections(TRUE);
+
+  DEBUG_SYNC(m_thd, "after_disable_slave_connections");
+
+  /*
+    If the binlog is turned on, write a RESTORE_EVENT as an
+    incident report into the binary log.
+  */
+  if (obs::is_binlog_engaged())
+    obs::write_incident_event(m_thd, obs::RESTORE_EVENT);
+
+  /*
+    Turn off binlog during restore.
+  */
+  if (obs::is_binlog_engaged())
+  {
+    m_engage_binlog= TRUE;
+    obs::engage_binlog(FALSE);
+  }
+
   return info;
 }
 
@@ -923,6 +956,17 @@ int Backup_restore_ctx::close()
 
   using namespace backup;
 
+  /*
+    Allow slaves connect after restore is complete.
+  */
+  obs::disable_slave_connections(FALSE);
+
+  /*
+    Turn binlog back on iff it was turned off earlier.
+  */
+  if (m_engage_binlog)
+    obs::engage_binlog(TRUE);
+
   time_t when= my_time(0);
 
   // unlock tables if they are still locked
@@ -1250,6 +1294,13 @@ int Backup_restore_ctx::do_restore()
   report_vp_time(info.get_vp_time(), FALSE); // FALSE = do not write to progress log
   if (info.flags & BSTREAM_FLAG_BINLOG)
     report_binlog_pos(info.binlog_pos);
+
+  /*
+    If we are a connected slave, write master's binlog information to
+    the progress log for later use.
+  */
+  if (obs::is_slave())
+    report_master_binlog_pos(active_mi);
 
   report_stats_post(info);                      // Never errors
 

=== modified file 'sql/backup/logger.h'
--- a/sql/backup/logger.h	2008-10-27 13:06:21 +0000
+++ b/sql/backup/logger.h	2008-10-29 00:10:42 +0000
@@ -5,6 +5,7 @@
 #include <backup_stream.h>
 #include <backup/error.h>
 #include "si_logs.h"
+#include "rpl_mi.h"
 
 namespace backup {
 
@@ -56,6 +57,7 @@ class Logger
    void report_state(enum_backup_state);
    void report_vp_time(time_t, bool);
    void report_binlog_pos(const st_bstream_binlog_pos&);
+   void report_master_binlog_pos(Master_info *active_mi);
    void report_driver(const char *driver);
    void report_backup_file(char * path);
    void report_stats_pre(const Image_info&);
@@ -267,6 +269,23 @@ void Logger::report_binlog_pos(const st_
   DBUG_ASSERT(backup_log);
   backup_log->binlog_pos(pos.pos);
   backup_log->binlog_file(pos.file);
+}
+
+/*
+  Get master's binlog information.
+*/
+inline
+void Logger::report_master_binlog_pos(Master_info *active_mi)
+{
+  char buff[1024];
+
+  if (active_mi)
+  {
+    sprintf(buff, 
+      "Recording master binlog information. binlog file = '%s', position = %d.",
+      active_mi->master_log_name, active_mi->master_log_pos);
+    backup_log->write_progress(0, 0, 0, 0, 0, 0, (char *)&buff);
+  }
 }
 
 /**

=== modified file 'sql/log.cc'
--- a/sql/log.cc	2008-10-28 14:17:05 +0000
+++ b/sql/log.cc	2008-10-29 00:10:42 +0000
@@ -29,6 +29,7 @@
 #include "rpl_filter.h"
 #include "rpl_rli.h"
 #include "sql_audit.h"
+#include "si_objects.h"
 
 #include <my_dir.h>
 #include <stdarg.h>
@@ -2031,6 +2032,7 @@ bool LOGGER::general_log_print(THD *thd,
 bool LOGGER::backup_history_log_write(THD *thd, 
                                       st_backup_history *history_data)
 {
+  bool reengage_binlog= FALSE;
   bool error= FALSE;
   Log_event_handler **current_handler= backup_history_log_handler_list;
   ulong id;
@@ -2046,12 +2048,27 @@ bool LOGGER::backup_history_log_write(TH
   else
     id= 0;                              /* Log from connect handler */
 
+  /*
+    If binlog is turned on, turn it off and don't replicate the
+    updates to the backup logs.
+  */
+  if (obs::is_binlog_engaged())
+  {
+    obs::engage_binlog(FALSE);
+    reengage_binlog= TRUE;
+  }
   lock_shared();
   while (*current_handler)
     error|= (*current_handler++)->
       log_backup_history(thd, history_data) || error;
   unlock();
 
+  /*
+    Turn binlog back on if disengaged.
+  */
+  if (reengage_binlog)
+    obs::engage_binlog(TRUE);
+
   return error;
 }
 
@@ -2086,6 +2103,7 @@ bool LOGGER::backup_progress_log_write(T
                                        int error_num,
                                        const char *notes)
 {
+  bool reengage_binlog= FALSE;
   bool error= FALSE;
   Log_event_handler **current_handler= backup_progress_log_handler_list;
   ulong id;
@@ -2101,6 +2119,16 @@ bool LOGGER::backup_progress_log_write(T
   else
     id= 0;                              /* Log from connect handler */
 
+
+  /*
+    If binlog is turned on, turn it off and don't replicate the
+    updates to the backup logs.
+  */
+  if (obs::is_binlog_engaged())
+  {
+    obs::engage_binlog(FALSE);
+    reengage_binlog= TRUE;
+  }
   lock_shared();
   while (*current_handler)
     error|= (*current_handler++)->
@@ -2108,6 +2136,12 @@ bool LOGGER::backup_progress_log_write(T
                              stop, size, progress, error_num, notes) || error;
   unlock();
 
+  /*
+    Turn binlog back on if disengaged.
+  */
+  if (reengage_binlog)
+    obs::engage_binlog(TRUE);
+
   return error;
 }
 
@@ -4055,7 +4089,7 @@ ulonglong MYSQL_BACKUP_LOG::get_next_bac
   else  // increment the counter
     id= m_next_id + 1;
 
-  DBUG_EXECUTE_IF("set_backup_id", id= 500;);
+  DBUG_EXECUTE_IF("set_backup_id", id= obs::is_slave() ? 600 : 500;);
 
   /* 
     Write the new value to the file

=== modified file 'sql/share/errmsg.txt'
--- a/sql/share/errmsg.txt	2008-10-28 18:14:14 +0000
+++ b/sql/share/errmsg.txt	2008-10-29 00:10:42 +0000
@@ -6416,3 +6416,5 @@ ER_MASTER_BLOCKING_SLAVES
   eng "The master is not allowing slave connections."
 ER_RESTORE_ON_MASTER
   eng "A restore operation was initiated on the master."
+ER_RESTORE_ON_SLAVE
+  eng "A restore operation was attempted on a slave during replication. You must stop the slave prior to running a restore."

Thread
bzr commit into mysql-6.0-backup branch (cbell:2720) WL#4209Chuck Bell29 Oct
  • Re: bzr commit into mysql-6.0-backup branch (cbell:2720) WL#4209Rafal Somla29 Oct
    • Re: bzr commit into mysql-6.0-backup branch (cbell:2720) WL#4209Chuck Bell29 Oct
  • Re: bzr commit into mysql-6.0-backup branch (cbell:2720) WL#4209Rafal Somla29 Oct
    • Re: bzr commit into mysql-6.0-backup branch (cbell:2720) WL#4209Chuck Bell29 Oct
  • Re: bzr commit into mysql-6.0-backup branch (cbell:2720) WL#4209Øystein Grøvlen29 Oct
    • Re: bzr commit into mysql-6.0-backup branch (cbell:2720) WL#4209Chuck Bell29 Oct
      • Re: bzr commit into mysql-6.0-backup branch (cbell:2720) WL#4209Øystein Grøvlen29 Oct
        • RE: bzr commit into mysql-6.0-backup branch (cbell:2720) WL#4209Chuck Bell29 Oct
          • Re: bzr commit into mysql-6.0-backup branch (cbell:2720) WL#4209Øystein Grøvlen29 Oct
  • Re: bzr commit into mysql-6.0-backup branch (cbell:2720) WL#4209Rafal Somla29 Oct
    • Re: bzr commit into mysql-6.0-backup branch (cbell:2720) WL#4209Chuck Bell29 Oct