Commit bc26963a authored by unknown's avatar unknown

Moved "hash" bit from k+fragbit to 0

parent eeb21a45
...@@ -9255,7 +9255,7 @@ void Dbacc::initFragAdd(Signal* signal, ...@@ -9255,7 +9255,7 @@ void Dbacc::initFragAdd(Signal* signal,
}//if }//if
regFragPtr.p->fragState = ACTIVEFRAG; regFragPtr.p->fragState = ACTIVEFRAG;
// NOTE: next line must match calculation in Dblqh::execLQHFRAGREQ // NOTE: next line must match calculation in Dblqh::execLQHFRAGREQ
regFragPtr.p->myfid = (rootFragIndex << (lhFragBits - 1)) | req->fragId; regFragPtr.p->myfid = (req->fragId << 1) | rootFragIndex;
regFragPtr.p->myroot = rootIndex; regFragPtr.p->myroot = rootIndex;
regFragPtr.p->myTableId = req->tableId; regFragPtr.p->myTableId = req->tableId;
ndbrequire(req->kValue == 6); ndbrequire(req->kValue == 6);
......
...@@ -1078,8 +1078,8 @@ void Dblqh::execLQHFRAGREQ(Signal* signal) ...@@ -1078,8 +1078,8 @@ void Dblqh::execLQHFRAGREQ(Signal* signal)
if (DictTabInfo::isOrderedIndex(tableType)) { if (DictTabInfo::isOrderedIndex(tableType)) {
jam(); jam();
// NOTE: next 2 lines stolen from ACC // NOTE: next 2 lines stolen from ACC
addfragptr.p->fragid1 = (0 << tlhstar) | fragId; addfragptr.p->fragid1 = (fragId << 1) | 0;
addfragptr.p->fragid2 = (1 << tlhstar) | fragId; addfragptr.p->fragid2 = (fragId << 1) | 1;
addfragptr.p->addfragStatus = AddFragRecord::WAIT_TWO_TUP; addfragptr.p->addfragStatus = AddFragRecord::WAIT_TWO_TUP;
sendAddFragReq(signal); sendAddFragReq(signal);
return; return;
...@@ -1268,7 +1268,7 @@ Dblqh::sendAddFragReq(Signal* signal) ...@@ -1268,7 +1268,7 @@ Dblqh::sendAddFragReq(Signal* signal)
tuxreq->noOfAttr = addfragptr.p->noOfAttr - 1; /* skip NDB$TNODE */ tuxreq->noOfAttr = addfragptr.p->noOfAttr - 1; /* skip NDB$TNODE */
tuxreq->fragId = tuxreq->fragId =
addfragptr.p->addfragStatus == AddFragRecord::WAIT_TWO_TUX addfragptr.p->addfragStatus == AddFragRecord::WAIT_TWO_TUX
? addfragptr.p->fragid1 : addfragptr.p->fragid2; ? addfragptr.p->fragid1: addfragptr.p->fragid2;
tuxreq->fragOff = addfragptr.p->lh3DistrBits; tuxreq->fragOff = addfragptr.p->lh3DistrBits;
tuxreq->tableType = addfragptr.p->tableType; tuxreq->tableType = addfragptr.p->tableType;
tuxreq->primaryTableId = addfragptr.p->primaryTableId; tuxreq->primaryTableId = addfragptr.p->primaryTableId;
...@@ -3420,7 +3420,7 @@ void Dblqh::execLQHKEYREQ(Signal* signal) ...@@ -3420,7 +3420,7 @@ void Dblqh::execLQHKEYREQ(Signal* signal)
LQHKEY_error(signal, 6); LQHKEY_error(signal, 6);
return; return;
}//if }//if
regTcPtr->localFragptr = (regTcPtr->hashValue >> fragptr.p->hashCheckBit) & 1; regTcPtr->localFragptr = regTcPtr->hashValue & 1;
Uint8 TcopyType = fragptr.p->fragCopy; Uint8 TcopyType = fragptr.p->fragCopy;
tfragDistKey = fragptr.p->fragDistributionKey; tfragDistKey = fragptr.p->fragDistributionKey;
if (fragptr.p->fragStatus == Fragrecord::ACTIVE_CREATION) { if (fragptr.p->fragStatus == Fragrecord::ACTIVE_CREATION) {
...@@ -8023,13 +8023,7 @@ void Dblqh::nextScanConfLoopLab(Signal* signal) ...@@ -8023,13 +8023,7 @@ void Dblqh::nextScanConfLoopLab(Signal* signal)
ptrCheckGuard(fragptr, cfragrecFileSize, fragrecord); ptrCheckGuard(fragptr, cfragrecFileSize, fragrecord);
if (! scanptr.p->rangeScan) { if (! scanptr.p->rangeScan) {
tableRef = tcConnectptr.p->tableref; tableRef = tcConnectptr.p->tableref;
if (fragptr.p->fragId == scanptr.p->scanLocalFragid) { tupFragPtr = fragptr.p->tupFragptr[scanptr.p->scanLocalFragid & 1];
jam();
tupFragPtr = fragptr.p->tupFragptr[0];
} else {
jam();
tupFragPtr = fragptr.p->tupFragptr[1];
}//if
} else { } else {
jam(); jam();
// for ordered index use primary table // for ordered index use primary table
...@@ -8037,13 +8031,7 @@ void Dblqh::nextScanConfLoopLab(Signal* signal) ...@@ -8037,13 +8031,7 @@ void Dblqh::nextScanConfLoopLab(Signal* signal)
tFragPtr.i = fragptr.p->tableFragptr; tFragPtr.i = fragptr.p->tableFragptr;
ptrCheckGuard(tFragPtr, cfragrecFileSize, fragrecord); ptrCheckGuard(tFragPtr, cfragrecFileSize, fragrecord);
tableRef = tFragPtr.p->tabRef; tableRef = tFragPtr.p->tabRef;
if (tFragPtr.p->fragId == scanptr.p->scanLocalFragid) { tupFragPtr = tFragPtr.p->tupFragptr[scanptr.p->scanLocalFragid & 1];
jam();
tupFragPtr = tFragPtr.p->tupFragptr[0];
} else {
jam();
tupFragPtr = tFragPtr.p->tupFragptr[1];
}//if
} }
{ {
jam(); jam();
...@@ -9122,13 +9110,7 @@ void Dblqh::copySendTupkeyReqLab(Signal* signal) ...@@ -9122,13 +9110,7 @@ void Dblqh::copySendTupkeyReqLab(Signal* signal)
scanptr.p->scanState = ScanRecord::WAIT_TUPKEY_COPY; scanptr.p->scanState = ScanRecord::WAIT_TUPKEY_COPY;
fragptr.i = tcConnectptr.p->fragmentptr; fragptr.i = tcConnectptr.p->fragmentptr;
ptrCheckGuard(fragptr, cfragrecFileSize, fragrecord); ptrCheckGuard(fragptr, cfragrecFileSize, fragrecord);
if (fragptr.p->fragId == scanptr.p->scanLocalFragid) { tupFragPtr = fragptr.p->tupFragptr[scanptr.p->scanLocalFragid & 1];
jam();
tupFragPtr = fragptr.p->tupFragptr[0];
} else {
jam();
tupFragPtr = fragptr.p->tupFragptr[1];
}//if
{ {
TupKeyReq * const tupKeyReq = (TupKeyReq *)signal->getDataPtrSend(); TupKeyReq * const tupKeyReq = (TupKeyReq *)signal->getDataPtrSend();
......
...@@ -57,9 +57,9 @@ Dbtux::execTUX_MAINT_REQ(Signal* signal) ...@@ -57,9 +57,9 @@ Dbtux::execTUX_MAINT_REQ(Signal* signal)
c_indexPool.getPtr(indexPtr, req->indexId); c_indexPool.getPtr(indexPtr, req->indexId);
ndbrequire(indexPtr.p->m_tableId == req->tableId); ndbrequire(indexPtr.p->m_tableId == req->tableId);
// get base fragment id and extra bits // get base fragment id and extra bits
const Uint32 fragOff = indexPtr.p->m_fragOff; const Uint32 fragId = req->fragId & ~1;
const Uint32 fragId = req->fragId & ((1 << fragOff) - 1); const Uint32 fragBit = req->fragId & 1;
const Uint32 fragBit = req->fragId >> fragOff;
// get the fragment // get the fragment
FragPtr fragPtr; FragPtr fragPtr;
fragPtr.i = RNIL; fragPtr.i = RNIL;
...@@ -71,6 +71,7 @@ Dbtux::execTUX_MAINT_REQ(Signal* signal) ...@@ -71,6 +71,7 @@ Dbtux::execTUX_MAINT_REQ(Signal* signal)
break; break;
} }
} }
ndbrequire(fragPtr.i != RNIL); ndbrequire(fragPtr.i != RNIL);
Frag& frag = *fragPtr.p; Frag& frag = *fragPtr.p;
// set up index keys for this operation // set up index keys for this operation
......
...@@ -34,7 +34,7 @@ Dbtux::execACC_SCANREQ(Signal* signal) ...@@ -34,7 +34,7 @@ Dbtux::execACC_SCANREQ(Signal* signal)
fragPtr.i = RNIL; fragPtr.i = RNIL;
for (unsigned i = 0; i < indexPtr.p->m_numFrags; i++) { for (unsigned i = 0; i < indexPtr.p->m_numFrags; i++) {
jam(); jam();
if (indexPtr.p->m_fragId[i] == req->fragmentNo) { if (indexPtr.p->m_fragId[i] == req->fragmentNo << 1) {
jam(); jam();
c_fragPool.getPtr(fragPtr, indexPtr.p->m_fragPtrI[i]); c_fragPool.getPtr(fragPtr, indexPtr.p->m_fragPtrI[i]);
break; break;
...@@ -43,7 +43,6 @@ Dbtux::execACC_SCANREQ(Signal* signal) ...@@ -43,7 +43,6 @@ Dbtux::execACC_SCANREQ(Signal* signal)
ndbrequire(fragPtr.i != RNIL); ndbrequire(fragPtr.i != RNIL);
Frag& frag = *fragPtr.p; Frag& frag = *fragPtr.p;
// must be normal DIH/TC fragment // must be normal DIH/TC fragment
ndbrequire(frag.m_fragId < (1 << frag.m_fragOff));
TreeHead& tree = frag.m_tree; TreeHead& tree = frag.m_tree;
// check for empty fragment // check for empty fragment
if (tree.m_root == NullTupLoc) { if (tree.m_root == NullTupLoc) {
...@@ -354,7 +353,7 @@ Dbtux::execACC_CHECK_SCAN(Signal* signal) ...@@ -354,7 +353,7 @@ Dbtux::execACC_CHECK_SCAN(Signal* signal)
NextScanConf* const conf = (NextScanConf*)signal->getDataPtrSend(); NextScanConf* const conf = (NextScanConf*)signal->getDataPtrSend();
conf->scanPtr = scan.m_userPtr; conf->scanPtr = scan.m_userPtr;
conf->accOperationPtr = RNIL; // no tuple returned conf->accOperationPtr = RNIL; // no tuple returned
conf->fragId = frag.m_fragId | (ent.m_fragBit << frag.m_fragOff); conf->fragId = frag.m_fragId | ent.m_fragBit;
unsigned signalLength = 3; unsigned signalLength = 3;
// if TC has ordered scan close, it will be detected here // if TC has ordered scan close, it will be detected here
sendSignal(scan.m_userRef, GSN_NEXT_SCANCONF, sendSignal(scan.m_userRef, GSN_NEXT_SCANCONF,
...@@ -397,7 +396,7 @@ Dbtux::execACC_CHECK_SCAN(Signal* signal) ...@@ -397,7 +396,7 @@ Dbtux::execACC_CHECK_SCAN(Signal* signal)
lockReq->userPtr = scanPtr.i; lockReq->userPtr = scanPtr.i;
lockReq->userRef = reference(); lockReq->userRef = reference();
lockReq->tableId = scan.m_tableId; lockReq->tableId = scan.m_tableId;
lockReq->fragId = frag.m_fragId | (ent.m_fragBit << frag.m_fragOff); lockReq->fragId = frag.m_fragId | ent.m_fragBit;
lockReq->fragPtrI = frag.m_accTableFragPtrI[ent.m_fragBit]; lockReq->fragPtrI = frag.m_accTableFragPtrI[ent.m_fragBit];
const Uint32* const buf32 = static_cast<Uint32*>(pkData); const Uint32* const buf32 = static_cast<Uint32*>(pkData);
const Uint64* const buf64 = reinterpret_cast<const Uint64*>(buf32); const Uint64* const buf64 = reinterpret_cast<const Uint64*>(buf32);
...@@ -496,7 +495,7 @@ Dbtux::execACC_CHECK_SCAN(Signal* signal) ...@@ -496,7 +495,7 @@ Dbtux::execACC_CHECK_SCAN(Signal* signal)
accLockOp = (Uint32)-1; accLockOp = (Uint32)-1;
} }
conf->accOperationPtr = accLockOp; conf->accOperationPtr = accLockOp;
conf->fragId = frag.m_fragId | (ent.m_fragBit << frag.m_fragOff); conf->fragId = frag.m_fragId | ent.m_fragBit;
conf->localKey[0] = getTupAddr(frag, ent); conf->localKey[0] = getTupAddr(frag, ent);
conf->localKey[1] = 0; conf->localKey[1] = 0;
conf->localKeyLength = 1; conf->localKeyLength = 1;
...@@ -890,7 +889,7 @@ Dbtux::scanVisible(ScanOpPtr scanPtr, TreeEnt ent) ...@@ -890,7 +889,7 @@ Dbtux::scanVisible(ScanOpPtr scanPtr, TreeEnt ent)
const Frag& frag = *c_fragPool.getPtr(scan.m_fragPtrI); const Frag& frag = *c_fragPool.getPtr(scan.m_fragPtrI);
Uint32 fragBit = ent.m_fragBit; Uint32 fragBit = ent.m_fragBit;
Uint32 tableFragPtrI = frag.m_tupTableFragPtrI[fragBit]; Uint32 tableFragPtrI = frag.m_tupTableFragPtrI[fragBit];
Uint32 fragId = frag.m_fragId | (fragBit << frag.m_fragOff); Uint32 fragId = frag.m_fragId | fragBit;
Uint32 tupAddr = getTupAddr(frag, ent); Uint32 tupAddr = getTupAddr(frag, ent);
Uint32 tupVersion = ent.m_tupVersion; Uint32 tupVersion = ent.m_tupVersion;
// check for same tuple twice in row // check for same tuple twice in row
......
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