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
......@@ -357,7 +357,7 @@ main(int argc, const char** argv)
}
}
clearConsumers();
return 1;
return 0;
} // main
template class Vector<BackupConsumer*>;
......@@ -29,7 +29,7 @@ public:
Bank();
int createAndLoadBank(bool overWrite);
int createAndLoadBank(bool overWrite, int num_accounts=10);
int dropBank();
int performTransactions(int maxSleepBetweenTrans = 20, int yield=0);
......
......@@ -53,7 +53,7 @@ int Bank::getNumAccountTypes(){
return accountTypesSize;
}
int Bank::createAndLoadBank(bool ovrWrt){
int Bank::createAndLoadBank(bool ovrWrt, int num_accounts){
m_ndb.init();
if (m_ndb.waitUntilReady() != 0)
......@@ -78,7 +78,7 @@ int Bank::createAndLoadBank(bool ovrWrt){
if (loadAccountType() != NDBT_OK)
return NDBT_FAILED;
if (loadAccount(10) != NDBT_OK)
if (loadAccount(num_accounts) != NDBT_OK)
return NDBT_FAILED;
if (loadSystemValues() != NDBT_OK)
......
......@@ -215,7 +215,7 @@ int runDropTable(NDBT_Context* ctx, NDBT_Step* step){
int runCreateBank(NDBT_Context* ctx, NDBT_Step* step){
Bank bank;
int overWriteExisting = true;
if (bank.createAndLoadBank(overWriteExisting) != NDBT_OK)
if (bank.createAndLoadBank(overWriteExisting, 10) != NDBT_OK)
return NDBT_FAILED;
return NDBT_OK;
}
......@@ -428,6 +428,15 @@ TESTCASE("BackupBank",
INITIALIZER(runCreateBank);
STEP(runBankTimer);
STEP(runBankTransactions);
STEP(runBankTransactions);
STEP(runBankTransactions);
STEP(runBankTransactions);
STEP(runBankTransactions);
STEP(runBankTransactions);
STEP(runBankTransactions);
STEP(runBankTransactions);
STEP(runBankTransactions);
STEP(runBankTransactions);
STEP(runBankGL);
// TODO STEP(runBankSum);
STEP(runBackupBank);
......
......@@ -140,14 +140,16 @@ NdbBackup::execRestore(bool _restore_data,
*/
snprintf(buf, buf_len,
"scp %s:%s/BACKUP/BACKUP-%d/* .",
"scp %s:%s/BACKUP/BACKUP-%d/BACKUP-%d*.%d.* .",
host, path,
_backup_id);
_backup_id,
_backup_id,
_node_id);
ndbout << "buf: "<< buf <<endl;
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 .",
#if 1
......@@ -164,7 +166,7 @@ NdbBackup::execRestore(bool _restore_data,
ndbout << "buf: "<< buf <<endl;
res = system(buf);
ndbout << "res: " << res << endl;
ndbout << "ndb_restore res: " << res << endl;
return res;
......@@ -180,21 +182,14 @@ NdbBackup::restore(unsigned _backup_id){
return -1;
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 metadata first and data for first node
res = execRestore(true, true, ndbNodes[0].node_id, _backup_id);
// Restore data once for each node
for(size_t i = 0; i < ndbNodes.size(); i++){
for(size_t i = 1; i < ndbNodes.size(); i++){
res = execRestore(true, false, ndbNodes[i].node_id, _backup_id);
}
}
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