summaryrefslogtreecommitdiff
path: root/ndb/test/ndbapi
diff options
context:
space:
mode:
authorunknown <joreland@mysql.com>2005-04-22 13:20:47 +0200
committerunknown <joreland@mysql.com>2005-04-22 13:20:47 +0200
commit12a176c8f936f9cc70b14be6eb5c5090cbe16945 (patch)
treea999f5c970993c28fac240f54b33b8f6abc741ea /ndb/test/ndbapi
parentcfac923cf5eb8048f8921ca2dd117d19f0be772f (diff)
parentfeb482281698d8f4db996a86a16cfea3c70b3847 (diff)
downloadmariadb-git-12a176c8f936f9cc70b14be6eb5c5090cbe16945.tar.gz
Merge joreland@bk-internal.mysql.com:/home/bk/mysql-4.1
into mysql.com:/home/jonas/src/mysql-4.1 ndb/src/kernel/blocks/dblqh/DblqhMain.cpp: Auto merged ndb/src/ndbapi/ndberror.c: Auto merged
Diffstat (limited to 'ndb/test/ndbapi')
-rw-r--r--ndb/test/ndbapi/testBackup.cpp14
-rw-r--r--ndb/test/ndbapi/testIndex.cpp2
-rw-r--r--ndb/test/ndbapi/testOperations.cpp72
3 files changed, 68 insertions, 20 deletions
diff --git a/ndb/test/ndbapi/testBackup.cpp b/ndb/test/ndbapi/testBackup.cpp
index 77b9d0a4baa..bea5d5307e2 100644
--- a/ndb/test/ndbapi/testBackup.cpp
+++ b/ndb/test/ndbapi/testBackup.cpp
@@ -74,20 +74,20 @@ int runAbort(NDBT_Context* ctx, NDBT_Step* step){
if (testMaster) {
if (testSlave) {
- if (backup.NFMasterAsSlave(restarter) == -1){
+ if (backup.NFMasterAsSlave(restarter) != NDBT_OK){
return NDBT_FAILED;
}
} else {
- if (backup.NFMaster(restarter) == -1){
+ if (backup.NFMaster(restarter) != NDBT_OK){
return NDBT_FAILED;
}
}
} else {
- if (backup.NFSlave(restarter) == -1){
+ if (backup.NFSlave(restarter) != NDBT_OK){
return NDBT_FAILED;
}
}
-
+
return NDBT_OK;
}
@@ -108,16 +108,16 @@ int runFail(NDBT_Context* ctx, NDBT_Step* step){
if (testMaster) {
if (testSlave) {
- if (backup.FailMasterAsSlave(restarter) == -1){
+ if (backup.FailMasterAsSlave(restarter) != NDBT_OK){
return NDBT_FAILED;
}
} else {
- if (backup.FailMaster(restarter) == -1){
+ if (backup.FailMaster(restarter) != NDBT_OK){
return NDBT_FAILED;
}
}
} else {
- if (backup.FailSlave(restarter) == -1){
+ if (backup.FailSlave(restarter) != NDBT_OK){
return NDBT_FAILED;
}
}
diff --git a/ndb/test/ndbapi/testIndex.cpp b/ndb/test/ndbapi/testIndex.cpp
index 6623ad35a7f..d359f83257f 100644
--- a/ndb/test/ndbapi/testIndex.cpp
+++ b/ndb/test/ndbapi/testIndex.cpp
@@ -1329,7 +1329,7 @@ TESTCASE("NFNR2_O",
INITIALIZER(runLoadTable);
STEP(runRestarts);
STEP(runTransactions2);
- STEP(runTransactions2);
+ //STEP(runTransactions2);
FINALIZER(runVerifyIndex);
FINALIZER(createRandomIndex_Drop);
FINALIZER(createPkIndex_Drop);
diff --git a/ndb/test/ndbapi/testOperations.cpp b/ndb/test/ndbapi/testOperations.cpp
index 9f1d5ee1191..773511a0475 100644
--- a/ndb/test/ndbapi/testOperations.cpp
+++ b/ndb/test/ndbapi/testOperations.cpp
@@ -547,21 +547,64 @@ runLockUpgrade1(NDBT_Context* ctx, NDBT_Step* step){
do
{
CHECK(hugoOps.startTransaction(pNdb) == 0);
- CHECK(hugoOps.pkReadRecord(pNdb, 0, 1, NdbOperation::LM_Read) == 0);
- CHECK(hugoOps.execute_NoCommit(pNdb) == 0);
+ if(ctx->getProperty("LOCK_UPGRADE", 1) == 1)
+ {
+ CHECK(hugoOps.pkReadRecord(pNdb, 0, 1, NdbOperation::LM_Read) == 0);
+ CHECK(hugoOps.execute_NoCommit(pNdb) == 0);
- ctx->setProperty("READ_DONE", 1);
- ctx->broadcast();
- ndbout_c("wait 2");
- ctx->getPropertyWait("READ_DONE", 2);
- ndbout_c("wait 2 - done");
+ ctx->setProperty("READ_DONE", 1);
+ ctx->broadcast();
+ ndbout_c("wait 2");
+ ctx->getPropertyWait("READ_DONE", 2);
+ ndbout_c("wait 2 - done");
+ }
+ else
+ {
+ ctx->setProperty("READ_DONE", 1);
+ ctx->broadcast();
+ ctx->getPropertyWait("READ_DONE", 2);
+ ndbout_c("wait 2 - done");
+ CHECK(hugoOps.pkReadRecord(pNdb, 0, 1, NdbOperation::LM_Read) == 0);
+ CHECK(hugoOps.execute_NoCommit(pNdb) == 0);
+ }
+ if(ctx->getProperty("LU_OP", o_INS) == o_INS)
+ {
+ CHECK(hugoOps.pkDeleteRecord(pNdb, 0, 1) == 0);
+ CHECK(hugoOps.pkInsertRecord(pNdb, 0, 1, 2) == 0);
+ }
+ else if(ctx->getProperty("LU_OP", o_UPD) == o_UPD)
+ {
+ CHECK(hugoOps.pkUpdateRecord(pNdb, 0, 1, 2) == 0);
+ }
+ else
+ {
+ CHECK(hugoOps.pkDeleteRecord(pNdb, 0, 1) == 0);
+ }
ctx->setProperty("READ_DONE", 3);
ctx->broadcast();
ndbout_c("before update");
- CHECK(hugoOps.pkUpdateRecord(pNdb, 0, 1, 2) == 0);
ndbout_c("wait update");
- CHECK(hugoOps.execute_NoCommit(pNdb) == 0);
- CHECK(hugoOps.closeTransaction(pNdb));
+ CHECK(hugoOps.execute_Commit(pNdb) == 0);
+ CHECK(hugoOps.closeTransaction(pNdb) == 0);
+
+ CHECK(hugoOps.startTransaction(pNdb) == 0);
+ CHECK(hugoOps.pkReadRecord(pNdb, 0, 1) == 0);
+ int res= hugoOps.execute_Commit(pNdb);
+ if(ctx->getProperty("LU_OP", o_INS) == o_INS)
+ {
+ CHECK(res == 0);
+ CHECK(hugoOps.verifyUpdatesValue(2) == 0);
+ }
+ else if(ctx->getProperty("LU_OP", o_UPD) == o_UPD)
+ {
+ CHECK(res == 0);
+ CHECK(hugoOps.verifyUpdatesValue(2) == 0);
+ }
+ else
+ {
+ CHECK(res == 626);
+ }
+
} while(0);
return result;
@@ -592,10 +635,10 @@ runLockUpgrade2(NDBT_Context* ctx, NDBT_Step* step){
ndbout_c("wait 3 - done");
NdbSleep_MilliSleep(200);
- CHECK(hugoOps.execute_Commit(pNdb) == 0);
+ CHECK(hugoOps.execute_Commit(pNdb) == 0);
} while(0);
- return NDBT_FAILED;
+ return result;
}
int
@@ -607,11 +650,16 @@ main(int argc, const char** argv){
NDBT_TestSuite ts("testOperations");
+ for(Uint32 i = 0; i <6; i++)
{
BaseString name("bug_9749");
+ name.appfmt("_%d", i);
NDBT_TestCaseImpl1 *pt = new NDBT_TestCaseImpl1(&ts,
name.c_str(), "");
+ pt->setProperty("LOCK_UPGRADE", 1 + (i & 1));
+ pt->setProperty("LU_OP", 1 + (i >> 1));
+
pt->addInitializer(new NDBT_Initializer(pt,
"runClearTable",
runClearTable));