Commit 94f9da5e authored by unknown's avatar unknown

Merge whalegate.ndb.mysql.com:/home/tomas/mysql-5.0-ndb

into  whalegate.ndb.mysql.com:/home/tomas/mysql-5.1-single-user


storage/ndb/tools/restore/consumer_restore.cpp:
  Auto merged
storage/ndb/tools/restore/restore_main.cpp:
  Auto merged
sql/ha_ndbcluster.cc:
  null merge, 5.1 already reports correct error
mysql-test/r/ndb_restore.result:
  manual merge
mysql-test/t/ndb_restore.test:
  manual merge
parents 7c291173 dfd00029
......@@ -16,7 +16,7 @@ CREATE TABLE `t2_c` (
`descrpooppo` varchar(64) default NULL,
`svcutonsa` varchar(64) NOT NULL default '',
PRIMARY KEY (`capgotod`),
KEY `i_quadaddsvr` (`gotod`)
KEY `i quadaddsvr` (`gotod`)
) ENGINE=ndbcluster DEFAULT CHARSET=latin1;
INSERT INTO `t2_c` VALUES (5,4,'','q3.net','addavp:MK_CASELECTOR=1','postorod rattoaa'),(2,1,'4','','addavp:MK_BRANDTAD=345','REDS Brandtad'),(3,2,'4','q3.net','execorder','fixedRatediPO REDS'),(1,1,'3','','addavp:MK_BRANDTAD=123','TEST Brandtad'),(6,5,'','told.q3.net','addavp:MK_BRANDTAD=123','Brandtad Toldzone'),(4,3,'3','q3.net','addavp:MK_POOLHINT=2','ratedi PO TEST');
CREATE TABLE `t3_c` (
......
......@@ -15,7 +15,10 @@ CREATE TABLE `t1_c` (
PRIMARY KEY (`capgoaledatta`,`goaledatta`,`maturegarbagefa`)
) ENGINE=ndbcluster DEFAULT CHARSET=latin1;
INSERT INTO `t1_c` VALUES (2,'3','q3plus.qt'),(4,'4','q3plus.qt'),(1,'3','q3.net'),(3,'4','q3.net'),(3,'20','threetrees.qt');
#
# Bug #27758 Restoring NDB backups makes table usable in SQL nodes
# - space in key made table unusable after restore
#
CREATE TABLE `t2_c` (
`capgotod` smallint(5) unsigned NOT NULL auto_increment,
`gotod` smallint(5) unsigned NOT NULL default '0',
......@@ -24,7 +27,7 @@ CREATE TABLE `t2_c` (
`descrpooppo` varchar(64) default NULL,
`svcutonsa` varchar(64) NOT NULL default '',
PRIMARY KEY (`capgotod`),
KEY `i_quadaddsvr` (`gotod`)
KEY `i quadaddsvr` (`gotod`)
) ENGINE=ndbcluster DEFAULT CHARSET=latin1;
INSERT INTO `t2_c` VALUES (5,4,'','q3.net','addavp:MK_CASELECTOR=1','postorod rattoaa'),(2,1,'4','','addavp:MK_BRANDTAD=345','REDS Brandtad'),(3,2,'4','q3.net','execorder','fixedRatediPO REDS'),(1,1,'3','','addavp:MK_BRANDTAD=123','TEST Brandtad'),(6,5,'','told.q3.net','addavp:MK_BRANDTAD=123','Brandtad Toldzone'),(4,3,'3','q3.net','addavp:MK_POOLHINT=2','ratedi PO TEST');
......
......@@ -813,7 +813,7 @@ BackupRestore::table(const TableS & table){
BaseString tmp(name);
Vector<BaseString> split;
if(tmp.split(split, "/") != 3){
err << "Invalid table name format " << name << endl;
err << "Invalid table name format `" << name << "`" << endl;
return false;
}
......@@ -881,7 +881,7 @@ BackupRestore::table(const TableS & table){
if (dict->createTable(copy) == -1)
{
err << "Create table " << table.getTableName() << " failed: "
err << "Create table `" << table.getTableName() << "` failed: "
<< dict->getNdbError() << endl;
if (dict->getNdbError().code == 771)
{
......@@ -898,12 +898,13 @@ BackupRestore::table(const TableS & table){
}
return false;
}
info << "Successfully restored table " << table.getTableName()<< endl ;
info << "Successfully restored table `"
<< table.getTableName() << "`" << endl;
}
const NdbDictionary::Table* tab = dict->getTable(split[2].c_str());
if(tab == 0){
err << "Unable to find table: " << split[2].c_str() << endl;
err << "Unable to find table: `" << split[2].c_str() << "`" << endl;
return false;
}
if(m_restore_meta)
......@@ -965,12 +966,15 @@ BackupRestore::endOfTables(){
for(size_t i = 0; i<m_indexes.size(); i++){
NdbTableImpl & indtab = NdbTableImpl::getImpl(* m_indexes[i]);
BaseString tmp(indtab.m_primaryTable.c_str());
Vector<BaseString> split;
if(tmp.split(split, "/") != 3){
err << "Invalid table name format " << indtab.m_primaryTable.c_str()
<< endl;
return false;
{
BaseString tmp(indtab.m_primaryTable.c_str());
if (tmp.split(split, "/") != 3)
{
err << "Invalid table name format `" << indtab.m_primaryTable.c_str()
<< "`" << endl;
return false;
}
}
m_ndb->setDatabaseName(split[0].c_str());
......@@ -978,39 +982,41 @@ BackupRestore::endOfTables(){
const NdbDictionary::Table * prim = dict->getTable(split[2].c_str());
if(prim == 0){
err << "Unable to find base table \"" << split[2].c_str()
<< "\" for index "
<< indtab.getName() << endl;
err << "Unable to find base table `" << split[2].c_str()
<< "` for index `"
<< indtab.getName() << "`" << endl;
return false;
}
NdbTableImpl& base = NdbTableImpl::getImpl(*prim);
NdbIndexImpl* idx;
int id;
char idxName[255], buf[255];
if(sscanf(indtab.getName(), "%[^/]/%[^/]/%d/%s",
buf, buf, &id, idxName) != 4){
err << "Invalid index name format " << indtab.getName() << endl;
return false;
Vector<BaseString> split_idx;
{
BaseString tmp(indtab.getName());
if (tmp.split(split_idx, "/") != 4)
{
err << "Invalid index name format `" << indtab.getName() << "`" << endl;
return false;
}
}
if(NdbDictInterface::create_index_obj_from_table(&idx, &indtab, &base))
{
err << "Failed to create index " << idxName
<< " on " << split[2].c_str() << endl;
err << "Failed to create index `" << split_idx[3]
<< "` on " << split[2].c_str() << endl;
return false;
}
idx->setName(idxName);
idx->setName(split_idx[3].c_str());
if(dict->createIndex(* idx) != 0)
{
delete idx;
err << "Failed to create index " << idxName
<< " on " << split[2].c_str() << endl
err << "Failed to create index `" << split_idx[3].c_str()
<< "` on `" << split[2].c_str() << "`" << endl
<< dict->getNdbError() << endl;
return false;
}
delete idx;
info << "Successfully created index " << idxName
<< " on " << split[2].c_str() << endl;
info << "Successfully created index `" << split_idx[3].c_str()
<< "` on `" << split[2].c_str() << "`" << endl;
}
return true;
}
......
......@@ -783,8 +783,8 @@ main(int argc, char** argv)
for(Uint32 j= 0; j < g_consumers.size(); j++)
if (!g_consumers[j]->table(* table))
{
err << "Restore: Failed to restore table: ";
err << table->getTableName() << " ... Exiting " << endl;
err << "Restore: Failed to restore table: `";
err << table->getTableName() << "` ... Exiting " << endl;
exitHandler(NDBT_FAILED);
}
} else {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment