MySQL Lists are EOL. Please join:

List:Commits« Previous MessageNext Message »
From:lzhou Date:April 21 2008 10:23am
Subject:bk commit into 5.1 tree (lzhou:1.2574) BUG#25918
View as plain text  
Below is the list of changes that have just been committed into a local
5.1 repository of lzhou.  When lzhou 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, 2008-04-21 10:23:05+00:00, lzhou@dev3-63.(none) +5 -0
  BUG#25918 add new flag '-o' to over write disk files

  mysql-test/suite/ndb/r/ndb_test.result@stripped, 2008-04-21 10:22:58+00:00, lzhou@dev3-63.(none) +31 -0
    Test case for new flag of ndb_restore

  mysql-test/suite/ndb/r/ndb_test.result@stripped, 2008-04-21 10:22:58+00:00, lzhou@dev3-63.(none) +0 -0

  mysql-test/suite/ndb/t/ndb_test.test@stripped, 2008-04-21 10:22:58+00:00, lzhou@dev3-63.(none) +45 -0
    Test case for new flag of ndb_restore(overwrite files)

  mysql-test/suite/ndb/t/ndb_test.test@stripped, 2008-04-21 10:22:58+00:00, lzhou@dev3-63.(none) +0 -0

  storage/ndb/tools/restore/consumer_restore.cpp@stripped, 2008-04-21 10:22:57+00:00, lzhou@dev3-63.(none) +2 -2
    Over write disk files using '-o' flag

  storage/ndb/tools/restore/consumer_restore.hpp@stripped, 2008-04-21 10:22:57+00:00, lzhou@dev3-63.(none) +2 -0
    Add variable '-o'

  storage/ndb/tools/restore/restore_main.cpp@stripped, 2008-04-21 10:22:57+00:00, lzhou@dev3-63.(none) +12 -0
    Add new flag to overwrite disk files

diff -Nrup a/mysql-test/suite/ndb/r/ndb_test.result b/mysql-test/suite/ndb/r/ndb_test.result
--- /dev/null	Wed Dec 31 16:00:00 196900
+++ b/mysql-test/suite/ndb/r/ndb_test.result	2008-04-21 10:22:58 +00:00
@@ -0,0 +1,31 @@
+DROP TABLE IF EXISTS t1;
+CREATE LOGFILE GROUP lg ADD UNDOFILE 'undo' INITIAL_SIZE 4M UNDO_BUFFER_SIZE = 1M ENGINE ndb;
+CREATE TABLESPACE ts ADD DATAFILE 'data' USE LOGFILE GROUP lg INITIAL_SIZE 2M ENGINE ndb;
+CREATE TABLE t1 ( id INT PRIMARY KEY, a INT, b CHAR(5) ) TABLESPACE ts STORAGE DISK ENGINE=NDB;
+INSERT INTO t1 VALUES (1, 1, 'abc');
+CREATE TEMPORARY TABLE IF NOT EXISTS test.backup_info (id INT, backup_id INT) ENGINE = HEAP;
+DELETE FROM test.backup_info;
+LOAD DATA INFILE '../tmp.dat' INTO TABLE test.backup_info FIELDS TERMINATED BY ',';
+SELECT @the_backup_id:=backup_id FROM test.backup_info;
+@the_backup_id:=backup_id
+<the_backup_id>
+DROP TABLE test.backup_info;
+drop table t1;
+ALTER TABLESPACE ts
+DROP DATAFILE 'data'
+ENGINE = NDB;
+DROP TABLESPACE ts
+ENGINE = NDB;
+DROP LOGFILE GROUP lg
+ENGINE =NDB;
+select * from t1;
+id	a	b
+1	1	abc
+drop table t1;
+ALTER TABLESPACE ts
+DROP DATAFILE 'data'
+ENGINE = NDB;
+DROP TABLESPACE ts
+ENGINE = NDB;
+DROP LOGFILE GROUP lg
+ENGINE =NDB;
diff -Nrup a/mysql-test/suite/ndb/t/ndb_test.test b/mysql-test/suite/ndb/t/ndb_test.test
--- /dev/null	Wed Dec 31 16:00:00 196900
+++ b/mysql-test/suite/ndb/t/ndb_test.test	2008-04-21 10:22:58 +00:00
@@ -0,0 +1,45 @@
+-- source include/have_ndb.inc
+
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+--enable_warnings
+
+CREATE LOGFILE GROUP lg ADD UNDOFILE 'undo' INITIAL_SIZE 4M UNDO_BUFFER_SIZE = 1M ENGINE ndb;
+CREATE TABLESPACE ts ADD DATAFILE 'data' USE LOGFILE GROUP lg INITIAL_SIZE 2M ENGINE ndb;
+CREATE TABLE t1 ( id INT PRIMARY KEY, a INT, b CHAR(5) ) TABLESPACE ts STORAGE DISK ENGINE=NDB;
+INSERT INTO t1 VALUES (1, 1, 'abc');
+
+--source include/ndb_backup.inc
+drop table t1;
+ALTER TABLESPACE ts
+DROP DATAFILE 'data'
+ENGINE = NDB;
+
+DROP TABLESPACE ts
+ENGINE = NDB;
+
+DROP LOGFILE GROUP lg
+ENGINE =NDB;
+
+#--exec echo >$MYSQLTEST_VARDIR/ndb_1_fs/undo
+--exec echo >$NDB_DATA_DIR/ndb_1_fs/undo
+--exec echo >$NDB_DATA_DIR/ndb_1_fs/data
+--exec echo >$NDB_DATA_DIR/ndb_2_fs/undo
+--exec echo >$NDB_DATA_DIR/ndb_2_fs/data
+
+--exec $NDB_TOOLS_DIR/ndb_restore --no-defaults -b $the_backup_id -o -n 1 -m -r --print --print_meta $NDB_BACKUP_DIR/BACKUP/BACKUP-$the_backup_id >> $NDB_TOOLS_OUTPUT
+--exec $NDB_TOOLS_DIR/ndb_restore --no-defaults -b $the_backup_id  -n 2 -r --print --print_meta $NDB_BACKUP_DIR/BACKUP/BACKUP-$the_backup_id >> $NDB_TOOLS_OUTPUT
+
+select * from t1;
+
+drop table t1;
+ALTER TABLESPACE ts
+DROP DATAFILE 'data'
+ENGINE = NDB;
+
+DROP TABLESPACE ts
+ENGINE = NDB;
+
+DROP LOGFILE GROUP lg
+ENGINE =NDB;
+
diff -Nrup a/storage/ndb/tools/restore/consumer_restore.cpp b/storage/ndb/tools/restore/consumer_restore.cpp
--- a/storage/ndb/tools/restore/consumer_restore.cpp	2007-06-17 15:20:17 +00:00
+++ b/storage/ndb/tools/restore/consumer_restore.cpp	2008-04-21 10:22:57 +00:00
@@ -566,7 +566,7 @@ BackupRestore::object(Uint32 type, const
 	    << " newid: " << ts->getObjectId() << endl;
       old.setTablespace(* ts);
       info << "Creating datafile \"" << old.getPath() << "\"..." << flush;
-      if (dict->createDatafile(old))
+      if (dict->createDatafile(old, m_overwrite_files))
       {
 	NdbError errobj= dict->getNdbError();
 	info << "FAILED" << endl;
@@ -592,7 +592,7 @@ BackupRestore::object(Uint32 type, const
 	    << " " << (void*)lg << endl;
       old.setLogfileGroup(* lg);
       info << "Creating undofile \"" << old.getPath() << "\"..." << flush;
-      if (dict->createUndofile(old))
+      if (dict->createUndofile(old, m_overwrite_files))
       {
 	NdbError errobj= dict->getNdbError();
 	info << "FAILED" << endl;
diff -Nrup a/storage/ndb/tools/restore/consumer_restore.hpp b/storage/ndb/tools/restore/consumer_restore.hpp
--- a/storage/ndb/tools/restore/consumer_restore.hpp	2007-04-24 01:45:13 +00:00
+++ b/storage/ndb/tools/restore/consumer_restore.hpp	2008-04-21 10:22:57 +00:00
@@ -46,6 +46,7 @@ public:
     m_restore = false;
     m_restore_meta = false;
     m_no_restore_disk = false;
+    m_overwrite_files = false;
     m_restore_epoch = false;
     m_parallelism = parallelism;
     m_callback = 0;
@@ -91,6 +92,7 @@ public:
   bool m_restore;
   bool m_restore_meta;
   bool m_no_restore_disk;
+  bool m_overwrite_files;
   bool m_restore_epoch;
   bool m_no_upgrade; // for upgrade ArrayType from 5.0 backup file.
   Uint32 m_logCount;
diff -Nrup a/storage/ndb/tools/restore/restore_main.cpp b/storage/ndb/tools/restore/restore_main.cpp
--- a/storage/ndb/tools/restore/restore_main.cpp	2007-08-30 08:17:24 +00:00
+++ b/storage/ndb/tools/restore/restore_main.cpp	2008-04-21 10:22:57 +00:00
@@ -70,6 +70,7 @@ static int _print_log = 0;
 static int _restore_data = 0;
 static int _restore_meta = 0;
 static int _no_restore_disk = 0;
+static int _overwrite_files = 0;
 BaseString g_options("ndb_restore");
 
 const char *load_default_groups[]= { "mysql_cluster","ndb_restore",0 };
@@ -124,6 +125,10 @@ static struct my_option my_long_options[
     "Dont restore disk objects (tablespace/logfilegroups etc)",
     (uchar**) &_no_restore_disk, (uchar**) &_no_restore_disk,  0,
     GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 },
+  { "overwrite files", 'o',
+    "Overwrite disk objects (data files/undo files etc)",
+    (uchar**) &_overwrite_files, (uchar**) &_overwrite_files,  0,
+    GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 },
   { "restore_epoch", 'e', 
     "Restore epoch info into the status table. Convenient on a MySQL Cluster "
     "replication slave, for starting replication. The row in "
@@ -465,6 +470,11 @@ o verify nodegroup mapping
     restore->m_no_restore_disk = true;
   }
   
+  if (_overwrite_files)
+  {
+    restore->m_overwrite_files = true;
+  }
+  
   if (ga_no_upgrade)
   {
      restore->m_no_upgrade = true;
@@ -664,6 +674,8 @@ main(int argc, char** argv)
     g_options.appfmt(" -e");
   if (_no_restore_disk)
     g_options.appfmt(" -d");
+  if (_overwrite_files)
+    g_options.appfmt(" -o");
   g_options.appfmt(" -p %d", ga_nParallelism);
 
   g_connect_string = opt_connect_str;
Thread
bk commit into 5.1 tree (lzhou:1.2574) BUG#25918lzhou21 Apr