Commit 4143a189 authored by joreland@mysql.com's avatar joreland@mysql.com

merge

parents 41e70c83 443e8be7
......@@ -500,6 +500,7 @@ export MASTER_MYPORT MASTER_MYPORT1 SLAVE_MYPORT MYSQL_TCP_PORT MASTER_MYSOCK MA
NDBCLUSTER_BASE_PORT=`expr $NDBCLUSTER_PORT + 2`
NDBCLUSTER_OPTS="--port=$NDBCLUSTER_PORT --port-base=$NDBCLUSTER_BASE_PORT --data-dir=$MYSQL_TEST_DIR/var --ndb_mgm-extra-opts=$NDB_MGM_EXTRA_OPTS --ndb_mgmd-extra-opts=$NDB_MGMD_EXTRA_OPTS --ndbd-extra-opts=$NDBD_EXTRA_OPTS"
NDB_BACKUP_DIR=$MYSQL_TEST_DIR/var/ndbcluster-$NDBCLUSTER_PORT
NDB_TOOLS_OUTPUT=$MYSQL_TEST_DIR/var/log/ndb_tools.log
if [ x$SOURCE_DIST = x1 ] ; then
MY_BASEDIR=$MYSQL_TEST_DIR
......@@ -700,6 +701,7 @@ export CLIENT_BINDIR MYSQL_CLIENT_TEST CHARSETSDIR
export NDB_TOOLS_DIR
export NDB_MGM
export NDB_BACKUP_DIR
export NDB_TOOLS_OUTPUT
export PURIFYOPTIONS
MYSQL_TEST_ARGS="--no-defaults --socket=$MASTER_MYSOCK --database=$DB \
......@@ -1071,6 +1073,7 @@ start_ndbcluster()
{
if [ ! -z "$USE_NDBCLUSTER" ]
then
rm -f $NDB_TOOLS_OUTPUT
if [ -z "$USE_RUNNING_NDBCLUSTER" ]
then
echo "Starting ndbcluster"
......
......@@ -199,7 +199,7 @@ insert into t4 values (1, "Automatic");
select * from t4;
# Remove the table from NDB
system exec $NDB_TOOLS_DIR/ndb_drop_table --no-defaults -d test t4 > /dev/null ;
system exec $NDB_TOOLS_DIR/ndb_drop_table --no-defaults -d test t4 >> $NDB_TOOLS_OUTPUT ;
#
# Test that correct error is returned
......@@ -230,7 +230,7 @@ select * from t4;
flush tables;
# Remove the table from NDB
system exec $NDB_TOOLS_DIR/ndb_drop_table --no-defaults -d test t4 > /dev/null ;
system exec $NDB_TOOLS_DIR/ndb_drop_table --no-defaults -d test t4 >> $NDB_TOOLS_OUTPUT ;
SHOW TABLES;
......@@ -264,8 +264,8 @@ insert into t8 values (8, "myisam table 8");
insert into t9 values (9);
# Remove t3, t5 from NDB
system exec $NDB_TOOLS_DIR/ndb_drop_table --no-defaults -d test t3 > /dev/null ;
system exec $NDB_TOOLS_DIR/ndb_drop_table --no-defaults -d test t5 > /dev/null ;
system exec $NDB_TOOLS_DIR/ndb_drop_table --no-defaults -d test t3 >> $NDB_TOOLS_OUTPUT ;
system exec $NDB_TOOLS_DIR/ndb_drop_table --no-defaults -d test t5 >> $NDB_TOOLS_OUTPUT ;
# Remove t6, t7 from disk
system rm var/master-data/test/t6.frm > /dev/null ;
system rm var/master-data/test/t7.frm > /dev/null ;
......@@ -498,4 +498,4 @@ create table t10 (
insert into t10 values (1, 'kalle');
--exec $NDB_TOOLS_DIR/ndb_drop_table --no-defaults -d test `$NDB_TOOLS_DIR/ndb_show_tables --no-defaults | grep BLOB` > /dev/null 2>&1 || true
--exec $NDB_TOOLS_DIR/ndb_drop_table --no-defaults -d test `$NDB_TOOLS_DIR/ndb_show_tables --no-defaults | grep BLOB` >> $NDB_TOOLS_OUTPUT 2>&1 || true
......@@ -142,10 +142,10 @@ create table t8_c engine=ndbcluster as select * from t8;
create table t9_c engine=ndbcluster as select * from t9;
--exec $NDB_MGM --no-defaults -e "start backup" > /dev/null
--exec $NDB_MGM --no-defaults -e "start backup" >> $NDB_TOOLS_OUTPUT
drop table t1_c,t2_c,t3_c,t4_c,t5_c,t6_c,t7_c,t8_c,t9_c;
--exec $NDB_TOOLS_DIR/ndb_restore --no-defaults -b 1 -n 1 -m -r --print --print_meta $NDB_BACKUP_DIR/BACKUP/BACKUP-1 > /tmp/ndb_restore.out
--exec $NDB_TOOLS_DIR/ndb_restore --no-defaults -b 1 -n 2 -r --print --print_meta $NDB_BACKUP_DIR/BACKUP/BACKUP-1 > /tmp/ndb_restore.out
--exec $NDB_TOOLS_DIR/ndb_restore --no-defaults -b 1 -n 1 -m -r --print --print_meta $NDB_BACKUP_DIR/BACKUP/BACKUP-1 >> $NDB_TOOLS_OUTPUT
--exec $NDB_TOOLS_DIR/ndb_restore --no-defaults -b 1 -n 2 -r --print --print_meta $NDB_BACKUP_DIR/BACKUP/BACKUP-1 >> $NDB_TOOLS_OUTPUT
show tables;
......
......@@ -804,6 +804,8 @@ private:
void remove_list(NdbOperation*& head, NdbOperation*);
void define_scan_op(NdbIndexScanOperation*);
friend class HugoOperations;
};
#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL
......
......@@ -4385,7 +4385,8 @@ void Dbacc::commitOperation(Signal* signal)
Uint32 tmp2Olq;
if ((operationRecPtr.p->commitDeleteCheckFlag == ZFALSE) &&
(operationRecPtr.p->operation != ZSCAN_OP)) {
(operationRecPtr.p->operation != ZSCAN_OP) &&
(operationRecPtr.p->operation != ZREAD)) {
jam();
/* This method is used to check whether the end result of the transaction
will be to delete the tuple. In this case all operation will be marked
......
......@@ -34,6 +34,8 @@ public:
NdbTransaction* getTransaction();
void refresh();
void setTransactionId(Uint64);
int pkInsertRecord(Ndb*,
int recordNo,
int numRecords = 1,
......
......@@ -191,7 +191,7 @@ public:
NDBT_TestCase(NDBT_TestSuite* psuite,
const char* name,
const char* comment);
virtual ~NDBT_TestCase(){}
virtual ~NDBT_TestCase() {}
// This is the default executor of a test case
// When a test case is executed it will need to be suplied with a number of
......@@ -228,6 +228,8 @@ protected:
void stopTimer(NDBT_Context*);
void printTimer(NDBT_Context*);
BaseString _name;
BaseString _comment;
const char* name;
const char* comment;
NDBT_TestSuite* suite;
......
......@@ -98,6 +98,15 @@ OperationTestCase matrix[] = {
result = NDBT_FAILED; \
break; }
#define C3(b) if (!(b)) { \
g_err << "ERR: "<< step->getName() \
<< " failed on line " << __LINE__ << endl; \
abort(); return NDBT_FAILED; }
#define C3(b) if (!(b)) { \
g_err << "ERR: failed on line " << __LINE__ << endl; \
return NDBT_FAILED; }
int
runOp(HugoOperations & hugoOps,
Ndb * pNdb,
......@@ -228,11 +237,369 @@ runClearTable(NDBT_Context* ctx, NDBT_Step* step){
return NDBT_OK;
}
enum OPS { o_DONE= 0, o_INS= 1, o_UPD= 2, o_DEL= 3 };
typedef Vector<OPS> Sequence;
static
bool
valid(const Sequence& s)
{
if(s.size() == 0)
return false;
for(size_t i = 1; i<s.size(); i++)
{
switch(s[i]){
case o_INS:
if(s[i-1] != o_DEL)
return false;
break;
case o_UPD:
case o_DEL:
if(s[i-1] == o_DEL)
return false;
break;
case o_DONE:
return true;
}
}
return true;
}
static
NdbOut& operator<<(NdbOut& out, const Sequence& s)
{
out << "[ ";
for(size_t i = 0; i<s.size(); i++)
{
switch(s[i]){
case o_INS:
out << "INS ";
break;
case o_DEL:
out << "DEL ";
break;
case o_UPD:
out << "UPD ";
break;
case o_DONE:
abort();
}
}
out << "]";
return out;
}
static
void
generate(Sequence& out, int no)
{
while(no & 3)
{
out.push_back((OPS)(no & 3));
no >>= 2;
}
}
static
void
generate(Vector<int>& out, size_t len)
{
int max= 1;
while(len)
{
max <<= 2;
len--;
}
len= 1;
for(int i = 0; i<max; i++)
{
Sequence tmp;
generate(tmp, i);
if(tmp.size() >= len && valid(tmp))
{
out.push_back(i);
len= tmp.size();
}
else
{
//ndbout << "DISCARD: " << tmp << endl;
}
}
}
static const Uint32 DUMMY = 0;
static const Uint32 ROW = 1;
int
verify_other(NDBT_Context* ctx,
Ndb* pNdb, int seq, OPS latest, bool initial_row, bool commit)
{
Uint32 no_wait = NdbOperation::LM_CommittedRead*
ctx->getProperty("NoWait", (Uint32)1);
for(size_t j = no_wait; j<3; j++)
{
HugoOperations other(*ctx->getTab());
C3(other.startTransaction(pNdb) == 0);
C3(other.pkReadRecord(pNdb, ROW, 1, (NdbOperation::LockMode)j) == 0);
int tmp= other.execute_Commit(pNdb);
if(seq == 0){
if(j == NdbOperation::LM_CommittedRead)
{
C3(initial_row? tmp==0 && other.verifyUpdatesValue(0) == 0 : tmp==626);
}
else
{
C3(tmp == 266);
}
}
else if(commit)
{
switch(latest){
case o_INS:
case o_UPD:
C3(tmp == 0 && other.verifyUpdatesValue(seq) == 0);
break;
case o_DEL:
C3(tmp == 626);
break;
case o_DONE:
abort();
}
}
else
{
// rollback
C3(initial_row? tmp==0 && other.verifyUpdatesValue(0) == 0 : tmp==626);
}
}
return NDBT_OK;
}
int
verify_savepoint(NDBT_Context* ctx,
Ndb* pNdb, int seq, OPS latest,
Uint64 transactionId)
{
bool initial_row= (seq == 0) && latest == o_INS;
for(size_t j = 0; j<3; j++)
{
const NdbOperation::LockMode lm= (NdbOperation::LockMode)j;
HugoOperations same(*ctx->getTab());
C3(same.startTransaction(pNdb) == 0);
same.setTransactionId(transactionId); // Cheat
/**
* Increase savepoint to <em>k</em>
*/
for(size_t l = 1; l<=seq; l++)
{
C3(same.pkReadRecord(pNdb, DUMMY, 1, lm) == 0); // Read dummy row
C3(same.execute_NoCommit(pNdb) == 0);
g_info << "savepoint: " << l << endl;
}
g_info << "op(" << seq << "): "
<< " lock mode " << lm << endl;
C3(same.pkReadRecord(pNdb, ROW, 1, lm) == 0); // Read real row
int tmp= same.execute_Commit(pNdb);
if(seq == 0)
{
if(initial_row)
{
C3(tmp == 0 && same.verifyUpdatesValue(0) == 0);
} else
{
C3(tmp == 626);
}
}
else
{
switch(latest){
case o_INS:
case o_UPD:
C3(tmp == 0 && same.verifyUpdatesValue(seq) == 0);
break;
case o_DEL:
C3(tmp == 626);
break;
case o_DONE:
abort();
}
}
}
return NDBT_OK;
}
int
runOperations(NDBT_Context* ctx, NDBT_Step* step)
{
int tmp;
Ndb* pNdb = GETNDB(step);
Uint32 seqNo = ctx->getProperty("Sequence", (Uint32)0);
Uint32 commit= ctx->getProperty("Commit", (Uint32)1);
if(seqNo == 0)
{
return NDBT_FAILED;
}
Sequence seq;
generate(seq, seqNo);
{
// Dummy row
HugoOperations hugoOps(*ctx->getTab());
C3(hugoOps.startTransaction(pNdb) == 0);
C3(hugoOps.pkInsertRecord(pNdb, DUMMY, 1, 0) == 0);
C3(hugoOps.execute_Commit(pNdb) == 0);
}
const bool initial_row= (seq[0] != o_INS);
if(initial_row)
{
HugoOperations hugoOps(*ctx->getTab());
C3(hugoOps.startTransaction(pNdb) == 0);
C3(hugoOps.pkInsertRecord(pNdb, ROW, 1, 0) == 0);
C3(hugoOps.execute_Commit(pNdb) == 0);
}
HugoOperations trans1(*ctx->getTab());
C3(trans1.startTransaction(pNdb) == 0);
for(size_t i = 0; i<seq.size(); i++)
{
/**
* Perform operation
*/
switch(seq[i]){
case o_INS:
C3(trans1.pkInsertRecord(pNdb, ROW, 1, i+1) == 0);
break;
case o_UPD:
C3(trans1.pkUpdateRecord(pNdb, ROW, 1, i+1) == 0);
break;
case o_DEL:
C3(trans1.pkDeleteRecord(pNdb, ROW, 1) == 0);
break;
case o_DONE:
abort();
}
C3(trans1.execute_NoCommit(pNdb) == 0);
/**
* Verify other transaction
*/
if(verify_other(ctx, pNdb, 0, seq[0], initial_row, commit) != NDBT_OK)
return NDBT_FAILED;
/**
* Verify savepoint read
*/
Uint64 transactionId= trans1.getTransaction()->getTransactionId();
for(size_t k=0; k<=i+1; k++)
{
if(verify_savepoint(ctx, pNdb, k,
k>0 ? seq[k-1] : initial_row ? o_INS : o_DONE,
transactionId) != NDBT_OK)
return NDBT_FAILED;
}
}
if(commit)
{
C3(trans1.execute_Commit(pNdb) == 0);
}
else
{
C3(trans1.execute_Rollback(pNdb) == 0);
}
if(verify_other(ctx, pNdb, seq.size(), seq.back(),
initial_row, commit) != NDBT_OK)
return NDBT_FAILED;
return NDBT_OK;
}
int
main(int argc, const char** argv){
ndb_init();
Vector<int> tmp;
generate(tmp, 5);
NDBT_TestSuite ts("testOperations");
for(size_t i = 0; i<tmp.size(); i++)
{
BaseString name;
Sequence s;
generate(s, tmp[i]);
for(size_t j = 0; j<s.size(); j++){
switch(s[j]){
case o_INS:
name.append("_INS");
break;
case o_DEL:
name.append("_DEL");
break;
case o_UPD:
name.append("_UPD");
break;
case o_DONE:
abort();
}
}
BaseString n1;
n1.append(name);
n1.append("_COMMIT");
NDBT_TestCaseImpl1 *pt = new NDBT_TestCaseImpl1(&ts,
n1.c_str()+1, "");
pt->setProperty("Sequence", tmp[i]);
pt->addInitializer(new NDBT_Initializer(pt,
"runClearTable",
runClearTable));
pt->addStep(new NDBT_ParallelStep(pt,
"run",
runOperations));
pt->addFinalizer(new NDBT_Finalizer(pt,
"runClearTable",
runClearTable));
ts.addTest(pt);
name.append("_ABORT");
pt = new NDBT_TestCaseImpl1(&ts, name.c_str()+1, "");
pt->setProperty("Sequence", tmp[i]);
pt->setProperty("Commit", (Uint32)0);
pt->addInitializer(new NDBT_Initializer(pt,
"runClearTable",
runClearTable));
pt->addStep(new NDBT_ParallelStep(pt,
"run",
runOperations));
pt->addFinalizer(new NDBT_Finalizer(pt,
"runClearTable",
runClearTable));
ts.addTest(pt);
}
for(Uint32 i = 0; i<sizeof(matrix)/sizeof(matrix[0]); i++){
NDBT_TestCaseImpl1 *pt = new NDBT_TestCaseImpl1(&ts, matrix[i].name, "");
......@@ -270,3 +637,5 @@ main(int argc, const char** argv){
return ts.execute(argc, argv);
}
template class Vector<OPS>;
template class Vector<Sequence>;
......@@ -45,6 +45,13 @@ int HugoOperations::setTransaction(NdbTransaction* new_trans){
return NDBT_OK;
}
void
HugoOperations::setTransactionId(Uint64 id){
if (pTrans != NULL){
pTrans->setTransactionId(id);
}
}
int HugoOperations::closeTransaction(Ndb* pNdb){
if (pTrans != NULL){
......@@ -369,6 +376,10 @@ HugoOperations::HugoOperations(const NdbDictionary::Table& _tab,
HugoOperations::~HugoOperations(){
deallocRows();
if (pTrans != NULL){
pTrans->close();
pTrans = NULL;
}
}
......
......@@ -68,20 +68,20 @@ HugoTransactions::scanReadRecords(Ndb* pNdb,
pOp = getScanOperation(pTrans);
if (pOp == NULL) {
ERR(pTrans->getNdbError());
pNdb->closeTransaction(pTrans);
closeTransaction(pNdb);
return NDBT_FAILED;
}
if( pOp ->readTuples(lm, 0, parallelism) ) {
ERR(pTrans->getNdbError());
pNdb->closeTransaction(pTrans);
closeTransaction(pNdb);
return NDBT_FAILED;
}
check = pOp->interpret_exit_ok();
if( check == -1 ) {
ERR(pTrans->getNdbError());
pNdb->closeTransaction(pTrans);
closeTransaction(pNdb);
return NDBT_FAILED;
}
......@@ -89,7 +89,7 @@ HugoTransactions::scanReadRecords(Ndb* pNdb,
if((row.attributeStore(a) =
pOp->getValue(tab.getColumn(a)->getName())) == 0) {
ERR(pTrans->getNdbError());
pNdb->closeTransaction(pTrans);
closeTransaction(pNdb);
return NDBT_FAILED;
}
}
......@@ -99,13 +99,13 @@ HugoTransactions::scanReadRecords(Ndb* pNdb,
const NdbError err = pTrans->getNdbError();
if (err.status == NdbError::TemporaryError){
ERR(err);
pNdb->closeTransaction(pTrans);
closeTransaction(pNdb);
NdbSleep_MilliSleep(50);
retryAttempt++;
continue;
}
ERR(err);
pNdb->closeTransaction(pTrans);
closeTransaction(pNdb);
return NDBT_FAILED;
}
......@@ -124,7 +124,7 @@ HugoTransactions::scanReadRecords(Ndb* pNdb,
while((eof = pOp->nextResult(true)) == 0){
rows++;
if (calc.verifyRowValues(&row) != 0){
pNdb->closeTransaction(pTrans);
closeTransaction(pNdb);
return NDBT_FAILED;
}
......@@ -134,11 +134,11 @@ HugoTransactions::scanReadRecords(Ndb* pNdb,
pOp->close();
if( check == -1 ) {
ERR(pTrans->getNdbError());
pNdb->closeTransaction(pTrans);
closeTransaction(pNdb);
return NDBT_FAILED;
}
pNdb->closeTransaction(pTrans);
closeTransaction(pNdb);
return NDBT_OK;
}
}
......@@ -147,7 +147,7 @@ HugoTransactions::scanReadRecords(Ndb* pNdb,
if (err.status == NdbError::TemporaryError){
ERR_INFO(err);
pNdb->closeTransaction(pTrans);
closeTransaction(pNdb);
NdbSleep_MilliSleep(50);
switch (err.code){
case 488:
......@@ -161,11 +161,11 @@ HugoTransactions::scanReadRecords(Ndb* pNdb,
continue;
}
ERR(err);
pNdb->closeTransaction(pTrans);
closeTransaction(pNdb);
return NDBT_FAILED;
}
pNdb->closeTransaction(pTrans);
closeTransaction(pNdb);
g_info << rows << " rows have been read" << endl;
if (records != 0 && rows != records){
......@@ -241,7 +241,7 @@ HugoTransactions::scanReadRecords(Ndb* pNdb,
if((row.attributeStore(a) =
pOp->getValue(tab.getColumn(a)->getName())) == 0) {
ERR(pTrans->getNdbError());
pNdb->closeTransaction(pTrans);
closeTransaction(pNdb);
return NDBT_FAILED;
}
}
......@@ -251,13 +251,13 @@ HugoTransactions::scanReadRecords(Ndb* pNdb,
const NdbError err = pTrans->getNdbError();
if (err.status == NdbError::TemporaryError){
ERR(err);
pNdb->closeTransaction(pTrans);
closeTransaction(pNdb);
NdbSleep_MilliSleep(50);
retryAttempt++;
continue;
}
ERR(err);
pNdb->closeTransaction(pTrans);
closeTransaction(pNdb);
return NDBT_FAILED;
}
......@@ -276,7 +276,7 @@ HugoTransactions::scanReadRecords(Ndb* pNdb,
while((eof = pOp->nextResult(true)) == 0){
rows++;
if (calc.verifyRowValues(&row) != 0){
pNdb->closeTransaction(pTrans);
closeTransaction(pNdb);
return NDBT_FAILED;
}
......@@ -286,11 +286,11 @@ HugoTransactions::scanReadRecords(Ndb* pNdb,
pOp->close();
if( check == -1 ) {
ERR(pTrans->getNdbError());
pNdb->closeTransaction(pTrans);
closeTransaction(pNdb);
return NDBT_FAILED;
}
pNdb->closeTransaction(pTrans);
closeTransaction(pNdb);
return NDBT_OK;
}
}
......@@ -299,7 +299,7 @@ HugoTransactions::scanReadRecords(Ndb* pNdb,
if (err.status == NdbError::TemporaryError){
ERR_INFO(err);
pNdb->closeTransaction(pTrans);
closeTransaction(pNdb);
NdbSleep_MilliSleep(50);
switch (err.code){
case 488:
......@@ -313,11 +313,11 @@ HugoTransactions::scanReadRecords(Ndb* pNdb,
continue;
}
ERR(err);
pNdb->closeTransaction(pTrans);
closeTransaction(pNdb);
return NDBT_FAILED;
}
pNdb->closeTransaction(pTrans);
closeTransaction(pNdb);
g_info << rows << " rows have been read" << endl;
if (records != 0 && rows != records){
......@@ -383,7 +383,7 @@ HugoTransactions::scanUpdateRecords3(Ndb* pNdb,
while (true){
restart:
restart:
if (retryAttempt++ >= retryMax){
g_info << "ERROR: has retried this operation " << retryAttempt
<< " times, failing!" << endl;
......@@ -404,13 +404,13 @@ HugoTransactions::scanUpdateRecords3(Ndb* pNdb,
pOp = getScanOperation(pTrans);
if (pOp == NULL) {
ERR(pTrans->getNdbError());
pNdb->closeTransaction(pTrans);
closeTransaction(pNdb);
return NDBT_FAILED;
}
if( pOp->readTuplesExclusive(parallelism) ) {
ERR(pTrans->getNdbError());
pNdb->closeTransaction(pTrans);
closeTransaction(pNdb);
return NDBT_FAILED;
}
......@@ -418,7 +418,7 @@ HugoTransactions::scanUpdateRecords3(Ndb* pNdb,
for(a=0; a<tab.getNoOfColumns(); a++){
if((row.attributeStore(a) = pOp->getValue(tab.getColumn(a)->getName())) == NULL){
ERR(pTrans->getNdbError());
pNdb->closeTransaction(pTrans);
closeTransaction(pNdb);
return NDBT_FAILED;
}
}
......@@ -427,7 +427,7 @@ HugoTransactions::scanUpdateRecords3(Ndb* pNdb,
if( check == -1 ) {
const NdbError err = pTrans->getNdbError();
ERR(err);
pNdb->closeTransaction(pTrans);
closeTransaction(pNdb);
if (err.status == NdbError::TemporaryError){
NdbSleep_MilliSleep(50);
continue;
......@@ -452,7 +452,7 @@ HugoTransactions::scanUpdateRecords3(Ndb* pNdb,
NdbOperation* pUp = pOp->updateCurrentTuple();
if(pUp == 0){
ERR(pTrans->getNdbError());
pNdb->closeTransaction(pTrans);
closeTransaction(pNdb);
return NDBT_FAILED;
}
const int updates = calc.getUpdatesValue(&row) + 1;
......@@ -461,7 +461,7 @@ HugoTransactions::scanUpdateRecords3(Ndb* pNdb,
if (tab.getColumn(a)->getPrimaryKey() == false){
if(setValueForAttr(pUp, a, r, updates ) != 0){
ERR(pTrans->getNdbError());
pNdb->closeTransaction(pTrans);
closeTransaction(pNdb);
return NDBT_FAILED;
}
}
......@@ -470,7 +470,7 @@ HugoTransactions::scanUpdateRecords3(Ndb* pNdb,
if (rows == abortCount && abortTrans == true){
g_info << "Scan is aborted" << endl;
// This scan should be aborted
pNdb->closeTransaction(pTrans);
closeTransaction(pNdb);
return NDBT_OK;
}
} while((check = pOp->nextResult(false)) == 0);
......@@ -482,7 +482,7 @@ HugoTransactions::scanUpdateRecords3(Ndb* pNdb,
const NdbError err = pTrans->getNdbError();
if( check == -1 ) {
pNdb->closeTransaction(pTrans);
closeTransaction(pNdb);
ERR(err);
if (err.status == NdbError::TemporaryError){
NdbSleep_MilliSleep(50);
......@@ -494,7 +494,7 @@ HugoTransactions::scanUpdateRecords3(Ndb* pNdb,
const NdbError err = pTrans->getNdbError();
if( check == -1 ) {
pNdb->closeTransaction(pTrans);
closeTransaction(pNdb);
ERR(err);
if (err.status == NdbError::TemporaryError){
NdbSleep_MilliSleep(50);
......@@ -503,7 +503,7 @@ HugoTransactions::scanUpdateRecords3(Ndb* pNdb,
return NDBT_FAILED;
}
pNdb->closeTransaction(pTrans);
closeTransaction(pNdb);
g_info << rows << " rows have been updated" << endl;
return NDBT_OK;
......@@ -575,7 +575,7 @@ HugoTransactions::loadTable(Ndb* pNdb,
if(pkInsertRecord(pNdb, c, batch) != NDBT_OK)
{
ERR(pTrans->getNdbError());
pNdb->closeTransaction(pTrans);
closeTransaction(pNdb);
return NDBT_FAILED;
}
......@@ -591,7 +591,7 @@ HugoTransactions::loadTable(Ndb* pNdb,
}
if(check == -1 ) {
const NdbError err = pTrans->getNdbError();
pNdb->closeTransaction(pTrans);
closeTransaction(pNdb);
pTrans= 0;
switch(err.status){
case NdbError::Success:
......@@ -633,7 +633,7 @@ HugoTransactions::loadTable(Ndb* pNdb,
}
else{
if (closeTrans) {
pNdb->closeTransaction(pTrans);
closeTransaction(pNdb);
pTrans= 0;
}
}
......@@ -644,7 +644,7 @@ HugoTransactions::loadTable(Ndb* pNdb,
}
if(pTrans)
pNdb->closeTransaction(pTrans);
closeTransaction(pNdb);
return NDBT_OK;
}
......@@ -696,7 +696,7 @@ HugoTransactions::fillTable(Ndb* pNdb,
if(pkInsertRecord(pNdb, c, batch) != NDBT_OK)
{
ERR(pTrans->getNdbError());
pNdb->closeTransaction(pTrans);
closeTransaction(pNdb);
return NDBT_FAILED;
}
......@@ -704,7 +704,7 @@ HugoTransactions::fillTable(Ndb* pNdb,
check = pTrans->execute( Commit, CommitAsMuchAsPossible );
if(check == -1 ) {
const NdbError err = pTrans->getNdbError();
pNdb->closeTransaction(pTrans);
closeTransaction(pNdb);
switch(err.status){
case NdbError::Success:
......@@ -756,7 +756,7 @@ HugoTransactions::fillTable(Ndb* pNdb,
}
}
else{
pNdb->closeTransaction(pTrans);
closeTransaction(pNdb);
}
// Step to next record
......@@ -1088,7 +1088,7 @@ HugoTransactions::pkReadRecords(Ndb* pNdb,
if(pkReadRecord(pNdb, r, batch, lm) != NDBT_OK)
{
ERR(pTrans->getNdbError());
pNdb->closeTransaction(pTrans);
closeTransaction(pNdb);
return NDBT_FAILED;
}
......@@ -1098,7 +1098,7 @@ HugoTransactions::pkReadRecords(Ndb* pNdb,
if (err.status == NdbError::TemporaryError){
ERR(err);
pNdb->closeTransaction(pTrans);
closeTransaction(pNdb);
NdbSleep_MilliSleep(50);
retryAttempt++;
continue;
......@@ -1111,7 +1111,7 @@ HugoTransactions::pkReadRecords(Ndb* pNdb,
default:
ERR(err);
pNdb->closeTransaction(pTrans);
closeTransaction(pNdb);
return NDBT_FAILED;
}
} else {
......@@ -1122,13 +1122,13 @@ HugoTransactions::pkReadRecords(Ndb* pNdb,
{
rows_found++;
if (calc.verifyRowValues(rows[0]) != 0){
pNdb->closeTransaction(pTrans);
closeTransaction(pNdb);
return NDBT_FAILED;
}
}
if(check != 1 || rows_found > batch)
{
pNdb->closeTransaction(pTrans);
closeTransaction(pNdb);
return NDBT_FAILED;
}
else if(rows_found < batch)
......@@ -1146,7 +1146,7 @@ HugoTransactions::pkReadRecords(Ndb* pNdb,
{
for (int b=0; (b<batch) && (r+b<records); b++){
if (calc.verifyRowValues(rows[b]) != 0){
pNdb->closeTransaction(pTrans);
closeTransaction(pNdb);
return NDBT_FAILED;
}
reads++;
......@@ -1155,7 +1155,7 @@ HugoTransactions::pkReadRecords(Ndb* pNdb,
}
}
pNdb->closeTransaction(pTrans);
closeTransaction(pNdb);
}
deallocRows();
g_info << reads << " records read" << endl;
......@@ -1209,7 +1209,7 @@ HugoTransactions::pkUpdateRecords(Ndb* pNdb,
if(pkReadRecord(pNdb, r, batch, NdbOperation::LM_Exclusive) != NDBT_OK)
{
ERR(pTrans->getNdbError());
pNdb->closeTransaction(pTrans);
closeTransaction(pNdb);
return NDBT_FAILED;
}
......@@ -1219,13 +1219,13 @@ HugoTransactions::pkUpdateRecords(Ndb* pNdb,
if (err.status == NdbError::TemporaryError){
ERR(err);
pNdb->closeTransaction(pTrans);
closeTransaction(pNdb);
NdbSleep_MilliSleep(50);
retryAttempt++;
continue;
}
ERR(err);
pNdb->closeTransaction(pTrans);
closeTransaction(pNdb);
return NDBT_FAILED;
}
......@@ -1237,7 +1237,7 @@ HugoTransactions::pkUpdateRecords(Ndb* pNdb,
do {
if (calc.verifyRowValues(rows[0]) != 0){
pNdb->closeTransaction(pTrans);
closeTransaction(pNdb);
return NDBT_FAILED;
}
......@@ -1246,7 +1246,7 @@ HugoTransactions::pkUpdateRecords(Ndb* pNdb,
if(pkUpdateRecord(pNdb, r+rows_found, 1, updates) != NDBT_OK)
{
ERR(pTrans->getNdbError());
pNdb->closeTransaction(pTrans);
closeTransaction(pNdb);
return NDBT_FAILED;
}
rows_found++;
......@@ -1259,7 +1259,7 @@ HugoTransactions::pkUpdateRecords(Ndb* pNdb,
}
if(check != 1 || rows_found != batch)
{
pNdb->closeTransaction(pTrans);
closeTransaction(pNdb);
return NDBT_FAILED;
}
}
......@@ -1269,7 +1269,7 @@ HugoTransactions::pkUpdateRecords(Ndb* pNdb,
{
if (calc.verifyRowValues(rows[b]) != 0)
{
pNdb->closeTransaction(pTrans);
closeTransaction(pNdb);
return NDBT_FAILED;
}
......@@ -1278,7 +1278,7 @@ HugoTransactions::pkUpdateRecords(Ndb* pNdb,
if(pkUpdateRecord(pNdb, r+b, 1, updates) != NDBT_OK)
{
ERR(pTrans->getNdbError());
pNdb->closeTransaction(pTrans);
closeTransaction(pNdb);
return NDBT_FAILED;
}
}
......@@ -1289,21 +1289,21 @@ HugoTransactions::pkUpdateRecords(Ndb* pNdb,
if (err.status == NdbError::TemporaryError){
ERR(err);
pNdb->closeTransaction(pTrans);
closeTransaction(pNdb);
NdbSleep_MilliSleep(50);
retryAttempt++;
continue;
}
ERR(err);
ndbout << "r = " << r << endl;
pNdb->closeTransaction(pTrans);
closeTransaction(pNdb);
return NDBT_FAILED;
}
else{
updated += batch;
}
pNdb->closeTransaction(pTrans);
closeTransaction(pNdb);
r += batch; // Read next record
}
......@@ -1348,14 +1348,14 @@ HugoTransactions::pkInterpretedUpdateRecords(Ndb* pNdb,
NdbOperation* pOp = pTrans->getNdbOperation(tab.getName());
if (pOp == NULL) {
ERR(pTrans->getNdbError());
pNdb->closeTransaction(pTrans);
closeTransaction(pNdb);
return NDBT_FAILED;
}
check = pOp->readTupleExclusive();
if( check == -1 ) {
ERR(pTrans->getNdbError());
pNdb->closeTransaction(pTrans);
closeTransaction(pNdb);
return NDBT_FAILED;
}
......@@ -1364,7 +1364,7 @@ HugoTransactions::pkInterpretedUpdateRecords(Ndb* pNdb,
if (tab.getColumn(a)->getPrimaryKey() == true){
if(equalForAttr(pOp, a, r) != 0){
ERR(pTrans->getNdbError());
pNdb->closeTransaction(pTrans);
closeTransaction(pNdb);
return NDBT_FAILED;
}
}
......@@ -1376,7 +1376,7 @@ HugoTransactions::pkInterpretedUpdateRecords(Ndb* pNdb,
if((row.attributeStore(a) =
pOp->getValue(tab.getColumn(a)->getName())) == 0) {
ERR(pTrans->getNdbError());
pNdb->closeTransaction(pTrans);
closeTransaction(pNdb);
return NDBT_FAILED;
}
}
......@@ -1388,13 +1388,13 @@ HugoTransactions::pkInterpretedUpdateRecords(Ndb* pNdb,
if (err.status == NdbError::TemporaryError){
ERR(err);
pNdb->closeTransaction(pTrans);
closeTransaction(pNdb);
NdbSleep_MilliSleep(50);
retryAttempt++;
continue;
}
ERR(err);
pNdb->closeTransaction(pTrans);
closeTransaction(pNdb);
return NDBT_FAILED;
}
......@@ -1404,14 +1404,14 @@ HugoTransactions::pkInterpretedUpdateRecords(Ndb* pNdb,
pUpdOp = pTrans->getNdbOperation(tab.getName());
if (pUpdOp == NULL) {
ERR(pTrans->getNdbError());
pNdb->closeTransaction(pTrans);
closeTransaction(pNdb);
return NDBT_FAILED;
}
check = pUpdOp->interpretedUpdateTuple();
if( check == -1 ) {
ERR(pTrans->getNdbError());
pNdb->closeTransaction(pTrans);
closeTransaction(pNdb);
return NDBT_FAILED;
}
......@@ -1420,7 +1420,7 @@ HugoTransactions::pkInterpretedUpdateRecords(Ndb* pNdb,
if (tab.getColumn(a)->getPrimaryKey() == true){
if(equalForAttr(pUpdOp, a, r) != 0){
ERR(pTrans->getNdbError());
pNdb->closeTransaction(pTrans);
closeTransaction(pNdb);
return NDBT_FAILED;
}
}
......@@ -1437,7 +1437,7 @@ HugoTransactions::pkInterpretedUpdateRecords(Ndb* pNdb,
check = pUpdOp->incValue(attr->getName(), valToIncWith);
if( check == -1 ) {
ERR(pTrans->getNdbError());
pNdb->closeTransaction(pTrans);
closeTransaction(pNdb);
return NDBT_FAILED;
}
}
......@@ -1449,7 +1449,7 @@ HugoTransactions::pkInterpretedUpdateRecords(Ndb* pNdb,
(calc.isUpdateCol(a) == false)){
if(setValueForAttr(pUpdOp, a, r, updates ) != 0){
ERR(pTrans->getNdbError());
pNdb->closeTransaction(pTrans);
closeTransaction(pNdb);
return NDBT_FAILED;
}
}
......@@ -1463,14 +1463,14 @@ HugoTransactions::pkInterpretedUpdateRecords(Ndb* pNdb,
if (err.status == NdbError::TemporaryError){
ERR(err);
pNdb->closeTransaction(pTrans);
closeTransaction(pNdb);
NdbSleep_MilliSleep(50);
retryAttempt++;
continue;
}
ERR(err);
ndbout << "r = " << r << endl;
pNdb->closeTransaction(pTrans);
closeTransaction(pNdb);
return NDBT_FAILED;
}
else{
......@@ -1478,7 +1478,7 @@ HugoTransactions::pkInterpretedUpdateRecords(Ndb* pNdb,
}
pNdb->closeTransaction(pTrans);
closeTransaction(pNdb);
r++; // Read next record
......@@ -1533,7 +1533,7 @@ HugoTransactions::pkDelRecords(Ndb* pNdb,
if(pkDeleteRecord(pNdb, r, batch) != NDBT_OK)
{
ERR(pTrans->getNdbError());
pNdb->closeTransaction(pTrans);
closeTransaction(pNdb);
return NDBT_FAILED;
}
......@@ -1544,7 +1544,7 @@ HugoTransactions::pkDelRecords(Ndb* pNdb,
switch(err.status){
case NdbError::TemporaryError:
ERR(err);
pNdb->closeTransaction(pTrans);
closeTransaction(pNdb);
NdbSleep_MilliSleep(50);
retryAttempt++;
continue;
......@@ -1563,20 +1563,20 @@ HugoTransactions::pkDelRecords(Ndb* pNdb,
}
}
ERR(err);
pNdb->closeTransaction(pTrans);
closeTransaction(pNdb);
return NDBT_FAILED;
break;
default:
ERR(err);
pNdb->closeTransaction(pTrans);
closeTransaction(pNdb);
return NDBT_FAILED;
}
}
else {
deleted += batch;
}
pNdb->closeTransaction(pTrans);
closeTransaction(pNdb);
r += batch; // Read next record
......@@ -1641,7 +1641,7 @@ HugoTransactions::lockRecords(Ndb* pNdb,
if(pkReadRecord(pNdb, r, lockBatch, lm) != NDBT_OK)
{
ERR(pTrans->getNdbError());
pNdb->closeTransaction(pTrans);
closeTransaction(pNdb);
return NDBT_FAILED;
}
......@@ -1656,18 +1656,18 @@ HugoTransactions::lockRecords(Ndb* pNdb,
if (err.status == NdbError::TemporaryError){
ERR(err);
pNdb->closeTransaction(pTrans);
closeTransaction(pNdb);
NdbSleep_MilliSleep(50);
retryAttempt++;
continue;
}
ERR(err);
pNdb->closeTransaction(pTrans);
closeTransaction(pNdb);
return NDBT_FAILED;
}
for (int b=0; (b<lockBatch) && (r+b<records); b++){
if (calc.verifyRowValues(rows[b]) != 0){
pNdb->closeTransaction(pTrans);
closeTransaction(pNdb);
return NDBT_FAILED;
}
}
......@@ -1682,26 +1682,26 @@ HugoTransactions::lockRecords(Ndb* pNdb,
if (err.status == NdbError::TemporaryError){
ERR(err);
pNdb->closeTransaction(pTrans);
closeTransaction(pNdb);
NdbSleep_MilliSleep(50);
retryAttempt++;
continue;
}
ERR(err);
pNdb->closeTransaction(pTrans);
closeTransaction(pNdb);
return NDBT_FAILED;
}
else{
for (int b=0; (b<lockBatch) && (r<records); b++){
if (calc.verifyRowValues(rows[b]) != 0){
pNdb->closeTransaction(pTrans);
closeTransaction(pNdb);
return NDBT_FAILED;
}
r++; // Read next record
}
}
pNdb->closeTransaction(pTrans);
closeTransaction(pNdb);
}
deallocRows();
......@@ -1765,7 +1765,7 @@ HugoTransactions::indexReadRecords(Ndb* pNdb,
pOp = pTrans->getNdbIndexOperation(idxName, tab.getName());
if (pOp == NULL) {
ERR(pTrans->getNdbError());
pNdb->closeTransaction(pTrans);
closeTransaction(pNdb);
return NDBT_FAILED;
}
check = pOp->readTuple();
......@@ -1773,7 +1773,7 @@ HugoTransactions::indexReadRecords(Ndb* pNdb,
pOp = sOp = pTrans->getNdbIndexScanOperation(idxName, tab.getName());
if (sOp == NULL) {
ERR(pTrans->getNdbError());
pNdb->closeTransaction(pTrans);
closeTransaction(pNdb);
return NDBT_FAILED;
}
check = sOp->readTuples();
......@@ -1781,7 +1781,7 @@ HugoTransactions::indexReadRecords(Ndb* pNdb,
if( check == -1 ) {
ERR(pTrans->getNdbError());
pNdb->closeTransaction(pTrans);
closeTransaction(pNdb);
return NDBT_FAILED;
}
......@@ -1790,7 +1790,7 @@ HugoTransactions::indexReadRecords(Ndb* pNdb,
if (tab.getColumn(a)->getPrimaryKey() == true){
if(equalForAttr(pOp, a, r+b) != 0){
ERR(pTrans->getNdbError());
pNdb->closeTransaction(pTrans);
closeTransaction(pNdb);
return NDBT_FAILED;
}
}
......@@ -1801,7 +1801,7 @@ HugoTransactions::indexReadRecords(Ndb* pNdb,
if((rows[b]->attributeStore(a) =
pOp->getValue(tab.getColumn(a)->getName())) == 0) {
ERR(pTrans->getNdbError());
pNdb->closeTransaction(pTrans);
closeTransaction(pNdb);
return NDBT_FAILED;
}
}
......@@ -1814,7 +1814,7 @@ HugoTransactions::indexReadRecords(Ndb* pNdb,
if (err.status == NdbError::TemporaryError){
ERR(err);
pNdb->closeTransaction(pTrans);
closeTransaction(pNdb);
NdbSleep_MilliSleep(50);
retryAttempt++;
continue;
......@@ -1827,13 +1827,13 @@ HugoTransactions::indexReadRecords(Ndb* pNdb,
default:
ERR(err);
pNdb->closeTransaction(pTrans);
closeTransaction(pNdb);
return NDBT_FAILED;
}
} else{
for (int b=0; (b<batch) && (r+b<records); b++){
if (calc.verifyRowValues(rows[b]) != 0){
pNdb->closeTransaction(pTrans);
closeTransaction(pNdb);
return NDBT_FAILED;
}
reads++;
......@@ -1842,11 +1842,11 @@ HugoTransactions::indexReadRecords(Ndb* pNdb,
if(ordered && sOp->nextResult(true) == 0){
ndbout << "Error when comparing records "
<< " - index op next_result to many" << endl;
pNdb->closeTransaction(pTrans);
closeTransaction(pNdb);
return NDBT_FAILED;
}
}
pNdb->closeTransaction(pTrans);
closeTransaction(pNdb);
}
deallocRows();
g_info << reads << " records read" << endl;
......@@ -1905,21 +1905,21 @@ HugoTransactions::indexUpdateRecords(Ndb* pNdb,
pOp = pTrans->getNdbIndexOperation(idxName, tab.getName());
if (pOp == NULL) {
ERR(pTrans->getNdbError());
pNdb->closeTransaction(pTrans);
closeTransaction(pNdb);
return NDBT_FAILED;
}
check = pOp->readTupleExclusive();
if( check == -1 ) {
ERR(pTrans->getNdbError());
pNdb->closeTransaction(pTrans);
closeTransaction(pNdb);
return NDBT_FAILED;
}
} else {
pOp = sOp = pTrans->getNdbIndexScanOperation(idxName, tab.getName());
if (pOp == NULL) {
ERR(pTrans->getNdbError());
pNdb->closeTransaction(pTrans);
closeTransaction(pNdb);
return NDBT_FAILED;
}
......@@ -1932,7 +1932,7 @@ HugoTransactions::indexUpdateRecords(Ndb* pNdb,
if (tab.getColumn(a)->getPrimaryKey() == true){
if(equalForAttr(pOp, a, r+b) != 0){
ERR(pTrans->getNdbError());
pNdb->closeTransaction(pTrans);
closeTransaction(pNdb);
return NDBT_FAILED;
}
}
......@@ -1943,7 +1943,7 @@ HugoTransactions::indexUpdateRecords(Ndb* pNdb,
if((rows[b]->attributeStore(a) =
pOp->getValue(tab.getColumn(a)->getName())) == 0) {
ERR(pTrans->getNdbError());
pNdb->closeTransaction(pTrans);
closeTransaction(pNdb);
return NDBT_FAILED;
}
}
......@@ -1954,7 +1954,7 @@ HugoTransactions::indexUpdateRecords(Ndb* pNdb,
if( check == -1 ) {
const NdbError err = pTrans->getNdbError();
ERR(err);
pNdb->closeTransaction(pTrans);
closeTransaction(pNdb);
if (err.status == NdbError::TemporaryError){
NdbSleep_MilliSleep(50);
......@@ -1966,13 +1966,13 @@ HugoTransactions::indexUpdateRecords(Ndb* pNdb,
if(ordered && check != 0){
g_err << check << " - Row: " << r << " not found!!" << endl;
pNdb->closeTransaction(pTrans);
closeTransaction(pNdb);
return NDBT_FAILED;
}
for(b = 0; b<batch && (b+r)<records; b++){
if (calc.verifyRowValues(rows[b]) != 0){
pNdb->closeTransaction(pTrans);
closeTransaction(pNdb);
return NDBT_FAILED;
}
......@@ -1988,13 +1988,13 @@ HugoTransactions::indexUpdateRecords(Ndb* pNdb,
if (pUpdOp == NULL) {
ERR(pTrans->getNdbError());
pNdb->closeTransaction(pTrans);
closeTransaction(pNdb);
return NDBT_FAILED;
}
if( check == -1 ) {
ERR(pTrans->getNdbError());
pNdb->closeTransaction(pTrans);
closeTransaction(pNdb);
return NDBT_FAILED;
}
......@@ -2003,7 +2003,7 @@ HugoTransactions::indexUpdateRecords(Ndb* pNdb,
if (tab.getColumn(a)->getPrimaryKey() == true){
if(equalForAttr(pUpdOp, a, r+b) != 0){
ERR(pTrans->getNdbError());
pNdb->closeTransaction(pTrans);
closeTransaction(pNdb);
return NDBT_FAILED;
}
}
......@@ -2014,7 +2014,7 @@ HugoTransactions::indexUpdateRecords(Ndb* pNdb,
if (tab.getColumn(a)->getPrimaryKey() == false){
if(setValueForAttr(pUpdOp, a, r+b, updates ) != 0){
ERR(pTrans->getNdbError());
pNdb->closeTransaction(pTrans);
closeTransaction(pNdb);
return NDBT_FAILED;
}
}
......@@ -2025,7 +2025,7 @@ HugoTransactions::indexUpdateRecords(Ndb* pNdb,
if( check == -1 ) {
const NdbError err = pTrans->getNdbError();
ERR(err);
pNdb->closeTransaction(pTrans);
closeTransaction(pNdb);
if (err.status == NdbError::TemporaryError){
NdbSleep_MilliSleep(50);
......@@ -2038,7 +2038,7 @@ HugoTransactions::indexUpdateRecords(Ndb* pNdb,
updated += batch;
}
pNdb->closeTransaction(pTrans);
closeTransaction(pNdb);
r+= batch; // Read next record
}
......
......@@ -330,13 +330,17 @@ NDBT_Finalizer::NDBT_Finalizer(NDBT_TestCase* ptest,
NDBT_TestCase::NDBT_TestCase(NDBT_TestSuite* psuite,
const char* pname,
const char* pcomment) :
name(pname) ,
comment(pcomment),
suite(psuite){
name(strdup(pname)) ,
comment(strdup(pcomment)),
suite(psuite)
{
_name.assign(pname);
_comment.assign(pcomment);
name= _name.c_str();
comment= _comment.c_str();
assert(suite != NULL);
}
NDBT_TestCaseImpl1::NDBT_TestCaseImpl1(NDBT_TestSuite* psuite,
const char* pname,
const char* pcomment) :
......
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