List:Commits« Previous MessageNext Message »
From:Jonas Oreland Date:December 3 2010 9:46am
Subject:bzr push into mysql-5.1-telco-6.3 branch (jonas:3358 to 3359) Bug#54613
View as plain text  
 3359 Jonas Oreland	2010-12-03
      ndb - bug#54613 - add new option --skip-broken-object that allows ndb_restore to carry on even if finding corrupt tables in backup file (currently it only handles case with missing blob-tables)

    added:
      mysql-test/std_data/ndb_backup_bug54613/
      mysql-test/std_data/ndb_backup_bug54613/BACKUP-2.2.ctl
    modified:
      mysql-test/Makefile.am
      mysql-test/suite/ndb/t/ndb_restore_compat.test
      storage/ndb/tools/restore/Restore.cpp
      storage/ndb/tools/restore/Restore.hpp
      storage/ndb/tools/restore/consumer_restore.cpp
      storage/ndb/tools/restore/restore_main.cpp
 3358 Jonas Oreland	2010-12-02
      ndb - bug#52988 - remove unused/useless code

    modified:
      storage/ndb/src/kernel/blocks/qmgr/QmgrMain.cpp
=== modified file 'mysql-test/Makefile.am'
--- a/mysql-test/Makefile.am	2010-10-12 11:54:35 +0000
+++ b/mysql-test/Makefile.am	2010-12-03 09:29:44 +0000
@@ -81,6 +81,7 @@ TEST_DIRS = t r include std_data std_dat
 	std_data/ndb_backup51_data_be std_data/ndb_backup51_data_le \
 	std_data/ndb_backup51_dd std_data/ndb_backup_packed \
 	std_data/ndb_backup51_d2_be std_data/ndb_backup51_d2_le \
+	std_data/ndb_backup_bug54613 \
 	std_data/funcs_1 \
 	extra/binlog_tests/ extra/rpl_tests \
 	suite/binlog suite/binlog/t suite/binlog/r suite/binlog/std_data \

=== added directory 'mysql-test/std_data/ndb_backup_bug54613'
=== added file 'mysql-test/std_data/ndb_backup_bug54613/BACKUP-2.2.ctl'
Files a/mysql-test/std_data/ndb_backup_bug54613/BACKUP-2.2.ctl	1970-01-01 00:00:00 +0000 and b/mysql-test/std_data/ndb_backup_bug54613/BACKUP-2.2.ctl	2010-12-03 09:29:44 +0000 differ

=== modified file 'mysql-test/suite/ndb/t/ndb_restore_compat.test'
--- a/mysql-test/suite/ndb/t/ndb_restore_compat.test	2008-05-16 13:10:18 +0000
+++ b/mysql-test/suite/ndb/t/ndb_restore_compat.test	2010-12-03 09:29:44 +0000
@@ -85,3 +85,11 @@ USE test;
 # hugo generated data...
 select a,b,hex(b0),hex(b1),hex(b2),hex(b3),b4,hex(b5),b6,hex(b7) from t1 order by 1,2;
 drop table t1;
+
+# bug#54613
+
+--error 1
+--exec $NDB_TOOLS_DIR/ndb_restore --no-defaults -b 2 -n 2 -m --core=0 --include-databases=ham --skip-unknown-objects $MYSQL_TEST_DIR/std_data/ndb_backup_bug54613 >> $NDB_TOOLS_OUTPUT
+
+--error 0
+--exec $NDB_TOOLS_DIR/ndb_restore --no-defaults -b 2 -n 2 -m --core=0 --include-databases=ham --skip-unknown-objects --skip-broken-objects $MYSQL_TEST_DIR/std_data/ndb_backup_bug54613 >> $NDB_TOOLS_OUTPUT

=== modified file 'storage/ndb/tools/restore/Restore.cpp'
--- a/storage/ndb/tools/restore/Restore.cpp	2010-10-22 01:15:45 +0000
+++ b/storage/ndb/tools/restore/Restore.cpp	2010-12-03 09:29:44 +0000
@@ -32,6 +32,7 @@
 #include "../../../../sql/ha_ndbcluster_tables.h"
 extern NdbRecordPrintFormat g_ndbrecord_print_format;
 extern bool ga_skip_unknown_objects;
+extern bool ga_skip_broken_objects;
 
 Uint16 Twiddle16(Uint16 in); // Byte shift 16-bit data
 Uint32 Twiddle32(Uint32 in); // Byte shift 32-bit data
@@ -565,13 +566,21 @@ RestoreMetaData::fixBlobs()
       }
       if (blobTable == NULL)
       {
+        table->m_broken = true;
         /* Corrupt backup, has main table, but no blob table */
         err << "Table " << table->m_dictTable->getName()
             << " has blob column " << j << " (" 
             << c->m_name.c_str()
             << ") with missing parts table in backup."
             << endl;
-        return false;
+        if (ga_skip_broken_objects)
+        {
+          continue;
+        }
+        else
+        {
+          return false;
+        }
       }
       assert(blobTable->m_dictTable != NULL);
       NdbTableImpl& bt = NdbTableImpl::getImpl(*blobTable->m_dictTable);
@@ -668,6 +677,7 @@ TableS::TableS(Uint32 version, NdbTableI
   backupVersion = version;
   m_isSysTable = false;
   m_isSYSTAB_0 = false;
+  m_broken = false;
   m_main_table = NULL;
   m_main_column_id = ~(Uint32)0;
   

=== modified file 'storage/ndb/tools/restore/Restore.hpp'
--- a/storage/ndb/tools/restore/Restore.hpp	2010-10-22 01:15:45 +0000
+++ b/storage/ndb/tools/restore/Restore.hpp	2010-12-03 09:29:44 +0000
@@ -175,6 +175,7 @@ class TableS {
 
   bool m_isSysTable;
   bool m_isSYSTAB_0;
+  bool m_broken;
 
   TableS *m_main_table;
   Uint32 m_main_column_id;
@@ -299,6 +300,12 @@ public:
   bool isSYSTAB_0() const {
     return m_isSYSTAB_0;
   } 
+
+  inline
+  bool isBroken() const {
+    return m_broken || (m_main_table && m_main_table->isBroken());
+  }
+  
 }; // TableS;
 
 class RestoreLogIterator;

=== modified file 'storage/ndb/tools/restore/consumer_restore.cpp'
--- a/storage/ndb/tools/restore/consumer_restore.cpp	2010-10-22 08:02:00 +0000
+++ b/storage/ndb/tools/restore/consumer_restore.cpp	2010-12-03 09:29:44 +0000
@@ -39,6 +39,7 @@ static Uint32 get_part_id(const NdbDicti
 extern const char * g_connect_string;
 extern BaseString g_options;
 extern unsigned int opt_no_binlog;
+extern bool ga_skip_broken_objects;
 
 bool BackupRestore::m_preserve_trailing_spaces = false;
 
@@ -1607,6 +1608,10 @@ BackupRestore::endOfTables(){
       err << "Unable to find base table `" << split[2].c_str() 
 	  << "` for index `"
 	  << indtab.getName() << "`" << endl;
+      if (ga_skip_broken_objects)
+      {
+        continue;
+      }
       return false;
     }
     NdbTableImpl& base = NdbTableImpl::getImpl(*prim);

=== modified file 'storage/ndb/tools/restore/restore_main.cpp'
--- a/storage/ndb/tools/restore/restore_main.cpp	2010-10-22 01:15:45 +0000
+++ b/storage/ndb/tools/restore/restore_main.cpp	2010-12-03 09:29:44 +0000
@@ -97,6 +97,7 @@ static bool _preserve_trailing_spaces = 
 static bool ga_disable_indexes = false;
 static bool ga_rebuild_indexes = false;
 bool ga_skip_unknown_objects = false;
+bool ga_skip_broken_objects = false;
 BaseString g_options("ndb_restore");
 
 const char *load_default_groups[]= { "mysql_cluster","ndb_restore",0 };
@@ -290,6 +291,9 @@ static struct my_option my_long_options[
   { "skip-unknown-objects", 256, "Skip unknown object when parsing backup",
     (uchar**) &ga_skip_unknown_objects, (uchar**) &ga_skip_unknown_objects, 0,
     GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 },
+  { "skip-broken-objects", 256, "Skip broken object when parsing backup",
+    (uchar**) &ga_skip_broken_objects, (uchar**) &ga_skip_broken_objects, 0,
+    GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 },
   { 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
 };
 
@@ -974,6 +978,9 @@ checkDoRestore(const TableS* table)
 static inline bool
 checkDbAndTableName(const TableS* table)
 {
+  if (table->isBroken())
+    return false;
+
   // If new options are given, ignore the old format
   if (opt_include_tables || opt_exclude_tables ||
       opt_include_databases || opt_exclude_databases ) {
@@ -1126,6 +1133,10 @@ main(int argc, char** argv)
   if (ga_rebuild_indexes)
     g_options.append(" --rebuild-indexes");
   g_options.appfmt(" -p %d", ga_nParallelism);
+  if (ga_skip_unknown_objects)
+    g_options.append(" --skip-unknown-objects");
+  if (ga_skip_broken_objects)
+    g_options.append(" --skip-broken-objects");
 
   g_connect_string = opt_connect_str;
 

No bundle (reason: useless for push emails).
Thread
bzr push into mysql-5.1-telco-6.3 branch (jonas:3358 to 3359) Bug#54613Jonas Oreland3 Dec