diff --git a/storage/ndb/tools/restore/consumer.hpp b/storage/ndb/tools/restore/consumer.hpp index d5c6d38985a9351885f4b346e2cab5e71b56d88c..37f67884e01b5dab301750def75e9fa03e1aa055 100644 --- a/storage/ndb/tools/restore/consumer.hpp +++ b/storage/ndb/tools/restore/consumer.hpp @@ -36,6 +36,7 @@ public: virtual void logEntry(const LogEntry &){} virtual void endOfLogEntrys(){} virtual bool finalize_table(const TableS &){return true;} + virtual bool createSystable(const TableS &){ return true;} virtual bool update_apply_status(const RestoreMetaData &metaData){return true;} NODE_GROUP_MAP *m_nodegroup_map; uint m_nodegroup_map_len; diff --git a/storage/ndb/tools/restore/consumer_restore.cpp b/storage/ndb/tools/restore/consumer_restore.cpp index 507058e2743e232089f25497c482a13f47111d3b..fe2e771d930fff7b981b00b0c41e4993d61c1598 100644 --- a/storage/ndb/tools/restore/consumer_restore.cpp +++ b/storage/ndb/tools/restore/consumer_restore.cpp @@ -666,6 +666,33 @@ BackupRestore::update_apply_status(const RestoreMetaData &metaData) return result; } +bool +BackupRestore::createSystable(const TableS & tables){ + const char *tablename = tables.getTableName(); + + if( strcmp(tablename, NDB_REP_DB "/def/" NDB_APPLY_TABLE) != 0 && + strcmp(tablename, NDB_REP_DB "/def/" NDB_SCHEMA_TABLE) != 0 ) + { + return true; + } + + BaseString tmp(tablename); + Vector<BaseString> split; + if(tmp.split(split, "/") != 3){ + err << "Invalid table name format " << tablename << endl; + return false; + } + + m_ndb->setDatabaseName(split[0].c_str()); + m_ndb->setSchemaName(split[1].c_str()); + + NdbDictionary::Dictionary* dict = m_ndb->getDictionary(); + if( dict->getTable(split[2].c_str()) != NULL ){ + return true; + } + return table(tables); +} + bool BackupRestore::table(const TableS & table){ if (!m_restore && !m_restore_meta) diff --git a/storage/ndb/tools/restore/consumer_restore.hpp b/storage/ndb/tools/restore/consumer_restore.hpp index c1d9472aea0f4cb35c6261f629a19967943005b1..3d20cb3041e391da74badbd48c4adbd2c0a37e05 100644 --- a/storage/ndb/tools/restore/consumer_restore.hpp +++ b/storage/ndb/tools/restore/consumer_restore.hpp @@ -73,6 +73,7 @@ public: virtual void endOfLogEntrys(); virtual bool finalize_table(const TableS &); virtual bool has_temp_error(); + virtual bool createSystable(const TableS & table); virtual bool update_apply_status(const RestoreMetaData &metaData); void connectToMysql(); bool map_in_frm(char *new_data, const char *data, diff --git a/storage/ndb/tools/restore/restore_main.cpp b/storage/ndb/tools/restore/restore_main.cpp index c6947f3bf0177752e407aab9656ec94042e3c53b..8a632d388e025e646a1f6915c45e61c16d8ad0fc 100644 --- a/storage/ndb/tools/restore/restore_main.cpp +++ b/storage/ndb/tools/restore/restore_main.cpp @@ -567,6 +567,15 @@ main(int argc, char** argv) err << metaData[i]->getTableName() << " ... Exiting " << endl; exitHandler(NDBT_FAILED); } + } else { + for(Uint32 j= 0; j < g_consumers.size(); j++) + if (!g_consumers[j]->createSystable(* metaData[i])) + { + err << "Restore: Failed to restore system table: "; + err << metaData[i]->getTableName() << " ... Exiting " << endl; + exitHandler(NDBT_FAILED); + } + } } debug << "Close tables" << endl;