22 #include <signaldata/NodeStateSignalData.hpp>
33 c_internalStartPhase(0),
34 c_typeOfStart(
NodeState::ST_ILLEGAL_TYPE),
35 c_indexStatAutoUpdate(false),
36 c_indexStatSaveSize(0),
37 c_indexStatSaveScale(0),
38 c_indexStatTriggerPct(0),
39 c_indexStatTriggerScale(0),
40 c_indexStatUpdateDelay(0)
42 BLOCK_CONSTRUCTOR(
Dbtux);
45 (
sizeof(TreeEnt) & 0x3) == 0 &&
46 (
sizeof(TreeNode) & 0x3) == 0 &&
47 (
sizeof(DescHead) & 0x3) == 0 &&
48 (
sizeof(KeyType) & 0x3) == 0
53 addRecSignal(GSN_CONTINUEB, &Dbtux::execCONTINUEB);
54 addRecSignal(GSN_STTOR, &Dbtux::execSTTOR);
55 addRecSignal(GSN_READ_CONFIG_REQ, &Dbtux::execREAD_CONFIG_REQ,
true);
59 addRecSignal(GSN_CREATE_TAB_REQ, &Dbtux::execCREATE_TAB_REQ);
60 addRecSignal(GSN_TUXFRAGREQ, &Dbtux::execTUXFRAGREQ);
61 addRecSignal(GSN_TUX_ADD_ATTRREQ, &Dbtux::execTUX_ADD_ATTRREQ);
62 addRecSignal(GSN_ALTER_INDX_IMPL_REQ, &Dbtux::execALTER_INDX_IMPL_REQ);
63 addRecSignal(GSN_DROP_TAB_REQ, &Dbtux::execDROP_TAB_REQ);
67 addRecSignal(GSN_TUX_MAINT_REQ, &Dbtux::execTUX_MAINT_REQ);
71 addRecSignal(GSN_ACC_SCANREQ, &Dbtux::execACC_SCANREQ);
72 addRecSignal(GSN_TUX_BOUND_INFO, &Dbtux::execTUX_BOUND_INFO);
73 addRecSignal(GSN_NEXT_SCANREQ, &Dbtux::execNEXT_SCANREQ);
74 addRecSignal(GSN_ACC_CHECK_SCAN, &Dbtux::execACC_CHECK_SCAN);
75 addRecSignal(GSN_ACCKEYCONF, &Dbtux::execACCKEYCONF);
76 addRecSignal(GSN_ACCKEYREF, &Dbtux::execACCKEYREF);
77 addRecSignal(GSN_ACC_ABORTCONF, &Dbtux::execACC_ABORTCONF);
81 addRecSignal(GSN_READ_PSEUDO_REQ, &Dbtux::execREAD_PSEUDO_REQ);
82 addRecSignal(GSN_INDEX_STAT_REP, &Dbtux::execINDEX_STAT_REP);
83 addRecSignal(GSN_INDEX_STAT_IMPL_REQ, &Dbtux::execINDEX_STAT_IMPL_REQ);
87 addRecSignal(GSN_DUMP_STATE_ORD, &Dbtux::execDUMP_STATE_ORD);
89 addRecSignal(GSN_DBINFO_SCANREQ, &Dbtux::execDBINFO_SCANREQ);
91 addRecSignal(GSN_NODE_STATE_REP, &Dbtux::execNODE_STATE_REP,
true);
93 addRecSignal(GSN_DROP_FRAG_REQ, &Dbtux::execDROP_FRAG_REQ);
101 Dbtux::execCONTINUEB(
Signal* signal)
104 const Uint32* data = signal->getDataPtr();
106 case TuxContinueB::DropIndex:
109 c_indexPool.
getPtr(indexPtr, data[1]);
110 dropIndex(signal, indexPtr, data[2], data[3]);
113 case TuxContinueB::StatMon:
116 ndbrequire(
id == c_statMon.m_loopIndexId);
117 statMonExecContinueB(signal);
146 Dbtux::execSTTOR(
Signal* signal)
149 Uint32 startPhase = signal->theData[1];
150 switch (startPhase) {
153 CLEAR_ERROR_INSERT_VALUE;
154 c_tup = (
Dbtup*)globalData.getBlock(DBTUP, instance());
155 ndbrequire(c_tup != 0);
159 c_typeOfStart = signal->theData[7];
163 c_internalStartPhase = 6;
168 c_statMon.m_loopIndexId = 0;
169 statMonSendContinueB(signal);
175 signal->theData[0] = 0;
176 signal->theData[1] = 0;
177 signal->theData[2] = 0;
178 signal->theData[3] = 1;
179 signal->theData[4] = 3;
180 signal->theData[5] = 7;
181 signal->theData[6] = 255;
182 BlockReference cntrRef = !isNdbMtLqh() ? NDBCNTR_REF : DBTUX_REF;
183 sendSignal(cntrRef, GSN_STTORRY, signal, 7, JBB);
187 Dbtux::execNODE_STATE_REP(
Signal* signal)
196 c_typeOfStart = rep->nodeState.starting.restartType;
198 SimulatedBlock::execNODE_STATE_REP(signal);
202 Dbtux::execREAD_CONFIG_REQ(
Signal* signal)
207 Uint32 ref = req->senderRef;
208 Uint32 senderData = req->senderData;
209 ndbrequire(req->noOfParameters == 0);
216 Uint32 nStatAutoUpdate;
217 Uint32 nStatSaveSize;
218 Uint32 nStatSaveScale;
219 Uint32 nStatTriggerPct;
220 Uint32 nStatTriggerScale;
221 Uint32 nStatUpdateDelay;
224 m_ctx.m_config.getOwnConfigIterator();
227 ndbrequire(!ndb_mgm_get_int_parameter(p, CFG_TUX_INDEX, &nIndex));
228 ndbrequire(!ndb_mgm_get_int_parameter(p, CFG_TUX_FRAGMENT, &nFragment));
229 ndbrequire(!ndb_mgm_get_int_parameter(p, CFG_TUX_ATTRIBUTE, &nAttribute));
230 ndbrequire(!ndb_mgm_get_int_parameter(p, CFG_TUX_SCAN_OP, &nScanOp));
231 ndbrequire(!ndb_mgm_get_int_parameter(p, CFG_DB_BATCH_SIZE, &nScanBatch));
234 ndb_mgm_get_int_parameter(p, CFG_DB_INDEX_STAT_AUTO_UPDATE,
237 nStatSaveSize = 32768;
238 ndb_mgm_get_int_parameter(p, CFG_DB_INDEX_STAT_SAVE_SIZE,
241 nStatSaveScale = 100;
242 ndb_mgm_get_int_parameter(p, CFG_DB_INDEX_STAT_SAVE_SCALE,
245 nStatTriggerPct = 100;
246 ndb_mgm_get_int_parameter(p, CFG_DB_INDEX_STAT_TRIGGER_PCT,
249 nStatTriggerScale = 100;
250 ndb_mgm_get_int_parameter(p, CFG_DB_INDEX_STAT_TRIGGER_SCALE,
253 nStatUpdateDelay = 60;
254 ndb_mgm_get_int_parameter(p, CFG_DB_INDEX_STAT_UPDATE_DELAY,
257 const Uint32 nDescPage = (nIndex * DescHeadSize + nAttribute * KeyTypeSize + nAttribute * AttributeHeaderSize + DescPageSize - 1) / DescPageSize;
258 const Uint32 nScanBoundWords = nScanOp * ScanBoundSegmentSize * 4;
259 const Uint32 nScanLock = nScanOp * nScanBatch;
260 const Uint32 nStatOp = 8;
264 c_descPagePool.
setSize(nDescPage);
265 c_fragOpPool.
setSize(MaxIndexFragments);
267 c_scanBoundPool.setSize(nScanBoundWords);
268 c_scanLockPool.
setSize(nScanLock);
270 c_indexStatAutoUpdate = nStatAutoUpdate;
271 c_indexStatSaveSize = nStatSaveSize;
272 c_indexStatSaveScale = nStatSaveScale;
273 c_indexStatTriggerPct = nStatTriggerPct;
274 c_indexStatTriggerScale = nStatTriggerScale;
275 c_indexStatUpdateDelay = nStatUpdateDelay;
285 c_indexPool.
seize(indexPtr);
286 if (indexPtr.i == RNIL) {
290 new (indexPtr.p) Index();
293 c_ctx.jamBuffer = jamBuffer();
294 c_ctx.c_searchKey = (Uint32*)
allocRecord(
"c_searchKey",
sizeof(Uint32), MaxAttrDataSize);
295 c_ctx.c_entryKey = (Uint32*)
allocRecord(
"c_entryKey",
sizeof(Uint32), MaxAttrDataSize);
297 c_ctx.c_dataBuffer = (Uint32*)
allocRecord(
"c_dataBuffer",
sizeof(Uint64), (MaxXfrmDataSize + 1) >> 1);
300 c_ctx.c_debugBuffer = (
char*)
allocRecord(
"c_debugBuffer",
sizeof(
char), DebugBufferBytes);
305 conf->senderRef = reference();
306 conf->senderData = senderData;
307 sendSignal(ref, GSN_READ_CONFIG_CONF, signal,
308 ReadConfigConf::SignalLength, JBB);
314 Dbtux::readKeyAttrs(TuxCtx& ctx,
const Frag& frag, TreeEnt ent, KeyData& keyData, Uint32 count)
316 const Index&
index = *c_indexPool.
getPtr(frag.m_indexId);
317 const DescHead& descHead = getDescHead(index);
319 Uint32*
const outputBuffer = ctx.c_dataBuffer;
322 ndbrequire(&keyData.get_spec() == &index.m_keySpec);
323 ndbrequire(keyData.get_spec().validate() == 0);
324 ndbrequire(count <= index.m_numAttrs);
327 const TupLoc tupLoc = ent.m_tupLoc;
328 const Uint32 pageId = tupLoc.getPageId();
329 const Uint32 pageOffset = tupLoc.getPageOffset();
330 const Uint32 tupVersion = ent.m_tupVersion;
331 const Uint32 tableFragPtrI = frag.m_tupTableFragPtrI;
332 const Uint32* keyAttrs32 = (
const Uint32*)&keyAttrs[0];
335 ret = c_tup->tuxReadAttrs(ctx.jamBuffer, tableFragPtrI, pageId, pageOffset, tupVersion, keyAttrs32, count, outputBuffer,
false);
340 ret = keyData.add_poai(outputBuffer, count, &len);
341 ndbrequire(ret == 0);
342 ret = keyData.finalize();
343 ndbrequire(ret == 0);
346 if (debugFlags & (DebugMaint | DebugScan)) {
347 debugOut <<
"readKeyAttrs: ";
348 debugOut <<
" ent:" << ent <<
" count:" << count;
349 debugOut <<
" data:" << keyData.print(ctx.c_debugBuffer, DebugBufferBytes);
356 Dbtux::readTablePk(
const Frag& frag, TreeEnt ent, Uint32* pkData,
unsigned& pkSize)
358 const Uint32 tableFragPtrI = frag.m_tupTableFragPtrI;
359 const TupLoc tupLoc = ent.m_tupLoc;
360 int ret = c_tup->tuxReadPk(tableFragPtrI, tupLoc.getPageId(), tupLoc.getPageOffset(), pkData,
true);
367 Dbtux::unpackBound(TuxCtx& ctx,
const ScanBound& scanBound, KeyBoundC& searchBound)
374 Uint32*
const outputBuffer = ctx.c_searchKey;
376 const Uint32
n = b.getSize();
377 ndbrequire(n <= MaxAttrDataSize);
378 for (Uint32
i = 0;
i <
n;
i++) {
379 outputBuffer[
i] = *iter.data;
383 KeyDataC& searchBoundData = searchBound.get_data();
384 searchBoundData.set_buf(outputBuffer, MaxAttrDataSize << 2, scanBound.m_cnt);
385 int ret = searchBound.finalize(scanBound.m_side);
386 ndbrequire(ret == 0);
390 Dbtux::findFrag(
const Index& index, Uint32 fragId, FragPtr& fragPtr)
392 const Uint32 numFrags = index.m_numFrags;
393 for (Uint32
i = 0;
i < numFrags;
i++) {
395 if (index.m_fragId[
i] == fragId) {
397 fragPtr.i = index.m_fragPtrI[
i];
398 c_fragPool.
getPtr(fragPtr);
405 BLOCK_FUNCTIONS(
Dbtux)