summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--mysql-test/ndb/ndbcluster.sh2
-rw-r--r--mysql-test/r/ndb_config.result6
-rw-r--r--mysql-test/r/ndb_restore.result9
-rw-r--r--mysql-test/t/disabled.def1
-rw-r--r--mysql-test/t/ndb_restore.test6
-rw-r--r--storage/ndb/tools/restore/consumer_restore.cpp12
-rw-r--r--storage/ndb/tools/restore/restore_main.cpp75
7 files changed, 53 insertions, 58 deletions
diff --git a/mysql-test/ndb/ndbcluster.sh b/mysql-test/ndb/ndbcluster.sh
index bc5d1000fe5..832987c7af6 100644
--- a/mysql-test/ndb/ndbcluster.sh
+++ b/mysql-test/ndb/ndbcluster.sh
@@ -89,7 +89,7 @@ while test $# -gt 0; do
--small)
ndb_no_ord=32
ndb_con_op=5000
- ndb_dmem=10M
+ ndb_dmem=20M
ndb_imem=1M
ndb_pbmem=4M
;;
diff --git a/mysql-test/r/ndb_config.result b/mysql-test/r/ndb_config.result
index 82d760c6cfc..d2a8a91828c 100644
--- a/mysql-test/r/ndb_config.result
+++ b/mysql-test/r/ndb_config.result
@@ -1,7 +1,7 @@
ndbd,1,localhost ndbd,2,localhost ndb_mgmd,3,localhost mysqld,4, mysqld,5, mysqld,6, mysqld,7, mysqld,8, mysqld,9, mysqld,10, mysqld,11,
-1,localhost,10485760,1048576 2,localhost,10485760,1048576
-1 localhost 10485760 1048576
-2 localhost 10485760 1048576
+1,localhost,20971520,1048576 2,localhost,20971520,1048576
+1 localhost 20971520 1048576
+2 localhost 20971520 1048576
1 2
ndbd,1,localhost ndbd,2,localhost ndb_mgmd,3,localhost mysqld,4, mysqld,5, mysqld,6, mysqld,7, mysqld,8, mysqld,9, mysqld,10, mysqld,11,
ndbd,1,localhost,52428800,26214400 ndbd,2,localhost,52428800,36700160 ndbd,3,localhost,52428800,52428800 ndbd,4,localhost,52428800,52428800 ndb_mgmd,5,localhost,, mysqld,6,localhost,,
diff --git a/mysql-test/r/ndb_restore.result b/mysql-test/r/ndb_restore.result
index 03076ea9253..b151eebde08 100644
--- a/mysql-test/r/ndb_restore.result
+++ b/mysql-test/r/ndb_restore.result
@@ -1,6 +1,14 @@
use test;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
drop table if exists t1_c,t2_c,t3_c,t4_c,t5_c,t6_c,t7_c,t8_c,t9_c;
+id type state logging database schema name
+2 UserTable Online Yes cluster_replication def apply_status
+1 SystemTable Online Yes sys def NDB$EVENTS_0
+3 UserTable Online Yes cluster_replication def schema
+0 SystemTable Online Yes sys def SYSTAB_0
+
+NDBT_ProgramExit: 0 - OK
+
CREATE TABLE `t1_c` (
`capgoaledatta` smallint(5) unsigned NOT NULL auto_increment,
`goaledatta` char(2) NOT NULL default '',
@@ -442,6 +450,7 @@ select * from t9_c) a;
count(*)
3
drop table t1_c,t2_c,t3_c,t4_c,t5_c,t6_c,t7_c,t8_c,t9_c;
+Create table test/def/t2_c failed: Translate frm error
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
drop table if exists t1_c,t2_c,t3_c,t4_c,t5_c,t6_c,t7_c,t8_c,t9_c;
520093696,2
diff --git a/mysql-test/t/disabled.def b/mysql-test/t/disabled.def
index aff855fb65b..869b9211e59 100644
--- a/mysql-test/t/disabled.def
+++ b/mysql-test/t/disabled.def
@@ -26,6 +26,5 @@ rpl_ndb_basic : Bug#16228
rpl_sp : Bug #16456
ndb_autodiscover : Needs to be fixed w.r.t binlog
ndb_autodiscover2 : Needs to be fixed w.r.t binlog
-ndb_restore : Needs fixing
system_mysql_db : Needs fixing
system_mysql_db_fix : Needs fixing
diff --git a/mysql-test/t/ndb_restore.test b/mysql-test/t/ndb_restore.test
index 034bb0fc247..5616dea04eb 100644
--- a/mysql-test/t/ndb_restore.test
+++ b/mysql-test/t/ndb_restore.test
@@ -8,6 +8,9 @@ drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
drop table if exists t1_c,t2_c,t3_c,t4_c,t5_c,t6_c,t7_c,t8_c,t9_c;
--enable_warnings
+--exec $NDB_TOOLS_DIR/ndb_show_tables
+--exec $NDB_MGM --no-defaults -e "all dump 1000" >> $NDB_TOOLS_OUTPUT
+
CREATE TABLE `t1_c` (
`capgoaledatta` smallint(5) unsigned NOT NULL auto_increment,
`goaledatta` char(2) NOT NULL default '',
@@ -348,8 +351,7 @@ select count(*)
select * from t9_c) a;
drop table t1_c,t2_c,t3_c,t4_c,t5_c,t6_c,t7_c,t8_c,t9_c;
---error 134
---exec $NDB_TOOLS_DIR/ndb_restore --no-defaults -b 2 -n 1 -m -r --ndb-nodegroup_map '(0,1)' --print --print_meta $NDB_BACKUP_DIR/BACKUP/BACKUP-2 >> $NDB_TOOLS_OUTPUT
+--exec $NDB_TOOLS_DIR/ndb_restore --no-defaults -b 2 -n 1 -m -r --ndb-nodegroup_map '(0,1)' $NDB_BACKUP_DIR/BACKUP/BACKUP-2 2>&1 | grep Translate || true
#
# Cleanup
diff --git a/storage/ndb/tools/restore/consumer_restore.cpp b/storage/ndb/tools/restore/consumer_restore.cpp
index d3da6749ca9..0d177366a57 100644
--- a/storage/ndb/tools/restore/consumer_restore.cpp
+++ b/storage/ndb/tools/restore/consumer_restore.cpp
@@ -213,7 +213,6 @@ Uint32 BackupRestore::map_ng(Uint32 ng)
if (ng == UNDEF_NODEGROUP ||
ng_map[ng].map_array[0] == UNDEF_NODEGROUP)
{
- ndbout << "No mapping done" << endl;
return ng;
}
else
@@ -226,13 +225,11 @@ Uint32 BackupRestore::map_ng(Uint32 ng)
assert(curr_inx < MAX_MAPS_PER_NODE_GROUP);
assert(new_curr_inx < MAX_MAPS_PER_NODE_GROUP);
- ndbout << "curr_inx = " << curr_inx << endl;
if (new_curr_inx >= MAX_MAPS_PER_NODE_GROUP)
new_curr_inx = 0;
else if (ng_map[ng].map_array[new_curr_inx] == UNDEF_NODEGROUP)
new_curr_inx = 0;
new_ng = ng_map[ng].map_array[curr_inx];
- ndbout << "new_ng = " << new_ng << endl;
ng_map[ng].curr_index = new_curr_inx;
return new_ng;
}
@@ -249,7 +246,6 @@ bool BackupRestore::map_nodegroups(Uint16 *ng_array, Uint32 no_parts)
for (i = 0; i < no_parts; i++)
{
Uint32 ng;
- ndbout << "map_nodegroups loop " << i << ", " << ng_array[i] << endl;
ng = map_ng((Uint32)ng_array[i]);
if (ng != ng_array[i])
mapped = TRUE;
@@ -279,7 +275,6 @@ bool BackupRestore::search_replace(char *search_str, char **new_data,
char start_delimiter = 0;
DBUG_ENTER("search_replace");
- ndbout << "search_replace" << endl;
do
{
char c = **data;
@@ -635,7 +630,6 @@ BackupRestore::table(const TableS & table){
const char * name = table.getTableName();
- ndbout << "Starting to handle table " << name << endl;
/**
* Ignore blob tables
*/
@@ -675,7 +669,6 @@ BackupRestore::table(const TableS & table){
if (copy.getDefaultNoPartitionsFlag())
{
- ndbout << "Default number of partitions" << endl;
/*
Table was defined with default number of partitions. We can restore
it with whatever is the default in this cluster.
@@ -688,7 +681,6 @@ BackupRestore::table(const TableS & table){
}
else
{
- ndbout << "Not default number of partitions" << endl;
/*
Table was defined with specific number of partitions. It should be
restored with the same number of partitions. It will either be
@@ -697,11 +689,8 @@ BackupRestore::table(const TableS & table){
*/
Uint16 *ng_array = (Uint16*)copy.getFragmentData();
Uint16 no_parts = copy.getFragmentCount();
- ndbout << "Map node groups, no_parts = " << no_parts << endl;
- ndbout << "ng_array = " << hex << (Uint32)ng_array << endl;
if (map_nodegroups(ng_array, no_parts))
{
- ndbout << "Node groups were mapped" << endl;
if (translate_frm(&copy))
{
err << "Create table " << table.getTableName() << " failed: ";
@@ -709,7 +698,6 @@ BackupRestore::table(const TableS & table){
return false;
}
}
- ndbout << "Set fragment Data " << endl;
copy.setFragmentData((const void *)ng_array, no_parts << 1);
}
diff --git a/storage/ndb/tools/restore/restore_main.cpp b/storage/ndb/tools/restore/restore_main.cpp
index 411c48c25d4..11687860bf5 100644
--- a/storage/ndb/tools/restore/restore_main.cpp
+++ b/storage/ndb/tools/restore/restore_main.cpp
@@ -183,7 +183,6 @@ static bool insert_ng_map(NODE_GROUP_MAP *ng_map,
uint ng_index= ng_map[index].no_maps;
opt_nodegroup_map_len++;
- printf("New node group map for source %u index %u\n",index,ng_index);
if (ng_index >= MAX_MAPS_PER_NODE_GROUP)
return true;
ng_map[index].no_maps++;
@@ -258,7 +257,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
printf("Error in --nodeid,-n setting, see --help\n");
exit(NDBT_ProgramExit(NDBT_WRONGARGS));
}
- ndbout << "Nodeid = " << ga_nodeId << endl;
+ info << "Nodeid = " << ga_nodeId << endl;
break;
case 'b':
if (ga_backupId == 0)
@@ -266,7 +265,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
printf("Error in --backupid,-b setting, see --help\n");
exit(NDBT_ProgramExit(NDBT_WRONGARGS));
}
- ndbout << "Backup Id = " << ga_backupId << endl;
+ info << "Backup Id = " << ga_backupId << endl;
break;
case OPT_NDB_NODEGROUP_MAP:
/*
@@ -274,7 +273,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
to nodegroup in new cluster.
*/
opt_nodegroup_map_len= 0;
- ndbout << "Analyse node group map" << endl;
+ info << "Analyse node group map" << endl;
if (analyse_nodegroup_map(opt_nodegroup_map_str,
&opt_nodegroup_map[0]))
{
@@ -288,12 +287,12 @@ bool
readArguments(int *pargc, char*** pargv)
{
Uint32 i;
- ndbout << "Load defaults" << endl;
+ debug << "Load defaults" << endl;
const char *load_default_groups[]= { "mysql_cluster","ndb_restore",0 };
init_nodegroup_map();
load_defaults("my",load_default_groups,pargc,pargv);
- ndbout << "handle_options" << endl;
+ debug << "handle_options" << endl;
if (handle_options(pargc, pargv, my_long_options, get_one_option))
{
exit(NDBT_ProgramExit(NDBT_WRONGARGS));
@@ -399,7 +398,7 @@ o verify nodegroup mapping
{
ga_backupPath = *pargv[0];
}
- ndbout << "backup path = " << ga_backupPath << endl;
+ info << "backup path = " << ga_backupPath << endl;
return true;
}
@@ -445,7 +444,7 @@ main(int argc, char** argv)
{
NDB_INIT(argv[0]);
- ndbout << "Start readArguments" << endl;
+ debug << "Start readArguments" << endl;
if (!readArguments(&argc, &argv))
{
exitHandler(NDBT_FAILED);
@@ -456,11 +455,11 @@ main(int argc, char** argv)
/**
* we must always load meta data, even if we will only print it to stdout
*/
- ndbout << "Start restoring meta data" << endl;
+ debug << "Start restoring meta data" << endl;
RestoreMetaData metaData(ga_backupPath, ga_nodeId, ga_backupId);
if (!metaData.readHeader())
{
- ndbout << "Failed to read " << metaData.getFilename() << endl << endl;
+ err << "Failed to read " << metaData.getFilename() << endl << endl;
exitHandler(NDBT_FAILED);
}
@@ -468,58 +467,58 @@ main(int argc, char** argv)
const Uint32 version = tmp.NdbVersion;
char buf[NDB_VERSION_STRING_BUF_SZ];
- ndbout << "Ndb version in backup files: "
+ info << "Ndb version in backup files: "
<< getVersionString(version, 0, buf, sizeof(buf)) << endl;
/**
* check wheater we can restore the backup (right version).
*/
- ndbout << "Load content" << endl;
+ debug << "Load content" << endl;
int res = metaData.loadContent();
if (res == 0)
{
- ndbout_c("Restore: Failed to load content");
+ err << "Restore: Failed to load content" << endl;
exitHandler(NDBT_FAILED);
}
- ndbout << "Get no of Tables" << endl;
+ debug << "Get no of Tables" << endl;
if (metaData.getNoOfTables() == 0)
{
- ndbout_c("Restore: The backup contains no tables ");
+ err << "The backup contains no tables" << endl;
exitHandler(NDBT_FAILED);
}
- ndbout << "Validate Footer" << endl;
+ debug << "Validate Footer" << endl;
if (!metaData.validateFooter())
{
- ndbout_c("Restore: Failed to validate footer.");
+ err << "Restore: Failed to validate footer." << endl;
exitHandler(NDBT_FAILED);
}
- ndbout << "Init Backup objects" << endl;
+ debug << "Init Backup objects" << endl;
Uint32 i;
for(i= 0; i < g_consumers.size(); i++)
{
if (!g_consumers[i]->init())
{
clearConsumers();
+ err << "Failed to initialize consumers" << endl;
exitHandler(NDBT_FAILED);
}
}
- ndbout << "Restore objects (tablespaces, ..)" << endl;
+ debug << "Restore objects (tablespaces, ..)" << endl;
for(i = 0; i<metaData.getNoOfObjects(); i++)
{
for(Uint32 j= 0; j < g_consumers.size(); j++)
if (!g_consumers[j]->object(metaData.getObjType(i),
metaData.getObjPtr(i)))
{
- ndbout_c("Restore: Failed to restore table: %s. "
- "Exiting...",
- metaData[i]->getTableName());
+ err << "Restore: Failed to restore table: ";
+ err << metaData[i]->getTableName() << " ... Exiting " << endl;
exitHandler(NDBT_FAILED);
}
}
- ndbout << "Restoring tables" << endl;
+ debug << "Restoring tables" << endl;
for(i = 0; i<metaData.getNoOfTables(); i++)
{
if (checkSysTable(metaData[i]->getTableName()))
@@ -527,21 +526,20 @@ main(int argc, char** argv)
for(Uint32 j= 0; j < g_consumers.size(); j++)
if (!g_consumers[j]->table(* metaData[i]))
{
- ndbout_c("Restore: Failed to restore table: %s. "
- "Exiting...",
- metaData[i]->getTableName());
+ err << "Restore: Failed to restore table: ";
+ err << metaData[i]->getTableName() << " ... Exiting " << endl;
exitHandler(NDBT_FAILED);
}
}
}
- ndbout << "Close tables" << endl;
+ debug << "Close tables" << endl;
for(i= 0; i < g_consumers.size(); i++)
if (!g_consumers[i]->endOfTables())
{
- ndbout_c("Restore: Failed while closing tables");
+ err << "Restore: Failed while closing tables" << endl;
exitHandler(NDBT_FAILED);
}
- ndbout << "Iterate over data" << endl;
+ debug << "Iterate over data" << endl;
if (ga_restore || ga_print)
{
if(_restore_data || _print_data)
@@ -551,7 +549,7 @@ main(int argc, char** argv)
// Read data file header
if (!dataIter.readHeader())
{
- ndbout << "Failed to read header of data file. Exiting..." ;
+ err << "Failed to read header of data file. Exiting..." << endl;
exitHandler(NDBT_FAILED);
}
@@ -568,13 +566,13 @@ main(int argc, char** argv)
if (res < 0)
{
- ndbout_c("Restore: An error occured while restoring data. "
- "Exiting...");
+ err <<" Restore: An error occured while restoring data. Exiting...";
+ err << endl;
exitHandler(NDBT_FAILED);
}
if (!dataIter.validateFragmentFooter()) {
- ndbout_c("Restore: Error validating fragment footer. "
- "Exiting...");
+ err << "Restore: Error validating fragment footer. ";
+ err << "Exiting..." << endl;
exitHandler(NDBT_FAILED);
}
} // while (dataIter.readFragmentHeader(res))
@@ -582,7 +580,7 @@ main(int argc, char** argv)
if (res < 0)
{
err << "Restore: An error occured while restoring data. Exiting... "
- << "res=" << res << endl;
+ << "res= " << res << endl;
exitHandler(NDBT_FAILED);
}
@@ -632,9 +630,8 @@ main(int argc, char** argv)
for(Uint32 j= 0; j < g_consumers.size(); j++)
if (!g_consumers[j]->finalize_table(* metaData[i]))
{
- ndbout_c("Restore: Failed to finalize restore table: %s. "
- "Exiting...",
- metaData[i]->getTableName());
+ err << "Restore: Failed to finalize restore table: %s. ";
+ err << "Exiting... " << metaData[i]->getTableName() << endl;
exitHandler(NDBT_FAILED);
}
}
@@ -646,7 +643,7 @@ main(int argc, char** argv)
for (i= 0; i < g_consumers.size(); i++)
if (!g_consumers[i]->update_apply_status(metaData))
{
- ndbout_c("Restore: Failed to restore epoch");
+ err << "Restore: Failed to restore epoch" << endl;
return -1;
}
}