20 #define DBTUP_BUFFER_CPP
22 #include <RefConvert.hpp>
23 #include <ndb_limits.h>
25 #include <signaldata/TransIdAI.hpp>
27 void Dbtup::execSEND_PACKED(
Signal* signal)
31 Uint32 TpackedListIndex= cpackedListIndex;
33 for (i= 0; i < TpackedListIndex; i++) {
35 hostId= cpackedList[
i];
36 ndbrequire((hostId - 1) < (MAX_NODES - 1));
37 Uint32 TpacketTA= hostBuffer[hostId].noOfPacketsTA;
40 BlockReference TBref= numberToRef(API_PACKED, hostId);
41 Uint32 TpacketLen= hostBuffer[hostId].packetLenTA;
42 MEMCOPY_NO_WORDS(&signal->theData[0],
43 &hostBuffer[hostId].packetBufferTA[0],
45 sendSignal(TBref, GSN_TRANSID_AI, signal, TpacketLen, JBB);
46 hostBuffer[hostId].noOfPacketsTA= 0;
47 hostBuffer[hostId].packetLenTA= 0;
49 hostBuffer[hostId].inPackedList=
false;
54 void Dbtup::bufferTRANSID_AI(
Signal* signal, BlockReference aRef,
60 Uint32 hostId= refToNode(aRef);
61 Uint32 Theader= ((refToBlock(aRef) << 16)+(Tlen-3));
63 ndbrequire(hostId < MAX_NODES);
64 Uint32 TpacketLen= hostBuffer[hostId].packetLenTA;
65 Uint32 TnoOfPackets= hostBuffer[hostId].noOfPacketsTA;
66 Uint32 sig0= signal->theData[0];
67 Uint32 sig1= signal->theData[1];
68 Uint32 sig2= signal->theData[2];
70 BlockReference TBref= numberToRef(API_PACKED, hostId);
72 if ((Tlen + TpacketLen + 1) <= 25) {
78 updatePackedList(signal, hostId);
79 }
else if (
false && TnoOfPackets == 1) {
84 Uint32 TnewRef= numberToRef((hostBuffer[hostId].packetBufferTA[0] >> 16),
86 MEMCOPY_NO_WORDS(&signal->theData[0],
87 &hostBuffer[hostId].packetBufferTA[1],
89 sendSignal(TnewRef, GSN_TRANSID_AI, signal, (TpacketLen - 1), JBB);
97 MEMCOPY_NO_WORDS(&signal->theData[0],
98 &hostBuffer[hostId].packetBufferTA[0],
100 sendSignal(TBref, GSN_TRANSID_AI, signal, TpacketLen, JBB);
107 hostBuffer[hostId].packetBufferTA[TpacketLen + 0]= Theader;
108 hostBuffer[hostId].packetBufferTA[TpacketLen + 1]= sig0;
109 hostBuffer[hostId].packetBufferTA[TpacketLen + 2]= sig1;
110 hostBuffer[hostId].packetBufferTA[TpacketLen + 3]= sig2;
111 hostBuffer[hostId].noOfPacketsTA= TnoOfPackets + 1;
112 hostBuffer[hostId].packetLenTA= Tlen + TpacketLen + 1;
113 MEMCOPY_NO_WORDS(&hostBuffer[hostId].packetBufferTA[TpacketLen + 4],
114 &signal->theData[25],
118 void Dbtup::updatePackedList(
Signal* signal, Uint16 hostId)
120 if (hostBuffer[hostId].inPackedList ==
false) {
121 Uint32 TpackedListIndex= cpackedListIndex;
123 hostBuffer[hostId].inPackedList=
true;
124 cpackedList[TpackedListIndex]= hostId;
125 cpackedListIndex= TpackedListIndex + 1;
132 void Dbtup::sendReadAttrinfo(
Signal* signal,
133 KeyReqStruct *req_struct,
135 const Operationrec *regOperPtr)
137 if(ToutBufIndex == 0)
140 const BlockReference recBlockref= req_struct->rec_blockref;
141 const Uint32
block= refToBlock(recBlockref);
142 const Uint32 nodeId= refToNode(recBlockref);
148 Uint32 TpacketLen= hostBuffer[nodeId].packetLenTA;
149 Uint32 TpacketTA= hostBuffer[nodeId].noOfPacketsTA;
151 if (ERROR_INSERTED(4006) && (nodeId != getOwnNodeId())){
154 connectedToNode=
false;
157 Uint32 sig0= req_struct->tc_operation_ptr;
158 Uint32 sig1= req_struct->trans_id1;
159 Uint32 sig2= req_struct->trans_id2;
162 transIdAI->connectPtr= sig0;
163 transIdAI->transId[0]= sig1;
164 transIdAI->transId[1]= sig2;
166 if (connectedToNode){
170 if(nodeId != getOwnNodeId()){
176 if (ToutBufIndex >= 22 && is_api) {
181 if (TpacketTA != 0) {
183 BlockReference TBref = numberToRef(API_PACKED, nodeId);
184 MEMCOPY_NO_WORDS(&signal->theData[0],
185 &hostBuffer[nodeId].packetBufferTA[0],
187 sendSignal(TBref, GSN_TRANSID_AI, signal, TpacketLen, JBB);
188 hostBuffer[nodeId].noOfPacketsTA = 0;
189 hostBuffer[nodeId].packetLenTA = 0;
190 transIdAI->connectPtr = sig0;
191 transIdAI->transId[0] = sig1;
192 transIdAI->transId[1] = sig2;
195 ptr[0].p= &signal->theData[25];
196 ptr[0].sz= ToutBufIndex;
197 sendSignal(recBlockref, GSN_TRANSID_AI, signal, 3, JBB, ptr, 1);
204 if ((block == DBUTIL || block == DBSPJ) && !old_dest) {
207 ptr[0].p= &signal->theData[25];
208 ptr[0].sz= ToutBufIndex;
209 sendSignal(recBlockref, GSN_TRANSID_AI, signal, 3, JBB, ptr, 1);
216 #ifndef NDB_NO_DROPPED_SIGNAL
217 if (ToutBufIndex < 22 && is_api){
219 bufferTRANSID_AI(signal, recBlockref, 3+ToutBufIndex);
227 Uint32 * src= signal->theData+25;
228 if (ToutBufIndex >= 22){
231 MEMCOPY_NO_WORDS(&signal->theData[3], src, 22);
232 sendSignal(recBlockref, GSN_TRANSID_AI, signal, 25, JBB);
235 }
while(ToutBufIndex >= 22);
238 if (ToutBufIndex > 0){
240 MEMCOPY_NO_WORDS(&signal->theData[3], src, ToutBufIndex);
241 sendSignal(recBlockref, GSN_TRANSID_AI, signal, 3+ToutBufIndex, JBB);
255 BlockNumber blockMain = blockToMain(block);
256 const bool sameInstance = blockToInstance(block) == instance();
257 if (blockMain == DBLQH)
259 EXECUTE_DIRECT(blockMain, GSN_TRANSID_AI, signal, 3 + ToutBufIndex);
262 else if (blockMain == SUMA && sameInstance)
264 EXECUTE_DIRECT(blockMain, GSN_TRANSID_AI, signal, 3 + ToutBufIndex);
267 else if (blockMain == BACKUP && sameInstance)
269 EXECUTE_DIRECT(blockMain, GSN_TRANSID_AI, signal, 3 + ToutBufIndex);
276 ptr[0].p= &signal->theData[3];
277 ptr[0].sz= ToutBufIndex;
278 sendSignal(recBlockref, GSN_TRANSID_AI, signal, 3, JBB, ptr, 1);
288 Uint32 routeBlockref= req_struct->TC_ref;
292 transIdAI->attrData[0]= recBlockref;
294 ptr[0].p= &signal->theData[25];
295 ptr[0].sz= ToutBufIndex;
296 sendSignal(routeBlockref, GSN_TRANSID_AI_R, signal, 4, JBB, ptr, 1);
305 Uint32 tot= ToutBufIndex;
307 Uint32 maxLen= TransIdAI::DataLength - 1;
310 Uint32 dataLen= (tot - sent > maxLen) ? maxLen : tot - sent;
311 Uint32 sigLen= dataLen + TransIdAI::HeaderLength + 1;
312 MEMCOPY_NO_WORDS(&transIdAI->attrData,
313 &signal->theData[25+sent],
316 transIdAI->attrData[dataLen]= recBlockref;
318 sendSignal(routeBlockref, GSN_TRANSID_AI_R,
319 signal, sigLen, JBB);