mirror of
https://github.com/MariaDB/server.git
synced 2025-01-20 05:52:27 +01:00
BUG #14612 If a restore is done on a slave cluster, yet the apply_status and schema tables don't exist,
ndb_restore tool should create them. storage/ndb/tools/restore/consumer.hpp: Add create apply_status and schema system table method when they don't exist. storage/ndb/tools/restore/consumer_restore.cpp: Implement to create apply_status and schema system table method when they don't exist. storage/ndb/tools/restore/consumer_restore.hpp: Add create apply_status and schema system table method when they don't exist. storage/ndb/tools/restore/restore_main.cpp: if apply_status and schema system tables don't exist, create them also.
This commit is contained in:
parent
3def506b9d
commit
e1922f0b32
4 changed files with 38 additions and 0 deletions
|
@ -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;
|
||||
|
|
|
@ -666,6 +666,33 @@ err:
|
|||
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)
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue