List:Commits« Previous MessageNext Message »
From:Chuck Bell Date:June 3 2009 9:11pm
Subject:bzr push into mysql-6.0-backup branch (charles.bell:2820 to 2821)
Bug#36471
View as plain text  
 2821 Chuck Bell	2009-06-03
      BUG#36471 : Default driver should not backup NDB tables
      
      It has been decided MySQL Backup should not backup NDB tables and that if
      an NDB table is included in a backup, the backup should fail. 
       
      This patch ensures MySQL Backup cannot be used to backup NDB tables. A
      specific error message is produced encouraging the user to refer to the 
      Cluster reference manual.
      added:
        mysql-test/suite/ndb/r/backup_no_ndb.result
        mysql-test/suite/ndb/t/backup_no_ndb.cnf
        mysql-test/suite/ndb/t/backup_no_ndb.test
      modified:
        sql/backup/backup_info.cc
        sql/share/errmsg.txt

 2820 Jorgen Loland	2009-06-03 [merge]
      Merge mysql-6.0-backup-merge -> mysql-6.0-backup
      modified:
        CMakeLists.txt
        Makefile.am
        include/config-win.h
        sql/CMakeLists.txt
        support-files/compiler_warnings.supp

=== added file 'mysql-test/suite/ndb/r/backup_no_ndb.result'
--- a/mysql-test/suite/ndb/r/backup_no_ndb.result	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/ndb/r/backup_no_ndb.result	2009-06-03 20:29:31 +0000
@@ -0,0 +1,31 @@
+#
+# Create data to backup
+#
+DROP DATABASE IF EXISTS db1;
+PURGE BACKUP LOGS;
+CREATE DATABASE db1;
+CREATE TABLE db1.t1(a int) ENGINE=NDBCLUSTER;
+#
+# Attempt backup with ndb table.
+#
+BACKUP DATABASE db1 TO 'test.bak';
+ERROR HY000: NDB tables cannot be used with MySQL Backup. Please see the MySQL Cluster reference manual.
+SHOW ERRORS;
+Level	Code	Message
+Error	####	NDB tables cannot be used with MySQL Backup. Please see the MySQL Cluster reference manual.
+Error	####	Can't find backup driver for table `db#`.`t#`
+verify backup history and progress logs:
+SELECT backup_state,operation, backup_file, command FROM mysql.backup_history;
+backup_state	operation	backup_file	command
+error	backup	test.bak	BACKUP DATABASE db1 TO 'test.bak'
+SELECT notes FROM mysql.backup_progress;
+notes
+starting
+running
+NDB tables cannot be used with MySQL Backup. Please see the MySQL Cluster reference manual.
+Can't find backup driver for table `db1`.`t1`
+error
+#
+# Cleanup
+#
+DROP DATABASE db1;

=== added file 'mysql-test/suite/ndb/t/backup_no_ndb.cnf'
--- a/mysql-test/suite/ndb/t/backup_no_ndb.cnf	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/ndb/t/backup_no_ndb.cnf	2009-06-03 20:29:31 +0000
@@ -0,0 +1,17 @@
+!include ../my.cnf
+
+[mysqld.1]
+server_id=1
+new=1
+
+[mysqld.2]
+server_id=2
+new=1
+
+[ENV]
+MASTER_MYPORT=           @mysqld.1.port
+MASTER_MYSOCK=           @mysqld.1.socket
+SLAVE_MYPORT=            @mysqld.2.port
+SLAVE_MYSOCK=            @mysqld.2.socket
+
+

=== added file 'mysql-test/suite/ndb/t/backup_no_ndb.test'
--- a/mysql-test/suite/ndb/t/backup_no_ndb.test	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/ndb/t/backup_no_ndb.test	2009-06-03 20:29:31 +0000
@@ -0,0 +1,45 @@
+# Check that BACKUP correctly rejects ndb tables
+
+--source include/not_embedded.inc
+--source include/have_ndb.inc
+
+--echo #
+--echo # Create data to backup
+--echo #
+
+--disable_warnings
+DROP DATABASE IF EXISTS db1;
+--enable_warnings
+
+let $MYSQLD_DATADIR= `select @@datadir`;
+
+--error 0,1
+--remove_file $MYSQLD_DATADIR/test.bak
+
+PURGE BACKUP LOGS;
+
+CREATE DATABASE db1;
+CREATE TABLE db1.t1(a int) ENGINE=NDBCLUSTER;
+
+--echo #
+--echo # Attempt backup with ndb table.
+--echo #
+
+--error ER_BACKUP_NO_NDB
+BACKUP DATABASE db1 TO 'test.bak';
+
+--replace_regex /[0-9]/#/
+SHOW ERRORS;
+
+--echo verify backup history and progress logs:
+SELECT backup_state,operation, backup_file, command FROM mysql.backup_history;
+SELECT notes FROM mysql.backup_progress;
+
+--echo #
+--echo # Cleanup
+--echo #
+
+DROP DATABASE db1;
+
+--error 0,1
+--remove_file $MYSQLD_DATADIR/test.bak

=== modified file 'sql/backup/backup_info.cc'
--- a/sql/backup/backup_info.cc	2009-03-27 11:46:26 +0000
+++ b/sql/backup/backup_info.cc	2009-06-03 20:29:31 +0000
@@ -244,8 +244,16 @@ Backup_info::find_backup_engine(const ba
     List_iterator<Snapshot_info> it(snapshots);
     
     while ((snap= it++))
+    {
+      if (my_strcasecmp(system_charset_info, se->name.str, "NDBCLUSTER") == 0)
+      {
+        m_log.report_error(ER_BACKUP_NO_NDB);
+        snap= NULL;
+        break;
+      }
       if (snap->accept(tbl, se))
         break;
+    }
   }
 
   if (!snap)

=== modified file 'sql/share/errmsg.txt'
--- a/sql/share/errmsg.txt	2009-05-25 07:11:29 +0000
+++ b/sql/share/errmsg.txt	2009-06-03 20:29:31 +0000
@@ -6518,3 +6518,5 @@ ER_BACKUP_NOT_ENABLED
   eng "The MySQL Backup system is disabled in this release. Use --new on server startup to enable."
 WARN_DB_DROP_RENAMED
   eng "Renamed directory with unknown files to '%.200s'"
+ER_BACKUP_NO_NDB
+  eng "NDB tables cannot be used with MySQL Backup. Please see the MySQL Cluster reference manual."

Thread
bzr push into mysql-6.0-backup branch (charles.bell:2820 to 2821)Bug#36471Chuck Bell3 Jun