21 #include "SignalData.hpp"
22 #include <transporter/TransporterDefinitions.hpp>
67 friend bool printTCKEYREQ(FILE *,
const Uint32 *, Uint32, Uint16);
68 friend bool printTCINDXREQ(FILE *,
const Uint32 *, Uint32, Uint16);
78 STATIC_CONST( MaxTotalAttrInfo = ((MAX_SEND_MESSAGE_BYTESIZE / 4) -
92 CommitIfFailFree = 0, AbortOnError = 0,
93 CommitAsMuchAsPossible = 2, IgnoreError = 2
96 typedef AbortOption CommitType;
105 Uint32 apiConnectPtr;
108 UintR apiOperationPtr;
128 UintR tableSchemaVersion;
137 UintR distrGroupHashValue;
138 UintR distributionKeySize;
145 UintR keyInfo[MaxKeyInfo];
146 UintR attrInfo[MaxAttrInfo];
152 static Uint16 getAPIVersion(
const UintR & attrLen);
153 static Uint16 getAttrinfoLen(
const UintR & attrLen);
154 static void setAPIVersion(UintR & attrLen, Uint16 apiVersion);
155 static void setAttrinfoLen(UintR & attrLen, Uint16 aiLen);
161 static Uint8 getCommitFlag(
const UintR & requestInfo);
162 static Uint8 getAbortOption(
const UintR & requestInfo);
163 static Uint8 getStartFlag(
const UintR & requestInfo);
164 static Uint8 getSimpleFlag(
const UintR & requestInfo);
165 static Uint8 getDirtyFlag(
const UintR & requestInfo);
166 static Uint8 getInterpretedFlag(
const UintR & requestInfo);
167 static Uint8 getDistributionKeyFlag(
const UintR & requestInfo);
168 static Uint8 getViaSPJFlag(
const UintR & requestInfo);
169 static Uint8 getScanIndFlag(
const UintR & requestInfo);
170 static Uint8 getOperationType(
const UintR & requestInfo);
171 static Uint8 getExecuteFlag(
const UintR & requestInfo);
173 static Uint16 getKeyLength(
const UintR & requestInfo);
174 static Uint8 getAIInTcKeyReq(
const UintR & requestInfo);
175 static UintR getNoDiskFlag(
const UintR & requestInfo);
177 static UintR getCoordinatedTransactionFlag(
const UintR & requestInfo);
182 static Uint8 getTakeOverScanFlag(
const UintR & scanInfo);
183 static Uint16 getTakeOverScanFragment(
const UintR & scanInfo);
184 static Uint32 getTakeOverScanInfo(
const UintR & scanInfo);
190 static void clearRequestInfo(UintR & requestInfo);
191 static void setAbortOption(UintR & requestInfo, Uint32
type);
192 static void setCommitFlag(UintR & requestInfo, Uint32 flag);
193 static void setStartFlag(UintR & requestInfo, Uint32 flag);
194 static void setSimpleFlag(UintR & requestInfo, Uint32 flag);
195 static void setDirtyFlag(UintR & requestInfo, Uint32 flag);
196 static void setInterpretedFlag(UintR & requestInfo, Uint32 flag);
197 static void setDistributionKeyFlag(UintR & requestInfo, Uint32 flag);
198 static void setViaSPJFlag(UintR & requestInfo, Uint32 flag);
199 static void setScanIndFlag(UintR & requestInfo, Uint32 flag);
200 static void setExecuteFlag(UintR & requestInfo, Uint32 flag);
201 static void setOperationType(UintR & requestInfo, Uint32
type);
203 static void setKeyLength(UintR & requestInfo, Uint32 len);
204 static void setAIInTcKeyReq(UintR & requestInfo, Uint32 len);
205 static void setNoDiskFlag(UintR & requestInfo, UintR val);
207 static void setReorgFlag(UintR & requestInfo, UintR val);
208 static UintR getReorgFlag(
const UintR & requestInfo);
209 static void setCoordinatedTransactionFlag(UintR & requestInfo, UintR val);
210 static void setQueueOnRedoProblemFlag(UintR & requestInfo, UintR val);
211 static UintR getQueueOnRedoProblemFlag(
const UintR & requestInfo);
216 static UintR getDeferredConstraints(
const UintR & requestInfo);
217 static void setDeferredConstraints(UintR & requestInfo, UintR val);
222 static void setTakeOverScanFlag(UintR & scanInfo, Uint8 flag);
223 static void setTakeOverScanFragment(UintR & scanInfo, Uint16 fragment);
224 static void setTakeOverScanInfo(UintR & scanInfo, Uint32 aScanInfo);
258 #define TCKEY_NODISK_SHIFT (1)
259 #define COMMIT_SHIFT (4)
260 #define START_SHIFT (11)
261 #define SIMPLE_SHIFT (8)
262 #define DIRTY_SHIFT (0)
263 #define EXECUTE_SHIFT (10)
264 #define INTERPRETED_SHIFT (15)
265 #define DISTR_KEY_SHIFT (2)
266 #define VIA_SPJ_SHIFT (3)
267 #define SCAN_SHIFT (14)
269 #define OPERATION_SHIFT (5)
270 #define OPERATION_MASK (7)
272 #define AINFO_SHIFT (16)
273 #define AINFO_MASK (7)
275 #define KEY_LEN_SHIFT (20)
276 #define KEY_LEN_MASK (4095)
278 #define COMMIT_TYPE_SHIFT (12)
279 #define COMMIT_TYPE_MASK (3)
281 #define TC_REORG_SHIFT (19)
282 #define QUEUE_ON_REDO_SHIFT (9)
284 #define TC_COORDINATED_SHIFT (16)
285 #define TC_DEFERRED_CONSTAINTS_SHIFT (17)
308 #define TAKE_OVER_SHIFT (0)
310 #define TAKE_OVER_FRAG_SHIFT (20)
311 #define TAKE_OVER_FRAG_MASK (4095)
313 #define SCAN_INFO_SHIFT (1)
314 #define SCAN_INFO_MASK (0x3ffff)
328 #define API_VER_NO_SHIFT (16)
329 #define API_VER_NO_MASK (65535)
331 #define ATTRLEN_SHIFT (0)
332 #define ATTRLEN_MASK (65535)
336 TcKeyReq::getCommitFlag(
const UintR & requestInfo){
337 return (Uint8)((requestInfo >> COMMIT_SHIFT) & 1);
342 TcKeyReq::getAbortOption(
const UintR & requestInfo){
343 return (Uint8)((requestInfo >> COMMIT_TYPE_SHIFT) & COMMIT_TYPE_MASK);
348 TcKeyReq::getStartFlag(
const UintR & requestInfo){
349 return (Uint8)((requestInfo >> START_SHIFT) & 1);
354 TcKeyReq::getSimpleFlag(
const UintR & requestInfo){
355 return (Uint8)((requestInfo >> SIMPLE_SHIFT) & 1);
360 TcKeyReq::getExecuteFlag(
const UintR & requestInfo){
361 return (Uint8)((requestInfo >> EXECUTE_SHIFT) & 1);
366 TcKeyReq::getDirtyFlag(
const UintR & requestInfo){
367 return (Uint8)((requestInfo >> DIRTY_SHIFT) & 1);
372 TcKeyReq::getInterpretedFlag(
const UintR & requestInfo){
373 return (Uint8)((requestInfo >> INTERPRETED_SHIFT) & 1);
378 TcKeyReq::getDistributionKeyFlag(
const UintR & requestInfo){
379 return (Uint8)((requestInfo >> DISTR_KEY_SHIFT) & 1);
384 TcKeyReq::getCoordinatedTransactionFlag(
const UintR & requestInfo){
385 return (UintR)((requestInfo >> TC_COORDINATED_SHIFT) & 1);
390 TcKeyReq::getViaSPJFlag(
const UintR & requestInfo){
391 return (Uint8)((requestInfo >> VIA_SPJ_SHIFT) & 1);
396 TcKeyReq::getScanIndFlag(
const UintR & requestInfo){
397 return (Uint8)((requestInfo >> SCAN_SHIFT) & 1);
402 TcKeyReq::getOperationType(
const UintR & requestInfo){
403 return (Uint8)((requestInfo >> OPERATION_SHIFT) & OPERATION_MASK);
408 TcKeyReq::getKeyLength(
const UintR & requestInfo){
409 return (Uint16)((requestInfo >> KEY_LEN_SHIFT) & KEY_LEN_MASK);
414 TcKeyReq::getAIInTcKeyReq(
const UintR & requestInfo){
415 return (Uint8)((requestInfo >> AINFO_SHIFT) & AINFO_MASK);
420 TcKeyReq::clearRequestInfo(UintR & requestInfo){
426 TcKeyReq::setAbortOption(UintR & requestInfo, Uint32
type){
427 ASSERT_MAX(type, COMMIT_TYPE_MASK,
"TcKeyReq::setAbortOption");
428 requestInfo &= ~(COMMIT_TYPE_MASK << COMMIT_TYPE_SHIFT);
429 requestInfo |= (type << COMMIT_TYPE_SHIFT);
434 TcKeyReq::setCommitFlag(UintR & requestInfo, Uint32 flag){
435 ASSERT_BOOL(flag,
"TcKeyReq::setCommitFlag");
436 requestInfo &= ~(1 << COMMIT_SHIFT);
437 requestInfo |= (flag << COMMIT_SHIFT);
442 TcKeyReq::setStartFlag(UintR & requestInfo, Uint32 flag){
443 ASSERT_BOOL(flag,
"TcKeyReq::setStartFlag");
444 requestInfo &= ~(1 << START_SHIFT);
445 requestInfo |= (flag << START_SHIFT);
450 TcKeyReq::setSimpleFlag(UintR & requestInfo, Uint32 flag){
451 ASSERT_BOOL(flag,
"TcKeyReq::setSimpleFlag");
452 requestInfo &= ~(1 << SIMPLE_SHIFT);
453 requestInfo |= (flag << SIMPLE_SHIFT);
458 TcKeyReq::setDirtyFlag(UintR & requestInfo, Uint32 flag){
459 ASSERT_BOOL(flag,
"TcKeyReq::setDirstFlag");
460 requestInfo &= ~(1 << DIRTY_SHIFT);
461 requestInfo |= (flag << DIRTY_SHIFT);
466 TcKeyReq::setExecuteFlag(UintR & requestInfo, Uint32 flag){
467 ASSERT_BOOL(flag,
"TcKeyReq::setExecuteFlag");
468 requestInfo &= ~(1 << EXECUTE_SHIFT);
469 requestInfo |= (flag << EXECUTE_SHIFT);
474 TcKeyReq::setInterpretedFlag(UintR & requestInfo, Uint32 flag){
475 ASSERT_BOOL(flag,
"TcKeyReq::setInterpretedFlag");
476 requestInfo &= ~(1 << INTERPRETED_SHIFT);
477 requestInfo |= (flag << INTERPRETED_SHIFT);
482 TcKeyReq::setDistributionKeyFlag(UintR & requestInfo, Uint32 flag){
483 ASSERT_BOOL(flag,
"TcKeyReq::setDistributionKeyFlag");
484 requestInfo &= ~(1 << DISTR_KEY_SHIFT);
485 requestInfo |= (flag << DISTR_KEY_SHIFT);
490 TcKeyReq::setCoordinatedTransactionFlag(UintR & requestInfo, UintR flag){
491 ASSERT_BOOL(flag,
"TcKeyReq::setCoordinatedTransactionFlag");
492 requestInfo &= ~(1 << TC_COORDINATED_SHIFT);
493 requestInfo |= (flag << TC_COORDINATED_SHIFT);
498 TcKeyReq::setViaSPJFlag(UintR & requestInfo, Uint32 flag){
499 ASSERT_BOOL(flag,
"TcKeyReq::setViaSPJFlag");
500 requestInfo &= ~(1 << VIA_SPJ_SHIFT);
501 requestInfo |= (flag << VIA_SPJ_SHIFT);
506 TcKeyReq::setScanIndFlag(UintR & requestInfo, Uint32 flag){
507 ASSERT_BOOL(flag,
"TcKeyReq::setScanIndFlag");
508 requestInfo &= ~(1 << SCAN_SHIFT);
509 requestInfo |= (flag << SCAN_SHIFT);
514 TcKeyReq::setOperationType(UintR & requestInfo, Uint32
type){
515 ASSERT_MAX(type, OPERATION_MASK,
"TcKeyReq::setOperationType");
516 requestInfo &= ~(OPERATION_MASK << OPERATION_SHIFT);
517 requestInfo |= (type << OPERATION_SHIFT);
522 TcKeyReq::setKeyLength(UintR & requestInfo, Uint32 len){
523 ASSERT_MAX(len, KEY_LEN_MASK,
"TcKeyReq::setKeyLength");
524 requestInfo &= ~(KEY_LEN_MASK << KEY_LEN_SHIFT);
525 requestInfo |= (len << KEY_LEN_SHIFT);
530 TcKeyReq::setAIInTcKeyReq(UintR & requestInfo, Uint32 len){
531 ASSERT_MAX(len, AINFO_MASK,
"TcKeyReq::setAIInTcKeyReq");
532 requestInfo &= ~(AINFO_MASK << AINFO_SHIFT);
533 requestInfo |= (len << AINFO_SHIFT);
538 TcKeyReq::getTakeOverScanFlag(
const UintR & scanInfo){
539 return (Uint8)((scanInfo >> TAKE_OVER_SHIFT) & 1);
544 TcKeyReq::getTakeOverScanFragment(
const UintR & scanInfo){
545 return (Uint16)((scanInfo >> TAKE_OVER_FRAG_SHIFT) & TAKE_OVER_FRAG_MASK);
550 TcKeyReq::getTakeOverScanInfo(
const UintR & scanInfo){
551 return (Uint32)((scanInfo >> SCAN_INFO_SHIFT) & SCAN_INFO_MASK);
557 TcKeyReq::setTakeOverScanFlag(UintR & scanInfo, Uint8 flag){
558 ASSERT_BOOL(flag,
"TcKeyReq::setTakeOverScanFlag");
559 scanInfo |= (flag << TAKE_OVER_SHIFT);
564 TcKeyReq::setTakeOverScanFragment(UintR & scanInfo, Uint16 node){
566 scanInfo |= (node << TAKE_OVER_FRAG_SHIFT);
571 TcKeyReq::setTakeOverScanInfo(UintR & scanInfo, Uint32 aScanInfo){
573 scanInfo |= (aScanInfo << SCAN_INFO_SHIFT);
579 TcKeyReq::getAPIVersion(
const UintR & anAttrLen){
580 return (Uint16)((anAttrLen >> API_VER_NO_SHIFT) & API_VER_NO_MASK);
585 TcKeyReq::setAPIVersion(UintR & anAttrLen, Uint16 apiVersion){
587 anAttrLen |= (apiVersion << API_VER_NO_SHIFT);
592 TcKeyReq::getAttrinfoLen(
const UintR & anAttrLen){
593 return (Uint16)((anAttrLen) & ATTRLEN_MASK);
598 TcKeyReq::setAttrinfoLen(UintR & anAttrLen, Uint16 aiLen){
605 TcKeyReq::getNoDiskFlag(
const UintR & requestInfo){
606 return (requestInfo >> TCKEY_NODISK_SHIFT) & 1;
611 TcKeyReq::setNoDiskFlag(UintR & requestInfo, Uint32 flag){
612 ASSERT_BOOL(flag,
"TcKeyReq::setNoDiskFlag");
613 requestInfo &= ~(1 << TCKEY_NODISK_SHIFT);
614 requestInfo |= (flag << TCKEY_NODISK_SHIFT);
619 TcKeyReq::getReorgFlag(
const UintR & requestInfo){
620 return (requestInfo >> TC_REORG_SHIFT) & 1;
625 TcKeyReq::setReorgFlag(UintR & requestInfo, Uint32 flag){
626 ASSERT_BOOL(flag,
"TcKeyReq::setReorgFlag");
627 requestInfo |= (flag << TC_REORG_SHIFT);
632 TcKeyReq::getQueueOnRedoProblemFlag(
const UintR & requestInfo){
633 return (requestInfo >> QUEUE_ON_REDO_SHIFT) & 1;
638 TcKeyReq::setQueueOnRedoProblemFlag(UintR & requestInfo, Uint32 flag){
639 ASSERT_BOOL(flag,
"TcKeyReq::setNoDiskFlag");
640 requestInfo |= (flag << QUEUE_ON_REDO_SHIFT);
645 TcKeyReq::setDeferredConstraints(UintR & requestInfo, UintR val){
646 ASSERT_BOOL(val,
"TcKeyReq::setDeferredConstraints");
647 requestInfo |= (val << TC_DEFERRED_CONSTAINTS_SHIFT);
652 TcKeyReq::getDeferredConstraints(
const UintR & requestInfo){
653 return (requestInfo >> TC_DEFERRED_CONSTAINTS_SHIFT) & 1;