26 Dbtux::TuxCtx * tux_ctx_ptr;
27 NdbMutex * alloc_mutex_ptr;
31 Dbtux_mt_buildIndexFragment_wrapper_C(
void * obj)
40 TuxCtx * tux_ctx =
reinterpret_cast<TuxCtx*
>(req->mem_buffer);
45 Uint32 * ptr =
reinterpret_cast<Uint32*
>(req->mem_buffer);
46 ptr += (
sizeof(* tux_ctx) + 3) / 4;
49 tux_ctx->jamBuffer->theEmulatedJamIndex = 0;
51 tux_ctx->c_searchKey = ptr;
52 ptr += MaxAttrDataSize;
53 tux_ctx->c_entryKey = ptr;
54 ptr += MaxAttrDataSize;
55 tux_ctx->c_dataBuffer = ptr;
56 ptr += MaxAttrDataSize;
58 tux_ctx->c_debugBuffer = (
char*)ptr;
59 ptr += (DebugBufferBytes + 3) / 4;
61 if (!(UintPtr(ptr) - UintPtr(req->mem_buffer) <= req->buffer_size))
66 ctx.indexId = req->indexId;
67 ctx.tableId = req->tableId;
68 ctx.fragId = req->fragId;
69 ctx.tux_ctx_ptr = tux_ctx;
70 ctx.tup_ptr =
reinterpret_cast<Dbtup*
>(req->tup_ptr);
72 Dbtux* tux =
reinterpret_cast<Dbtux*
>(req->tux_ptr);
73 return tux->mt_buildIndexFragment(&ctx);
80 c_indexPool.
getPtr(indexPtr, req->indexId);
81 ndbrequire(indexPtr.p->m_tableId == req->tableId);
83 const Uint32 fragId = req->fragId;
86 findFrag(*indexPtr.p, fragId, fragPtr);
87 ndbrequire(fragPtr.i != RNIL);
88 Frag& frag = *fragPtr.p;
90 TuxCtx & ctx = * (TuxCtx*)req->tux_ctx_ptr;
94 int err = req->tup_ptr->mt_scan_init(req->tableId, req->fragId,
96 bool moveNext =
false;
97 while (globalData.theRestartFlag != perform_stop &&
99 (err = req->tup_ptr->mt_scan_next(req->tableId,
100 fragPtrI, &pos, moveNext)) == 0)
106 ent.m_tupLoc = TupLoc(pos.m_page_no, pos.m_page_idx);
107 ent.m_tupVersion = pos.m_file_no;
110 KeyData searchKey(indexPtr.p->m_keySpec,
false, 0);
111 searchKey.set_buf(ctx.c_searchKey, MaxAttrDataSize << 2);
112 readKeyAttrs(ctx, frag, ent, searchKey, indexPtr.p->m_numAttrs);
114 if (unlikely(! indexPtr.p->m_storeNullKey) &&
115 searchKey.get_null_cnt() == indexPtr.p->m_numAttrs) {
121 bool ok = searchToAdd(ctx, frag, searchKey, ent, treePos);
128 if (frag.m_freeLoc == NullTupLoc)
131 NodeHandle node(frag);
132 err = -(int)allocNode(ctx, node);
138 frag.m_freeLoc = node.m_loc;
139 ndbrequire(frag.m_freeLoc != NullTupLoc);
141 treeAdd(ctx, frag, treePos, ent);
143 frag.m_entryBytes += searchKey.get_data_len();