Commit ea67b28c authored by unknown's avatar unknown

WL #2747: After push fixes


mysql-test/ndb/ndbcluster.sh:
  Upgraded DataMemory to 20M so that ndb_restore tests fit in memory
mysql-test/r/ndb_config.result:
  Upgraded DataMemory to 20M so that ndb_restore tests fit in memory
mysql-test/r/ndb_restore.result:
  Added check that no extra objects exist before starting
  Added printout from erronous node group map
mysql-test/t/disabled.def:
  Activated ndb_restore again
mysql-test/t/ndb_restore.test:
  Added new test cases and handling of error case for node group maps
storage/ndb/tools/restore/consumer_restore.cpp:
  Removed debug printouts
storage/ndb/tools/restore/restore_main.cpp:
  Removed debug printouts
  ndbout => info
  some ndbout => err
  and yet others
  ndbout => debug
parent 098af0ae
......@@ -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
;;
......
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,,
......
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
......@@ -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
......@@ -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
......
......@@ -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);
}
......
......@@ -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;
}
}
......
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