Commit b9dc94a0 authored by unknown's avatar unknown

Merge joreland@bk-internal.mysql.com:/home/bk/mysql-5.0-ndb

into mysql.com:/home/jonas/src/mysql-5.0-ndb

parents 1454564f 8296883f
...@@ -1177,7 +1177,7 @@ public: ...@@ -1177,7 +1177,7 @@ public:
Uint32 nextScan; Uint32 nextScan;
// Length of expected attribute information // Length of expected attribute information
Uint32 scanAiLength; union { Uint32 scanAiLength; Uint32 m_booked_fragments_count; };
Uint32 scanKeyLen; Uint32 scanKeyLen;
......
...@@ -3195,7 +3195,6 @@ void Dbtc::attrinfoDihReceivedLab(Signal* signal) ...@@ -3195,7 +3195,6 @@ void Dbtc::attrinfoDihReceivedLab(Signal* signal)
CacheRecord * const regCachePtr = cachePtr.p; CacheRecord * const regCachePtr = cachePtr.p;
TcConnectRecord * const regTcPtr = tcConnectptr.p; TcConnectRecord * const regTcPtr = tcConnectptr.p;
Uint16 Tnode = regTcPtr->tcNodedata[0]; Uint16 Tnode = regTcPtr->tcNodedata[0];
Uint16 TscanTakeOverInd = regCachePtr->scanTakeOverInd;
TableRecordPtr localTabptr; TableRecordPtr localTabptr;
localTabptr.i = regCachePtr->tableref; localTabptr.i = regCachePtr->tableref;
...@@ -8931,6 +8930,7 @@ void Dbtc::diFcountReqLab(Signal* signal, ScanRecordPtr scanptr) ...@@ -8931,6 +8930,7 @@ void Dbtc::diFcountReqLab(Signal* signal, ScanRecordPtr scanptr)
} }
scanptr.p->scanNextFragId = 0; scanptr.p->scanNextFragId = 0;
scanptr.p->m_booked_fragments_count= 0;
scanptr.p->scanState = ScanRecord::WAIT_FRAGMENT_COUNT; scanptr.p->scanState = ScanRecord::WAIT_FRAGMENT_COUNT;
if(!cachePtr.p->distributionKeyIndicator) if(!cachePtr.p->distributionKeyIndicator)
...@@ -9573,6 +9573,9 @@ void Dbtc::execSCAN_NEXTREQ(Signal* signal) ...@@ -9573,6 +9573,9 @@ void Dbtc::execSCAN_NEXTREQ(Signal* signal)
*/ */
jam(); jam();
ndbrequire(scanptr.p->scanNextFragId < scanptr.p->scanNoFrag); ndbrequire(scanptr.p->scanNextFragId < scanptr.p->scanNoFrag);
jam();
ndbassert(scanptr.p->m_booked_fragments_count);
scanptr.p->m_booked_fragments_count--;
scanFragptr.p->scanFragState = ScanFragRec::WAIT_GET_PRIMCONF; scanFragptr.p->scanFragState = ScanFragRec::WAIT_GET_PRIMCONF;
tcConnectptr.i = scanptr.p->scanTcrec; tcConnectptr.i = scanptr.p->scanTcrec;
...@@ -9816,6 +9819,7 @@ void Dbtc::sendScanTabConf(Signal* signal, ScanRecordPtr scanPtr) { ...@@ -9816,6 +9819,7 @@ void Dbtc::sendScanTabConf(Signal* signal, ScanRecordPtr scanPtr) {
} }
Uint32 left = scanPtr.p->scanNoFrag - scanPtr.p->scanNextFragId; Uint32 left = scanPtr.p->scanNoFrag - scanPtr.p->scanNextFragId;
Uint32 booked = scanPtr.p->m_booked_fragments_count;
ScanTabConf * conf = (ScanTabConf*)&signal->theData[0]; ScanTabConf * conf = (ScanTabConf*)&signal->theData[0];
conf->apiConnectPtr = apiConnectptr.p->ndbapiConnect; conf->apiConnectPtr = apiConnectptr.p->ndbapiConnect;
...@@ -9831,7 +9835,9 @@ void Dbtc::sendScanTabConf(Signal* signal, ScanRecordPtr scanPtr) { ...@@ -9831,7 +9835,9 @@ void Dbtc::sendScanTabConf(Signal* signal, ScanRecordPtr scanPtr) {
ScanFragRecPtr curr = ptr; // Remove while iterating... ScanFragRecPtr curr = ptr; // Remove while iterating...
queued.next(ptr); queued.next(ptr);
bool done = curr.p->m_scan_frag_conf_status && --left; bool done = curr.p->m_scan_frag_conf_status && (left == booked);
if(curr.p->m_scan_frag_conf_status && (booked < left))
booked++;
* ops++ = curr.p->m_apiPtr; * ops++ = curr.p->m_apiPtr;
* ops++ = done ? RNIL : curr.i; * ops++ = done ? RNIL : curr.i;
...@@ -9850,8 +9856,10 @@ void Dbtc::sendScanTabConf(Signal* signal, ScanRecordPtr scanPtr) { ...@@ -9850,8 +9856,10 @@ void Dbtc::sendScanTabConf(Signal* signal, ScanRecordPtr scanPtr) {
} }
} }
scanPtr.p->m_booked_fragments_count = booked;
if(scanPtr.p->m_delivered_scan_frags.isEmpty() && if(scanPtr.p->m_delivered_scan_frags.isEmpty() &&
scanPtr.p->m_running_scan_frags.isEmpty()){ scanPtr.p->m_running_scan_frags.isEmpty())
{
conf->requestInfo = op_count | ScanTabConf::EndOfData; conf->requestInfo = op_count | ScanTabConf::EndOfData;
releaseScanResources(scanPtr); releaseScanResources(scanPtr);
} }
......
...@@ -1065,6 +1065,44 @@ int runScanRestart(NDBT_Context* ctx, NDBT_Step* step){ ...@@ -1065,6 +1065,44 @@ int runScanRestart(NDBT_Context* ctx, NDBT_Step* step){
} }
int
runScanParallelism(NDBT_Context* ctx, NDBT_Step* step){
int loops = ctx->getNumLoops() + 3;
int records = ctx->getNumRecords();
int abort = ctx->getProperty("AbortProb", 15);
Uint32 fib[] = { 1, 2 };
Uint32 parallelism = 0; // start with 0
int i = 0;
HugoTransactions hugoTrans(*ctx->getTab());
while (i<loops && !ctx->isTestStopped()) {
g_info << i << ": ";
if (hugoTrans.scanReadRecords(GETNDB(step), records, abort, parallelism,
NdbOperation::LM_Read) != 0){
return NDBT_FAILED;
}
if (hugoTrans.scanReadRecords(GETNDB(step), records, abort, parallelism,
NdbOperation::LM_Exclusive) != 0){
return NDBT_FAILED;
}
if (hugoTrans.scanReadRecords(GETNDB(step), records, abort, parallelism,
NdbOperation::LM_CommittedRead) != 0){
return NDBT_FAILED;
}
if (hugoTrans.scanUpdateRecords(GETNDB(step), records, abort, parallelism)
!= 0){
return NDBT_FAILED;
}
i++;
parallelism = fib[0];
Uint32 next = fib[0] + fib[1];
fib[0] = fib[1];
fib[1] = next;
}
return NDBT_OK;
}
NDBT_TESTSUITE(testScan); NDBT_TESTSUITE(testScan);
TESTCASE("ScanRead", TESTCASE("ScanRead",
"Verify scan requirement: It should be possible "\ "Verify scan requirement: It should be possible "\
...@@ -1515,6 +1553,12 @@ TESTCASE("ScanRestart", ...@@ -1515,6 +1553,12 @@ TESTCASE("ScanRestart",
STEP(runScanRestart); STEP(runScanRestart);
FINALIZER(runClearTable); FINALIZER(runClearTable);
} }
TESTCASE("ScanParallelism",
"Test scan with different parallelism"){
INITIALIZER(runLoadTable);
STEP(runScanParallelism);
FINALIZER(runClearTable);
}
NDBT_TESTSUITE_END(testScan); NDBT_TESTSUITE_END(testScan);
int main(int argc, const char** argv){ int main(int argc, const char** argv){
......
...@@ -345,6 +345,10 @@ max-time: 500 ...@@ -345,6 +345,10 @@ max-time: 500
cmd: testScan cmd: testScan
args: -n ScanRestart T1 args: -n ScanRestart T1
max-time: 500
cmd: testScan
args: -n ScanParallelism
# #
# DICT TESTS # DICT TESTS
max-time: 1500 max-time: 1500
......
...@@ -72,7 +72,7 @@ HugoTransactions::scanReadRecords(Ndb* pNdb, ...@@ -72,7 +72,7 @@ HugoTransactions::scanReadRecords(Ndb* pNdb,
return NDBT_FAILED; return NDBT_FAILED;
} }
if( pOp ->readTuples(lm) ) { if( pOp ->readTuples(lm, 0, parallelism) ) {
ERR(pTrans->getNdbError()); ERR(pTrans->getNdbError());
pNdb->closeTransaction(pTrans); pNdb->closeTransaction(pTrans);
return NDBT_FAILED; return NDBT_FAILED;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment