1
/* Copyright (C) 2003 MySQL AB
3
This program is free software; you can redistribute it and/or modify
4
it under the terms of the GNU General Public License as published by
5
the Free Software Foundation; version 2 of the License.
7
This program is distributed in the hope that it will be useful,
8
but WITHOUT ANY WARRANTY; without even the implied warranty of
9
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10
GNU General Public License for more details.
12
You should have received a copy of the GNU General Public License
13
along with this program; if not, write to the Free Software
14
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
19
#include "SignalData.hpp"
25
friend class Dblqh; // Reciver
36
friend bool printLQHKEYREQ(FILE * output, const Uint32 * theData, Uint32 len, Uint16 receiverBlockNo);
39
STATIC_CONST( FixedSignalLength = 11 );
46
//-------------------------------------------------------------
47
// Unconditional part. First 10 words
48
//-------------------------------------------------------------
49
UintR clientConnectPtr; // DATA 0
50
UintR attrLen; // DATA 1
51
UintR hashValue; // DATA 2
52
UintR requestInfo; // DATA 3
53
UintR tcBlockref; // DATA 4
54
UintR tableSchemaVersion; // DATA 5
55
UintR fragmentData; // DATA 6
56
UintR transId1; // DATA 7
57
UintR transId2; // DATA 8
58
UintR savePointId; // DATA 9
61
* When sent from TC -> LQH this variable contains scanInfo
62
* When send from LQH -> LQH this variable contains noFiredTriggers
64
UintR noFiredTriggers; // DATA 10
65
Uint32 scanInfo; // DATA 10
68
//-------------------------------------------------------------
69
// Variable sized key part. Those will be placed to
70
// pack the signal in an appropriate manner.
71
//-------------------------------------------------------------
72
UintR variableData[10]; // DATA 11 - 21
74
static UintR getAttrLen(const UintR & scanInfoAttrLen);
75
static UintR getScanTakeOverFlag(const UintR & scanInfoAttrLen);
76
static UintR getStoredProcFlag(const UintR & scanData);
77
static UintR getDistributionKey(const UintR & scanData);
79
static UintR getTableId(const UintR & tableSchemaVersion);
80
static UintR getSchemaVersion(const UintR & tableSchemaVersion);
82
static UintR getFragmentId(const UintR & fragmentData);
83
static UintR getNextReplicaNodeId(const UintR & fragmentData);
85
static Uint8 getLockType(const UintR & requestInfo);
86
static Uint8 getDirtyFlag(const UintR & requestInfo);
87
static Uint8 getInterpretedFlag(const UintR & requestInfo);
88
static Uint8 getSimpleFlag(const UintR & requestInfo);
89
static Uint8 getOperation(const UintR & requestInfo);
90
static Uint8 getSeqNoReplica(const UintR & requestInfo);
91
static Uint8 getLastReplicaNo(const UintR & requestInfo);
92
static Uint8 getAIInLqhKeyReq(const UintR & requestInfo);
93
static UintR getKeyLen(const UintR & requestInfo);
94
static UintR getSameClientAndTcFlag(const UintR & requestInfo);
95
static UintR getReturnedReadLenAIFlag(const UintR & requestInfo);
96
static UintR getApplicationAddressFlag(const UintR & requestInfo);
97
static UintR getMarkerFlag(const UintR & requestInfo);
98
static UintR getNoDiskFlag(const UintR & requestInfo);
104
static void setAttrLen(UintR & scanInfoAttrLen, UintR val);
105
static void setScanTakeOverFlag(UintR & scanInfoAttrLen, UintR val);
106
static void setStoredProcFlag(UintR & scanData, UintR val);
107
static void setDistributionKey(UintR & scanData, UintR val);
109
static void setTableId(UintR & tableSchemaVersion, UintR val);
110
static void setSchemaVersion(UintR & tableSchemaVersion, UintR val);
112
static void setFragmentId(UintR & fragmentData, UintR val);
113
static void setNextReplicaNodeId(UintR & fragmentData, UintR val);
115
static void setLockType(UintR & requestInfo, UintR val);
116
static void setDirtyFlag(UintR & requestInfo, UintR val);
117
static void setInterpretedFlag(UintR & requestInfo, UintR val);
118
static void setSimpleFlag(UintR & requestInfo, UintR val);
119
static void setOperation(UintR & requestInfo, UintR val);
120
static void setSeqNoReplica(UintR & requestInfo, UintR val);
121
static void setLastReplicaNo(UintR & requestInfo, UintR val);
122
static void setAIInLqhKeyReq(UintR & requestInfo, UintR val);
123
static void setKeyLen(UintR & requestInfo, UintR val);
124
static void setSameClientAndTcFlag(UintR & requestInfo, UintR val);
125
static void setReturnedReadLenAIFlag(UintR & requestInfo, UintR val);
126
static void setApplicationAddressFlag(UintR & requestInfo, UintR val);
127
static void setMarkerFlag(UintR & requestInfo, UintR val);
128
static void setNoDiskFlag(UintR & requestInfo, UintR val);
130
static UintR getRowidFlag(const UintR & requestInfo);
131
static void setRowidFlag(UintR & requestInfo, UintR val);
134
* When doing DIRTY WRITES
136
static UintR getGCIFlag(const UintR & requestInfo);
137
static void setGCIFlag(UintR & requestInfo, UintR val);
139
static UintR getNrCopyFlag(const UintR & requestInfo);
140
static void setNrCopyFlag(UintR & requestInfo, UintR val);
146
* k = Key len - 10 Bits (0-9) max 1023
147
* l = Last Replica No - 2 Bits -> Max 3 (10-11)
149
IF version < NDBD_ROWID_VERSION
150
* t = Lock type - 3 Bits -> Max 7 (12-14)
151
* p = Application Addr. Ind - 1 Bit (15)
152
* d = Dirty indicator - 1 Bit (16)
153
* i = Interpreted indicator - 1 Bit (17)
154
* s = Simple indicator - 1 Bit (18)
155
* o = Operation - 3 Bits (19-21)
156
* r = Sequence replica - 2 Bits (22-23)
157
* a = Attr Info in LQHKEYREQ - 3 Bits (24-26)
158
* c = Same client and tc - 1 Bit (27)
159
* u = Read Len Return Ind - 1 Bit (28)
160
* m = Commit ack marker - 1 Bit (29)
161
* x = No disk usage - 1 Bit (30)
162
* z = Use rowid for insert - 1 Bit (31)
163
* g = gci flag - 1 Bit (12)
164
* n = NR copy - 1 Bit (13)
166
* 1111111111222222222233
167
* 01234567890123456789012345678901
168
* kkkkkkkkkklltttpdisooorraaacumxz
169
* kkkkkkkkkkllgn pdisooorraaacumxz
172
#define RI_KEYLEN_SHIFT (0)
173
#define RI_KEYLEN_MASK (1023)
174
#define RI_LAST_REPL_SHIFT (10)
175
#define RI_LAST_REPL_MASK (3)
176
#define RI_LOCK_TYPE_SHIFT (12)
177
#define RI_LOCK_TYPE_MASK (7)
178
#define RI_APPL_ADDR_SHIFT (15)
179
#define RI_DIRTY_SHIFT (16)
180
#define RI_INTERPRETED_SHIFT (17)
181
#define RI_SIMPLE_SHIFT (18)
182
#define RI_OPERATION_SHIFT (19)
183
#define RI_OPERATION_MASK (7)
184
#define RI_SEQ_REPLICA_SHIFT (22)
185
#define RI_SEQ_REPLICA_MASK (3)
186
#define RI_AI_IN_THIS_SHIFT (24)
187
#define RI_AI_IN_THIS_MASK (7)
188
#define RI_SAME_CLIENT_SHIFT (27)
189
#define RI_RETURN_AI_SHIFT (28)
190
#define RI_MARKER_SHIFT (29)
191
#define RI_NODISK_SHIFT (30)
192
#define RI_ROWID_SHIFT (31)
193
#define RI_GCI_SHIFT (12)
194
#define RI_NR_COPY_SHIFT (13)
199
* a = Attr Len - 16 Bits -> max 65535 (0-15)
200
* p = Stored Procedure Ind - 1 Bit (16)
201
* d = Distribution key - 8 Bit -> max 255 (17-24)
202
* t = Scan take over indicator - 1 Bit (25)
204
* 1111111111222222222233
205
* 01234567890123456789012345678901
206
* aaaaaaaaaaaaaaaapddddddddt
209
#define SI_ATTR_LEN_MASK (65535)
210
#define SI_ATTR_LEN_SHIFT (0)
211
#define SI_STORED_PROC_SHIFT (16)
212
#define SI_DISTR_KEY_MASK (255)
213
#define SI_DISTR_KEY_SHIFT (17)
214
#define SI_SCAN_TO_SHIFT (25)
215
#define SI_SCAN_INFO_MASK (63)
216
#define SI_SCAN_INFO_SHIFT (26)
220
LqhKeyReq::getAttrLen(const UintR & scanData)
222
return (scanData >> SI_ATTR_LEN_SHIFT) & SI_ATTR_LEN_MASK;
227
LqhKeyReq::getScanTakeOverFlag(const UintR & scanData)
229
return (scanData >> SI_SCAN_TO_SHIFT) & 1;
234
LqhKeyReq::getStoredProcFlag(const UintR & scanData){
235
return (scanData >> SI_STORED_PROC_SHIFT) & 1;
240
LqhKeyReq::getDistributionKey(const UintR & scanData){
241
return (scanData >> SI_DISTR_KEY_SHIFT) & SI_DISTR_KEY_MASK;
245
UintR LqhKeyReq::getTableId(const UintR & tableSchemaVersion)
247
return tableSchemaVersion & 0xFFFF;
251
UintR LqhKeyReq::getSchemaVersion(const UintR & tableSchemaVersion)
253
return tableSchemaVersion >> 16;
257
UintR LqhKeyReq::getFragmentId(const UintR & fragmentData)
259
return fragmentData & 0xFFFF;
263
UintR LqhKeyReq::getNextReplicaNodeId(const UintR & fragmentData)
265
return fragmentData >> 16;
269
Uint8 LqhKeyReq::getLastReplicaNo(const UintR & requestInfo)
271
return (requestInfo >> RI_LAST_REPL_SHIFT) & RI_LAST_REPL_MASK;
275
Uint8 LqhKeyReq::getLockType(const UintR & requestInfo)
277
return (requestInfo >> RI_LOCK_TYPE_SHIFT) & RI_LOCK_TYPE_MASK;
281
Uint8 LqhKeyReq::getDirtyFlag(const UintR & requestInfo)
283
return (requestInfo >> RI_DIRTY_SHIFT) & 1;
287
Uint8 LqhKeyReq::getInterpretedFlag(const UintR & requestInfo)
289
return (requestInfo >> RI_INTERPRETED_SHIFT) & 1;
293
Uint8 LqhKeyReq::getSimpleFlag(const UintR & requestInfo)
295
return (requestInfo >> RI_SIMPLE_SHIFT) & 1;
299
Uint8 LqhKeyReq::getOperation(const UintR & requestInfo)
301
return (requestInfo >> RI_OPERATION_SHIFT) & RI_OPERATION_MASK;
305
Uint8 LqhKeyReq::getSeqNoReplica(const UintR & requestInfo)
307
return (requestInfo >> RI_SEQ_REPLICA_SHIFT) & RI_SEQ_REPLICA_MASK;
312
Uint8 LqhKeyReq::getAIInLqhKeyReq(const UintR & requestInfo)
314
return (requestInfo >> RI_AI_IN_THIS_SHIFT) & RI_AI_IN_THIS_MASK;
318
UintR LqhKeyReq::getKeyLen(const UintR & requestInfo)
320
return (requestInfo >> RI_KEYLEN_SHIFT) & RI_KEYLEN_MASK;
325
LqhKeyReq::getSameClientAndTcFlag(const UintR & requestInfo)
327
return (requestInfo >> RI_SAME_CLIENT_SHIFT) & 1;
331
UintR LqhKeyReq::getReturnedReadLenAIFlag(const UintR & requestInfo)
333
return (requestInfo >> RI_RETURN_AI_SHIFT) & 1;
338
LqhKeyReq::getApplicationAddressFlag(const UintR & requestInfo){
339
return (requestInfo >> RI_APPL_ADDR_SHIFT) & 1;
344
LqhKeyReq::setAttrLen(UintR & scanInfoAttrLen, UintR val){
345
ASSERT_MAX(val, SI_ATTR_LEN_MASK, "LqhKeyReq::setAttrLen");
346
scanInfoAttrLen |= (val << SI_ATTR_LEN_SHIFT);
352
LqhKeyReq::setScanTakeOverFlag(UintR & scanInfoAttrLen, UintR val){
353
ASSERT_BOOL(val, "LqhKeyReq::setScanTakeOverFlag");
354
scanInfoAttrLen |= (val << SI_SCAN_TO_SHIFT);
359
LqhKeyReq::setStoredProcFlag(UintR & scanData, UintR val){
360
ASSERT_BOOL(val, "LqhKeyReq::setStoredProcFlag");
361
scanData |= (val << SI_STORED_PROC_SHIFT);
367
LqhKeyReq::setDistributionKey(UintR & scanData, UintR val){
368
ASSERT_MAX(val, SI_DISTR_KEY_MASK, "LqhKeyReq::setDistributionKey");
369
scanData |= (val << SI_DISTR_KEY_SHIFT);
376
LqhKeyReq::setTableId(UintR & tableSchemaVersion, UintR val){
381
LqhKeyReq::setSchemaVersion(UintR & tableSchemaVersion, UintR val);
385
LqhKeyReq::setFragmentId(UintR & fragmentData, UintR val);
389
LqhKeyReq::setNextReplicaNodeId(UintR & fragmentData, UintR val);
394
LqhKeyReq::setLockType(UintR & requestInfo, UintR val){
395
ASSERT_MAX(val, RI_LOCK_TYPE_MASK, "LqhKeyReq::setLockType");
396
requestInfo |= (val << RI_LOCK_TYPE_SHIFT);
401
LqhKeyReq::setDirtyFlag(UintR & requestInfo, UintR val){
402
ASSERT_BOOL(val, "LqhKeyReq::setDirtyFlag");
403
requestInfo |= (val << RI_DIRTY_SHIFT);
408
LqhKeyReq::setInterpretedFlag(UintR & requestInfo, UintR val){
409
ASSERT_BOOL(val, "LqhKeyReq::setInterpretedFlag");
410
requestInfo |= (val << RI_INTERPRETED_SHIFT);
415
LqhKeyReq::setSimpleFlag(UintR & requestInfo, UintR val){
416
ASSERT_BOOL(val, "LqhKeyReq::setSimpleFlag");
417
requestInfo |= (val << RI_SIMPLE_SHIFT);
422
LqhKeyReq::setOperation(UintR & requestInfo, UintR val){
423
ASSERT_MAX(val, RI_OPERATION_MASK, "LqhKeyReq::setOperation");
424
requestInfo |= (val << RI_OPERATION_SHIFT);
429
LqhKeyReq::setSeqNoReplica(UintR & requestInfo, UintR val){
430
ASSERT_MAX(val, RI_SEQ_REPLICA_MASK, "LqhKeyReq::setSeqNoReplica");
431
requestInfo |= (val << RI_SEQ_REPLICA_SHIFT);
436
LqhKeyReq::setLastReplicaNo(UintR & requestInfo, UintR val){
437
ASSERT_MAX(val, RI_LAST_REPL_MASK, "LqhKeyReq::setLastReplicaNo");
438
requestInfo |= (val << RI_LAST_REPL_SHIFT);
443
LqhKeyReq::setAIInLqhKeyReq(UintR & requestInfo, UintR val){
444
ASSERT_MAX(val, RI_AI_IN_THIS_MASK, "LqhKeyReq::setAIInLqhKeyReq");
445
requestInfo |= (val << RI_AI_IN_THIS_SHIFT);
450
LqhKeyReq::setKeyLen(UintR & requestInfo, UintR val){
451
ASSERT_MAX(val, RI_KEYLEN_MASK, "LqhKeyReq::setKeyLen");
452
requestInfo |= (val << RI_KEYLEN_SHIFT);
457
LqhKeyReq::setSameClientAndTcFlag(UintR & requestInfo, UintR val){
458
ASSERT_BOOL(val, "LqhKeyReq::setSameClientAndTcFlag");
459
requestInfo |= (val << RI_SAME_CLIENT_SHIFT);
464
LqhKeyReq::setReturnedReadLenAIFlag(UintR & requestInfo, UintR val){
465
ASSERT_BOOL(val, "LqhKeyReq::setReturnedReadLenAIFlag");
466
requestInfo |= (val << RI_RETURN_AI_SHIFT);
471
LqhKeyReq::setApplicationAddressFlag(UintR & requestInfo, UintR val){
472
ASSERT_BOOL(val, "LqhKeyReq::setApplicationAddressFlag");
473
requestInfo |= (val << RI_APPL_ADDR_SHIFT);
480
LqhKeyReq::setMarkerFlag(UintR & requestInfo, UintR val){
481
ASSERT_BOOL(val, "LqhKeyReq::setMarkerFlag");
482
requestInfo |= (val << RI_MARKER_SHIFT);
487
LqhKeyReq::getMarkerFlag(const UintR & requestInfo){
488
return (requestInfo >> RI_MARKER_SHIFT) & 1;
493
LqhKeyReq::setNoDiskFlag(UintR & requestInfo, UintR val){
494
ASSERT_BOOL(val, "LqhKeyReq::setNoDiskFlag");
495
requestInfo |= (val << RI_NODISK_SHIFT);
500
LqhKeyReq::getNoDiskFlag(const UintR & requestInfo){
501
return (requestInfo >> RI_NODISK_SHIFT) & 1;
506
LqhKeyReq::setRowidFlag(UintR & requestInfo, UintR val){
507
ASSERT_BOOL(val, "LqhKeyReq::setRowidFlag");
508
requestInfo |= (val << RI_ROWID_SHIFT);
513
LqhKeyReq::getRowidFlag(const UintR & requestInfo){
514
return (requestInfo >> RI_ROWID_SHIFT) & 1;
519
LqhKeyReq::setGCIFlag(UintR & requestInfo, UintR val){
520
ASSERT_BOOL(val, "LqhKeyReq::setGciFlag");
521
requestInfo |= (val << RI_GCI_SHIFT);
526
LqhKeyReq::getGCIFlag(const UintR & requestInfo){
527
return (requestInfo >> RI_GCI_SHIFT) & 1;
532
LqhKeyReq::setNrCopyFlag(UintR & requestInfo, UintR val){
533
ASSERT_BOOL(val, "LqhKeyReq::setNrCopyFlag");
534
requestInfo |= (val << RI_NR_COPY_SHIFT);
539
LqhKeyReq::getNrCopyFlag(const UintR & requestInfo){
540
return (requestInfo >> RI_NR_COPY_SHIFT) & 1;
548
friend class Restore;
555
// Sent in a packed signal
556
friend class PackedSignal;
560
friend bool printPACKED_SIGNAL(FILE * output, const Uint32 * theData, Uint32 len, Uint16 receiverBlockNo);
561
friend bool printLQHKEYCONF(FILE * output, const Uint32 * theData, Uint32 len, Uint16 receiverBlockNo);
564
STATIC_CONST( SignalLength = 7 );
577
Uint32 noFiredTriggers;
585
friend class Restore;
595
friend bool printLQHKEYREF(FILE * output, const Uint32 * theData, Uint32 len, Uint16 receiverBlockNo);
598
STATIC_CONST( SignalLength = 5 );