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