Commit 16bd53d4 authored by unknown's avatar unknown

fixed return code for ndb_backup

added possibility to set number of accounts in createAndLoadBank
bumbed up number of threads in tastBackup BackupBank


ndb/src/kernel/blocks/backup/restore/main.cpp:
  fixed return code
ndb/test/ndbapi/bank/Bank.hpp:
  added possibility to set number of accounts in createAndLoadBank
ndb/test/ndbapi/bank/BankLoad.cpp:
  added possibility to set number of accounts in createAndLoadBank
ndb/test/ndbapi/testBackup.cpp:
  bumbed up number of threads in tastBackup BackupBank
ndb/test/src/NdbBackup.cpp:
  some small optimizations
parent 48cce619
......@@ -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