1 /*
2 Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
3
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License, version 2.0,
6 as published by the Free Software Foundation.
7
8 This program is also distributed with certain software (including
9 but not limited to OpenSSL) that is licensed under separate terms,
10 as designated in a particular file or component or in included license
11 documentation. The authors of MySQL hereby grant you an additional
12 permission to link the program and your derivative works with the
13 separately licensed software that they have included with MySQL.
14
15 This program is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 GNU General Public License, version 2.0, for more details.
19
20 You should have received a copy of the GNU General Public License
21 along with this program; if not, write to the Free Software
22 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
23 */
24
25 #ifndef TC_KEY_REQ_H
26 #define TC_KEY_REQ_H
27
28 #include "SignalData.hpp"
29 #include <transporter/TransporterDefinitions.hpp>
30
31 /**
32 * @class TcKeyReq
33 * @brief Contains KeyInfo and AttrInfo and is commonly followed by more signals
34 *
35 * - SENDER: API, NDBCNTR
36 * - RECEIVER: TC
37 *
38 * Short TCKEYREQ
39 * Prior to NDB 6.4.0, TCKEYREQ was always sent as a short signal train with
40 * up to 8 words of KeyInfo and 5 words of AttrInfo in the TCKEYREQ signal, and
41 * all other Key and AttrInfo sent in separate signal trains. This format is
42 * supported for non NdbRecord operations, backwards compatibility, and for
43 * internal TCKEYREQ signals received from non-API clients.
44 *
45 * Long TCKEYREQ
46 * From NDB 6.4.0, for NdbRecord operations the API nodes send long TCKEYREQ
47 * signals with all KeyInfo and AttrInfo in long sections sent with the
48 * TCKEYREQ signal. As each section has a section length, and no Key/AttrInfo
49 * is sent in the TCKEYREQ signal itself, the KeyLength, AttrInfoLen and
50 * AIInTcKeyReq fields of the header are no longer required, and their bits
51 * can be reused in future.
52 */
53 class TcKeyReq {
54 /**
55 * Receiver(s)
56 */
57 friend class Dbtc; // Receiver
58
59 /**
60 * Sender(s)
61 */
62 friend class Ndbcntr;
63 friend class NdbQueryImpl;
64 friend class NdbOperation;
65 friend class NdbIndexOperation;
66 friend class NdbScanOperation;
67 friend class NdbBlob;
68 friend class DbUtil;
69 friend class Trix;
70
71 /**
72 * For printing
73 */
74 friend bool printTCKEYREQ(FILE *, const Uint32 *, Uint32, Uint16);
75 friend bool printTCINDXREQ(FILE *, const Uint32 *, Uint32, Uint16);
76
77 public:
78 /**
79 * Length of signal
80 */
81 STATIC_CONST( StaticLength = 8 );
82 STATIC_CONST( SignalLength = 25 );
83 STATIC_CONST( MaxKeyInfo = 8 );
84 STATIC_CONST( MaxAttrInfo = 5 );
85 STATIC_CONST( MaxTotalAttrInfo = ((MAX_SEND_MESSAGE_BYTESIZE / 4) -
86 SignalLength ));
87
88 /**
89 * Long signal variant of TCKEYREQ
90 */
91 STATIC_CONST( KeyInfoSectionNum = 0 );
92 STATIC_CONST( AttrInfoSectionNum = 1 );
93
94 STATIC_CONST( UnlockKeyLen = 2 );
95
96 private:
97
98 enum AbortOption {
99 CommitIfFailFree = 0, AbortOnError = 0,
100 CommitAsMuchAsPossible = 2, IgnoreError = 2
101 };
102
103 typedef AbortOption CommitType;
104
105 /**
106 * DATA VARIABLES
107 */
108
109 // ----------------------------------------------------------------------
110 // Unconditional part = must be present in signal. First 8 words
111 // ----------------------------------------------------------------------
112 Uint32 apiConnectPtr; // DATA 0
113 union {
114 Uint32 senderData;
115 UintR apiOperationPtr; // DATA 1
116 };
117 /**
118 * Short TCKEYREQ only :
119 * ATTRIBUTE INFO (attrinfo) LENGTH
120 * This is the total length of all attribute info that is sent from
121 * the application as part of this operation.
122 * It includes all attribute info sent in possible attrinfo
123 * signals as well as the attribute info sent in TCKEYREQ.
124 *
125 * (APIVERSION << 16 | ATTRINFOLEN)
126 *
127 * Long TCKEYREQ
128 * (APIVERSION << 16)
129 * Get AttrInfoLength from length of section 1, if present.
130 *
131 */
132 UintR attrLen; // DATA 2 (also stores API Version)
133 UintR tableId; // DATA 3
134 UintR requestInfo; // DATA 4 Various transaction flags
135 UintR tableSchemaVersion; // DATA 5
136 UintR transId1; // DATA 6
137 UintR transId2; // DATA 7
138
139 // ----------------------------------------------------------------------
140 // Conditional part = can be present in signal.
141 // These four words will be sent only if their indicator is set.
142 // ----------------------------------------------------------------------
143 UintR scanInfo; // DATA 8 Various flags for scans, see below
144 UintR distrGroupHashValue; // DATA 9
145 UintR distributionKeySize; // DATA 10
146 UintR storedProcId; // DATA 11
147
148 // ----------------------------------------------------------------------
149 // Variable sized KEY and ATTRINFO part.
150 // These will be placed to pack the signal in an appropriate manner.
151 // ----------------------------------------------------------------------
152 UintR keyInfo[MaxKeyInfo]; // DATA 12 - 19
153 UintR attrInfo[MaxAttrInfo]; // DATA 20 - 24
154
155 /**
156 * Get:ers for attrLen
157 */
158
159 static Uint16 getAPIVersion(const UintR & attrLen);
160 static Uint16 getAttrinfoLen(const UintR & attrLen);
161 static void setAPIVersion(UintR & attrLen, Uint16 apiVersion);
162 static void setAttrinfoLen(UintR & attrLen, Uint16 aiLen);
163
164
165 /**
166 * Get:ers for requestInfo
167 */
168 static Uint8 getCommitFlag(const UintR & requestInfo);
169 static Uint8 getAbortOption(const UintR & requestInfo);
170 static Uint8 getStartFlag(const UintR & requestInfo);
171 static Uint8 getSimpleFlag(const UintR & requestInfo);
172 static Uint8 getDirtyFlag(const UintR & requestInfo);
173 static Uint8 getInterpretedFlag(const UintR & requestInfo);
174 static Uint8 getDistributionKeyFlag(const UintR & requestInfo);
175 static Uint8 getViaSPJFlag(const UintR & requestInfo);
176 static Uint8 getScanIndFlag(const UintR & requestInfo);
177 static Uint8 getOperationType(const UintR & requestInfo);
178 static Uint8 getExecuteFlag(const UintR & requestInfo);
179
180 static Uint16 getKeyLength(const UintR & requestInfo);
181 static Uint8 getAIInTcKeyReq(const UintR & requestInfo);
182 static UintR getNoDiskFlag(const UintR & requestInfo);
183
184 static UintR getCoordinatedTransactionFlag(const UintR & requestInfo);
185
186 /**
187 * Get:ers for scanInfo
188 */
189 static Uint8 getTakeOverScanFlag(const UintR & scanInfo);
190 static Uint16 getTakeOverScanFragment(const UintR & scanInfo);
191 static Uint32 getTakeOverScanInfo(const UintR & scanInfo);
192
193
194 /**
195 * Set:ers for requestInfo
196 */
197 static void clearRequestInfo(UintR & requestInfo);
198 static void setAbortOption(UintR & requestInfo, Uint32 type);
199 static void setCommitFlag(UintR & requestInfo, Uint32 flag);
200 static void setStartFlag(UintR & requestInfo, Uint32 flag);
201 static void setSimpleFlag(UintR & requestInfo, Uint32 flag);
202 static void setDirtyFlag(UintR & requestInfo, Uint32 flag);
203 static void setInterpretedFlag(UintR & requestInfo, Uint32 flag);
204 static void setDistributionKeyFlag(UintR & requestInfo, Uint32 flag);
205 static void setViaSPJFlag(UintR & requestInfo, Uint32 flag);
206 static void setScanIndFlag(UintR & requestInfo, Uint32 flag);
207 static void setExecuteFlag(UintR & requestInfo, Uint32 flag);
208 static void setOperationType(UintR & requestInfo, Uint32 type);
209
210 static void setKeyLength(UintR & requestInfo, Uint32 len);
211 static void setAIInTcKeyReq(UintR & requestInfo, Uint32 len);
212 static void setNoDiskFlag(UintR & requestInfo, UintR val);
213
214 static void setReorgFlag(UintR & requestInfo, UintR val);
215 static UintR getReorgFlag(const UintR & requestInfo);
216 static void setCoordinatedTransactionFlag(UintR & requestInfo, UintR val);
217 static void setQueueOnRedoProblemFlag(UintR & requestInfo, UintR val);
218 static UintR getQueueOnRedoProblemFlag(const UintR & requestInfo);
219
220 /**
221 * Check constraints deferred
222 */
223 static UintR getDeferredConstraints(const UintR & requestInfo);
224 static void setDeferredConstraints(UintR & requestInfo, UintR val);
225
226 /**
227 * Set:ers for scanInfo
228 */
229 static void setTakeOverScanFlag(UintR & scanInfo, Uint8 flag);
230 static void setTakeOverScanFragment(UintR & scanInfo, Uint16 fragment);
231 static void setTakeOverScanInfo(UintR & scanInfo, Uint32 aScanInfo);
232 };
233
234 /**
235 * Request Info
236 *
237 a = Attr Info in TCKEYREQ - 3 Bits -> Max 7 (Bit 16-18)
238 (Short TCKEYREQ only, for long req a == 0)
239 b = Distribution Key Ind - 1 Bit 2
240 v = Via SPJ - 1 Bit 3
241 c = Commit Indicator - 1 Bit 4
242 d = Dirty Indicator - 1 Bit 0
243 e = Scan Indicator - 1 Bit 14
244 i = Interpreted Indicator - 1 Bit 15
245 k = Key length - 12 Bits -> Max 4095 (Bit 20 - 31)
246 (Short TCKEYREQ only, for long req use length of
247 section 0)
248 o = Operation Type - 3 Bits -> Max 7 (Bit 5-7)
249 l = Execute - 1 Bit 10
250 p = Simple Indicator - 1 Bit 8
251 s = Start Indicator - 1 Bit 11
252 y = Commit Type - 2 Bit 12-13
253 n = No disk flag - 1 Bit 1
254 r = reorg flag - 1 Bit 19
255 x = Coordinated Tx flag - 1 Bit 16
256 q = Queue on redo problem - 1 Bit 9
257 D = deferred constraint - 1 Bit 17
258
259 1111111111222222222233
260 01234567890123456789012345678901
261 dnb cooop lsyyeiaaarkkkkkkkkkkkk (Short TCKEYREQ)
262 dnbvcooopqlsyyeixD r (Long TCKEYREQ)
263 */
264
265 #define TCKEY_NODISK_SHIFT (1)
266 #define COMMIT_SHIFT (4)
267 #define START_SHIFT (11)
268 #define SIMPLE_SHIFT (8)
269 #define DIRTY_SHIFT (0)
270 #define EXECUTE_SHIFT (10)
271 #define INTERPRETED_SHIFT (15)
272 #define DISTR_KEY_SHIFT (2)
273 #define VIA_SPJ_SHIFT (3)
274 #define SCAN_SHIFT (14)
275
276 #define OPERATION_SHIFT (5)
277 #define OPERATION_MASK (7)
278
279 #define AINFO_SHIFT (16)
280 #define AINFO_MASK (7)
281
282 #define KEY_LEN_SHIFT (20)
283 #define KEY_LEN_MASK (4095)
284
285 #define COMMIT_TYPE_SHIFT (12)
286 #define COMMIT_TYPE_MASK (3)
287
288 #define TC_REORG_SHIFT (19)
289 #define QUEUE_ON_REDO_SHIFT (9)
290
291 #define TC_COORDINATED_SHIFT (16)
292 #define TC_DEFERRED_CONSTAINTS_SHIFT (17)
293
294 /**
295 * Scan Info
296 *
297 * Scan Info is used to identify the row and lock to take over from a scan.
298 *
299 * If "Scan take over indicator" is set, this operation will take over a lock
300 * currently held on a row being scanned.
301 * Scan locks not taken over in this way (by same or other transaction) are
302 * released when fetching the next batch of rows (SCAN_NEXTREQ signal).
303 * The value for "take over node" and "scan info" are obtained from the
304 * KEYINFO20 signal sent to NDB API by LQH if requested in SCAN_TABREQ.
305 *
306 t = Scan take over indicator - 1 Bit
307 n = Take over node - 12 Bits -> max 4095
308 p = Scan Info - 18 Bits -> max 0x3ffff
309
310 1111111111222222222233
311 01234567890123456789012345678901
312 tpppppppppppppppppp nnnnnnnnnnnn
313 */
314
315 #define TAKE_OVER_SHIFT (0)
316
317 #define TAKE_OVER_FRAG_SHIFT (20)
318 #define TAKE_OVER_FRAG_MASK (4095)
319
320 #define SCAN_INFO_SHIFT (1)
321 #define SCAN_INFO_MASK (0x3ffff)
322
323 /**
324 * Attr Len
325 *
326 n = Attrinfo length(words) - 16 Bits -> max 65535 (Short TCKEYREQ only)
327 a = API version no - 16 Bits -> max 65535
328
329 1111111111222222222233
330 01234567890123456789012345678901
331 aaaaaaaaaaaaaaaannnnnnnnnnnnnnnn (Short TCKEYREQ)
332 aaaaaaaaaaaaaaaa (Long TCKEYREQ)
333 */
334
335 #define API_VER_NO_SHIFT (16)
336 #define API_VER_NO_MASK (65535)
337
338 #define ATTRLEN_SHIFT (0)
339 #define ATTRLEN_MASK (65535)
340
341 inline
342 Uint8
getCommitFlag(const UintR & requestInfo)343 TcKeyReq::getCommitFlag(const UintR & requestInfo){
344 return (Uint8)((requestInfo >> COMMIT_SHIFT) & 1);
345 }
346
347 inline
348 Uint8
getAbortOption(const UintR & requestInfo)349 TcKeyReq::getAbortOption(const UintR & requestInfo){
350 return (Uint8)((requestInfo >> COMMIT_TYPE_SHIFT) & COMMIT_TYPE_MASK);
351 }
352
353 inline
354 Uint8
getStartFlag(const UintR & requestInfo)355 TcKeyReq::getStartFlag(const UintR & requestInfo){
356 return (Uint8)((requestInfo >> START_SHIFT) & 1);
357 }
358
359 inline
360 Uint8
getSimpleFlag(const UintR & requestInfo)361 TcKeyReq::getSimpleFlag(const UintR & requestInfo){
362 return (Uint8)((requestInfo >> SIMPLE_SHIFT) & 1);
363 }
364
365 inline
366 Uint8
getExecuteFlag(const UintR & requestInfo)367 TcKeyReq::getExecuteFlag(const UintR & requestInfo){
368 return (Uint8)((requestInfo >> EXECUTE_SHIFT) & 1);
369 }
370
371 inline
372 Uint8
getDirtyFlag(const UintR & requestInfo)373 TcKeyReq::getDirtyFlag(const UintR & requestInfo){
374 return (Uint8)((requestInfo >> DIRTY_SHIFT) & 1);
375 }
376
377 inline
378 Uint8
getInterpretedFlag(const UintR & requestInfo)379 TcKeyReq::getInterpretedFlag(const UintR & requestInfo){
380 return (Uint8)((requestInfo >> INTERPRETED_SHIFT) & 1);
381 }
382
383 inline
384 Uint8
getDistributionKeyFlag(const UintR & requestInfo)385 TcKeyReq::getDistributionKeyFlag(const UintR & requestInfo){
386 return (Uint8)((requestInfo >> DISTR_KEY_SHIFT) & 1);
387 }
388
389 inline
390 UintR
getCoordinatedTransactionFlag(const UintR & requestInfo)391 TcKeyReq::getCoordinatedTransactionFlag(const UintR & requestInfo){
392 return (UintR)((requestInfo >> TC_COORDINATED_SHIFT) & 1);
393 }
394
395 inline
396 Uint8
getViaSPJFlag(const UintR & requestInfo)397 TcKeyReq::getViaSPJFlag(const UintR & requestInfo){
398 return (Uint8)((requestInfo >> VIA_SPJ_SHIFT) & 1);
399 }
400
401 inline
402 Uint8
getScanIndFlag(const UintR & requestInfo)403 TcKeyReq::getScanIndFlag(const UintR & requestInfo){
404 return (Uint8)((requestInfo >> SCAN_SHIFT) & 1);
405 }
406
407 inline
408 Uint8
getOperationType(const UintR & requestInfo)409 TcKeyReq::getOperationType(const UintR & requestInfo){
410 return (Uint8)((requestInfo >> OPERATION_SHIFT) & OPERATION_MASK);
411 }
412
413 inline
414 Uint16
getKeyLength(const UintR & requestInfo)415 TcKeyReq::getKeyLength(const UintR & requestInfo){
416 return (Uint16)((requestInfo >> KEY_LEN_SHIFT) & KEY_LEN_MASK);
417 }
418
419 inline
420 Uint8
getAIInTcKeyReq(const UintR & requestInfo)421 TcKeyReq::getAIInTcKeyReq(const UintR & requestInfo){
422 return (Uint8)((requestInfo >> AINFO_SHIFT) & AINFO_MASK);
423 }
424
425 inline
426 void
clearRequestInfo(UintR & requestInfo)427 TcKeyReq::clearRequestInfo(UintR & requestInfo){
428 requestInfo = 0;
429 }
430
431 inline
432 void
setAbortOption(UintR & requestInfo,Uint32 type)433 TcKeyReq::setAbortOption(UintR & requestInfo, Uint32 type){
434 ASSERT_MAX(type, COMMIT_TYPE_MASK, "TcKeyReq::setAbortOption");
435 requestInfo &= ~(COMMIT_TYPE_MASK << COMMIT_TYPE_SHIFT);
436 requestInfo |= (type << COMMIT_TYPE_SHIFT);
437 }
438
439 inline
440 void
setCommitFlag(UintR & requestInfo,Uint32 flag)441 TcKeyReq::setCommitFlag(UintR & requestInfo, Uint32 flag){
442 ASSERT_BOOL(flag, "TcKeyReq::setCommitFlag");
443 requestInfo &= ~(1 << COMMIT_SHIFT);
444 requestInfo |= (flag << COMMIT_SHIFT);
445 }
446
447 inline
448 void
setStartFlag(UintR & requestInfo,Uint32 flag)449 TcKeyReq::setStartFlag(UintR & requestInfo, Uint32 flag){
450 ASSERT_BOOL(flag, "TcKeyReq::setStartFlag");
451 requestInfo &= ~(1 << START_SHIFT);
452 requestInfo |= (flag << START_SHIFT);
453 }
454
455 inline
456 void
setSimpleFlag(UintR & requestInfo,Uint32 flag)457 TcKeyReq::setSimpleFlag(UintR & requestInfo, Uint32 flag){
458 ASSERT_BOOL(flag, "TcKeyReq::setSimpleFlag");
459 requestInfo &= ~(1 << SIMPLE_SHIFT);
460 requestInfo |= (flag << SIMPLE_SHIFT);
461 }
462
463 inline
464 void
setDirtyFlag(UintR & requestInfo,Uint32 flag)465 TcKeyReq::setDirtyFlag(UintR & requestInfo, Uint32 flag){
466 ASSERT_BOOL(flag, "TcKeyReq::setDirstFlag");
467 requestInfo &= ~(1 << DIRTY_SHIFT);
468 requestInfo |= (flag << DIRTY_SHIFT);
469 }
470
471 inline
472 void
setExecuteFlag(UintR & requestInfo,Uint32 flag)473 TcKeyReq::setExecuteFlag(UintR & requestInfo, Uint32 flag){
474 ASSERT_BOOL(flag, "TcKeyReq::setExecuteFlag");
475 requestInfo &= ~(1 << EXECUTE_SHIFT);
476 requestInfo |= (flag << EXECUTE_SHIFT);
477 }
478
479 inline
480 void
setInterpretedFlag(UintR & requestInfo,Uint32 flag)481 TcKeyReq::setInterpretedFlag(UintR & requestInfo, Uint32 flag){
482 ASSERT_BOOL(flag, "TcKeyReq::setInterpretedFlag");
483 requestInfo &= ~(1 << INTERPRETED_SHIFT);
484 requestInfo |= (flag << INTERPRETED_SHIFT);
485 }
486
487 inline
488 void
setDistributionKeyFlag(UintR & requestInfo,Uint32 flag)489 TcKeyReq::setDistributionKeyFlag(UintR & requestInfo, Uint32 flag){
490 ASSERT_BOOL(flag, "TcKeyReq::setDistributionKeyFlag");
491 requestInfo &= ~(1 << DISTR_KEY_SHIFT);
492 requestInfo |= (flag << DISTR_KEY_SHIFT);
493 }
494
495 inline
496 void
setCoordinatedTransactionFlag(UintR & requestInfo,UintR flag)497 TcKeyReq::setCoordinatedTransactionFlag(UintR & requestInfo, UintR flag){
498 ASSERT_BOOL(flag, "TcKeyReq::setCoordinatedTransactionFlag");
499 requestInfo &= ~(1 << TC_COORDINATED_SHIFT);
500 requestInfo |= (flag << TC_COORDINATED_SHIFT);
501 }
502
503 inline
504 void
setViaSPJFlag(UintR & requestInfo,Uint32 flag)505 TcKeyReq::setViaSPJFlag(UintR & requestInfo, Uint32 flag){
506 ASSERT_BOOL(flag, "TcKeyReq::setViaSPJFlag");
507 requestInfo &= ~(1 << VIA_SPJ_SHIFT);
508 requestInfo |= (flag << VIA_SPJ_SHIFT);
509 }
510
511 inline
512 void
setScanIndFlag(UintR & requestInfo,Uint32 flag)513 TcKeyReq::setScanIndFlag(UintR & requestInfo, Uint32 flag){
514 ASSERT_BOOL(flag, "TcKeyReq::setScanIndFlag");
515 requestInfo &= ~(1 << SCAN_SHIFT);
516 requestInfo |= (flag << SCAN_SHIFT);
517 }
518
519 inline
520 void
setOperationType(UintR & requestInfo,Uint32 type)521 TcKeyReq::setOperationType(UintR & requestInfo, Uint32 type){
522 ASSERT_MAX(type, OPERATION_MASK, "TcKeyReq::setOperationType");
523 requestInfo &= ~(OPERATION_MASK << OPERATION_SHIFT);
524 requestInfo |= (type << OPERATION_SHIFT);
525 }
526
527 inline
528 void
setKeyLength(UintR & requestInfo,Uint32 len)529 TcKeyReq::setKeyLength(UintR & requestInfo, Uint32 len){
530 ASSERT_MAX(len, KEY_LEN_MASK, "TcKeyReq::setKeyLength");
531 requestInfo &= ~(KEY_LEN_MASK << KEY_LEN_SHIFT);
532 requestInfo |= (len << KEY_LEN_SHIFT);
533 }
534
535 inline
536 void
setAIInTcKeyReq(UintR & requestInfo,Uint32 len)537 TcKeyReq::setAIInTcKeyReq(UintR & requestInfo, Uint32 len){
538 ASSERT_MAX(len, AINFO_MASK, "TcKeyReq::setAIInTcKeyReq");
539 requestInfo &= ~(AINFO_MASK << AINFO_SHIFT);
540 requestInfo |= (len << AINFO_SHIFT);
541 }
542
543 inline
544 Uint8
getTakeOverScanFlag(const UintR & scanInfo)545 TcKeyReq::getTakeOverScanFlag(const UintR & scanInfo){
546 return (Uint8)((scanInfo >> TAKE_OVER_SHIFT) & 1);
547 }
548
549 inline
550 Uint16
getTakeOverScanFragment(const UintR & scanInfo)551 TcKeyReq::getTakeOverScanFragment(const UintR & scanInfo){
552 return (Uint16)((scanInfo >> TAKE_OVER_FRAG_SHIFT) & TAKE_OVER_FRAG_MASK);
553 }
554
555 inline
556 Uint32
getTakeOverScanInfo(const UintR & scanInfo)557 TcKeyReq::getTakeOverScanInfo(const UintR & scanInfo){
558 return (Uint32)((scanInfo >> SCAN_INFO_SHIFT) & SCAN_INFO_MASK);
559 }
560
561
562 inline
563 void
setTakeOverScanFlag(UintR & scanInfo,Uint8 flag)564 TcKeyReq::setTakeOverScanFlag(UintR & scanInfo, Uint8 flag){
565 ASSERT_BOOL(flag, "TcKeyReq::setTakeOverScanFlag");
566 scanInfo |= (flag << TAKE_OVER_SHIFT);
567 }
568
569 inline
570 void
setTakeOverScanFragment(UintR & scanInfo,Uint16 node)571 TcKeyReq::setTakeOverScanFragment(UintR & scanInfo, Uint16 node){
572 // ASSERT_MAX(node, TAKE_OVER_NODE_MASK, "TcKeyReq::setTakeOverScanNode");
573 scanInfo |= (node << TAKE_OVER_FRAG_SHIFT);
574 }
575
576 inline
577 void
setTakeOverScanInfo(UintR & scanInfo,Uint32 aScanInfo)578 TcKeyReq::setTakeOverScanInfo(UintR & scanInfo, Uint32 aScanInfo){
579 // ASSERT_MAX(aScanInfo, SCAN_INFO_MASK, "TcKeyReq::setTakeOverScanInfo");
580 scanInfo |= (aScanInfo << SCAN_INFO_SHIFT);
581 }
582
583
584 inline
585 Uint16
getAPIVersion(const UintR & anAttrLen)586 TcKeyReq::getAPIVersion(const UintR & anAttrLen){
587 return (Uint16)((anAttrLen >> API_VER_NO_SHIFT) & API_VER_NO_MASK);
588 }
589
590 inline
591 void
setAPIVersion(UintR & anAttrLen,Uint16 apiVersion)592 TcKeyReq::setAPIVersion(UintR & anAttrLen, Uint16 apiVersion){
593 // ASSERT_MAX(apiVersion, API_VER_NO_MASK, "TcKeyReq::setAPIVersion");
594 anAttrLen |= (apiVersion << API_VER_NO_SHIFT);
595 }
596
597 inline
598 Uint16
getAttrinfoLen(const UintR & anAttrLen)599 TcKeyReq::getAttrinfoLen(const UintR & anAttrLen){
600 return (Uint16)((anAttrLen) & ATTRLEN_MASK);
601 }
602
603 inline
604 void
setAttrinfoLen(UintR & anAttrLen,Uint16 aiLen)605 TcKeyReq::setAttrinfoLen(UintR & anAttrLen, Uint16 aiLen){
606 // ASSERT_MAX(aiLen, ATTRLEN_MASK, "TcKeyReq::setAttrinfoLen");
607 anAttrLen |= aiLen;
608 }
609
610 inline
611 UintR
getNoDiskFlag(const UintR & requestInfo)612 TcKeyReq::getNoDiskFlag(const UintR & requestInfo){
613 return (requestInfo >> TCKEY_NODISK_SHIFT) & 1;
614 }
615
616 inline
617 void
setNoDiskFlag(UintR & requestInfo,Uint32 flag)618 TcKeyReq::setNoDiskFlag(UintR & requestInfo, Uint32 flag){
619 ASSERT_BOOL(flag, "TcKeyReq::setNoDiskFlag");
620 requestInfo &= ~(1 << TCKEY_NODISK_SHIFT);
621 requestInfo |= (flag << TCKEY_NODISK_SHIFT);
622 }
623
624 inline
625 UintR
getReorgFlag(const UintR & requestInfo)626 TcKeyReq::getReorgFlag(const UintR & requestInfo){
627 return (requestInfo >> TC_REORG_SHIFT) & 1;
628 }
629
630 inline
631 void
setReorgFlag(UintR & requestInfo,Uint32 flag)632 TcKeyReq::setReorgFlag(UintR & requestInfo, Uint32 flag){
633 ASSERT_BOOL(flag, "TcKeyReq::setReorgFlag");
634 requestInfo |= (flag << TC_REORG_SHIFT);
635 }
636
637 inline
638 UintR
getQueueOnRedoProblemFlag(const UintR & requestInfo)639 TcKeyReq::getQueueOnRedoProblemFlag(const UintR & requestInfo){
640 return (requestInfo >> QUEUE_ON_REDO_SHIFT) & 1;
641 }
642
643 inline
644 void
setQueueOnRedoProblemFlag(UintR & requestInfo,Uint32 flag)645 TcKeyReq::setQueueOnRedoProblemFlag(UintR & requestInfo, Uint32 flag){
646 ASSERT_BOOL(flag, "TcKeyReq::setNoDiskFlag");
647 requestInfo |= (flag << QUEUE_ON_REDO_SHIFT);
648 }
649
650 inline
651 void
setDeferredConstraints(UintR & requestInfo,UintR val)652 TcKeyReq::setDeferredConstraints(UintR & requestInfo, UintR val){
653 ASSERT_BOOL(val, "TcKeyReq::setDeferredConstraints");
654 requestInfo |= (val << TC_DEFERRED_CONSTAINTS_SHIFT);
655 }
656
657 inline
658 UintR
getDeferredConstraints(const UintR & requestInfo)659 TcKeyReq::getDeferredConstraints(const UintR & requestInfo){
660 return (requestInfo >> TC_DEFERRED_CONSTAINTS_SHIFT) & 1;
661 }
662
663
664 #endif
665