Commit 10b17d98 authored by tomas@poseidon.(none)'s avatar tomas@poseidon.(none)

fixed return code for ndb_backup

added possibility to set number of accounts in createAndLoadBank
bumbed up number of threads in tastBackup BackupBank
parent 9201b78b
...@@ -331,7 +331,7 @@ main(int argc, const char** argv) ...@@ -331,7 +331,7 @@ main(int argc, const char** argv)
for (i= 0; i < g_consumers.size(); i++) for (i= 0; i < g_consumers.size(); i++)
g_consumers[i]->endOfTuples(); g_consumers[i]->endOfTuples();
RestoreLogIterator logIter(metaData); RestoreLogIterator logIter(metaData);
if (!logIter.readHeader()) if (!logIter.readHeader())
{ {
...@@ -357,7 +357,7 @@ main(int argc, const char** argv) ...@@ -357,7 +357,7 @@ main(int argc, const char** argv)
} }
} }
clearConsumers(); clearConsumers();
return 1; return 0;
} // main } // main
template class Vector<BackupConsumer*>; template class Vector<BackupConsumer*>;
...@@ -29,7 +29,7 @@ public: ...@@ -29,7 +29,7 @@ public:
Bank(); Bank();
int createAndLoadBank(bool overWrite); int createAndLoadBank(bool overWrite, int num_accounts=10);
int dropBank(); int dropBank();
int performTransactions(int maxSleepBetweenTrans = 20, int yield=0); int performTransactions(int maxSleepBetweenTrans = 20, int yield=0);
......
...@@ -53,7 +53,7 @@ int Bank::getNumAccountTypes(){ ...@@ -53,7 +53,7 @@ int Bank::getNumAccountTypes(){
return accountTypesSize; return accountTypesSize;
} }
int Bank::createAndLoadBank(bool ovrWrt){ int Bank::createAndLoadBank(bool ovrWrt, int num_accounts){
m_ndb.init(); m_ndb.init();
if (m_ndb.waitUntilReady() != 0) if (m_ndb.waitUntilReady() != 0)
...@@ -78,7 +78,7 @@ int Bank::createAndLoadBank(bool ovrWrt){ ...@@ -78,7 +78,7 @@ int Bank::createAndLoadBank(bool ovrWrt){
if (loadAccountType() != NDBT_OK) if (loadAccountType() != NDBT_OK)
return NDBT_FAILED; return NDBT_FAILED;
if (loadAccount(10) != NDBT_OK) if (loadAccount(num_accounts) != NDBT_OK)
return NDBT_FAILED; return NDBT_FAILED;
if (loadSystemValues() != NDBT_OK) if (loadSystemValues() != NDBT_OK)
......
...@@ -215,7 +215,7 @@ int runDropTable(NDBT_Context* ctx, NDBT_Step* step){ ...@@ -215,7 +215,7 @@ int runDropTable(NDBT_Context* ctx, NDBT_Step* step){
int runCreateBank(NDBT_Context* ctx, NDBT_Step* step){ int runCreateBank(NDBT_Context* ctx, NDBT_Step* step){
Bank bank; Bank bank;
int overWriteExisting = true; int overWriteExisting = true;
if (bank.createAndLoadBank(overWriteExisting) != NDBT_OK) if (bank.createAndLoadBank(overWriteExisting, 10) != NDBT_OK)
return NDBT_FAILED; return NDBT_FAILED;
return NDBT_OK; return NDBT_OK;
} }
...@@ -428,6 +428,15 @@ TESTCASE("BackupBank", ...@@ -428,6 +428,15 @@ TESTCASE("BackupBank",
INITIALIZER(runCreateBank); INITIALIZER(runCreateBank);
STEP(runBankTimer); STEP(runBankTimer);
STEP(runBankTransactions); STEP(runBankTransactions);
STEP(runBankTransactions);
STEP(runBankTransactions);
STEP(runBankTransactions);
STEP(runBankTransactions);
STEP(runBankTransactions);
STEP(runBankTransactions);
STEP(runBankTransactions);
STEP(runBankTransactions);
STEP(runBankTransactions);
STEP(runBankGL); STEP(runBankGL);
// TODO STEP(runBankSum); // TODO STEP(runBankSum);
STEP(runBackupBank); STEP(runBackupBank);
......
...@@ -140,14 +140,16 @@ NdbBackup::execRestore(bool _restore_data, ...@@ -140,14 +140,16 @@ NdbBackup::execRestore(bool _restore_data,
*/ */
snprintf(buf, buf_len, snprintf(buf, buf_len,
"scp %s:%s/BACKUP/BACKUP-%d/* .", "scp %s:%s/BACKUP/BACKUP-%d/BACKUP-%d*.%d.* .",
host, path, host, path,
_backup_id); _backup_id,
_backup_id,
_node_id);
ndbout << "buf: "<< buf <<endl; ndbout << "buf: "<< buf <<endl;
int res = system(buf); int res = system(buf);
ndbout << "res: " << res << endl; ndbout << "scp res: " << res << endl;
snprintf(buf, 255, "%sndb_restore -c \"host=%s\" -n %d -b %d %s %s .", snprintf(buf, 255, "%sndb_restore -c \"host=%s\" -n %d -b %d %s %s .",
#if 1 #if 1
...@@ -162,9 +164,9 @@ NdbBackup::execRestore(bool _restore_data, ...@@ -162,9 +164,9 @@ NdbBackup::execRestore(bool _restore_data,
_restore_meta?"-m":""); _restore_meta?"-m":"");
ndbout << "buf: "<< buf <<endl; ndbout << "buf: "<< buf <<endl;
res = system(buf); res = system(buf);
ndbout << "res: " << res << endl; ndbout << "ndb_restore res: " << res << endl;
return res; return res;
...@@ -180,20 +182,13 @@ NdbBackup::restore(unsigned _backup_id){ ...@@ -180,20 +182,13 @@ NdbBackup::restore(unsigned _backup_id){
return -1; return -1;
int res; int res;
if ( ndbNodes.size() == 1) {
// restore metadata and data in one call
res = execRestore(true, true, ndbNodes[0].node_id, _backup_id);
} else {
assert(ndbNodes.size() > 1);
// restore metadata first
res = execRestore(false, true, ndbNodes[0].node_id, _backup_id);
// Restore data once for each node // restore metadata first and data for first node
for(size_t i = 0; i < ndbNodes.size(); i++){ res = execRestore(true, true, ndbNodes[0].node_id, _backup_id);
res = execRestore(true, false, ndbNodes[i].node_id, _backup_id);
} // Restore data once for each node
for(size_t i = 1; i < ndbNodes.size(); i++){
res = execRestore(true, false, ndbNodes[i].node_id, _backup_id);
} }
return 0; return 0;
......
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