summaryrefslogtreecommitdiff
path: root/ndb/test
diff options
context:
space:
mode:
authorunknown <joreland@mysql.com>2004-11-29 09:00:39 +0100
committerunknown <joreland@mysql.com>2004-11-29 09:00:39 +0100
commitd212891f6f0c0de275190f52672f3346979e07c0 (patch)
treeaee2e495889130d76c89111a62e30a751848b674 /ndb/test
parent8d1171742ce6196875b45f1b9c1462c72101f902 (diff)
downloadmariadb-git-d212891f6f0c0de275190f52672f3346979e07c0.tar.gz
ndb - scan bug fix + more test cases
ndb/include/ndbapi/NdbScanOperation.hpp: Improved doc. a bit ndb/src/ndbapi/NdbConnectionScan.cpp: Set error code ndb/src/ndbapi/NdbScanOperation.cpp: Check error directly after taking mutex ndb/test/ndbapi/testScan.cpp: new scan test with lots of threads ndb/test/run-test/daily-basic-tests.txt: Added two more scan tests Collapsed testTransactions & testOperations
Diffstat (limited to 'ndb/test')
-rw-r--r--ndb/test/ndbapi/testScan.cpp130
-rw-r--r--ndb/test/run-test/daily-basic-tests.txt496
2 files changed, 136 insertions, 490 deletions
diff --git a/ndb/test/ndbapi/testScan.cpp b/ndb/test/ndbapi/testScan.cpp
index 51913e8fbf9..22ec3fff327 100644
--- a/ndb/test/ndbapi/testScan.cpp
+++ b/ndb/test/ndbapi/testScan.cpp
@@ -90,11 +90,59 @@ int runLoadAllTables(NDBT_Context* ctx, NDBT_Step* step){
return NDBT_OK;
}
+char orderedPkIdxName[255];
+
+int createOrderedPkIndex(NDBT_Context* ctx, NDBT_Step* step){
+
+ const NdbDictionary::Table* pTab = ctx->getTab();
+ Ndb* pNdb = GETNDB(step);
+
+ // Create index
+ BaseString::snprintf(orderedPkIdxName, sizeof(orderedPkIdxName),
+ "IDC_O_PK_%s", pTab->getName());
+ NdbDictionary::Index pIdx(orderedPkIdxName);
+ pIdx.setTable(pTab->getName());
+ pIdx.setType(NdbDictionary::Index::OrderedIndex);
+ pIdx.setLogging(false);
+
+ for (int c = 0; c< pTab->getNoOfColumns(); c++){
+ const NdbDictionary::Column * col = pTab->getColumn(c);
+ if(col->getPrimaryKey()){
+ pIdx.addIndexColumn(col->getName());
+ }
+ }
+
+ if (pNdb->getDictionary()->createIndex(pIdx) != 0){
+ ndbout << "FAILED! to create index" << endl;
+ const NdbError err = pNdb->getDictionary()->getNdbError();
+ ERR(err);
+ return NDBT_FAILED;
+ }
+
+ return NDBT_OK;
+}
+
+int createOrderedPkIndex_Drop(NDBT_Context* ctx, NDBT_Step* step){
+ const NdbDictionary::Table* pTab = ctx->getTab();
+ Ndb* pNdb = GETNDB(step);
+
+ // Drop index
+ if (pNdb->getDictionary()->dropIndex(orderedPkIdxName,
+ pTab->getName()) != 0){
+ ndbout << "FAILED! to drop index" << endl;
+ ERR(pNdb->getDictionary()->getNdbError());
+ return NDBT_FAILED;
+ }
+
+ return NDBT_OK;
+}
+
+
int runScanReadRandomTable(NDBT_Context* ctx, NDBT_Step* step){
int loops = ctx->getNumLoops();
int records = ctx->getNumRecords();
int parallelism = ctx->getProperty("Parallelism", 240);
- int abort = ctx->getProperty("AbortProb");
+ int abort = ctx->getProperty("AbortProb", 5);
int i = 0;
while (i<loops) {
@@ -218,7 +266,7 @@ int runScanRead(NDBT_Context* ctx, NDBT_Step* step){
int loops = ctx->getNumLoops();
int records = ctx->getNumRecords();
int parallelism = ctx->getProperty("Parallelism", 240);
- int abort = ctx->getProperty("AbortProb");
+ int abort = ctx->getProperty("AbortProb", 5);
int i = 0;
HugoTransactions hugoTrans(*ctx->getTab());
@@ -232,11 +280,58 @@ int runScanRead(NDBT_Context* ctx, NDBT_Step* step){
return NDBT_OK;
}
+int runRandScanRead(NDBT_Context* ctx, NDBT_Step* step){
+ int loops = ctx->getNumLoops();
+ int records = ctx->getNumRecords();
+ int parallelism = ctx->getProperty("Parallelism", 240);
+ int abort = ctx->getProperty("AbortProb", 5);
+
+ int i = 0;
+ HugoTransactions hugoTrans(*ctx->getTab());
+ while (i<loops && !ctx->isTestStopped()) {
+ g_info << i << ": ";
+ NdbOperation::LockMode lm = (NdbOperation::LockMode)(rand() % 3);
+ if (hugoTrans.scanReadRecords(GETNDB(step),
+ records, abort, parallelism,
+ lm) != 0){
+ return NDBT_FAILED;
+ }
+ i++;
+ }
+ return NDBT_OK;
+}
+
+int runScanReadIndex(NDBT_Context* ctx, NDBT_Step* step){
+ int loops = ctx->getNumLoops();
+ int records = ctx->getNumRecords();
+ int parallelism = ctx->getProperty("Parallelism", 240);
+ int abort = ctx->getProperty("AbortProb", 5);
+ const NdbDictionary::Index * pIdx =
+ GETNDB(step)->getDictionary()->getIndex(orderedPkIdxName,
+ ctx->getTab()->getName());
+
+ int i = 0;
+ HugoTransactions hugoTrans(*ctx->getTab());
+ while (pIdx && i<loops && !ctx->isTestStopped()) {
+ g_info << i << ": ";
+ bool sort = (rand() % 100) > 50 ? true : false;
+ NdbOperation::LockMode lm = (NdbOperation::LockMode)(rand() % 3);
+ if (hugoTrans.scanReadRecords(GETNDB(step), pIdx,
+ records, abort, parallelism,
+ lm,
+ sort) != 0){
+ return NDBT_FAILED;
+ }
+ i++;
+ }
+ return NDBT_OK;
+}
+
int runScanReadCommitted(NDBT_Context* ctx, NDBT_Step* step){
int loops = ctx->getNumLoops();
int records = ctx->getNumRecords();
int parallelism = ctx->getProperty("Parallelism", 240);
- int abort = ctx->getProperty("AbortProb");
+ int abort = ctx->getProperty("AbortProb", 5);
int i = 0;
HugoTransactions hugoTrans(*ctx->getTab());
@@ -425,7 +520,7 @@ int runScanUpdate(NDBT_Context* ctx, NDBT_Step* step){
int loops = ctx->getNumLoops();
int records = ctx->getNumRecords();
int parallelism = ctx->getProperty("Parallelism", 1);
- int abort = ctx->getProperty("AbortProb");
+ int abort = ctx->getProperty("AbortProb", 5);
int i = 0;
HugoTransactions hugoTrans(*ctx->getTab());
while (i<loops) {
@@ -465,7 +560,7 @@ int runScanUpdate2(NDBT_Context* ctx, NDBT_Step* step){
int loops = ctx->getNumLoops();
int records = ctx->getNumRecords();
int parallelism = ctx->getProperty("Parallelism", 240);
- int abort = ctx->getProperty("AbortProb");
+ int abort = ctx->getProperty("AbortProb", 5);
int i = 0;
HugoTransactions hugoTrans(*ctx->getTab());
while (i<loops) {
@@ -1080,7 +1175,30 @@ TESTCASE("ScanRead488",
"When this limit is exceeded the scan will be aborted with errorcode "\
"488."){
INITIALIZER(runLoadTable);
- STEPS(runScanRead, 70);
+ STEPS(runRandScanRead, 70);
+ FINALIZER(runClearTable);
+}
+TESTCASE("ScanRead488O",
+ "Verify scan requirement: It's only possible to have 11 concurrent "\
+ "scans per fragment running in Ndb kernel at the same time. "\
+ "When this limit is exceeded the scan will be aborted with errorcode "\
+ "488."){
+ INITIALIZER(createOrderedPkIndex);
+ INITIALIZER(runLoadTable);
+ STEPS(runScanReadIndex, 70);
+ FINALIZER(createOrderedPkIndex_Drop);
+ FINALIZER(runClearTable);
+}
+TESTCASE("ScanRead488_Mixed",
+ "Verify scan requirement: It's only possible to have 11 concurrent "\
+ "scans per fragment running in Ndb kernel at the same time. "\
+ "When this limit is exceeded the scan will be aborted with errorcode "\
+ "488."){
+ INITIALIZER(createOrderedPkIndex);
+ INITIALIZER(runLoadTable);
+ STEPS(runRandScanRead, 50);
+ STEPS(runScanReadIndex, 50);
+ FINALIZER(createOrderedPkIndex_Drop);
FINALIZER(runClearTable);
}
TESTCASE("ScanRead488Timeout",
diff --git a/ndb/test/run-test/daily-basic-tests.txt b/ndb/test/run-test/daily-basic-tests.txt
index aa38fb4763c..8a927b88194 100644
--- a/ndb/test/run-test/daily-basic-tests.txt
+++ b/ndb/test/run-test/daily-basic-tests.txt
@@ -224,6 +224,14 @@ args: -n ScanRead488 -l 10 T6
max-time: 500
cmd: testScan
+args: -n ScanRead488O -l 10 T6
+
+max-time: 1000
+cmd: testScan
+args: -n ScanRead488_Mixed -l 10 T6
+
+max-time: 500
+cmd: testScan
args: -n ScanRead488Timeout -l 10 T6
max-time: 600
@@ -478,493 +486,13 @@ args: -n UpdateWithoutValues T6
#cmd: testInterpreter
#args: T1
#
-max-time: 1500
-cmd: testOperations
-args: -n ReadRead
-
-max-time: 1500
-cmd: testOperations
-args: -n ReadReadEx
-
-max-time: 1500
-cmd: testOperations
-args: -n ReadInsert
-
-max-time: 1500
-cmd: testOperations
-args: -n ReadUpdate
-
-max-time: 1500
-cmd: testOperations
-args: -n ReadDelete
-
-max-time: 1500
-cmd: testOperations
-args: -n FReadRead
-
-max-time: 1500
-cmd: testOperations
-args: -n FReadReadEx
-
-max-time: 1500
-cmd: testOperations
-args: -n FReadInsert
-
-max-time: 1500
-cmd: testOperations
-args: -n FReadUpdate
-
-max-time: 1500
-cmd: testOperations
-args: -n FReadDelete
-
-max-time: 1500
-cmd: testOperations
-args: -n ReadExRead
-
-max-time: 1500
-cmd: testOperations
-args: -n ReadExReadEx
-
-max-time: 1500
-cmd: testOperations
-args: -n ReadExInsert
-
-max-time: 1500
-cmd: testOperations
-args: -n ReadExUpdate
-
-max-time: 1500
-cmd: testOperations
-args: -n ReadExDelete
-
-max-time: 1500
-cmd: testOperations
-args: -n InsertRead
-
-max-time: 1500
-cmd: testOperations
-args: -n InsertReadEx
-
-max-time: 1500
-cmd: testOperations
-args: -n InsertInsert
-
-max-time: 1500
-cmd: testOperations
-args: -n InsertUpdate
-
-max-time: 1500
-cmd: testOperations
-args: -n InsertDelete
-
-max-time: 1500
-cmd: testOperations
-args: -n UpdateRead
-
-max-time: 1500
-cmd: testOperations
-args: -n UpdateReadEx
-
-max-time: 1500
-cmd: testOperations
-args: -n UpdateInsert
-
-max-time: 1500
-cmd: testOperations
-args: -n UpdateUpdate
-
-max-time: 1500
-cmd: testOperations
-args: -n UpdateDelete
-
-max-time: 1500
-cmd: testOperations
-args: -n DeleteRead
-
-max-time: 1500
-cmd: testOperations
-args: -n DeleteReadEx
-
-max-time: 1500
-cmd: testOperations
-args: -n DeleteInsert
-
-max-time: 1500
-cmd: testOperations
-args: -n DeleteUpdate
-
-max-time: 1500
+max-time: 150000
cmd: testOperations
-args: -n DeleteDelete
-
-max-time: 1500
-cmd: testOperations
-args: -n ReadSimpleRead
-
-max-time: 1500
-cmd: testOperations
-args: -n ReadDirtyRead
-
-max-time: 1500
-cmd: testOperations
-args: -n FReadSimpleRead
-
-max-time: 1500
-cmd: testOperations
-args: -n FReadDirtyRead
-
-max-time: 1500
-cmd: testOperations
-args: -n ReadExSimpleRead
-
-max-time: 1500
-cmd: testOperations
-args: -n ReadExDirtyRead
-
-max-time: 1500
-cmd: testOperations
-args: -n InsertSimpleRead
-
-max-time: 1500
-cmd: testOperations
-args: -n InsertDirtyRead
-
-max-time: 1500
-cmd: testOperations
-args: -n UpdateSimpleRead
-
-max-time: 1500
-cmd: testOperations
-args: -n UpdateDirtyRead
-
-max-time: 1500
-cmd: testOperations
-args: -n DeleteSimpleRead
-
-max-time: 1500
-cmd: testOperations
-args: -n DeleteDirtyRead
-
-max-time: 1500
-cmd: testTransactions
-args: -n ReadRead
-
-max-time: 1500
-cmd: testTransactions
-args: -n ReadReadEx
-
-max-time: 1500
-cmd: testTransactions
-args: -n ReadInsert
-
-max-time: 1500
-cmd: testTransactions
-args: -n ReadUpdate
-
-max-time: 1500
-cmd: testTransactions
-args: -n ReadDelete
-
-max-time: 1500
-cmd: testTransactions
-args: -n ReadExRead
-
-max-time: 1500
-cmd: testTransactions
-args: -n ReadExReadEx
-
-max-time: 1500
-cmd: testTransactions
-args: -n ReadExInsert
-
-max-time: 1500
-cmd: testTransactions
-args: -n ReadExUpdate
-
-max-time: 1500
-cmd: testTransactions
-args: -n ReadExDelete
-
-max-time: 1500
-cmd: testTransactions
-args: -n InsertRead
-
-max-time: 1500
-cmd: testTransactions
-args: -n InsertReadEx
-
-max-time: 1500
-cmd: testTransactions
-args: -n InsertInsert
-
-max-time: 1500
-cmd: testTransactions
-args: -n InsertUpdate
-
-max-time: 1500
-cmd: testTransactions
-args: -n InsertDelete
-
-max-time: 1500
-cmd: testTransactions
-args: -n UpdateRead
-
-max-time: 1500
-cmd: testTransactions
-args: -n UpdateReadEx
-
-max-time: 1500
-cmd: testTransactions
-args: -n UpdateInsert
-
-max-time: 1500
-cmd: testTransactions
-args: -n UpdateUpdate
-
-max-time: 1500
-cmd: testTransactions
-args: -n UpdateDelete
-
-max-time: 1500
-cmd: testTransactions
-args: -n DeleteRead
-
-max-time: 1500
-cmd: testTransactions
-args: -n DeleteReadEx
-
-max-time: 1500
-cmd: testTransactions
-args: -n DeleteInsert
-
-max-time: 1500
-cmd: testTransactions
-args: -n DeleteUpdate
-
-max-time: 1500
-cmd: testTransactions
-args: -n DeleteDelete
-
-max-time: 1500
-cmd: testTransactions
-args: -n ReadSimpleRead
-
-max-time: 1500
-cmd: testTransactions
-args: -n ReadDirtyRead
-
-max-time: 1500
-cmd: testTransactions
-args: -n ReadExSimpleRead
-
-max-time: 1500
-cmd: testTransactions
-args: -n ReadExDirtyRead
-
-max-time: 1500
-cmd: testTransactions
-args: -n InsertSimpleRead
-
-max-time: 1500
-cmd: testTransactions
-args: -n InsertDirtyRead
-
-max-time: 1500
-cmd: testTransactions
-args: -n UpdateSimpleRead
-
-max-time: 1500
-cmd: testTransactions
-args: -n UpdateDirtyRead
-
-max-time: 1500
-cmd: testTransactions
-args: -n DeleteSimpleRead
-
-max-time: 1500
-cmd: testTransactions
-args: -n DeleteDirtyRead
-
-max-time: 1500
-cmd: testTransactions
-args: -n ReadScan
-
-max-time: 1500
-cmd: testTransactions
-args: -n ReadScanHl
-
-max-time: 1500
-cmd: testTransactions
-args: -n ReadScanEx
-
-max-time: 1500
-cmd: testTransactions
-args: -n ScanRead
-
-max-time: 1500
-cmd: testTransactions
-args: -n ScanReadEx
-
-max-time: 1500
-cmd: testTransactions
-args: -n ScanSimpleRead
-
-max-time: 1500
-cmd: testTransactions
-args: -n ScanDirtyRead
-
-max-time: 1500
-cmd: testTransactions
-args: -n ScanInsert
-
-max-time: 1500
-cmd: testTransactions
-args: -n ScanUpdate
-
-max-time: 1500
-cmd: testTransactions
-args: -n ScanDelete
-
-max-time: 1500
-cmd: testTransactions
-args: -n ScanScan
-
-max-time: 1500
-cmd: testTransactions
-args: -n ScanScanHl
-
-max-time: 1500
-cmd: testTransactions
-args: -n ScanScanEx
-
-max-time: 1500
-cmd: testTransactions
-args: -n ScanHlRead
-
-max-time: 1500
-cmd: testTransactions
-args: -n ScanHlReadEx
-
-max-time: 1500
-cmd: testTransactions
-args: -n ScanHlSimpleRead
-
-max-time: 1500
-cmd: testTransactions
-args: -n ScanHlDirtyRead
-
-max-time: 1500
-cmd: testTransactions
-args: -n ScanHlInsert
-
-max-time: 1500
-cmd: testTransactions
-args: -n ScanHlUpdate
-
-max-time: 1500
-cmd: testTransactions
-args: -n ScanHlDelete
-
-max-time: 1500
-cmd: testTransactions
-args: -n ScanHlScan
-
-max-time: 1500
-cmd: testTransactions
-args: -n ScanHlScanHl
-
-max-time: 1500
-cmd: testTransactions
-args: -n ScanHlScanEx
-
-max-time: 1500
-cmd: testTransactions
-args: -n ScanExRead
-
-max-time: 1500
-cmd: testTransactions
-args: -n ScanExReadEx
-
-max-time: 1500
-cmd: testTransactions
-args: -n ScanExSimpleRead
-
-max-time: 1500
-cmd: testTransactions
-args: -n ScanExDirtyRead
-
-max-time: 1500
-cmd: testTransactions
-args: -n ScanExInsert
-
-max-time: 1500
-cmd: testTransactions
-args: -n ScanExUpdate
-
-max-time: 1500
-cmd: testTransactions
-args: -n ScanExDelete
-
-max-time: 1500
-cmd: testTransactions
-args: -n ScanExScan
-
-max-time: 1500
-cmd: testTransactions
-args: -n ScanExScanHl
-
-max-time: 1500
-cmd: testTransactions
-args: -n ScanExScanEx
-
-max-time: 1500
-cmd: testTransactions
-args: -n ReadExScan
-
-max-time: 1500
-cmd: testTransactions
-args: -n ReadExScanHl
-
-max-time: 1500
-cmd: testTransactions
-args: -n ReadExScanEx
-
-max-time: 1500
-cmd: testTransactions
-args: -n InsertScan
-
-max-time: 1500
-cmd: testTransactions
-args: -n InsertScanHl
-
-max-time: 1500
-cmd: testTransactions
-args: -n InsertScanEx
-
-max-time: 1500
-cmd: testTransactions
-args: -n UpdateScan
-
-max-time: 1500
-cmd: testTransactions
-args: -n UpdateScanHl
-
-max-time: 1500
-cmd: testTransactions
-args: -n UpdateScanEx
-
-max-time: 1500
-cmd: testTransactions
-args: -n DeleteScan
-
-max-time: 1500
-cmd: testTransactions
-args: -n DeleteScanHl
+args:
-max-time: 1500
+max-time: 150000
cmd: testTransactions
-args: -n DeleteScanEx
+args:
max-time: 1500
cmd: testRestartGci