18 #include <NDBT_Test.hpp>
19 #include <NdbRestarter.hpp>
21 #define CHECKNOTNULL(p) if ((p) == NULL) { \
22 ndbout << "Error at line " << __LINE__ << endl; \
23 ERR(trans->getNdbError()); \
27 #define CHECKEQUAL(v, e) if ((e) != (v)) { \
28 ndbout << "Error at line " << __LINE__ << \
29 " expected " << v << endl; \
30 ERR(trans->getNdbError()); \
38 Uint32 setLongVarchar(
char* where,
const char* what, Uint32 sz)
41 where[1]=(sz >> 8) & 0xff;
42 memcpy(&where[2], what, sz);
63 if (restarter->insertErrorInAllNodes(val) != 0){
64 g_err <<
"error insert 1 (" << val <<
") failed" << endl;
67 if (restarter->insertErrorInAllNodes(val) != 0){
68 g_err <<
"error insert 2 (" << val <<
") failed" << endl;
78 CHECKEQUAL(0, insert->
equal((Uint32) 0,
79 NdbDictionary::getValuePtr
84 NdbDictionary::getValuePtr
114 if (strcmp(ctx->getTab()->
getName(),
"WIDE_2COL") != 0)
117 const Uint32 maxRowBytes= NDB_MAX_TUPLE_SIZE_IN_WORDS *
sizeof(Uint32);
118 const Uint32 srcBuffBytes= NDBT_Tables::MaxVarTypeKeyBytes;
119 const Uint32 maxAttrBytes= NDBT_Tables::MaxKeyMaxVarTypeAttrBytes;
121 char srcBuff[srcBuffBytes];
122 char smallRowBuf[maxRowBytes];
123 char bigKeyRowBuf[maxRowBytes];
124 char bigAttrRowBuf[maxRowBytes];
127 Uint32 smallKeySize= setLongVarchar(&smallKey[0],
132 memset(srcBuff,
'B', srcBuffBytes);
139 setLongVarchar(NdbDictionary::getValuePtr(record,
144 NdbDictionary::setNull(record, smallRowBuf, 0,
false);
146 setLongVarchar(NdbDictionary::getValuePtr(record,
151 NdbDictionary::setNull(record, smallRowBuf, 1,
false);
154 setLongVarchar(NdbDictionary::getValuePtr(record,
159 NdbDictionary::setNull(record, bigKeyRowBuf, 0,
false);
161 setLongVarchar(NdbDictionary::getValuePtr(record,
166 NdbDictionary::setNull(record, bigKeyRowBuf, 1,
false);
169 setLongVarchar(NdbDictionary::getValuePtr(record,
174 NdbDictionary::setNull(record, bigAttrRowBuf, 0,
false);
176 setLongVarchar(NdbDictionary::getValuePtr(record,
181 NdbDictionary::setNull(record, bigAttrRowBuf, 1,
false);
184 Ndb* pNdb= GETNDB(step);
195 CHECKEQUAL(NDBT_OK, activateErrorInsert(trans,
206 const NdbOperation* bigInsert = trans->insertTuple(record, bigKeyRowBuf);
208 CHECKNOTNULL(bigInsert);
229 CHECKNOTNULL(bigInsert = trans->insertTuple(record, bigAttrRowBuf));
247 CHECKNOTNULL(bigInsert = trans->insertTuple(record, bigAttrRowBuf));
251 CHECKNOTNULL(secondOp = trans->insertTuple(record, bigAttrRowBuf));
273 CHECKEQUAL(0, bigInsertOldApi->
equal((Uint32)0,
274 NdbDictionary::getValuePtr
278 CHECKEQUAL(0, bigInsertOldApi->
setValue(1,
279 NdbDictionary::getValuePtr
301 CHECKEQUAL(0, bigInsertOldApi->
equal((Uint32)0,
302 NdbDictionary::getValuePtr
306 CHECKEQUAL(0, bigInsertOldApi->
setValue(1,
307 NdbDictionary::getValuePtr
333 restarter.insertErrorInAllNodes(8066);
347 CHECKEQUAL(0, bigInsertOldApi->
equal((Uint32)0,
348 NdbDictionary::getValuePtr
352 CHECKEQUAL(0, bigInsertOldApi->
setValue(1, NdbDictionary::getValuePtr
368 restarter.insertErrorInAllNodes(8067);
378 CHECKEQUAL(0, bigInsertOldApi->
equal((Uint32)0,
379 NdbDictionary::getValuePtr
383 CHECKEQUAL(0, bigInsertOldApi->
setValue(1,
384 NdbDictionary::getValuePtr
404 CHECKEQUAL(NDBT_OK, activateErrorInsert(trans,
439 if (strcmp(ctx->getTab()->
getName(),
"WIDE_2COL_IX") != 0)
442 const char* indexName=
"WIDE_2COL_IX$NDBT_IDX0";
443 const Uint32 maxRowBytes= NDB_MAX_TUPLE_SIZE_IN_WORDS *
sizeof(Uint32);
444 const Uint32 srcBuffBytes= NDBT_Tables::MaxVarTypeKeyBytes;
445 const Uint32 maxIndexKeyBytes= NDBT_Tables::MaxKeyMaxVarTypeAttrBytesIndex;
453 const Uint32 mediumPrimaryKeyBytes= (6* 60 * 4) - 2;
455 char srcBuff[srcBuffBytes];
456 char smallRowBuf[maxRowBytes];
457 char bigKeyIxBuf[maxRowBytes];
458 char bigAttrIxBuf[maxRowBytes];
459 char bigKeyRowBuf[maxRowBytes];
460 char resultSpace[maxRowBytes];
463 Uint32 smallKeySize= setLongVarchar(&smallKey[0],
468 memset(srcBuff,
'B', srcBuffBytes);
470 Ndb* pNdb= GETNDB(step);
474 getDictionary()->getIndex(indexName,
475 ctx->getTab()->
getName())->getDefaultRecord();
480 setLongVarchar(NdbDictionary::getValuePtr(baseRecord,
485 NdbDictionary::setNull(baseRecord, smallRowBuf, 0,
false);
487 setLongVarchar(NdbDictionary::getValuePtr(baseRecord,
492 NdbDictionary::setNull(baseRecord, smallRowBuf, 1,
false);
500 setLongVarchar(NdbDictionary::getValuePtr(ixRecord,
505 NdbDictionary::setNull(ixRecord, bigKeyIxBuf, 1,
false);
509 setLongVarchar(NdbDictionary::getValuePtr(baseRecord,
515 NdbDictionary::setNull(baseRecord, bigAttrIxBuf, 0,
false);
517 setLongVarchar(NdbDictionary::getValuePtr(baseRecord,
522 NdbDictionary::setNull(baseRecord, bigAttrIxBuf, 1,
false);
528 setLongVarchar(NdbDictionary::getValuePtr(baseRecord,
532 mediumPrimaryKeyBytes);
534 NdbDictionary::setNull(baseRecord, bigKeyRowBuf, 0,
false);
536 setLongVarchar(NdbDictionary::getValuePtr(baseRecord,
541 NdbDictionary::setNull(baseRecord, bigKeyRowBuf, 1,
false);
552 CHECKNOTNULL(trans->insertTuple(baseRecord,
567 CHECKEQUAL(NDBT_OK, activateErrorInsert(trans,
583 CHECKNOTNULL(bigRead);
602 CHECKNOTNULL(trans->readTuple(ixRecord,
621 CHECKNOTNULL(trans->readTuple(ixRecord,
626 CHECKNOTNULL(trans->readTuple(ixRecord,
656 CHECKEQUAL(NDBT_OK, activateErrorInsert(trans,
664 CHECKNOTNULL(bigRead= trans->readTuple(ixRecord,
700 CHECKEQUAL(0, bigReadOldApi->
readTuple());
702 CHECKEQUAL(0, bigReadOldApi->
equal((Uint32)0,
703 NdbDictionary::getValuePtr
708 CHECKNOTNULL(bigReadOldApi->
getValue((Uint32)1));
729 CHECKEQUAL(0, bigUpdateOldApi->
equal((Uint32)0,
730 NdbDictionary::getValuePtr
735 CHECKEQUAL(0, bigUpdateOldApi->
setValue((Uint32)1,
736 NdbDictionary::getValuePtr
751 restarter.insertErrorInAllNodes(8066);
764 CHECKEQUAL(0, bigUpdateOldApi->
equal((Uint32)0,
765 NdbDictionary::getValuePtr
770 CHECKEQUAL(0, bigUpdateOldApi->
setValue((Uint32)1,
771 NdbDictionary::getValuePtr
784 restarter.insertErrorInAllNodes(8067);
797 CHECKEQUAL(0, bigUpdateOldApi->
equal((Uint32)0,
798 NdbDictionary::getValuePtr
803 CHECKEQUAL(0, bigUpdateOldApi->
setValue((Uint32)1,
804 NdbDictionary::getValuePtr
823 CHECKEQUAL(NDBT_OK, activateErrorInsert(trans,
847 if (strcmp(ctx->getTab()->
getName(),
"WIDE_2COL") != 0)
850 const Uint32 maxRowBytes= NDB_MAX_TUPLE_SIZE_IN_WORDS *
sizeof(Uint32);
852 char smallRowBuf[maxRowBytes];
854 Uint32 smallKeySize= setLongVarchar(&smallKey[0],
863 setLongVarchar(NdbDictionary::getValuePtr(record,
868 NdbDictionary::setNull(record, smallRowBuf, 0,
false);
870 setLongVarchar(NdbDictionary::getValuePtr(record,
875 NdbDictionary::setNull(record, smallRowBuf, 1,
false);
878 Ndb* pNdb= GETNDB(step);
889 CHECKEQUAL(NDBT_OK, activateErrorInsert(trans,
910 for (Uint32 w=0; w < 2500; w++)
911 CHECKEQUAL(0, prog.load_const_null(1));
913 CHECKEQUAL(0, prog.interpret_exit_ok());
914 CHECKEQUAL(0, prog.finalise());
934 CHECKEQUAL(NDBT_OK, activateErrorInsert(trans,
963 Ndb* pNdb= GETNDB(step);
970 const Uint32 PROG_WORDS= 16500;
974 Uint32 errorInsertCode;
977 const Uint32 numSubCases= 5;
978 const SubCase cases[numSubCases]=
985 const Uint32 numIterations= 50;
987 Uint32 buff[ PROG_WORDS + 10 ];
989 for (Uint32 iteration=0; iteration < (numIterations * numSubCases); iteration++)
995 SubCase subcase= cases[iteration % numSubCases];
997 Uint32 errorInsertVal= subcase.errorInsertCode;
1004 CHECKEQUAL(0, restarter.insertErrorInAllNodes(errorInsertVal));
1005 CHECKEQUAL(0, restarter.insertErrorInAllNodes(errorInsertVal));
1011 CHECKEQUAL(0, scan->readTuples());
1016 for (Uint32 w=0; w < PROG_WORDS; w++)
1017 CHECKEQUAL(0, prog.load_const_null(1));
1019 CHECKEQUAL(0, prog.interpret_exit_ok());
1020 CHECKEQUAL(0, prog.finalise());
1022 CHECKEQUAL(0, scan->setInterpretedCode(&prog));
1029 CHECKEQUAL(-1, scan->nextResult());
1031 int expectedResult= subcase.expectedRc;
1032 CHECKEQUAL(expectedResult, scan->getNdbError().code);
1039 restarter.insertErrorInAllNodes(0);
1045 NDBT_TESTSUITE(testLimits);
1047 TESTCASE(
"ExhaustSegmentedSectionPk",
1048 "Test behaviour at Segmented Section exhaustion for PK"){
1049 INITIALIZER(testSegmentedSectionPk);
1052 TESTCASE(
"ExhaustSegmentedSectionIX",
1053 "Test behaviour at Segmented Section exhaustion for Unique index"){
1054 INITIALIZER(testSegmentedSectionIx);
1056 TESTCASE(
"ExhaustSegmentedSectionScan",
1057 "Test behaviour at Segmented Section exhaustion for Scan"){
1058 INITIALIZER(testSegmentedSectionScan);
1061 TESTCASE(
"DropSignalFragments",
1062 "Test behaviour of Segmented Section exhaustion with fragmented signals"){
1063 INITIALIZER(testDropSignalFragments);
1066 NDBT_TESTSUITE_END(testLimits);
1068 int main(
int argc,
const char** argv){
1070 NDBT_TESTSUITE_INSTANCE(testLimits);
1071 return testLimits.execute(argc, argv);