diff options
Diffstat (limited to 'ndb/test/ndbapi')
26 files changed, 547 insertions, 242 deletions
diff --git a/ndb/test/ndbapi/asyncGenerator.cpp b/ndb/test/ndbapi/asyncGenerator.cpp index 84a93414712..d91e38dff1a 100644 --- a/ndb/test/ndbapi/asyncGenerator.cpp +++ b/ndb/test/ndbapi/asyncGenerator.cpp @@ -248,7 +248,7 @@ doTransaction_T1(Ndb * pNDB, ThreadData * td, int async) /*----------------*/ getRandomSubscriberNumber(td->transactionData.number); getRandomChangedBy(td->transactionData.changed_by); - snprintf(td->transactionData.changed_time, + BaseString::snprintf(td->transactionData.changed_time, sizeof(td->transactionData.changed_time), "%ld - %d", td->changedTime++, myRandom48(65536*1024)); //getRandomChangedTime(td->transactionData.changed_time); diff --git a/ndb/test/ndbapi/bulk_copy.cpp b/ndb/test/ndbapi/bulk_copy.cpp index 8821a92fb27..b53654ce0fb 100644 --- a/ndb/test/ndbapi/bulk_copy.cpp +++ b/ndb/test/ndbapi/bulk_copy.cpp @@ -263,7 +263,7 @@ int main(int argc, const char** argv){ } char buf[255]; - snprintf(buf, sizeof(buf), "%s.data", (const char*)_tabname); + BaseString::snprintf(buf, sizeof(buf), "%s.data", (const char*)_tabname); if (insertFile(&MyNdb, pTab, buf) != 0){ return NDBT_ProgramExit(NDBT_FAILED); } diff --git a/ndb/test/ndbapi/cdrserver.cpp b/ndb/test/ndbapi/cdrserver.cpp index 8d15061e94b..976319034bf 100644 --- a/ndb/test/ndbapi/cdrserver.cpp +++ b/ndb/test/ndbapi/cdrserver.cpp @@ -501,11 +501,11 @@ server(long int servernum) /* that this program could easily be ported to a host */ /* that does require it. */ - snprintf(msg,sizeof(msg),"Startup from %s port %u",hostname,ntohs(peeraddr_in.sin_port)); + BaseString::snprintf(msg,sizeof(msg),"Startup from %s port %u",hostname,ntohs(peeraddr_in.sin_port)); if ((checkchangelog(fi,temp))==0) c2log(fi,msg); n2log(log,msg); - snprintf(msg,sizeof(msg),"For further information, see log(%s)",lognamn); + BaseString::snprintf(msg,sizeof(msg),"For further information, see log(%s)",lognamn); if ((checkchangelog(fi,temp))==0) c2log(fi,msg); @@ -516,7 +516,7 @@ server(long int servernum) linger.l_onoff =1; linger.l_linger =0; if (setsockopt(s, SOL_SOCKET, SO_LINGER,(const char*)&linger,sizeof(linger)) == -1) { - snprintf(msg,sizeof(msg),"Setting SO_LINGER, l_onoff=%d, l_linger=%d",linger.l_onoff,linger.l_linger); + BaseString::snprintf(msg,sizeof(msg),"Setting SO_LINGER, l_onoff=%d, l_linger=%d",linger.l_onoff,linger.l_linger); if ((checkchangelog(log,lognamn))==0) n2log(log,msg); goto errout; @@ -529,7 +529,7 @@ server(long int servernum) rcvbuf_size=64*1024; if (setsockopt(s, SOL_SOCKET, SO_RCVBUF,(const char*) &rcvbuf_size,sizeof(rcvbuf_size)) == -1) { - snprintf(msg,sizeof(msg),"Setting SO_RCVBUF = %d",rcvbuf_size); + BaseString::snprintf(msg,sizeof(msg),"Setting SO_RCVBUF = %d",rcvbuf_size); if ((checkchangelog(log,lognamn))==0) n2log(log,msg); goto errout; @@ -913,7 +913,7 @@ server(long int servernum) tmpcdrptr->USED_FIELDS |= B_ReroutingIndicator; break; default : - snprintf(msg,sizeof(msg),"ERROR: Redirection information has wrong length %d\n",parmlen); + BaseString::snprintf(msg,sizeof(msg),"ERROR: Redirection information has wrong length %d\n",parmlen); if ((checkchangelog(log,lognamn))==0) n2log(log,msg); break; @@ -1060,7 +1060,7 @@ server(long int servernum) tmpcdrptr->USED_FIELDS |= B_RINParameter; break; default : - snprintf(msg,sizeof(msg),"ERROR: Rin parameter has wrong length %d\n",parmlen); + BaseString::snprintf(msg,sizeof(msg),"ERROR: Rin parameter has wrong length %d\n",parmlen); if ((checkchangelog(log,lognamn))==0) n2log(log,msg); break; @@ -1088,7 +1088,7 @@ server(long int servernum) tmpcdrptr->USED_FIELDS |= B_OriginatingPointCode; break; default : - snprintf(msg,sizeof(msg),"ERROR: OriginatingPointCode parameter has wrong length %d\n",parmlen); + BaseString::snprintf(msg,sizeof(msg),"ERROR: OriginatingPointCode parameter has wrong length %d\n",parmlen); if ((checkchangelog(log,lognamn))==0) n2log(log,msg); break; @@ -1119,7 +1119,7 @@ server(long int servernum) tmpcdrptr->USED_FIELDS |= B_DestinationPointCode; break; default : - snprintf(msg,sizeof(msg),"ERROR: DestinationPointCode parameter has wrong length %d\n",parmlen); + BaseString::snprintf(msg,sizeof(msg),"ERROR: DestinationPointCode parameter has wrong length %d\n",parmlen); if ((checkchangelog(log,lognamn))==0) n2log(log,msg); break; @@ -1146,7 +1146,7 @@ server(long int servernum) break; default: printf("ERROR: Undefined parmtype %d , previous %d, length %d\n",parmtype,parmtype_prev,parmlen); - snprintf(msg,sizeof(msg),"ERROR: Undefined parmtype %d , previous %d, length %d\n",parmtype,parmtype_prev,parmlen); + BaseString::snprintf(msg,sizeof(msg),"ERROR: Undefined parmtype %d , previous %d, length %d\n",parmtype,parmtype_prev,parmlen); if ((checkchangelog(log,lognamn))==0) n2log(log,msg); if (parmlen == 0) { @@ -1289,17 +1289,17 @@ server(long int servernum) /* that this program could easily be ported to a host */ /* that does require it. */ - snprintf(msg,sizeof(msg),"Completed %s port %u, %d requests",hostname,ntohs(peeraddr_in.sin_port), reqcnt); + BaseString::snprintf(msg,sizeof(msg),"Completed %s port %u, %d requests",hostname,ntohs(peeraddr_in.sin_port), reqcnt); if ((checkchangelog(fi,temp))==0) c2log(fi,msg); error_from_client = 1; - snprintf(msg,sizeof(msg),"Communicate with threads"); + BaseString::snprintf(msg,sizeof(msg),"Communicate with threads"); if ((checkchangelog(log,lognamn))==0) n2log(log,msg); - snprintf(msg,sizeof(msg),"Waiting for threads to return from work"); + BaseString::snprintf(msg,sizeof(msg),"Waiting for threads to return from work"); if ((checkchangelog(log,lognamn))==0) n2log(log,msg); - snprintf(msg,sizeof(msg),"Closing down"); + BaseString::snprintf(msg,sizeof(msg),"Closing down"); if ((checkchangelog(log,lognamn))==0) n2log(log,msg); close(s); @@ -1307,19 +1307,19 @@ server(long int servernum) return EXIT_SUCCESS; errout: - snprintf(msg,sizeof(msg),"Connection with %s aborted on error\n", hostname); + BaseString::snprintf(msg,sizeof(msg),"Connection with %s aborted on error\n", hostname); if ((checkchangelog(log,lognamn))==0) n2log(log,msg); if ((checkchangelog(fi,temp))==0) c2log(fi,msg); error_from_client = 1; - snprintf(msg,sizeof(msg),"Communicate with threads"); + BaseString::snprintf(msg,sizeof(msg),"Communicate with threads"); if ((checkchangelog(log,lognamn))==0) n2log(log,msg); - snprintf(msg,sizeof(msg),"Waiting for threads to return from work"); + BaseString::snprintf(msg,sizeof(msg),"Waiting for threads to return from work"); if ((checkchangelog(log,lognamn))==0) n2log(log,msg); - snprintf(msg,sizeof(msg),"Closing down"); + BaseString::snprintf(msg,sizeof(msg),"Closing down"); if ((checkchangelog(log,lognamn))==0) n2log(log,msg); close(s); diff --git a/ndb/test/ndbapi/flexAsynch.cpp b/ndb/test/ndbapi/flexAsynch.cpp index 8c0ba46130c..1953444d640 100644 --- a/ndb/test/ndbapi/flexAsynch.cpp +++ b/ndb/test/ndbapi/flexAsynch.cpp @@ -710,7 +710,7 @@ static void setAttrNames() int i; for (i = 0; i < MAXATTR ; i++){ - snprintf(attrName[i], MAXSTRLEN, "COL%d", i); + BaseString::snprintf(attrName[i], MAXSTRLEN, "COL%d", i); } } @@ -722,10 +722,10 @@ static void setTableNames() int i; for (i = 0; i < MAXTABLES ; i++){ if (theStdTableNameFlag==0){ - snprintf(tableName[i], MAXSTRLEN, "TAB%d_%d", i, + BaseString::snprintf(tableName[i], MAXSTRLEN, "TAB%d_%d", i, (int)(NdbTick_CurrentMillisecond()/1000)); } else { - snprintf(tableName[i], MAXSTRLEN, "TAB%d", i); + BaseString::snprintf(tableName[i], MAXSTRLEN, "TAB%d", i); } } } diff --git a/ndb/test/ndbapi/flexBench.cpp b/ndb/test/ndbapi/flexBench.cpp index b19944498f4..2a2388109a1 100644 --- a/ndb/test/ndbapi/flexBench.cpp +++ b/ndb/test/ndbapi/flexBench.cpp @@ -1032,7 +1032,7 @@ static int readArguments(int argc, const char** argv) const char *q = strrchr(p, ':'); if (q == 0) return -1; - snprintf(statHost, sizeof(statHost), "%.*s", q-p, p); + BaseString::snprintf(statHost, sizeof(statHost), "%.*s", q-p, p); statPort = atoi(q+1); statEnable = true; argc -= 1; @@ -1068,17 +1068,17 @@ static int createTables(Ndb* pMyNdb){ int i; for (i = 0; i < tNoOfAttributes; i++){ - snprintf(attrName[i], MAXSTRLEN, "COL%d", i); + BaseString::snprintf(attrName[i], MAXSTRLEN, "COL%d", i); } // Note! Uses only uppercase letters in table name's // so that we can look at the tables with SQL for (i = 0; i < tNoOfTables; i++){ if (theStdTableNameFlag == 0){ - snprintf(tableName[i], MAXSTRLEN, "TAB%d_%d", i, + BaseString::snprintf(tableName[i], MAXSTRLEN, "TAB%d_%d", i, (int)(NdbTick_CurrentMillisecond() / 1000)); } else { - snprintf(tableName[i], MAXSTRLEN, "TAB%d", i); + BaseString::snprintf(tableName[i], MAXSTRLEN, "TAB%d", i); } } diff --git a/ndb/test/ndbapi/flexHammer.cpp b/ndb/test/ndbapi/flexHammer.cpp index 80cc7c5a53f..688e70d501a 100644 --- a/ndb/test/ndbapi/flexHammer.cpp +++ b/ndb/test/ndbapi/flexHammer.cpp @@ -840,7 +840,7 @@ static int setAttrNames() int retVal = 0; for (i = 0; i < MAXATTR ; i++) { - retVal = snprintf(attrName[i], MAXSTRLEN, "COL%d", i); + retVal = BaseString::snprintf(attrName[i], MAXSTRLEN, "COL%d", i); if (retVal < 0) { // Error in conversion return(-1); @@ -859,11 +859,11 @@ static int setTableNames() for (i = 0; i < MAXTABLES ; i++) { if (theStandardTableNameFlag == 0) { - retVal = snprintf(tableName[i], MAXSTRLEN, "TAB%d_%d", i, + retVal = BaseString::snprintf(tableName[i], MAXSTRLEN, "TAB%d_%d", i, NdbTick_CurrentMillisecond()/1000); } // if else { - retVal = snprintf(tableName[i], MAXSTRLEN, "TAB%d", i); + retVal = BaseString::snprintf(tableName[i], MAXSTRLEN, "TAB%d", i); } // else if (retVal < 0) { // Error in conversion diff --git a/ndb/test/ndbapi/flexScan.cpp b/ndb/test/ndbapi/flexScan.cpp index b09d71fb010..c7f4041a525 100644 --- a/ndb/test/ndbapi/flexScan.cpp +++ b/ndb/test/ndbapi/flexScan.cpp @@ -713,7 +713,7 @@ static int setAttrNames() int retVal = 0; for (i = 0; i < MAXATTR ; i++) { - retVal = snprintf(attrName[i], MAXSTRLEN, "COL%d", i); + retVal = BaseString::snprintf(attrName[i], MAXSTRLEN, "COL%d", i); if (retVal < 0) { return(-1); } // if @@ -733,11 +733,11 @@ static int setTableNames() for (i = 0; i < MAXTABLES ; i++) { if (theStdTableNameFlag == 0) { - retVal = snprintf(tableName[i], MAXSTRLEN, "TAB%d_%d", i, + retVal = BaseString::snprintf(tableName[i], MAXSTRLEN, "TAB%d_%d", i, (int)(NdbTick_CurrentMillisecond() / 1000)); } // if else { - retVal = snprintf(tableName[i], MAXSTRLEN, "TAB%d", i); + retVal = BaseString::snprintf(tableName[i], MAXSTRLEN, "TAB%d", i); } // if else if (retVal < 0) { diff --git a/ndb/test/ndbapi/flexTT.cpp b/ndb/test/ndbapi/flexTT.cpp index 162fc080218..3b976f9f87e 100644 --- a/ndb/test/ndbapi/flexTT.cpp +++ b/ndb/test/ndbapi/flexTT.cpp @@ -641,17 +641,17 @@ defineOperation(NdbConnection* localNdbConnection, TransNdb* transNdbRef, static void setAttrNames() { - snprintf(attrName[0], MAXSTRLEN, "VPN_ID"); - snprintf(attrName[1], MAXSTRLEN, "VPN_NB"); - snprintf(attrName[2], MAXSTRLEN, "DIRECTORY_NB"); - snprintf(attrName[3], MAXSTRLEN, "LAST_CALL_PARTY"); - snprintf(attrName[4], MAXSTRLEN, "DESCR"); + BaseString::snprintf(attrName[0], MAXSTRLEN, "VPN_ID"); + BaseString::snprintf(attrName[1], MAXSTRLEN, "VPN_NB"); + BaseString::snprintf(attrName[2], MAXSTRLEN, "DIRECTORY_NB"); + BaseString::snprintf(attrName[3], MAXSTRLEN, "LAST_CALL_PARTY"); + BaseString::snprintf(attrName[4], MAXSTRLEN, "DESCR"); } static void setTableNames() { - snprintf(tableName[0], MAXSTRLEN, "VPN_USERS"); + BaseString::snprintf(tableName[0], MAXSTRLEN, "VPN_USERS"); } static diff --git a/ndb/test/ndbapi/flex_bench_mysql.cpp b/ndb/test/ndbapi/flex_bench_mysql.cpp index 8e1fbcd9058..c8d4d85bedf 100644 --- a/ndb/test/ndbapi/flex_bench_mysql.cpp +++ b/ndb/test/ndbapi/flex_bench_mysql.cpp @@ -1552,7 +1552,7 @@ static int readArguments(int argc, const char** argv) const char *q = strrchr(p, ':'); if (q == 0) return -1; - snprintf(statHost, sizeof(statHost), "%.*s", q-p, p); + BaseString::snprintf(statHost, sizeof(statHost), "%.*s", q-p, p); statPort = atoi(q+1); statEnable = true; argc -= 1; @@ -1618,17 +1618,17 @@ static int createTables(MYSQL* mysqlp){ for (Uint32 i = 0; i < tNoOfAttributes; i++){ - snprintf(attrName[i], MAXSTRLEN, "COL%d", i); + BaseString::snprintf(attrName[i], MAXSTRLEN, "COL%d", i); } // Note! Uses only uppercase letters in table name's // so that we can look at the tables with SQL for (Uint32 i = 0; i < tNoOfTables; i++){ if (theStdTableNameFlag == 0){ - snprintf(tableName[i], MAXSTRLEN, "TAB%d_%d", i, + BaseString::snprintf(tableName[i], MAXSTRLEN, "TAB%d_%d", i, (int)(NdbTick_CurrentMillisecond() / 1000)); } else { - snprintf(tableName[i], MAXSTRLEN, "TAB%d", i); + BaseString::snprintf(tableName[i], MAXSTRLEN, "TAB%d", i); } } @@ -1663,17 +1663,17 @@ static int createTables(Ndb* pMyNdb){ for (Uint32 i = 0; i < tNoOfAttributes; i++){ - snprintf(attrName[i], MAXSTRLEN, "COL%d", i); + BaseString::snprintf(attrName[i], MAXSTRLEN, "COL%d", i); } // Note! Uses only uppercase letters in table name's // so that we can look at the tables with SQL for (Uint32 i = 0; i < tNoOfTables; i++){ if (theStdTableNameFlag == 0){ - snprintf(tableName[i], MAXSTRLEN, "TAB%d_%d", i, + BaseString::snprintf(tableName[i], MAXSTRLEN, "TAB%d_%d", i, (int)(NdbTick_CurrentMillisecond() / 1000)); } else { - snprintf(tableName[i], MAXSTRLEN, "TAB%d", i); + BaseString::snprintf(tableName[i], MAXSTRLEN, "TAB%d", i); } } diff --git a/ndb/test/ndbapi/interpreterInTup.cpp b/ndb/test/ndbapi/interpreterInTup.cpp index 20d84e6e96d..a07d5898213 100644 --- a/ndb/test/ndbapi/interpreterInTup.cpp +++ b/ndb/test/ndbapi/interpreterInTup.cpp @@ -1507,12 +1507,12 @@ void delete_rows(Ndb* pMyNdb, int tupleTest, int opType) { inline void setAttrNames(){ for (int i = 0; i < MAXATTR; i++){ - snprintf(attrName[i], MAXSTRLEN, "COL%d", i); + BaseString::snprintf(attrName[i], MAXSTRLEN, "COL%d", i); } } inline void setTableNames(){ - snprintf(tableName, MAXSTRLEN, "TAB1"); + BaseString::snprintf(tableName, MAXSTRLEN, "TAB1"); } diff --git a/ndb/test/ndbapi/testBasic.cpp b/ndb/test/ndbapi/testBasic.cpp index 7d03016b87a..4d64b15ecfa 100644 --- a/ndb/test/ndbapi/testBasic.cpp +++ b/ndb/test/ndbapi/testBasic.cpp @@ -160,8 +160,8 @@ int runPkDirtyRead(NDBT_Context* ctx, NDBT_Step* step){ HugoTransactions hugoTrans(*ctx->getTab()); while (i<loops) { g_info << i << ": "; - if (hugoTrans.pkReadRecords(GETNDB(step), records, - batchSize, dirty) != NDBT_OK){ + if (hugoTrans.pkReadRecords(GETNDB(step), records, batchSize, + NdbOperation::LM_CommittedRead) != NDBT_OK){ g_info << endl; return NDBT_FAILED; } @@ -398,14 +398,14 @@ int runNoCommitSleep(NDBT_Context* ctx, NDBT_Step* step){ for (int i = 2; i < 8; i++){ CHECK(hugoOps.startTransaction(pNdb) == 0); - CHECK(hugoOps.pkReadRecord(pNdb, 1, true) == 0); + CHECK(hugoOps.pkReadRecord(pNdb, 1, 1, NdbOperation::LM_Exclusive) == 0); CHECK(hugoOps.execute_NoCommit(pNdb) == 0); ndbout << i <<": Sleeping for " << sleepTime << " ms" << endl; NdbSleep_MilliSleep(sleepTime); // Dont care about result of these ops - hugoOps.pkReadRecord(pNdb, 1, true); + hugoOps.pkReadRecord(pNdb, 1, 1, NdbOperation::LM_Exclusive); hugoOps.closeTransaction(pNdb); sleepTime = sleepTime *i; @@ -424,16 +424,16 @@ int runCommit626(NDBT_Context* ctx, NDBT_Step* step){ do{ // Commit transaction CHECK(hugoOps.startTransaction(pNdb) == 0); - CHECK(hugoOps.pkReadRecord(pNdb, 1, true) == 0); + CHECK(hugoOps.pkReadRecord(pNdb, 1, 1, NdbOperation::LM_Exclusive) == 0); CHECK(hugoOps.execute_Commit(pNdb) == 626); CHECK(hugoOps.closeTransaction(pNdb) == 0); // Commit transaction // Multiple operations CHECK(hugoOps.startTransaction(pNdb) == 0); - CHECK(hugoOps.pkReadRecord(pNdb, 1, true) == 0); - CHECK(hugoOps.pkReadRecord(pNdb, 2, true) == 0); - CHECK(hugoOps.pkReadRecord(pNdb, 3, true) == 0); + CHECK(hugoOps.pkReadRecord(pNdb, 1, 1, NdbOperation::LM_Exclusive) == 0); + CHECK(hugoOps.pkReadRecord(pNdb, 2, 1, NdbOperation::LM_Exclusive) == 0); + CHECK(hugoOps.pkReadRecord(pNdb, 3, 1, NdbOperation::LM_Exclusive) == 0); CHECK(hugoOps.execute_Commit(pNdb) == 626); }while(false); @@ -467,7 +467,7 @@ int runCommit_TryCommit626(NDBT_Context* ctx, NDBT_Step* step){ do{ // Commit transaction, TryCommit CHECK(hugoOps.startTransaction(pNdb) == 0); - CHECK(hugoOps.pkReadRecord(pNdb, 1, true) == 0); + CHECK(hugoOps.pkReadRecord(pNdb, 1, 1, NdbOperation::LM_Exclusive) == 0); CHECK(hugoOps.execute_Commit(pNdb, TryCommit) == 626); CHECK(hugoOps.closeTransaction(pNdb) == 0); @@ -475,11 +475,11 @@ int runCommit_TryCommit626(NDBT_Context* ctx, NDBT_Step* step){ // Several operations in one transaction // The insert is OK CHECK(hugoOps.startTransaction(pNdb) == 0); - CHECK(hugoOps.pkReadRecord(pNdb, 1, true) == 0); - CHECK(hugoOps.pkReadRecord(pNdb, 2, true) == 0); - CHECK(hugoOps.pkReadRecord(pNdb, 3, true) == 0); + CHECK(hugoOps.pkReadRecord(pNdb, 1, 1, NdbOperation::LM_Exclusive) == 0); + CHECK(hugoOps.pkReadRecord(pNdb, 2, 1, NdbOperation::LM_Exclusive) == 0); + CHECK(hugoOps.pkReadRecord(pNdb, 3, 1, NdbOperation::LM_Exclusive) == 0); CHECK(hugoOps.pkInsertRecord(pNdb, 1) == 0); - CHECK(hugoOps.pkReadRecord(pNdb, 4, true) == 0); + CHECK(hugoOps.pkReadRecord(pNdb, 4, 1, NdbOperation::LM_Exclusive) == 0); CHECK(hugoOps.execute_Commit(pNdb, TryCommit) == 626); }while(false); @@ -513,20 +513,23 @@ int runCommit_CommitAsMuchAsPossible626(NDBT_Context* ctx, NDBT_Step* step){ do{ // Commit transaction, CommitAsMuchAsPossible CHECK(hugoOps.startTransaction(pNdb) == 0); - CHECK(hugoOps.pkReadRecord(pNdb, 1, true) == 0); + CHECK(hugoOps.pkReadRecord(pNdb, 1, 1, NdbOperation::LM_Exclusive) == 0); CHECK(hugoOps.execute_Commit(pNdb, CommitAsMuchAsPossible) == 626); CHECK(hugoOps.closeTransaction(pNdb) == 0); // Commit transaction, CommitAsMuchAsPossible CHECK(hugoOps.startTransaction(pNdb) == 0); - CHECK(hugoOps.pkReadRecord(pNdb, 1, true) == 0); - CHECK(hugoOps.pkReadRecord(pNdb, 2, true) == 0); - CHECK(hugoOps.pkReadRecord(pNdb, 3, true) == 0); + CHECK(hugoOps.pkReadRecord(pNdb, 2, 1, NdbOperation::LM_Exclusive) == 0); + CHECK(hugoOps.pkReadRecord(pNdb, 3, 1, NdbOperation::LM_Exclusive) == 0); CHECK(hugoOps.pkInsertRecord(pNdb, 1) == 0); - CHECK(hugoOps.pkReadRecord(pNdb, 4, true) == 0); CHECK(hugoOps.execute_Commit(pNdb, CommitAsMuchAsPossible) == 626); CHECK(hugoOps.closeTransaction(pNdb) == 0); - }while(false); + + CHECK(hugoOps.startTransaction(pNdb) == 0); + CHECK(hugoOps.pkReadRecord(pNdb, 1) == 0); + CHECK(hugoOps.execute_Commit(pNdb) == 0); + CHECK(hugoOps.closeTransaction(pNdb) == 0); + } while(false); hugoOps.closeTransaction(pNdb); @@ -542,8 +545,14 @@ int runCommit_CommitAsMuchAsPossible630(NDBT_Context* ctx, NDBT_Step* step){ // Commit transaction, CommitAsMuchAsPossible CHECK(hugoOps.startTransaction(pNdb) == 0); CHECK(hugoOps.pkInsertRecord(pNdb, 1) == 0); + CHECK(hugoOps.pkDeleteRecord(pNdb, 2) == 0); CHECK(hugoOps.execute_Commit(pNdb, CommitAsMuchAsPossible) == 630); - }while(false); + CHECK(hugoOps.closeTransaction(pNdb) == 0); + + CHECK(hugoOps.startTransaction(pNdb) == 0); + CHECK(hugoOps.pkReadRecord(pNdb, 2) == 0); + CHECK(hugoOps.execute_Commit(pNdb) == 0); + } while(false); hugoOps.closeTransaction(pNdb); @@ -558,13 +567,13 @@ int runNoCommit626(NDBT_Context* ctx, NDBT_Step* step){ do{ // No commit transaction, readTuple CHECK(hugoOps.startTransaction(pNdb) == 0); - CHECK(hugoOps.pkReadRecord(pNdb, 1, false) == 0); + CHECK(hugoOps.pkReadRecord(pNdb, 1, 1, NdbOperation::LM_Read) == 0); CHECK(hugoOps.execute_NoCommit(pNdb) == 626); CHECK(hugoOps.closeTransaction(pNdb) == 0); // No commit transaction, readTupleExcluive CHECK(hugoOps.startTransaction(pNdb) == 0); - CHECK(hugoOps.pkReadRecord(pNdb, 1, true) == 0); + CHECK(hugoOps.pkReadRecord(pNdb, 1, 1, NdbOperation::LM_Exclusive) == 0); CHECK(hugoOps.execute_NoCommit(pNdb) == 626); }while(false); @@ -598,7 +607,7 @@ int runNoCommitRollback626(NDBT_Context* ctx, NDBT_Step* step){ do{ // No commit transaction, rollback CHECK(hugoOps.startTransaction(pNdb) == 0); - CHECK(hugoOps.pkReadRecord(pNdb, 1, true) == 0); + CHECK(hugoOps.pkReadRecord(pNdb, 1, 1, NdbOperation::LM_Exclusive) == 0); CHECK(hugoOps.execute_NoCommit(pNdb) == 626); CHECK(hugoOps.execute_Rollback(pNdb) == 0); CHECK(hugoOps.closeTransaction(pNdb) == 0); @@ -606,10 +615,10 @@ int runNoCommitRollback626(NDBT_Context* ctx, NDBT_Step* step){ // No commit transaction, rollback // Multiple operations CHECK(hugoOps.startTransaction(pNdb) == 0); - CHECK(hugoOps.pkReadRecord(pNdb, 1, true) == 0); - CHECK(hugoOps.pkReadRecord(pNdb, 2, true) == 0); - CHECK(hugoOps.pkReadRecord(pNdb, 3, true) == 0); - CHECK(hugoOps.pkReadRecord(pNdb, 4, true) == 0); + CHECK(hugoOps.pkReadRecord(pNdb, 1, 1, NdbOperation::LM_Exclusive) == 0); + CHECK(hugoOps.pkReadRecord(pNdb, 2, 1, NdbOperation::LM_Exclusive) == 0); + CHECK(hugoOps.pkReadRecord(pNdb, 3, 1, NdbOperation::LM_Exclusive) == 0); + CHECK(hugoOps.pkReadRecord(pNdb, 4, 1, NdbOperation::LM_Exclusive) == 0); CHECK(hugoOps.execute_NoCommit(pNdb) == 626); CHECK(hugoOps.execute_Rollback(pNdb) == 0); }while(false); @@ -647,7 +656,7 @@ int runNoCommitAndClose(NDBT_Context* ctx, NDBT_Step* step){ // Read CHECK(hugoOps.startTransaction(pNdb) == 0); for (i = 0; i < 10; i++) - CHECK(hugoOps.pkReadRecord(pNdb, i, true) == 0); + CHECK(hugoOps.pkReadRecord(pNdb, i, 1, NdbOperation::LM_Exclusive) == 0); CHECK(hugoOps.execute_NoCommit(pNdb) == 0); CHECK(hugoOps.closeTransaction(pNdb) == 0); @@ -701,7 +710,7 @@ int runCheckRollbackDelete(NDBT_Context* ctx, NDBT_Step* step){ CHECK(hugoOps.execute_NoCommit(pNdb) == 0); // Check record is deleted - CHECK(hugoOps.pkReadRecord(pNdb, 5, true) == 0); + CHECK(hugoOps.pkReadRecord(pNdb, 5, 1, NdbOperation::LM_Exclusive) == 0); CHECK(hugoOps.execute_NoCommit(pNdb) == 626); CHECK(hugoOps.execute_Rollback(pNdb) == 0); @@ -709,13 +718,13 @@ int runCheckRollbackDelete(NDBT_Context* ctx, NDBT_Step* step){ // Check record is not deleted CHECK(hugoOps.startTransaction(pNdb) == 0); - CHECK(hugoOps.pkReadRecord(pNdb, 5, true) == 0); + CHECK(hugoOps.pkReadRecord(pNdb, 5, 1, NdbOperation::LM_Exclusive) == 0); CHECK(hugoOps.execute_Commit(pNdb) == 0); CHECK(hugoOps.closeTransaction(pNdb) == 0); // Check record is back to original value CHECK(hugoOps.startTransaction(pNdb) == 0); - CHECK(hugoOps.pkReadRecord(pNdb, 5, true) == 0); + CHECK(hugoOps.pkReadRecord(pNdb, 5, 1, NdbOperation::LM_Exclusive) == 0); CHECK(hugoOps.execute_Commit(pNdb) == 0); CHECK(hugoOps.compareRecordToCopy() == NDBT_OK); @@ -736,7 +745,7 @@ int runCheckRollbackUpdate(NDBT_Context* ctx, NDBT_Step* step){ // Read value and save it for later CHECK(hugoOps.startTransaction(pNdb) == 0); - CHECK(hugoOps.pkReadRecord(pNdb, 1, false, numRecords) == 0); + CHECK(hugoOps.pkReadRecord(pNdb, 1, numRecords) == 0); CHECK(hugoOps.execute_Commit(pNdb) == 0); CHECK(hugoOps.verifyUpdatesValue(0) == NDBT_OK); // Update value 0 CHECK(hugoOps.closeTransaction(pNdb) == 0); @@ -747,7 +756,7 @@ int runCheckRollbackUpdate(NDBT_Context* ctx, NDBT_Step* step){ CHECK(hugoOps.execute_NoCommit(pNdb) == 0); // Check record is updated - CHECK(hugoOps.pkReadRecord(pNdb, 1, true, numRecords) == 0); + CHECK(hugoOps.pkReadRecord(pNdb, 1, numRecords, NdbOperation::LM_Exclusive) == 0); CHECK(hugoOps.execute_NoCommit(pNdb) == 0); CHECK(hugoOps.verifyUpdatesValue(5) == NDBT_OK); // Updates value 5 CHECK(hugoOps.execute_Rollback(pNdb) == 0); @@ -756,7 +765,7 @@ int runCheckRollbackUpdate(NDBT_Context* ctx, NDBT_Step* step){ // Check record is back to original value CHECK(hugoOps.startTransaction(pNdb) == 0); - CHECK(hugoOps.pkReadRecord(pNdb, 1, true, numRecords) == 0); + CHECK(hugoOps.pkReadRecord(pNdb, 1, numRecords, NdbOperation::LM_Exclusive) == 0); CHECK(hugoOps.execute_Commit(pNdb) == 0); CHECK(hugoOps.verifyUpdatesValue(0) == NDBT_OK); // Updates value 0 @@ -775,7 +784,7 @@ int runCheckRollbackDeleteMultiple(NDBT_Context* ctx, NDBT_Step* step){ do{ // Read value and save it for later CHECK(hugoOps.startTransaction(pNdb) == 0); - CHECK(hugoOps.pkReadRecord(pNdb, 5, false, 10) == 0); + CHECK(hugoOps.pkReadRecord(pNdb, 5, 10) == 0); CHECK(hugoOps.execute_Commit(pNdb) == 0); CHECK(hugoOps.verifyUpdatesValue(0) == NDBT_OK); CHECK(hugoOps.closeTransaction(pNdb) == 0); @@ -785,7 +794,7 @@ int runCheckRollbackDeleteMultiple(NDBT_Context* ctx, NDBT_Step* step){ for(Uint32 i = 0; i<1; i++){ // Read record 5 - 10 CHECK(hugoOps.startTransaction(pNdb) == 0); - CHECK(hugoOps.pkReadRecord(pNdb, 5, true, 10) == 0); + CHECK(hugoOps.pkReadRecord(pNdb, 5, 10, NdbOperation::LM_Exclusive) == 0); CHECK(hugoOps.execute_NoCommit(pNdb) == 0); for(j = 0; j<10; j++){ @@ -794,7 +803,7 @@ int runCheckRollbackDeleteMultiple(NDBT_Context* ctx, NDBT_Step* step){ CHECK(hugoOps.pkUpdateRecord(pNdb, 5, 10, updatesValue) == 0); CHECK(hugoOps.execute_NoCommit(pNdb) == 0); - CHECK(hugoOps.pkReadRecord(pNdb, 5, true, 10) == 0); + CHECK(hugoOps.pkReadRecord(pNdb, 5, 10, NdbOperation::LM_Exclusive) == 0); CHECK(hugoOps.execute_NoCommit(pNdb) == 0); CHECK(hugoOps.verifyUpdatesValue(updatesValue) == 0); } @@ -806,7 +815,7 @@ int runCheckRollbackDeleteMultiple(NDBT_Context* ctx, NDBT_Step* step){ #if 0 // Check records are deleted - CHECK(hugoOps.pkReadRecord(pNdb, 5, true, 10) == 0); + CHECK(hugoOps.pkReadRecord(pNdb, 5, 10, NdbOperation::LM_Exclusive) == 0); CHECK(hugoOps.execute_NoCommit(pNdb) == 626); #endif @@ -814,7 +823,7 @@ int runCheckRollbackDeleteMultiple(NDBT_Context* ctx, NDBT_Step* step){ CHECK(hugoOps.pkInsertRecord(pNdb, 5, 10, updatesValue) == 0); CHECK(hugoOps.execute_NoCommit(pNdb) == 0); - CHECK(hugoOps.pkReadRecord(pNdb, 5, true, 10) == 0); + CHECK(hugoOps.pkReadRecord(pNdb, 5, 10, NdbOperation::LM_Exclusive) == 0); CHECK(hugoOps.execute_NoCommit(pNdb) == 0); CHECK(hugoOps.verifyUpdatesValue(updatesValue) == 0); } @@ -823,7 +832,7 @@ int runCheckRollbackDeleteMultiple(NDBT_Context* ctx, NDBT_Step* step){ CHECK(hugoOps.execute_NoCommit(pNdb) == 0); // Check records are deleted - CHECK(hugoOps.pkReadRecord(pNdb, 5, true, 10) == 0); + CHECK(hugoOps.pkReadRecord(pNdb, 5, 10, NdbOperation::LM_Exclusive) == 0); CHECK(hugoOps.execute_NoCommit(pNdb) == 626); CHECK(hugoOps.execute_Rollback(pNdb) == 0); @@ -833,7 +842,7 @@ int runCheckRollbackDeleteMultiple(NDBT_Context* ctx, NDBT_Step* step){ // Check records are not deleted // after rollback CHECK(hugoOps.startTransaction(pNdb) == 0); - CHECK(hugoOps.pkReadRecord(pNdb, 5, true, 10) == 0); + CHECK(hugoOps.pkReadRecord(pNdb, 5, 10, NdbOperation::LM_Exclusive) == 0); CHECK(hugoOps.execute_Commit(pNdb) == 0); CHECK(hugoOps.verifyUpdatesValue(0) == NDBT_OK); @@ -853,7 +862,7 @@ int runCheckImplicitRollbackDelete(NDBT_Context* ctx, NDBT_Step* step){ do{ // Read record 5 CHECK(hugoOps.startTransaction(pNdb) == 0); - CHECK(hugoOps.pkReadRecord(pNdb, 5, true) == 0); + CHECK(hugoOps.pkReadRecord(pNdb, 5, 1, NdbOperation::LM_Exclusive) == 0); CHECK(hugoOps.execute_NoCommit(pNdb) == 0); CHECK(hugoOps.closeTransaction(pNdb) == 0); @@ -872,7 +881,7 @@ int runCheckImplicitRollbackDelete(NDBT_Context* ctx, NDBT_Step* step){ // Check record is not deleted // Close transaction should have rollbacked CHECK(hugoOps.startTransaction(pNdb) == 0); - CHECK(hugoOps.pkReadRecord(pNdb, 5, true) == 0); + CHECK(hugoOps.pkReadRecord(pNdb, 5, 1, NdbOperation::LM_Exclusive) == 0); CHECK(hugoOps.execute_Commit(pNdb) == 0); }while(false); @@ -889,7 +898,7 @@ int runCheckCommitDelete(NDBT_Context* ctx, NDBT_Step* step){ do{ // Read 10 records CHECK(hugoOps.startTransaction(pNdb) == 0); - CHECK(hugoOps.pkReadRecord(pNdb, 5, true, 10) == 0); + CHECK(hugoOps.pkReadRecord(pNdb, 5, 10, NdbOperation::LM_Exclusive) == 0); CHECK(hugoOps.execute_NoCommit(pNdb) == 0); // Update 10 records @@ -905,7 +914,7 @@ int runCheckCommitDelete(NDBT_Context* ctx, NDBT_Step* step){ // Check record's are deleted CHECK(hugoOps.startTransaction(pNdb) == 0); - CHECK(hugoOps.pkReadRecord(pNdb, 5, true, 10) == 0); + CHECK(hugoOps.pkReadRecord(pNdb, 5, 10, NdbOperation::LM_Exclusive) == 0); CHECK(hugoOps.execute_Commit(pNdb) == 626); }while(false); @@ -930,7 +939,7 @@ int runRollbackNothing(NDBT_Context* ctx, NDBT_Step* step){ // Check records are not deleted CHECK(hugoOps.startTransaction(pNdb) == 0); - CHECK(hugoOps.pkReadRecord(pNdb, 5, true, 10) == 0); + CHECK(hugoOps.pkReadRecord(pNdb, 5, 10, NdbOperation::LM_Exclusive) == 0); CHECK(hugoOps.execute_Commit(pNdb) == 0); CHECK(hugoOps.closeTransaction(pNdb) == 0); @@ -964,8 +973,8 @@ int runMassiveRollback(NDBT_Context* ctx, NDBT_Step* step){ for(int row = 0; row < records; row++){ int res; CHECK(hugoOps.startTransaction(pNdb) == 0); - for(int i = 0; i<OPS_TOTAL; i += OPS_PER_TRANS){ - for(int j = 0; j<OPS_PER_TRANS; j++){ + for(Uint32 i = 0; i<OPS_TOTAL; i += OPS_PER_TRANS){ + for(Uint32 j = 0; j<OPS_PER_TRANS; j++){ CHECK(hugoOps.pkUpdateRecord(pNdb, row, 1, i) == 0); } g_info << "Performed " << (i+OPS_PER_TRANS) << " updates on row: " << row @@ -1007,9 +1016,9 @@ runMassiveRollback2(NDBT_Context* ctx, NDBT_Step* step){ const Uint32 OPS_TOTAL = 4096; const Uint32 LOOPS = 10; - for(int loop = 0; loop<LOOPS; loop++){ + for(Uint32 loop = 0; loop<LOOPS; loop++){ CHECK(hugoOps.startTransaction(pNdb) == 0); - for(int i = 0; i<OPS_TOTAL-1; i ++){ + for(Uint32 i = 0; i<OPS_TOTAL-1; i ++){ if((i & 1) == 0){ CHECK(hugoOps.pkUpdateRecord(pNdb, 0, 1, loop) == 0); } else { @@ -1110,13 +1119,6 @@ TESTCASE("ReadWithLocksAndInserts", STEP(runInsertUntilStopped); FINALIZER(runClearTable); } -TESTCASE("ReadConsistency", - "Check that a read within a transaction returns the " \ - "same result no matter"){ - STEP(runInsertOne); - STEP(runReadOne); - FINALIZER(runClearTable2); -} TESTCASE("PkInsertTwice", "Verify that we can't insert an already inserted record." "Error should be returned" ){ @@ -1124,12 +1126,6 @@ TESTCASE("PkInsertTwice", STEP(runInsertTwice); FINALIZER(runClearTable); } -TESTCASE("Fill", - "Verify what happens when we fill the db" ){ - INITIALIZER(runFillTable); - INITIALIZER(runPkRead); - FINALIZER(runClearTable2); -} TESTCASE("NoCommitSleep", "Verify what happens when a NoCommit transaction is aborted by " "NDB because the application is sleeping" ){ @@ -1275,8 +1271,24 @@ TESTCASE("MassiveTransaction", INITIALIZER(runLoadTable2); FINALIZER(runClearTable2); } +TESTCASE("Fill", + "Verify what happens when we fill the db" ){ + INITIALIZER(runFillTable); + INITIALIZER(runPkRead); + FINALIZER(runClearTable2); +} NDBT_TESTSUITE_END(testBasic); +#if 0 +TESTCASE("ReadConsistency", + "Check that a read within a transaction returns the " \ + "same result no matter"){ + STEP(runInsertOne); + STEP(runReadOne); + FINALIZER(runClearTable2); +} +#endif + int main(int argc, const char** argv){ ndb_init(); return testBasic.execute(argc, argv); diff --git a/ndb/test/ndbapi/testBlobs.cpp b/ndb/test/ndbapi/testBlobs.cpp index e18f4a8bd1a..41bb82f3e06 100644 --- a/ndb/test/ndbapi/testBlobs.cpp +++ b/ndb/test/ndbapi/testBlobs.cpp @@ -1030,7 +1030,7 @@ readScan(int style, bool idx) } else { CHK((g_ops = g_con->getNdbIndexScanOperation(g_opt.m_x2name, g_opt.m_tname)) != 0); } - CHK((rs = g_ops->readTuples(NdbScanOperation::LM_Exclusive)) != 0); + CHK((rs = g_ops->readTuples(NdbScanOperation::LM_Read)) != 0); CHK(g_ops->getValue("PK1", (char*)&tup.m_pk1) != 0); if (g_opt.m_pk2len != 0) CHK(g_ops->getValue("PK2", tup.m_pk2) != 0); diff --git a/ndb/test/ndbapi/testDataBuffers.cpp b/ndb/test/ndbapi/testDataBuffers.cpp index 94658d5c6b9..04602f51d5f 100644 --- a/ndb/test/ndbapi/testDataBuffers.cpp +++ b/ndb/test/ndbapi/testDataBuffers.cpp @@ -93,7 +93,7 @@ ndberror(char const* fmt, ...) va_list ap; char buf[200]; va_start(ap, fmt); - vsnprintf(buf, sizeof(buf), fmt, ap); + BaseString::vsnprintf(buf, sizeof(buf), fmt, ap); va_end(ap); ndbout << buf << " --" << endl; if (ndb) @@ -115,7 +115,7 @@ chkerror(char const* fmt, ...) va_list ap; char buf[200]; va_start(ap, fmt); - vsnprintf(buf, sizeof(buf), fmt, ap); + BaseString::vsnprintf(buf, sizeof(buf), fmt, ap); va_end(ap); ndbout << "*** check failed: " << buf << " ***" << endl; return -1; diff --git a/ndb/test/ndbapi/testDict.cpp b/ndb/test/ndbapi/testDict.cpp index 7cba5ce4cc8..89232de2535 100644 --- a/ndb/test/ndbapi/testDict.cpp +++ b/ndb/test/ndbapi/testDict.cpp @@ -55,7 +55,7 @@ int runCreateInvalidTables(NDBT_Context* ctx, NDBT_Step* step){ char failTabName[256]; for (int i = 0; i < 10; i++){ - snprintf(failTabName, 256, "F%d", i); + BaseString::snprintf(failTabName, 256, "F%d", i); const NdbDictionary::Table* pFailTab = NDBT_Tables::getTable(failTabName); if (pFailTab != NULL){ @@ -425,7 +425,7 @@ int runCreateMaxTables(NDBT_Context* ctx, NDBT_Step* step){ Ndb* pNdb = GETNDB(step); for (int i = 0; i < numTables && failures < 5; i++){ - snprintf(tabName, 256, "MAXTAB%d", i); + BaseString::snprintf(tabName, 256, "MAXTAB%d", i); if (pNdb->waitUntilReady(30) != 0){ // Db is not ready, return with failure @@ -491,7 +491,7 @@ int runDropMaxTables(NDBT_Context* ctx, NDBT_Step* step){ Ndb* pNdb = GETNDB(step); for (int i = 0; i < numTables; i++){ - snprintf(tabName, 256, "MAXTAB%d", i); + BaseString::snprintf(tabName, 256, "MAXTAB%d", i); if (pNdb->waitUntilReady(30) != 0){ // Db is not ready, return with failure @@ -707,7 +707,7 @@ int runPkSizes(NDBT_Context* ctx, NDBT_Step* step){ int numRecords = ctx->getNumRecords(); for (int i = minPkSize; i < maxPkSize; i++){ - snprintf(tabName, 256, "TPK_%d", i); + BaseString::snprintf(tabName, 256, "TPK_%d", i); int records = numRecords; int max = ~0; diff --git a/ndb/test/ndbapi/testIndex.cpp b/ndb/test/ndbapi/testIndex.cpp index bef3b310c96..ed9e114fd92 100644 --- a/ndb/test/ndbapi/testIndex.cpp +++ b/ndb/test/ndbapi/testIndex.cpp @@ -150,7 +150,7 @@ int create_index(NDBT_Context* ctx, int indxNum, } // Create index - snprintf(idxName, 255, "IDC%d", indxNum); + BaseString::snprintf(idxName, 255, "IDC%d", indxNum); if (orderedIndex) ndbout << "Creating " << ((logged)?"logged ": "temporary ") << "ordered index "<<idxName << " ("; else @@ -194,7 +194,7 @@ int drop_index(int indxNum, Ndb* pNdb, if (attr->indexCreated == false) return NDBT_OK; - snprintf(idxName, 255, "IDC%d", indxNum); + BaseString::snprintf(idxName, 255, "IDC%d", indxNum); // Drop index ndbout << "Dropping index "<<idxName<<"(" << pTab->getName() << ") "; @@ -284,7 +284,7 @@ int createRandomIndex_Drop(NDBT_Context* ctx, NDBT_Step* step){ Uint32 i = ctx->getProperty("createRandomIndex"); - snprintf(idxName, 255, "IDC%d", i); + BaseString::snprintf(idxName, 255, "IDC%d", i); // Drop index ndbout << "Dropping index " << idxName << " "; @@ -309,7 +309,7 @@ int createPkIndex(NDBT_Context* ctx, NDBT_Step* step){ bool logged = ctx->getProperty("LoggedIndexes", 1); // Create index - snprintf(pkIdxName, 255, "IDC_PK_%s", pTab->getName()); + BaseString::snprintf(pkIdxName, 255, "IDC_PK_%s", pTab->getName()); if (orderedIndex) ndbout << "Creating " << ((logged)?"logged ": "temporary ") << "ordered index " << pkIdxName << " ("; @@ -381,27 +381,6 @@ runVerifyIndex(NDBT_Context* ctx, NDBT_Step* step){ } int -sync_down(NDBT_Context* ctx){ - Uint32 threads = ctx->getProperty("PauseThreads", (unsigned)0); - if(threads){ - ctx->decProperty("PauseThreads"); - } - return 0; -} - -int -sync_up_and_wait(NDBT_Context* ctx){ - Uint32 threads = ctx->getProperty("Threads", (unsigned)0); - ndbout_c("Setting PauseThreads to %d", threads); - ctx->setProperty("PauseThreads", threads); - ctx->getPropertyWait("PauseThreads", (unsigned)0); - if(threads){ - ndbout_c("wait completed"); - } - return 0; -} - -int runTransactions1(NDBT_Context* ctx, NDBT_Step* step){ // Verify that data in index match // table data @@ -416,7 +395,7 @@ runTransactions1(NDBT_Context* ctx, NDBT_Step* step){ return NDBT_FAILED; } - sync_down(ctx); + ctx->sync_down("PauseThreads"); if(ctx->isTestStopped()) break; @@ -425,7 +404,7 @@ runTransactions1(NDBT_Context* ctx, NDBT_Step* step){ return NDBT_FAILED; } - sync_down(ctx); + ctx->sync_down("PauseThreads"); } return NDBT_OK; } @@ -446,7 +425,7 @@ runTransactions2(NDBT_Context* ctx, NDBT_Step* step){ return NDBT_FAILED; } #endif - sync_down(ctx); + ctx->sync_down("PauseThreads"); if(ctx->isTestStopped()) break; #if 1 @@ -455,7 +434,7 @@ runTransactions2(NDBT_Context* ctx, NDBT_Step* step){ return NDBT_FAILED; } #endif - sync_down(ctx); + ctx->sync_down("PauseThreads"); } return NDBT_OK; } @@ -476,7 +455,7 @@ runTransactions3(NDBT_Context* ctx, NDBT_Step* step){ g_err << "Load table failed" << endl; return NDBT_FAILED; } - sync_down(ctx); + ctx->sync_down("PauseThreads"); if(ctx->isTestStopped()) break; @@ -485,7 +464,7 @@ runTransactions3(NDBT_Context* ctx, NDBT_Step* step){ return NDBT_FAILED; } - sync_down(ctx); + ctx->sync_down("PauseThreads"); if(ctx->isTestStopped()) break; @@ -494,7 +473,7 @@ runTransactions3(NDBT_Context* ctx, NDBT_Step* step){ return NDBT_FAILED; } - sync_down(ctx); + ctx->sync_down("PauseThreads"); if(ctx->isTestStopped()) break; @@ -503,7 +482,7 @@ runTransactions3(NDBT_Context* ctx, NDBT_Step* step){ return NDBT_FAILED; } - sync_down(ctx); + ctx->sync_down("PauseThreads"); if(ctx->isTestStopped()) break; @@ -512,7 +491,7 @@ runTransactions3(NDBT_Context* ctx, NDBT_Step* step){ return NDBT_FAILED; } - sync_down(ctx); + ctx->sync_down("PauseThreads"); if(ctx->isTestStopped()) break; @@ -521,14 +500,14 @@ runTransactions3(NDBT_Context* ctx, NDBT_Step* step){ return NDBT_FAILED; } - sync_down(ctx); + ctx->sync_down("PauseThreads"); if(ctx->isTestStopped()) break; int count = -1; if(utilTrans.selectCount(pNdb, 64, &count) != 0 || count != 0) return NDBT_FAILED; - sync_down(ctx); + ctx->sync_down("PauseThreads"); } return NDBT_OK; } @@ -540,6 +519,7 @@ int runRestarts(NDBT_Context* ctx, NDBT_Step* step){ NdbRestarts restarts; int i = 0; int timeout = 240; + int sync_threads = ctx->getProperty("Threads", (unsigned)0); while(i<loops && result != NDBT_FAILED && !ctx->isTestStopped()){ if(restarts.executeRestart("RestartRandomNodeAbort", timeout) != 0){ @@ -547,7 +527,7 @@ int runRestarts(NDBT_Context* ctx, NDBT_Step* step){ result = NDBT_FAILED; break; } - sync_up_and_wait(ctx); + ctx->sync_up_and_wait("PauseThreads", sync_threads); i++; } ctx->stopTest(); @@ -1088,7 +1068,7 @@ runUniqueNullTransactions(NDBT_Context* ctx, NDBT_Step* step){ const NdbDictionary::Table* pTab = ctx->getTab(); // Create index char nullIndex[255]; - snprintf(nullIndex, 255, "IDC_PK_%s_NULL", pTab->getName()); + BaseString::snprintf(nullIndex, 255, "IDC_PK_%s_NULL", pTab->getName()); if (orderedIndex) ndbout << "Creating " << ((logged)?"logged ": "temporary ") << "ordered index " << pkIdxName << " ("; diff --git a/ndb/test/ndbapi/testNdbApi.cpp b/ndb/test/ndbapi/testNdbApi.cpp index 47987629fe3..74cb1f8bcd0 100644 --- a/ndb/test/ndbapi/testNdbApi.cpp +++ b/ndb/test/ndbapi/testNdbApi.cpp @@ -229,7 +229,7 @@ int runTestMaxOperations(NDBT_Context* ctx, NDBT_Step* step){ int i = 0; while (errors < maxErrors){ - if(hugoOps.pkReadRecord(pNdb,1, false, 1) != NDBT_OK){ + if(hugoOps.pkReadRecord(pNdb,1, 1) != NDBT_OK){ errors++; continue; } diff --git a/ndb/test/ndbapi/testNodeRestart.cpp b/ndb/test/ndbapi/testNodeRestart.cpp index 6bfe59f8d3f..e844f227034 100644 --- a/ndb/test/ndbapi/testNodeRestart.cpp +++ b/ndb/test/ndbapi/testNodeRestart.cpp @@ -100,11 +100,16 @@ int runScanReadUntilStopped(NDBT_Context* ctx, NDBT_Step* step){ int runPkReadUntilStopped(NDBT_Context* ctx, NDBT_Step* step){ int result = NDBT_OK; int records = ctx->getNumRecords(); + NdbOperation::LockMode lm = + (NdbOperation::LockMode)ctx->getProperty("ReadLockMode", + (Uint32)NdbOperation::LM_Read); int i = 0; HugoTransactions hugoTrans(*ctx->getTab()); while (ctx->isTestStopped() == false) { g_info << i << ": "; - if (hugoTrans.pkReadRecords(GETNDB(step), records, 128) != 0){ + int rows = (rand()%records)+1; + int batch = (rand()%rows)+1; + if (hugoTrans.pkReadRecords(GETNDB(step), rows, batch, lm) != 0){ return NDBT_FAILED; } i++; @@ -119,7 +124,9 @@ int runPkUpdateUntilStopped(NDBT_Context* ctx, NDBT_Step* step){ HugoTransactions hugoTrans(*ctx->getTab()); while (ctx->isTestStopped() == false) { g_info << i << ": "; - if (hugoTrans.pkUpdateRecords(GETNDB(step), records) != 0){ + int rows = (rand()%records)+1; + int batch = (rand()%rows)+1; + if (hugoTrans.pkUpdateRecords(GETNDB(step), rows, batch) != 0){ return NDBT_FAILED; } i++; @@ -127,6 +134,60 @@ int runPkUpdateUntilStopped(NDBT_Context* ctx, NDBT_Step* step){ return result; } +int runPkReadPkUpdateUntilStopped(NDBT_Context* ctx, NDBT_Step* step){ + int result = NDBT_OK; + int records = ctx->getNumRecords(); + Ndb* pNdb = GETNDB(step); + int i = 0; + HugoOperations hugoOps(*ctx->getTab()); + while (ctx->isTestStopped() == false) { + g_info << i++ << ": "; + int rows = (rand()%records)+1; + int batch = (rand()%rows)+1; + int row = (records - rows) ? rand() % (records - rows) : 0; + + int j,k; + for(j = 0; j<rows; j += batch) + { + k = batch; + if(j+k > rows) + k = rows - j; + + if(hugoOps.startTransaction(pNdb) != 0) + goto err; + + if(hugoOps.pkReadRecord(pNdb, row+j, k, NdbOperation::LM_Exclusive) != 0) + goto err; + + if(hugoOps.execute_NoCommit(pNdb) != 0) + goto err; + + if(hugoOps.pkUpdateRecord(pNdb, row+j, k, rand()) != 0) + goto err; + + if(hugoOps.execute_Commit(pNdb) != 0) + goto err; + + if(hugoOps.closeTransaction(pNdb) != 0) + return NDBT_FAILED; + } + + continue; +err: + NdbConnection* pCon = hugoOps.getTransaction(); + if(pCon == 0) + continue; + NdbError error = pCon->getNdbError(); + hugoOps.closeTransaction(pNdb); + if (error.status == NdbError::TemporaryError){ + NdbSleep_MilliSleep(50); + continue; + } + return NDBT_FAILED; + } + return NDBT_OK; +} + int runScanUpdateUntilStopped(NDBT_Context* ctx, NDBT_Step* step){ int result = NDBT_OK; int records = ctx->getNumRecords(); @@ -158,6 +219,7 @@ int runScanReadVerify(NDBT_Context* ctx, NDBT_Step* step){ int runRestarter(NDBT_Context* ctx, NDBT_Step* step){ int result = NDBT_OK; int loops = ctx->getNumLoops(); + int sync_threads = ctx->getProperty("SyncThreads", (unsigned)0); NdbRestarter restarter; int i = 0; int lastId = 0; @@ -174,11 +236,11 @@ int runRestarter(NDBT_Context* ctx, NDBT_Step* step){ loops *= restarter.getNumDbNodes(); while(i<loops && result != NDBT_FAILED && !ctx->isTestStopped()){ - + int id = lastId % restarter.getNumDbNodes(); int nodeId = restarter.getDbNodeId(id); ndbout << "Restart node " << nodeId << endl; - if(restarter.restartOneDbNode(nodeId) != 0){ + if(restarter.restartOneDbNode(nodeId, false, false, true) != 0){ g_err << "Failed to restartNextDbNode" << endl; result = NDBT_FAILED; break; @@ -190,7 +252,7 @@ int runRestarter(NDBT_Context* ctx, NDBT_Step* step){ break; } - NdbSleep_SecSleep(1); + ctx->sync_up_and_wait("PauseThreads", sync_threads); lastId++; i++; @@ -234,6 +296,54 @@ int runRestarts(NDBT_Context* ctx, NDBT_Step* step){ return result; } +int runDirtyRead(NDBT_Context* ctx, NDBT_Step* step){ + int result = NDBT_OK; + int loops = ctx->getNumLoops(); + int records = ctx->getNumRecords(); + NdbRestarter restarter; + HugoOperations hugoOps(*ctx->getTab()); + Ndb* pNdb = GETNDB(step); + + int i = 0; + while(i<loops && result != NDBT_FAILED && !ctx->isTestStopped()){ + g_info << i << ": "; + + int id = i % restarter.getNumDbNodes(); + int nodeId = restarter.getDbNodeId(id); + ndbout << "Restart node " << nodeId << endl; + restarter.insertErrorInAllNodes(5041); + restarter.insertErrorInAllNodes(8048 + (i & 1)); + + for(int j = 0; j<records; j++){ + if(hugoOps.startTransaction(pNdb) != 0) + return NDBT_FAILED; + + if(hugoOps.pkReadRecord(pNdb, j, 1, NdbOperation::LM_CommittedRead) != 0) + goto err; + + int res; + if((res = hugoOps.execute_Commit(pNdb)) == 4119) + goto done; + + if(res != 0) + goto err; + + if(hugoOps.closeTransaction(pNdb) != 0) + return NDBT_FAILED; + } +done: + if(hugoOps.closeTransaction(pNdb) != 0) + return NDBT_FAILED; + + i++; + restarter.waitClusterStarted(60) ; + } + return result; +err: + hugoOps.closeTransaction(pNdb); + return NDBT_FAILED; +} + NDBT_TESTSUITE(testNodeRestart); TESTCASE("NoLoad", "Test that one node at a time can be stopped and then restarted "\ @@ -246,6 +356,27 @@ TESTCASE("NoLoad", TESTCASE("PkRead", "Test that one node at a time can be stopped and then restarted "\ "perform pk read while restarting. Do this loop number of times"){ + TC_PROPERTY("ReadLockMode", NdbOperation::LM_Read); + INITIALIZER(runCheckAllNodesStarted); + INITIALIZER(runLoadTable); + STEP(runRestarter); + STEP(runPkReadUntilStopped); + FINALIZER(runClearTable); +} +TESTCASE("PkReadCommitted", + "Test that one node at a time can be stopped and then restarted "\ + "perform pk read while restarting. Do this loop number of times"){ + TC_PROPERTY("ReadLockMode", NdbOperation::LM_CommittedRead); + INITIALIZER(runCheckAllNodesStarted); + INITIALIZER(runLoadTable); + STEP(runRestarter); + STEP(runPkReadUntilStopped); + FINALIZER(runClearTable); +} +TESTCASE("MixedPkRead", + "Test that one node at a time can be stopped and then restarted "\ + "perform pk read while restarting. Do this loop number of times"){ + TC_PROPERTY("ReadLockMode", -1); INITIALIZER(runCheckAllNodesStarted); INITIALIZER(runLoadTable); STEP(runRestarter); @@ -255,14 +386,31 @@ TESTCASE("PkRead", TESTCASE("PkReadPkUpdate", "Test that one node at a time can be stopped and then restarted "\ "perform pk read and pk update while restarting. Do this loop number of times"){ + TC_PROPERTY("ReadLockMode", NdbOperation::LM_Read); INITIALIZER(runCheckAllNodesStarted); INITIALIZER(runLoadTable); STEP(runRestarter); STEP(runPkReadUntilStopped); + STEP(runPkUpdateUntilStopped); + STEP(runPkReadPkUpdateUntilStopped); STEP(runPkReadUntilStopped); + STEP(runPkUpdateUntilStopped); + STEP(runPkReadPkUpdateUntilStopped); + FINALIZER(runClearTable); +} +TESTCASE("MixedPkReadPkUpdate", + "Test that one node at a time can be stopped and then restarted "\ + "perform pk read and pk update while restarting. Do this loop number of times"){ + TC_PROPERTY("ReadLockMode", -1); + INITIALIZER(runCheckAllNodesStarted); + INITIALIZER(runLoadTable); + STEP(runRestarter); STEP(runPkReadUntilStopped); + STEP(runPkUpdateUntilStopped); + STEP(runPkReadPkUpdateUntilStopped); STEP(runPkReadUntilStopped); STEP(runPkUpdateUntilStopped); + STEP(runPkReadPkUpdateUntilStopped); FINALIZER(runClearTable); } TESTCASE("ReadUpdateScan", @@ -273,6 +421,21 @@ TESTCASE("ReadUpdateScan", STEP(runRestarter); STEP(runPkReadUntilStopped); STEP(runPkUpdateUntilStopped); + STEP(runPkReadPkUpdateUntilStopped); + STEP(runScanReadUntilStopped); + STEP(runScanUpdateUntilStopped); + FINALIZER(runClearTable); +} +TESTCASE("MixedReadUpdateScan", + "Test that one node at a time can be stopped and then restarted "\ + "perform pk read, pk update and scan reads while restarting. Do this loop number of times"){ + TC_PROPERTY("ReadLockMode", -1); + INITIALIZER(runCheckAllNodesStarted); + INITIALIZER(runLoadTable); + STEP(runRestarter); + STEP(runPkReadUntilStopped); + STEP(runPkUpdateUntilStopped); + STEP(runPkReadPkUpdateUntilStopped); STEP(runScanReadUntilStopped); STEP(runScanUpdateUntilStopped); FINALIZER(runClearTable); @@ -431,6 +594,12 @@ TESTCASE("StopOnError", FINALIZER(runScanReadVerify); FINALIZER(runClearTable); } +TESTCASE("CommittedRead", + "Test committed read"){ + INITIALIZER(runLoadTable); + STEP(runDirtyRead); + FINALIZER(runClearTable); +} NDBT_TESTSUITE_END(testNodeRestart); int main(int argc, const char** argv){ diff --git a/ndb/test/ndbapi/testOIBasic.cpp b/ndb/test/ndbapi/testOIBasic.cpp index f9eb3514926..1c611d2b8ff 100644 --- a/ndb/test/ndbapi/testOIBasic.cpp +++ b/ndb/test/ndbapi/testOIBasic.cpp @@ -40,18 +40,21 @@ struct Opt { bool m_core; const char* m_csname; CHARSET_INFO* m_cs; + int m_die; bool m_dups; NdbDictionary::Object::FragmentType m_fragtype; - unsigned m_idxloop; + unsigned m_subsubloop; const char* m_index; unsigned m_loop; - bool m_nologging; bool m_msglock; + bool m_nologging; + bool m_noverify; unsigned m_pctnull; unsigned m_rows; unsigned m_samples; - unsigned m_scanrd; - unsigned m_scanex; + unsigned m_scanbat; + unsigned m_scanpar; + unsigned m_scanstop; unsigned m_seed; unsigned m_subloop; const char* m_table; @@ -64,22 +67,25 @@ struct Opt { m_core(false), m_csname("latin1_bin"), m_cs(0), + m_die(0), m_dups(false), m_fragtype(NdbDictionary::Object::FragUndefined), - m_idxloop(4), + m_subsubloop(4), m_index(0), m_loop(1), - m_nologging(false), m_msglock(true), + m_nologging(false), + m_noverify(false), m_pctnull(10), m_rows(1000), m_samples(0), - m_scanrd(240), - m_scanex(240), + m_scanbat(0), + m_scanpar(0), + m_scanstop(0), m_seed(0), m_subloop(4), m_table(0), - m_threads(4), + m_threads(10), m_v(1) { } }; @@ -100,16 +106,18 @@ printhelp() << " -case abc only given test cases (letters a-z)" << endl << " -core core dump on error [" << d.m_core << "]" << endl << " -csname S charset (collation) of non-pk char column [" << d.m_csname << "]" << endl + << " -die nnn exit immediately on NDB error code nnn" << endl << " -dups allow duplicate tuples from index scan [" << d.m_dups << "]" << endl << " -fragtype T fragment type single/small/medium/large" << endl << " -index xyz only given index numbers (digits 1-9)" << endl << " -loop N loop count full suite 0=forever [" << d.m_loop << "]" << endl << " -nologging create tables in no-logging mode" << endl + << " -noverify skip index verifications" << endl << " -pctnull N pct NULL values in nullable column [" << d.m_pctnull << "]" << endl << " -rows N rows per thread [" << d.m_rows << "]" << endl << " -samples N samples for some timings (0=all) [" << d.m_samples << "]" << endl - << " -scanrd N scan read parallelism [" << d.m_scanrd << "]" << endl - << " -scanex N scan exclusive parallelism [" << d.m_scanex << "]" << endl + << " -scanbat N scan batch per fragment (ignored by ndb api) [" << d.m_scanbat << "]" << endl + << " -scanpar N scan parallelism [" << d.m_scanpar << "]" << endl << " -seed N srandom seed 0=loop number[" << d.m_seed << "]" << endl << " -subloop N subtest loop count [" << d.m_subloop << "]" << endl << " -table xyz only given table numbers (digits 1-9)" << endl @@ -208,10 +216,14 @@ struct Par : public Opt { Set& set() const { assert(m_set != 0); return *m_set; } Tmr* m_tmr; Tmr& tmr() const { assert(m_tmr != 0); return *m_tmr; } + unsigned m_lno; + unsigned m_slno; unsigned m_totrows; // value calculation unsigned m_range; unsigned m_pctrange; + // choice of key + bool m_randomkey; // do verify after read bool m_verify; // deadlock possible @@ -224,9 +236,12 @@ struct Par : public Opt { m_tab(0), m_set(0), m_tmr(0), + m_lno(0), + m_slno(0), m_totrows(m_threads * m_rows), m_range(m_rows), m_pctrange(0), + m_randomkey(false), m_verify(false), m_deadlock(false) { } @@ -688,13 +703,14 @@ struct Con { int setBound(int num, int type, const void* value); int execute(ExecType t); int execute(ExecType t, bool& deadlock); - int openScanRead(unsigned parallelism); - int openScanExclusive(unsigned parallelism); + int openScanRead(unsigned scanbat, unsigned scanpar); + int openScanExclusive(unsigned scanbat, unsigned scanpar); int executeScan(); int nextScanResult(bool fetchAllowed); int nextScanResult(bool fetchAllowed, bool& deadlock); int updateScanTuple(Con& con2); int deleteScanTuple(Con& con2); + void closeScan(); void closeTransaction(); void printerror(NdbOut& out); }; @@ -815,18 +831,20 @@ Con::execute(ExecType t, bool& deadlock) } int -Con::openScanRead(unsigned parallelism) +Con::openScanRead(unsigned scanbat, unsigned scanpar) { assert(m_tx != 0 && m_op != 0); - CHKCON((m_resultset = m_scanop->readTuples(parallelism)) != 0, *this); + NdbOperation::LockMode lm = NdbOperation::LM_Read; + CHKCON((m_resultset = m_scanop->readTuples(lm, scanbat, scanpar)) != 0, *this); return 0; } int -Con::openScanExclusive(unsigned parallelism) +Con::openScanExclusive(unsigned scanbat, unsigned scanpar) { assert(m_tx != 0 && m_op != 0); - CHKCON((m_resultset = m_scanop->readTuplesExclusive(parallelism)) != 0, *this); + NdbOperation::LockMode lm = NdbOperation::LM_Exclusive; + CHKCON((m_resultset = m_scanop->readTuples(lm, scanbat, scanpar)) != 0, *this); return 0; } @@ -880,11 +898,21 @@ Con::deleteScanTuple(Con& con2) } void +Con::closeScan() +{ + assert(m_resultset != 0); + m_resultset->close(); + m_scanop = 0, m_indexscanop = 0, m_resultset = 0; + +} + +void Con::closeTransaction() { assert(m_ndb != 0 && m_tx != 0); m_ndb->closeTransaction(m_tx); m_tx = 0, m_op = 0; + m_scanop = 0, m_indexscanop = 0, m_resultset = 0; } void @@ -893,27 +921,37 @@ Con::printerror(NdbOut& out) m_errtype = ErrOther; unsigned any = 0; int code; + int die = 0; if (m_ndb) { if ((code = m_ndb->getNdbError().code) != 0) { LL0(++any << " ndb: error " << m_ndb->getNdbError()); + die += (code == g_opt.m_die); } if (m_dic && (code = m_dic->getNdbError().code) != 0) { LL0(++any << " dic: error " << m_dic->getNdbError()); + die += (code == g_opt.m_die); } if (m_tx) { if ((code = m_tx->getNdbError().code) != 0) { LL0(++any << " con: error " << m_tx->getNdbError()); + die += (code == g_opt.m_die); if (code == 266 || code == 274 || code == 296 || code == 297 || code == 499) m_errtype = ErrDeadlock; } if (m_op && m_op->getNdbError().code != 0) { LL0(++any << " op : error " << m_op->getNdbError()); + die += (code == g_opt.m_die); } } } if (! any) { LL0("failed but no NDB error code"); } + if (die) { + if (g_opt.m_core) + abort(); + exit(1); + } } // dictionary operations @@ -1965,9 +2003,21 @@ BSet::calcpk(Par par, unsigned i) int BSet::setbnd(Par par) const { - for (unsigned j = 0; j < m_bvals; j++) { - const BVal& bval = *m_bval[j]; - CHK(bval.setbnd(par) == 0); + if (m_bvals != 0) { + unsigned p1 = urandom(m_bvals); + unsigned p2 = 10009; // prime + // random order + for (unsigned j = 0; j < m_bvals; j++) { + unsigned k = p1 + p2 * j; + const BVal& bval = *m_bval[k % m_bvals]; + CHK(bval.setbnd(par) == 0); + } + // duplicate + if (urandom(5) == 0) { + unsigned k = urandom(m_bvals); + const BVal& bval = *m_bval[k]; + CHK(bval.setbnd(par) == 0); + } } return 0; } @@ -2054,7 +2104,8 @@ pkinsert(Par par) CHK(con.startTransaction() == 0); Lst lst; for (unsigned j = 0; j < par.m_rows; j++) { - unsigned i = thrrow(par, j); + unsigned j2 = ! par.m_randomkey ? j : urandom(par.m_rows); + unsigned i = thrrow(par, j2); set.lock(); if (set.exist(i) || set.pending(i)) { set.unlock(); @@ -2107,7 +2158,8 @@ pkupdate(Par par) Lst lst; bool deadlock = false; for (unsigned j = 0; j < par.m_rows; j++) { - unsigned i = thrrow(par, j); + unsigned j2 = ! par.m_randomkey ? j : urandom(par.m_rows); + unsigned i = thrrow(par, j2); set.lock(); if (! set.exist(i) || set.pending(i)) { set.unlock(); @@ -2158,7 +2210,8 @@ pkdelete(Par par) Lst lst; bool deadlock = false; for (unsigned j = 0; j < par.m_rows; j++) { - unsigned i = thrrow(par, j); + unsigned j2 = ! par.m_randomkey ? j : urandom(par.m_rows); + unsigned i = thrrow(par, j2); set.lock(); if (! set.exist(i) || set.pending(i)) { set.unlock(); @@ -2268,7 +2321,7 @@ scanreadtable(Par par) Set set2(tab, set.m_rows); CHK(con.startTransaction() == 0); CHK(con.getNdbScanOperation(tab) == 0); - CHK(con.openScanRead(par.m_scanrd) == 0); + CHK(con.openScanRead(par.m_scanbat, par.m_scanpar) == 0); set2.getval(par); CHK(con.executeScan() == 0); while (1) { @@ -2296,7 +2349,7 @@ scanreadtablefast(Par par, unsigned countcheck) LL3("scanfast " << tab.m_name); CHK(con.startTransaction() == 0); CHK(con.getNdbScanOperation(tab) == 0); - CHK(con.openScanRead(par.m_scanrd) == 0); + CHK(con.openScanRead(par.m_scanbat, par.m_scanpar) == 0); // get 1st column NdbRecAttr* rec; CHK(con.getValue((Uint32)0, rec) == 0); @@ -2328,7 +2381,7 @@ scanreadindex(Par par, const ITab& itab, const BSet& bset) Set set2(tab, set.m_rows); CHK(con.startTransaction() == 0); CHK(con.getNdbScanOperation(itab, tab) == 0); - CHK(con.openScanRead(par.m_scanrd) == 0); + CHK(con.openScanRead(par.m_scanbat, par.m_scanpar) == 0); CHK(bset.setbnd(par) == 0); set2.getval(par); CHK(con.executeScan() == 0); @@ -2359,7 +2412,7 @@ scanreadindexfast(Par par, const ITab& itab, const BSet& bset, unsigned countche LL4(bset); CHK(con.startTransaction() == 0); CHK(con.getNdbScanOperation(itab, tab) == 0); - CHK(con.openScanRead(par.m_scanrd) == 0); + CHK(con.openScanRead(par.m_scanbat, par.m_scanpar) == 0); CHK(bset.setbnd(par) == 0); // get 1st column NdbRecAttr* rec; @@ -2382,7 +2435,7 @@ static int scanreadindex(Par par, const ITab& itab) { const Tab& tab = par.tab(); - for (unsigned i = 0; i < par.m_idxloop; i++) { + for (unsigned i = 0; i < par.m_subsubloop; i++) { BSet bset(tab, itab, par.m_rows); bset.calc(par); CHK(scanreadindex(par, itab, bset) == 0); @@ -2478,7 +2531,7 @@ scanupdatetable(Par par) Set set2(tab, set.m_rows); CHK(con.startTransaction() == 0); CHK(con.getNdbScanOperation(tab) == 0); - CHK(con.openScanExclusive(par.m_scanex) == 0); + CHK(con.openScanExclusive(par.m_scanbat, par.m_scanpar) == 0); set2.getval(par); CHK(con.executeScan() == 0); unsigned count = 0; @@ -2498,6 +2551,10 @@ scanupdatetable(Par par) LL1("scanupdatetable: stop on deadlock"); break; } + if (par.m_scanstop != 0 && urandom(par.m_scanstop) == 0) { + con.closeScan(); + break; + } do { unsigned i = (unsigned)-1; CHK(set2.getkey(par, &i) == 0); @@ -2557,7 +2614,7 @@ scanupdateindex(Par par, const ITab& itab, const BSet& bset) Set set2(tab, set.m_rows); CHK(con.startTransaction() == 0); CHK(con.getNdbScanOperation(itab, tab) == 0); - CHK(con.openScanExclusive(par.m_scanex) == 0); + CHK(con.openScanExclusive(par.m_scanbat, par.m_scanpar) == 0); CHK(bset.setbnd(par) == 0); set2.getval(par); CHK(con.executeScan() == 0); @@ -2578,6 +2635,10 @@ scanupdateindex(Par par, const ITab& itab, const BSet& bset) LL1("scanupdateindex: stop on deadlock"); break; } + if (par.m_scanstop != 0 && urandom(par.m_scanstop) == 0) { + con.closeScan(); + break; + } do { unsigned i = (unsigned)-1; CHK(set2.getkey(par, &i) == 0); @@ -2629,7 +2690,7 @@ static int scanupdateindex(Par par, const ITab& itab) { const Tab& tab = par.tab(); - for (unsigned i = 0; i < par.m_idxloop; i++) { + for (unsigned i = 0; i < par.m_subsubloop; i++) { BSet bset(tab, itab, par.m_rows); bset.calc(par); CHK(scanupdateindex(par, itab, bset) == 0); @@ -2663,6 +2724,8 @@ scanupdateall(Par par) static int readverify(Par par) { + if (par.m_noverify) + return 0; par.m_verify = true; CHK(pkread(par) == 0); CHK(scanreadall(par) == 0); @@ -2670,6 +2733,55 @@ readverify(Par par) } static int +readverifyfull(Par par) +{ + if (par.m_noverify) + return 0; + par.m_verify = true; + if (par.m_no == 0) + CHK(scanreadtable(par) == 0); + else { + const Tab& tab = par.tab(); + unsigned i = par.m_no; + if (i <= tab.m_itabs && useindex(i)) { + const ITab& itab = tab.m_itab[i - 1]; + BSet bset(tab, itab, par.m_rows); + CHK(scanreadindex(par, itab, bset) == 0); + } + } + return 0; +} + +static int +pkops(Par par) +{ + par.m_randomkey = true; + for (unsigned i = 0; i < par.m_subsubloop; i++) { + unsigned sel = urandom(10); + if (par.m_slno % 2 == 0) { + // favor insert + if (sel < 8) { + CHK(pkinsert(par) == 0); + } else if (sel < 9) { + CHK(pkupdate(par) == 0); + } else { + CHK(pkdelete(par) == 0); + } + } else { + // favor delete + if (sel < 1) { + CHK(pkinsert(par) == 0); + } else if (sel < 2) { + CHK(pkupdate(par) == 0); + } else { + CHK(pkdelete(par) == 0); + } + } + } + return 0; +} + +static int pkupdatescanread(Par par) { par.m_dups = true; @@ -2691,6 +2803,7 @@ mixedoperations(Par par) { par.m_dups = true; par.m_deadlock = true; + par.m_scanstop = par.m_totrows; // randomly close scans unsigned sel = urandom(10); if (sel < 2) { CHK(pkdelete(par) == 0); @@ -2710,6 +2823,7 @@ pkupdateindexbuild(Par par) if (par.m_no == 0) { CHK(createindex(par) == 0); } else { + par.m_randomkey = true; CHK(pkupdate(par) == 0); } return 0; @@ -2913,6 +3027,8 @@ runstep(Par par, const char* fname, TFunc func, unsigned mode) thr.m_par.m_tab = par.m_tab; thr.m_par.m_set = par.m_set; thr.m_par.m_tmr = par.m_tmr; + thr.m_par.m_lno = par.m_lno; + thr.m_par.m_slno = par.m_slno; thr.m_func = func; thr.start(); } @@ -2936,8 +3052,8 @@ tbuild(Par par) RUNSTEP(par, droptable, ST); RUNSTEP(par, createtable, ST); RUNSTEP(par, invalidatetable, MT); - for (unsigned i = 0; i < par.m_subloop; i++) { - if (i % 2 == 0) { + for (par.m_slno = 0; par.m_slno < par.m_subloop; par.m_slno++) { + if (par.m_slno % 2 == 0) { RUNSTEP(par, createindex, ST); RUNSTEP(par, invalidateindex, MT); RUNSTEP(par, pkinsert, MT); @@ -2946,9 +3062,10 @@ tbuild(Par par) RUNSTEP(par, createindex, ST); RUNSTEP(par, invalidateindex, MT); } - RUNSTEP(par, readverify, MT); + RUNSTEP(par, pkupdate, MT); + RUNSTEP(par, readverifyfull, MT); RUNSTEP(par, pkdelete, MT); - RUNSTEP(par, readverify, MT); + RUNSTEP(par, readverifyfull, MT); RUNSTEP(par, dropindex, ST); } return 0; @@ -2960,11 +3077,27 @@ tpkops(Par par) RUNSTEP(par, droptable, ST); RUNSTEP(par, createtable, ST); RUNSTEP(par, invalidatetable, MT); + RUNSTEP(par, createindex, ST); + RUNSTEP(par, invalidateindex, MT); + for (par.m_slno = 0; par.m_slno < par.m_subloop; par.m_slno++) { + RUNSTEP(par, pkops, MT); + LL2("rows=" << par.set().count()); + RUNSTEP(par, readverifyfull, MT); + } + return 0; +} + +static int +tpkopsread(Par par) +{ + RUNSTEP(par, droptable, ST); + RUNSTEP(par, createtable, ST); + RUNSTEP(par, invalidatetable, MT); RUNSTEP(par, pkinsert, MT); RUNSTEP(par, createindex, ST); RUNSTEP(par, invalidateindex, MT); RUNSTEP(par, readverify, ST); - for (unsigned i = 0; i < par.m_subloop; i++) { + for (par.m_slno = 0; par.m_slno < par.m_subloop; par.m_slno++) { RUNSTEP(par, pkupdatescanread, MT); RUNSTEP(par, readverify, ST); } @@ -2983,7 +3116,7 @@ tmixedops(Par par) RUNSTEP(par, createindex, ST); RUNSTEP(par, invalidateindex, MT); RUNSTEP(par, readverify, ST); - for (unsigned i = 0; i < par.m_subloop; i++) { + for (par.m_slno = 0; par.m_slno < par.m_subloop; par.m_slno++) { RUNSTEP(par, mixedoperations, MT); RUNSTEP(par, readverify, ST); } @@ -2997,7 +3130,7 @@ tbusybuild(Par par) RUNSTEP(par, createtable, ST); RUNSTEP(par, invalidatetable, MT); RUNSTEP(par, pkinsert, MT); - for (unsigned i = 0; i < par.m_subloop; i++) { + for (par.m_slno = 0; par.m_slno < par.m_subloop; par.m_slno++) { RUNSTEP(par, pkupdateindexbuild, MT); RUNSTEP(par, invalidateindex, MT); RUNSTEP(par, readverify, ST); @@ -3013,7 +3146,7 @@ ttimebuild(Par par) RUNSTEP(par, droptable, ST); RUNSTEP(par, createtable, ST); RUNSTEP(par, invalidatetable, MT); - for (unsigned i = 0; i < par.m_subloop; i++) { + for (par.m_slno = 0; par.m_slno < par.m_subloop; par.m_slno++) { RUNSTEP(par, pkinsert, MT); t1.on(); RUNSTEP(par, createindex, ST); @@ -3032,7 +3165,7 @@ ttimemaint(Par par) RUNSTEP(par, droptable, ST); RUNSTEP(par, createtable, ST); RUNSTEP(par, invalidatetable, MT); - for (unsigned i = 0; i < par.m_subloop; i++) { + for (par.m_slno = 0; par.m_slno < par.m_subloop; par.m_slno++) { RUNSTEP(par, pkinsert, MT); t1.on(); RUNSTEP(par, pkupdate, MT); @@ -3057,7 +3190,7 @@ ttimescan(Par par) RUNSTEP(par, droptable, ST); RUNSTEP(par, createtable, ST); RUNSTEP(par, invalidatetable, MT); - for (unsigned i = 0; i < par.m_subloop; i++) { + for (par.m_slno = 0; par.m_slno < par.m_subloop; par.m_slno++) { RUNSTEP(par, pkinsert, MT); RUNSTEP(par, createindex, ST); par.m_tmr = &t1; @@ -3079,7 +3212,7 @@ ttimepkread(Par par) RUNSTEP(par, droptable, ST); RUNSTEP(par, createtable, ST); RUNSTEP(par, invalidatetable, MT); - for (unsigned i = 0; i < par.m_subloop; i++) { + for (par.m_slno = 0; par.m_slno < par.m_subloop; par.m_slno++) { RUNSTEP(par, pkinsert, MT); RUNSTEP(par, createindex, ST); par.m_tmr = &t1; @@ -3115,9 +3248,10 @@ struct TCase { static const TCase tcaselist[] = { TCase("a", tbuild, "index build"), - TCase("b", tpkops, "pk operations and scan reads"), - TCase("c", tmixedops, "pk operations and scan operations"), - TCase("d", tbusybuild, "pk operations and index build"), + TCase("b", tpkops, "pk operations"), + TCase("c", tpkopsread, "pk operations and scan reads"), + TCase("d", tmixedops, "pk operations and scan operations"), + TCase("e", tbusybuild, "pk operations and index build"), TCase("t", ttimebuild, "time index build"), TCase("u", ttimemaint, "time index maintenance"), TCase("v", ttimescan, "time full scan table vs index on pk"), @@ -3175,10 +3309,10 @@ runtest(Par par) Thr& thr = *g_thrlist[n]; assert(thr.m_thread != 0); } - for (unsigned l = 0; par.m_loop == 0 || l < par.m_loop; l++) { - LL1("loop " << l); + for (par.m_lno = 0; par.m_loop == 0 || par.m_lno < par.m_loop; par.m_lno++) { + LL1("loop " << par.m_lno); if (par.m_seed == 0) - srandom(l); + srandom(par.m_lno); for (unsigned i = 0; i < tcasecount; i++) { const TCase& tcase = tcaselist[i]; if (par.m_case != 0 && strchr(par.m_case, tcase.m_name[0]) == 0) @@ -3252,6 +3386,12 @@ NDB_COMMAND(testOIBasic, "testOIBasic", "testOIBasic", "testOIBasic", 65535) continue; } } + if (strcmp(arg, "-die") == 0) { + if (++argv, --argc > 0) { + g_opt.m_die = atoi(argv[0]); + continue; + } + } if (strcmp(arg, "-dups") == 0) { g_opt.m_dups = true; continue; @@ -3292,6 +3432,10 @@ NDB_COMMAND(testOIBasic, "testOIBasic", "testOIBasic", "testOIBasic", 65535) g_opt.m_nologging = true; continue; } + if (strcmp(arg, "-noverify") == 0) { + g_opt.m_noverify = true; + continue; + } if (strcmp(arg, "-pctnull") == 0) { if (++argv, --argc > 0) { g_opt.m_pctnull = atoi(argv[0]); @@ -3310,15 +3454,15 @@ NDB_COMMAND(testOIBasic, "testOIBasic", "testOIBasic", "testOIBasic", 65535) continue; } } - if (strcmp(arg, "-scanrd") == 0) { + if (strcmp(arg, "-scanbat") == 0) { if (++argv, --argc > 0) { - g_opt.m_scanrd = atoi(argv[0]); + g_opt.m_scanbat = atoi(argv[0]); continue; } } - if (strcmp(arg, "-scanex") == 0) { + if (strcmp(arg, "-scanpar") == 0) { if (++argv, --argc > 0) { - g_opt.m_scanex = atoi(argv[0]); + g_opt.m_scanpar = atoi(argv[0]); continue; } } diff --git a/ndb/test/ndbapi/testOperations.cpp b/ndb/test/ndbapi/testOperations.cpp index ba41e1d1c40..f31906dd737 100644 --- a/ndb/test/ndbapi/testOperations.cpp +++ b/ndb/test/ndbapi/testOperations.cpp @@ -86,7 +86,7 @@ OperationTestCase matrix[] = { { "DeleteRead", true, "DELETE", 0, 0, "READ", 626, 0, 0, 0 }, { "DeleteReadEx", true, "DELETE", 0, 0, "READ-EX", 626, 0, 0, 0 }, { "DeleteSimpleRead", true, "DELETE", 0, 0, "S-READ", 626, 0, 0, 0 }, - { "DeleteDirtyRead", true, "DELETE", 0, 0, "D-READ", 626, 0, 0, 0 }, + { "DeleteDirtyRead", true, "DELETE", 0, 0, "D-READ", 626, 0, 626, 0 }, { "DeleteInsert", true, "DELETE", 0, 0, "INSERT", 0, 1, 0, 1 }, { "DeleteUpdate", true, "DELETE", 0, 0, "UPDATE", 626, 1, 0, 0 }, { "DeleteDelete", true, "DELETE", 0, 0, "DELETE", 626, 0, 0, 0 } @@ -110,13 +110,13 @@ runOp(HugoOperations & hugoOps, return NDBT_FAILED; }} if(strcmp(op, "READ") == 0){ - C2(hugoOps.pkReadRecord(pNdb, 1, false, 1), 0); + C2(hugoOps.pkReadRecord(pNdb, 1, 1, NdbOperation::LM_Read), 0); } else if(strcmp(op, "READ-EX") == 0){ - C2(hugoOps.pkReadRecord(pNdb, 1, true, 1), 0); + C2(hugoOps.pkReadRecord(pNdb, 1, 1, NdbOperation::LM_Exclusive), 0); } else if(strcmp(op, "S-READ") == 0){ - C2(hugoOps.pkSimpleReadRecord(pNdb, 1, 1), 0); + C2(hugoOps.pkReadRecord(pNdb, 1, 1, NdbOperation::LM_Read), 0); } else if(strcmp(op, "D-READ") == 0){ - C2(hugoOps.pkDirtyReadRecord(pNdb, 1, 1), 0); + C2(hugoOps.pkReadRecord(pNdb, 1, 1, NdbOperation::LM_CommittedRead), 0); } else if(strcmp(op, "INSERT") == 0){ C2(hugoOps.pkInsertRecord(pNdb, 1, 1, value), 0); } else if(strcmp(op, "UPDATE") == 0){ diff --git a/ndb/test/ndbapi/testReadPerf.cpp b/ndb/test/ndbapi/testReadPerf.cpp index 7cf3755d66f..8d0d78cbe8c 100644 --- a/ndb/test/ndbapi/testReadPerf.cpp +++ b/ndb/test/ndbapi/testReadPerf.cpp @@ -130,9 +130,9 @@ main(int argc, const char** argv){ for(int i = optind; i<argc; i++){ const char * T = argv[i]; g_info << "Testing " << T << endl; - snprintf(g_table, sizeof(g_table), T); - snprintf(g_ordered, sizeof(g_ordered), "IDX_O_%s", T); - snprintf(g_unique, sizeof(g_unique), "IDX_U_%s", T); + BaseString::snprintf(g_table, sizeof(g_table), T); + BaseString::snprintf(g_ordered, sizeof(g_ordered), "IDX_O_%s", T); + BaseString::snprintf(g_unique, sizeof(g_unique), "IDX_U_%s", T); if(create_table()) goto error; if(load_table()) diff --git a/ndb/test/ndbapi/testRestartGci.cpp b/ndb/test/ndbapi/testRestartGci.cpp index 4cdfca29e6f..e817245af55 100644 --- a/ndb/test/ndbapi/testRestartGci.cpp +++ b/ndb/test/ndbapi/testRestartGci.cpp @@ -63,7 +63,7 @@ int runInsertRememberGci(NDBT_Context* ctx, NDBT_Step* step){ result = NDBT_FAILED; break; } - CHECK(hugoOps.pkReadRecord(pNdb, i, false) == 0); + CHECK(hugoOps.pkReadRecord(pNdb, i) == 0); if (hugoOps.execute_Commit(pNdb) != 0){ ndbout << "Did not find record in DB " << i << endl; result = NDBT_FAILED; @@ -146,7 +146,7 @@ int runVerifyInserts(NDBT_Context* ctx, NDBT_Step* step){ // gci as in the vector for (unsigned i = 0; i < savedRecords.size(); i++){ CHECK(hugoOps.startTransaction(pNdb) == 0); - CHECK(hugoOps.pkReadRecord(pNdb, i, false) == 0); + CHECK(hugoOps.pkReadRecord(pNdb, i) == 0); if (hugoOps.execute_Commit(pNdb) != 0){ // Record was not found in db' diff --git a/ndb/test/ndbapi/testScanInterpreter.cpp b/ndb/test/ndbapi/testScanInterpreter.cpp index 3a5ef22b613..5a7ca30cd2a 100644 --- a/ndb/test/ndbapi/testScanInterpreter.cpp +++ b/ndb/test/ndbapi/testScanInterpreter.cpp @@ -90,7 +90,7 @@ int runCreateResultTable(NDBT_Context* ctx, NDBT_Step* step){ const NdbDictionary::Table* pTab = ctx->getTab(); char newTabName[256]; - snprintf(newTabName, 256, "%s_RES", pTab->getName()); + BaseString::snprintf(newTabName, 256, "%s_RES", pTab->getName()); ctx->setProperty("ResultTabName", newTabName); NdbDictionary::Table resTab(* pTab); diff --git a/ndb/test/ndbapi/testScanPerf.cpp b/ndb/test/ndbapi/testScanPerf.cpp index 8c1a41047ca..c1334125978 100644 --- a/ndb/test/ndbapi/testScanPerf.cpp +++ b/ndb/test/ndbapi/testScanPerf.cpp @@ -110,8 +110,8 @@ main(int argc, const char** argv){ for(int i = optind; i<argc; i++){ const char * T = argv[i]; g_info << "Testing " << T << endl; - snprintf(g_tablename, sizeof(g_tablename), T); - snprintf(g_indexname, sizeof(g_indexname), "IDX_%s", T); + BaseString::snprintf(g_tablename, sizeof(g_tablename), T); + BaseString::snprintf(g_indexname, sizeof(g_indexname), "IDX_%s", T); if(create_table()) goto error; if(load_table()) diff --git a/ndb/test/ndbapi/testTimeout.cpp b/ndb/test/ndbapi/testTimeout.cpp index 5cabb86541d..e310e12df81 100644 --- a/ndb/test/ndbapi/testTimeout.cpp +++ b/ndb/test/ndbapi/testTimeout.cpp @@ -108,7 +108,7 @@ int runTimeoutTrans(NDBT_Context* ctx, NDBT_Step* step){ do{ // Commit transaction CHECK(hugoOps.startTransaction(pNdb) == 0); - CHECK(hugoOps.pkReadRecord(pNdb, stepNo, true) == 0); + CHECK(hugoOps.pkReadRecord(pNdb, stepNo) == 0); CHECK(hugoOps.execute_NoCommit(pNdb) == 0); int sleep = minSleep + myRandom48(maxSleep-minSleep); @@ -162,25 +162,25 @@ int runTimeoutTrans2(NDBT_Context* ctx, NDBT_Step* step){ case 0: break; case 1: - if(hugoOps.pkReadRecord(pNdb, stepNo, true) != 0){ + if(hugoOps.pkReadRecord(pNdb, stepNo) != 0){ g_err << stepNo << ": Fail" << __LINE__ << endl; result = NDBT_FAILED; break; } break; case 2: - if(hugoOps.pkUpdateRecord(pNdb, stepNo, true) != 0){ + if(hugoOps.pkUpdateRecord(pNdb, stepNo) != 0){ g_err << stepNo << ": Fail" << __LINE__ << endl; result = NDBT_FAILED; break; } break; case 3: - if(hugoOps.pkDeleteRecord(pNdb, stepNo, true) != 0){ + if(hugoOps.pkDeleteRecord(pNdb, stepNo) != 0){ g_err << stepNo << ": Fail" << __LINE__ << endl; result = NDBT_FAILED; break; } break; case 4: - if(hugoOps.pkInsertRecord(pNdb, stepNo+records+l, true) != 0){ + if(hugoOps.pkInsertRecord(pNdb, stepNo+records+l) != 0){ g_err << stepNo << ": Fail" << __LINE__ << endl; result = NDBT_FAILED; break; } @@ -204,25 +204,25 @@ int runTimeoutTrans2(NDBT_Context* ctx, NDBT_Step* step){ case 0: break; case 1: - if(hugoOps.pkReadRecord(pNdb, stepNo, true) != 0){ + if(hugoOps.pkReadRecord(pNdb, stepNo) != 0){ g_err << stepNo << ": Fail" << __LINE__ << endl; result = NDBT_FAILED; break; } break; case 2: - if(hugoOps.pkUpdateRecord(pNdb, stepNo, true) != 0){ + if(hugoOps.pkUpdateRecord(pNdb, stepNo) != 0){ g_err << stepNo << ": Fail" << __LINE__ << endl; result = NDBT_FAILED; break; } break; case 3: - if(hugoOps.pkDeleteRecord(pNdb, stepNo, true) != 0){ + if(hugoOps.pkDeleteRecord(pNdb, stepNo) != 0){ g_err << stepNo << ": Fail" << __LINE__ << endl; result = NDBT_FAILED; break; } break; case 4: - if(hugoOps.pkInsertRecord(pNdb, stepNo+2*records+l, true) != 0){ + if(hugoOps.pkInsertRecord(pNdb, stepNo+2*records+l) != 0){ g_err << stepNo << ": Fail" << __LINE__ << endl; result = NDBT_FAILED; break; } @@ -263,7 +263,7 @@ int runDontTimeoutTrans(NDBT_Context* ctx, NDBT_Step* step){ do{ // Commit transaction CHECK(hugoOps.startTransaction(pNdb) == 0); - CHECK(hugoOps.pkReadRecord(pNdb, stepNo, true) == 0); + CHECK(hugoOps.pkReadRecord(pNdb, stepNo) == 0); CHECK(hugoOps.execute_NoCommit(pNdb) == 0); int sleep = myRandom48(maxSleep); @@ -299,7 +299,7 @@ int runBuddyTransNoTimeout(NDBT_Context* ctx, NDBT_Step* step){ // Start an insert trans CHECK(hugoOps.startTransaction(pNdb) == 0); int recordNo = records + (stepNo*loops) + l; - CHECK(hugoOps.pkInsertRecord(pNdb, recordNo, true) == 0); + CHECK(hugoOps.pkInsertRecord(pNdb, recordNo) == 0); CHECK(hugoOps.execute_NoCommit(pNdb) == 0); for (int i = 0; i < 3; i++){ diff --git a/ndb/test/ndbapi/testTransactions.cpp b/ndb/test/ndbapi/testTransactions.cpp index 2dca9e24fb4..46be808d8a5 100644 --- a/ndb/test/ndbapi/testTransactions.cpp +++ b/ndb/test/ndbapi/testTransactions.cpp @@ -190,13 +190,13 @@ runOp(HugoOperations & hugoOps, return NDBT_FAILED; } if(strcmp(op, "READ") == 0){ - C2(hugoOps.pkReadRecord(pNdb, 1, false, 1) == 0); + C2(hugoOps.pkReadRecord(pNdb, 1, 1, NdbOperation::LM_Read) == 0); } else if(strcmp(op, "READ-EX") == 0){ - C2(hugoOps.pkReadRecord(pNdb, 1, true, 1) == 0); + C2(hugoOps.pkReadRecord(pNdb, 1, 1, NdbOperation::LM_Exclusive) == 0); } else if(strcmp(op, "S-READ") == 0){ - C2(hugoOps.pkSimpleReadRecord(pNdb, 1, 1) == 0); + C2(hugoOps.pkReadRecord(pNdb, 1, 1, NdbOperation::LM_Read) == 0); } else if(strcmp(op, "D-READ") == 0){ - C2(hugoOps.pkDirtyReadRecord(pNdb, 1, 1) == 0); + C2(hugoOps.pkReadRecord(pNdb, 1, 1, NdbOperation::LM_CommittedRead) == 0); } else if(strcmp(op, "INSERT") == 0){ C2(hugoOps.pkInsertRecord(pNdb, 1, 1, value) == 0); } else if(strcmp(op, "UPDATE") == 0){ diff --git a/ndb/test/ndbapi/userInterface.cpp b/ndb/test/ndbapi/userInterface.cpp index fdbc229cc98..2f77c0f4857 100644 --- a/ndb/test/ndbapi/userInterface.cpp +++ b/ndb/test/ndbapi/userInterface.cpp @@ -103,7 +103,7 @@ void showTime() now = ::time((time_t*)NULL); tm_now = ::gmtime(&now); - ::snprintf(buf, 128, + BaseString::snprintf(buf, 128, "%d-%.2d-%.2d %.2d:%.2d:%.2d", tm_now->tm_year + 1900, tm_now->tm_mon, |