21 #include "SignalData.hpp"
22 #include "ndb_limits.h"
38 STATIC_CONST( SignalLength = 12 );
40 STATIC_CONST( AttrInfoSectionNum = 0 );
41 STATIC_CONST( KeyInfoSectionNum = 1 );
43 friend bool printSCAN_FRAGREQ(FILE *,
const Uint32*, Uint32, Uint16);
44 friend bool printSCAN_FRAGCONF(FILE *,
const Uint32*, Uint32, Uint16);
59 Uint32 fragmentNoKeyLen;
67 Uint32 batch_size_rows;
68 Uint32 batch_size_bytes;
69 Uint32 variableData[1];
71 static Uint32 getLockMode(
const Uint32 & requestInfo);
72 static Uint32 getHoldLockFlag(
const Uint32 & requestInfo);
73 static Uint32 getKeyinfoFlag(
const Uint32 & requestInfo);
74 static Uint32 getReadCommittedFlag(
const Uint32 & requestInfo);
75 static Uint32 getRangeScanFlag(
const Uint32 & requestInfo);
76 static Uint32 getDescendingFlag(
const Uint32 & requestInfo);
77 static Uint32 getTupScanFlag(
const Uint32 & requestInfo);
78 static Uint32 getAttrLen(
const Uint32 & requestInfo);
79 static Uint32 getScanPrio(
const Uint32 & requestInfo);
80 static Uint32 getNoDiskFlag(
const Uint32 & requestInfo);
81 static Uint32 getLcpScanFlag(
const Uint32 & requestInfo);
82 static Uint32 getStatScanFlag(
const Uint32 & requestInfo);
84 static void setLockMode(Uint32 & requestInfo, Uint32 lockMode);
85 static void setHoldLockFlag(Uint32 & requestInfo, Uint32 holdLock);
86 static void setKeyinfoFlag(Uint32 & requestInfo, Uint32 keyinfo);
87 static void setReadCommittedFlag(Uint32 & requestInfo, Uint32 readCommitted);
88 static void setRangeScanFlag(Uint32 & requestInfo, Uint32 rangeScan);
89 static void setDescendingFlag(Uint32 & requestInfo, Uint32 descending);
90 static void setTupScanFlag(Uint32 & requestInfo, Uint32 tupScan);
91 static void setAttrLen(Uint32 & requestInfo, Uint32 attrLen);
92 static void setScanPrio(Uint32& requestInfo, Uint32 prio);
93 static void setNoDiskFlag(Uint32& requestInfo, Uint32 val);
94 static void setLcpScanFlag(Uint32 & requestInfo, Uint32 val);
95 static void setStatScanFlag(Uint32 & requestInfo, Uint32 val);
97 static void setReorgFlag(Uint32 & requestInfo, Uint32 val);
98 static Uint32 getReorgFlag(
const Uint32 & requestInfo);
100 static void setCorrFactorFlag(Uint32 & requestInfo, Uint32 val);
101 static Uint32 getCorrFactorFlag(
const Uint32 & requestInfo);
127 friend class NdbScanReceiver;
129 STATIC_CONST( HeaderLength = 5);
130 STATIC_CONST( DataLength = 20 );
133 static Uint32 setScanInfo(Uint32 noOfOps, Uint32 scanNo);
134 static Uint32 getScanNo(Uint32 scanInfo);
135 static Uint32 getScanOp(Uint32 scanInfo);
146 Uint32 scanInfo_Node;
149 Uint32 keyData[DataLength];
172 STATIC_CONST( SignalLength = 6 );
177 Uint32 fragmentCompleted;
196 STATIC_CONST( SignalLength = 4 );
199 ZNO_FREE_TC_CONREC_ERROR = 484,
200 ZTOO_FEW_CONCURRENT_OPERATIONS = 485,
201 ZTOO_MANY_CONCURRENT_OPERATIONS = 486,
202 ZSCAN_NO_FRAGMENT_ERROR = 487,
203 ZTOO_MANY_ACTIVE_SCAN_ERROR = 488,
204 ZNO_FREE_SCANREC_ERROR = 489,
205 ZWRONG_BATCH_SIZE = 1230,
206 ZSTANDBY_SCAN_ERROR = 1209,
207 NO_TC_CONNECT_ERROR = 1217,
208 ZSCAN_BOOK_ACC_OP_ERROR = 1219,
209 ZUNKNOWN_TRANS_ERROR = 1227
236 friend bool printSCANFRAGNEXTREQ(FILE * output,
const Uint32 * theData,
237 Uint32 len, Uint16 receiverBlockNo);
239 STATIC_CONST( SignalLength = 6 );
246 Uint32 batch_size_rows;
247 Uint32 batch_size_bytes;
248 Uint32 variableData[1];
250 STATIC_CONST( ZCLOSE = 1 );
252 static Uint32 getCloseFlag(
const Uint32&);
253 static void setCloseFlag(Uint32&, Uint32);
255 static Uint32 getCorrFactorFlag(
const Uint32&);
256 static void setCorrFactorFlag(Uint32&);
282 #define SF_LOCK_MODE_SHIFT (5)
283 #define SF_LOCK_MODE_MASK (1)
285 #define SF_NO_DISK_SHIFT (4)
286 #define SF_HOLD_LOCK_SHIFT (7)
287 #define SF_KEYINFO_SHIFT (8)
288 #define SF_READ_COMMITTED_SHIFT (9)
289 #define SF_RANGE_SCAN_SHIFT (6)
290 #define SF_DESCENDING_SHIFT (10)
291 #define SF_TUP_SCAN_SHIFT (11)
292 #define SF_LCP_SCAN_SHIFT (3)
294 #define SF_ATTR_LEN_SHIFT (16)
295 #define SF_ATTR_LEN_MASK (65535)
297 #define SF_PRIO_SHIFT 12
298 #define SF_PRIO_MASK 15
300 #define SF_REORG_SHIFT (1)
301 #define SF_REORG_MASK (3)
303 #define SF_CORR_FACTOR_SHIFT (16)
305 #define SF_STAT_SCAN_SHIFT (17)
309 ScanFragReq::getLockMode(
const Uint32 & requestInfo){
310 return (requestInfo >> SF_LOCK_MODE_SHIFT) & SF_LOCK_MODE_MASK;
315 ScanFragReq::getHoldLockFlag(
const Uint32 & requestInfo){
316 return (requestInfo >> SF_HOLD_LOCK_SHIFT) & 1;
321 ScanFragReq::getKeyinfoFlag(
const Uint32 & requestInfo){
322 return (requestInfo >> SF_KEYINFO_SHIFT) & 1;
327 ScanFragReq::getRangeScanFlag(
const Uint32 & requestInfo){
328 return (requestInfo >> SF_RANGE_SCAN_SHIFT) & 1;
333 ScanFragReq::getDescendingFlag(
const Uint32 & requestInfo){
334 return (requestInfo >> SF_DESCENDING_SHIFT) & 1;
339 ScanFragReq::getTupScanFlag(
const Uint32 & requestInfo){
340 return (requestInfo >> SF_TUP_SCAN_SHIFT) & 1;
345 ScanFragReq::getReadCommittedFlag(
const Uint32 & requestInfo){
346 return (requestInfo >> SF_READ_COMMITTED_SHIFT) & 1;
351 ScanFragReq::getAttrLen(
const Uint32 & requestInfo){
352 return (requestInfo >> SF_ATTR_LEN_SHIFT) & SF_ATTR_LEN_MASK;
357 ScanFragReq::getScanPrio(
const Uint32 & requestInfo){
358 return (requestInfo >> SF_PRIO_SHIFT) & SF_PRIO_MASK;
363 ScanFragReq::setScanPrio(UintR & requestInfo, UintR val){
364 ASSERT_MAX(val, SF_PRIO_MASK,
"ScanFragReq::setScanPrio");
365 requestInfo |= (val << SF_PRIO_SHIFT);
370 ScanFragReq::setLockMode(UintR & requestInfo, UintR val){
371 ASSERT_MAX(val, SF_LOCK_MODE_MASK,
"ScanFragReq::setLockMode");
372 requestInfo |= (val << SF_LOCK_MODE_SHIFT);
377 ScanFragReq::setHoldLockFlag(UintR & requestInfo, UintR val){
378 ASSERT_BOOL(val,
"ScanFragReq::setHoldLockFlag");
379 requestInfo |= (val << SF_HOLD_LOCK_SHIFT);
384 ScanFragReq::setKeyinfoFlag(UintR & requestInfo, UintR val){
385 ASSERT_BOOL(val,
"ScanFragReq::setKeyinfoFlag");
386 requestInfo |= (val << SF_KEYINFO_SHIFT);
391 ScanFragReq::setReadCommittedFlag(UintR & requestInfo, UintR val){
392 ASSERT_BOOL(val,
"ScanFragReq::setReadCommittedFlag");
393 requestInfo |= (val << SF_READ_COMMITTED_SHIFT);
398 ScanFragReq::setRangeScanFlag(UintR & requestInfo, UintR val){
399 ASSERT_BOOL(val,
"ScanFragReq::setRangeScanFlag");
400 requestInfo |= (val << SF_RANGE_SCAN_SHIFT);
405 ScanFragReq::setDescendingFlag(UintR & requestInfo, UintR val){
406 ASSERT_BOOL(val,
"ScanFragReq::setDescendingFlag");
407 requestInfo |= (val << SF_DESCENDING_SHIFT);
412 ScanFragReq::setTupScanFlag(UintR & requestInfo, UintR val){
413 ASSERT_BOOL(val,
"ScanFragReq::setTupScanFlag");
414 requestInfo |= (val << SF_TUP_SCAN_SHIFT);
419 ScanFragReq::setAttrLen(UintR & requestInfo, UintR val){
420 ASSERT_MAX(val, SF_ATTR_LEN_MASK,
"ScanFragReq::setAttrLen");
421 requestInfo |= (val << SF_ATTR_LEN_SHIFT);
426 ScanFragReq::getNoDiskFlag(
const Uint32 & requestInfo){
427 return (requestInfo >> SF_NO_DISK_SHIFT) & 1;
432 ScanFragReq::setNoDiskFlag(UintR & requestInfo, UintR val){
433 ASSERT_BOOL(val,
"ScanFragReq::setNoDiskFlag");
434 requestInfo |= (val << SF_NO_DISK_SHIFT);
439 ScanFragReq::getLcpScanFlag(
const Uint32 & requestInfo){
440 return (requestInfo >> SF_LCP_SCAN_SHIFT) & 1;
445 ScanFragReq::setLcpScanFlag(UintR & requestInfo, UintR val){
446 ASSERT_BOOL(val,
"ScanFragReq::setLcpScanFlag");
447 requestInfo |= (val << SF_LCP_SCAN_SHIFT);
452 KeyInfo20::setScanInfo(Uint32 opNo, Uint32 scanNo){
453 ASSERT_MAX(opNo, 1023,
"KeyInfo20::setScanInfo");
454 ASSERT_MAX(scanNo, 255,
"KeyInfo20::setScanInfo");
455 return (opNo << 8) + scanNo;
460 KeyInfo20::getScanNo(Uint32 scanInfo){
461 return scanInfo & 0xFF;
466 KeyInfo20::getScanOp(Uint32 scanInfo){
467 return (scanInfo >> 8) & 0x3FF;
472 ScanFragReq::getReorgFlag(
const Uint32 & requestInfo){
473 return (requestInfo >> SF_REORG_SHIFT) & SF_REORG_MASK;
478 ScanFragReq::setReorgFlag(UintR & requestInfo, UintR val){
479 ASSERT_MAX(val, SF_REORG_MASK,
"ScanFragReq::setLcpScanFlag");
480 requestInfo |= (val << SF_REORG_SHIFT);
485 ScanFragReq::getCorrFactorFlag(
const Uint32 & requestInfo){
486 return (requestInfo >> SF_CORR_FACTOR_SHIFT) & 1;
491 ScanFragReq::setCorrFactorFlag(UintR & requestInfo, UintR val){
492 ASSERT_BOOL(val,
"ScanFragReq::setCorrFactorFlag");
493 requestInfo |= (val << SF_CORR_FACTOR_SHIFT);
498 ScanFragReq::getStatScanFlag(
const Uint32 & requestInfo){
499 return (requestInfo >> SF_STAT_SCAN_SHIFT) & 1;
504 ScanFragReq::setStatScanFlag(UintR & requestInfo, UintR val){
505 ASSERT_BOOL(val,
"ScanFragReq::setStatScanFlag");
506 requestInfo |= (val << SF_STAT_SCAN_SHIFT);
519 #define SFN_CLOSE_SHIFT 0
520 #define SFN_CORR_SHIFT 1
524 ScanFragNextReq::getCorrFactorFlag(
const Uint32 & ri)
526 return (ri >> SFN_CORR_SHIFT) & 1;
531 ScanFragNextReq::setCorrFactorFlag(Uint32 & ri)
533 ri |= (1 << SFN_CORR_SHIFT);