int runInterpretedUKLookup(NDBT_Context* ctx, NDBT_Step* step) { const NdbDictionary::Table * pTab = ctx->getTab(); Ndb* pNdb = GETNDB(step); NdbDictionary::Dictionary * dict = pNdb->getDictionary(); const NdbDictionary::Index* pIdx= dict->getIndex(pkIdxName, pTab->getName()); CHK_RET_FAILED(pIdx != 0); const NdbRecord * pRowRecord = pTab->getDefaultRecord(); CHK_RET_FAILED(pRowRecord != 0); const NdbRecord * pIdxRecord = pIdx->getDefaultRecord(); CHK_RET_FAILED(pIdxRecord != 0); const Uint32 len = NdbDictionary::getRecordRowLength(pRowRecord); Uint8 * pRow = new Uint8[len]; bzero(pRow, len); HugoCalculator calc(* pTab); calc.equalForRow(pRow, pRowRecord, 0); NdbTransaction* pTrans = pNdb->startTransaction(); CHK_RET_FAILED(pTrans != 0); NdbInterpretedCode code; code.interpret_exit_ok(); code.finalise(); NdbOperation::OperationOptions opts; bzero(&opts, sizeof(opts)); opts.optionsPresent = NdbOperation::OperationOptions::OO_INTERPRETED; opts.interpretedCode = &code; const NdbOperation * pOp = pTrans->readTuple(pIdxRecord, (char*)pRow, pRowRecord, (char*)pRow, NdbOperation::LM_Read, 0, &opts, sizeof(opts)); CHK_RET_FAILED(pOp); int res = pTrans->execute(Commit, AbortOnError); CHK_RET_FAILED(res == 0); delete [] pRow; return NDBT_OK; }
int testSegmentedSectionScan(NDBT_Context* ctx, NDBT_Step* step){ /* Test that TC handling of segmented section exhaustion is * correct * Since NDBAPI always send long requests, that is all that * we test */ /* We just run on one table */ if (strcmp(ctx->getTab()->getName(), "WIDE_2COL") != 0) return NDBT_OK; const Uint32 maxRowBytes= NDB_MAX_TUPLE_SIZE_IN_WORDS * sizeof(Uint32); char smallKey[50]; char smallRowBuf[maxRowBytes]; Uint32 smallKeySize= setLongVarchar(&smallKey[0], "ShortKey", 8); const NdbRecord* record= ctx->getTab()->getDefaultRecord(); /* Setup buffers * Small row buffer with small key and small data */ setLongVarchar(NdbDictionary::getValuePtr(record, smallRowBuf, 0), "ShortKey", 8); NdbDictionary::setNull(record, smallRowBuf, 0, false); setLongVarchar(NdbDictionary::getValuePtr(record, smallRowBuf, 1), "ShortData", 9); NdbDictionary::setNull(record, smallRowBuf, 1, false); NdbRestarter restarter; Ndb* pNdb= GETNDB(step); /* Start a transaction on a specific node */ NdbTransaction* trans= pNdb->startTransaction(ctx->getTab(), &smallKey[0], smallKeySize); CHECKNOTNULL(trans); /* Activate error insert 8066 in this transaction, limits a * single import/append to 1 section. */ CHECKEQUAL(NDBT_OK, activateErrorInsert(trans, record, ctx->getTab(), smallRowBuf, &restarter, 8066)); /* A scan will always send 2 long sections (Receiver Ids, * AttrInfo) * Let's start a scan with > 2400 bytes of * ATTRINFO and see what happens */ NdbScanOperation* scan= trans->getNdbScanOperation(ctx->getTab()); CHECKNOTNULL(scan); CHECKEQUAL(0, scan->readTuples()); /* Create a particularly useless program */ NdbInterpretedCode prog; for (Uint32 w=0; w < 2500; w++) CHECKEQUAL(0, prog.load_const_null(1)); CHECKEQUAL(0, prog.interpret_exit_ok()); CHECKEQUAL(0, prog.finalise()); CHECKEQUAL(0, scan->setInterpretedCode(&prog)); /* Api doesn't seem to wait for result of scan request */ CHECKEQUAL(0, trans->execute(NdbTransaction::NoCommit)); CHECKEQUAL(0, trans->getNdbError().code); CHECKEQUAL(-1, scan->nextResult()); CHECKEQUAL(217, scan->getNdbError().code); trans->close(); /* Finished with error insert, cleanup the error insertion */ CHECKNOTNULL(trans= pNdb->startTransaction(ctx->getTab(), &smallKey[0], smallKeySize)); CHECKEQUAL(NDBT_OK, activateErrorInsert(trans, record, ctx->getTab(), smallRowBuf, &restarter, 8068)); CHECKEQUAL(0, trans->execute(NdbTransaction::Rollback)); CHECKEQUAL(0, trans->getNdbError().code); trans->close(); return NDBT_OK; }