1 /*
2 Copyright (c) 2003, 2021, Oracle and/or its affiliates.
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 #include <signaldata/LqhKey.hpp>
26
27 bool
printLQHKEYREQ(FILE * output,const Uint32 * theData,Uint32 len,Uint16 receiverBlockNo)28 printLQHKEYREQ(FILE * output, const Uint32 * theData, Uint32 len, Uint16 receiverBlockNo){
29
30 const LqhKeyReq * const sig = (LqhKeyReq *) theData;
31
32 fprintf(output,
33 " ClientPtr = H\'%.8x hashValue = H\'%.8x tcBlockRef = H\'%.8x\n"
34 " transId1 = H\'%.8x transId2 = H\'%.8x savePointId = H\'%.8x\n",
35 sig->clientConnectPtr, // DATA 0
36 sig->hashValue, // DATA 2
37 sig->tcBlockref, // DATA 4
38 sig->transId1, // DATA 7
39 sig->transId2, // DATA 8
40 sig->savePointId // DATA 9
41 );
42
43 const Uint32 reqInfo = sig->requestInfo;
44 const Uint32 attrLen = sig->attrLen;
45
46 fprintf(output, " Operation: %s\n",
47 LqhKeyReq::getOperation(reqInfo) == ZREAD ? "Read" :
48 LqhKeyReq::getOperation(reqInfo) == ZREAD_EX ? "Read-Ex" :
49 LqhKeyReq::getOperation(reqInfo) == ZUPDATE ? "Update" :
50 LqhKeyReq::getOperation(reqInfo) == ZINSERT ? "Insert" :
51 LqhKeyReq::getOperation(reqInfo) == ZDELETE ? "Delete" :
52 LqhKeyReq::getOperation(reqInfo) == ZWRITE ? "Write" :
53 LqhKeyReq::getOperation(reqInfo) == ZUNLOCK ? "Unlock" :
54 LqhKeyReq::getOperation(reqInfo) == ZREFRESH ? "Refresh" :
55 "Unknown");
56
57 fprintf(output,
58 " Op: %d Lock: %d Flags: ",
59 LqhKeyReq::getOperation(reqInfo),
60 LqhKeyReq::getLockType(reqInfo));
61 if(LqhKeyReq::getSimpleFlag(reqInfo))
62 fprintf(output, "Simple ");
63 if(LqhKeyReq::getDirtyFlag(reqInfo))
64 {
65 if (LqhKeyReq::getNormalProtocolFlag(reqInfo))
66 fprintf(output, "Dirty(N) ");
67 else
68 fprintf(output, "Dirty ");
69 }
70 if(LqhKeyReq::getInterpretedFlag(reqInfo))
71 fprintf(output, "Interpreted ");
72 if(LqhKeyReq::getScanTakeOverFlag(attrLen))
73 fprintf(output, "ScanTakeOver ");
74 if(LqhKeyReq::getMarkerFlag(reqInfo))
75 fprintf(output, "CommitAckMarker ");
76 if(LqhKeyReq::getNoDiskFlag(reqInfo))
77 fprintf(output, "NoDisk ");
78 if(LqhKeyReq::getRowidFlag(reqInfo))
79 fprintf(output, "Rowid ");
80 if(LqhKeyReq::getNrCopyFlag(reqInfo))
81 fprintf(output, "NrCopy ");
82 if(LqhKeyReq::getGCIFlag(reqInfo))
83 fprintf(output, "GCI ");
84 if(LqhKeyReq::getQueueOnRedoProblemFlag(reqInfo))
85 fprintf(output, "Queue ");
86 if(LqhKeyReq::getDeferredConstraints(reqInfo))
87 fprintf(output, "Deferred-constraints ");
88
89 fprintf(output, "ScanInfo/noFiredTriggers: H\'%x\n", sig->scanInfo);
90
91 if(LqhKeyReq::getDisableFkConstraints(reqInfo))
92 fprintf(output, "Disable FK constraints");
93
94 fprintf(output,
95 " AttrLen: %d (%d in this) KeyLen: %d TableId: %d SchemaVer: %d\n",
96 LqhKeyReq::getAttrLen(attrLen),
97 LqhKeyReq::getAIInLqhKeyReq(reqInfo),
98 LqhKeyReq::getKeyLen(reqInfo),
99 LqhKeyReq::getTableId(sig->tableSchemaVersion),
100 LqhKeyReq::getSchemaVersion(sig->tableSchemaVersion));
101
102 fprintf(output,
103 " FragId: %d ReplicaNo: %d LastReplica: %d NextNodeId: %d\n",
104 LqhKeyReq::getFragmentId(sig->fragmentData),
105 LqhKeyReq::getSeqNoReplica(reqInfo),
106 LqhKeyReq::getLastReplicaNo(reqInfo),
107 LqhKeyReq::getNextReplicaNodeId(sig->fragmentData));
108
109 bool printed = false;
110 Uint32 nextPos = LqhKeyReq::getApplicationAddressFlag(reqInfo) << 1;
111 if(nextPos != 0){
112 fprintf(output,
113 " ApiRef: H\'%.8x ApiOpRef: H\'%.8x",
114 sig->variableData[0],
115 sig->variableData[1]);
116 printed = true;
117 }
118
119 if(LqhKeyReq::getSameClientAndTcFlag(reqInfo)){
120 fprintf(output, " TcOpRec: H\'%.8x", sig->variableData[nextPos]);
121 nextPos++;
122 printed = true;
123 }
124
125 Uint32 tmp = LqhKeyReq::getLastReplicaNo(reqInfo) -
126 LqhKeyReq::getSeqNoReplica(reqInfo);
127 if(tmp > 1){
128 NodeId node2 = sig->variableData[nextPos] & 0xffff;
129 NodeId node3 = sig->variableData[nextPos] >> 16;
130 fprintf(output, " NextNodeId2: %d NextNodeId3: %d",
131 node2, node3);
132 nextPos ++;
133 printed = true;
134 }
135 if(printed)
136 fprintf(output, "\n");
137
138 printed = false;
139 if(LqhKeyReq::getStoredProcFlag(attrLen)){
140 fprintf(output, " StoredProcId: %d", sig->variableData[nextPos]);
141 nextPos++;
142 printed = true;
143 }
144
145 if(LqhKeyReq::getReturnedReadLenAIFlag(reqInfo)){
146 fprintf(output, " ReturnedReadLenAI: %d",
147 sig->variableData[nextPos]);
148 nextPos++;
149 printed = true;
150 }
151
152 const UintR keyLen = LqhKeyReq::getKeyLen(reqInfo);
153 if(keyLen > 0){
154 fprintf(output, " KeyInfo: ");
155 for(UintR i = 0; i<keyLen && i<4; i++, nextPos++)
156 fprintf(output, "H\'%.8x ", sig->variableData[nextPos]);
157 fprintf(output, "\n");
158 }
159
160 if (LqhKeyReq::getRowidFlag(reqInfo))
161 {
162 fprintf(output, " Rowid: [ page: %d idx: %d ]\n",
163 sig->variableData[nextPos + 0],
164 sig->variableData[nextPos + 1]);
165 nextPos += 2;
166 }
167
168 if (LqhKeyReq::getGCIFlag(reqInfo))
169 {
170 fprintf(output, " GCI: %u", sig->variableData[nextPos + 0]);
171 nextPos++;
172 }
173
174 if (LqhKeyReq::getCorrFactorFlag(reqInfo))
175 {
176 fprintf(output, " corrFactorLo: 0x%x", sig->variableData[nextPos + 0]);
177 nextPos++;
178 fprintf(output, " corrFactorHi: 0x%x", sig->variableData[nextPos + 0]);
179 nextPos++;
180 }
181
182 if(!LqhKeyReq::getInterpretedFlag(reqInfo)){
183 fprintf(output, " AttrInfo: ");
184 for(int i = 0; i<LqhKeyReq::getAIInLqhKeyReq(reqInfo); i++, nextPos++)
185 fprintf(output, "H\'%.8x ", sig->variableData[nextPos]);
186 fprintf(output, "\n");
187 } else {
188 /* Only have section sizes if it's a short LQHKEYREQ */
189 if (LqhKeyReq::getAIInLqhKeyReq(reqInfo) == LqhKeyReq::MaxAttrInfo)
190 {
191 fprintf(output, " InitialReadSize: %d InterpretedSize: %d "
192 "FinalUpdateSize: %d FinalReadSize: %d SubroutineSize: %d\n",
193 sig->variableData[nextPos+0], sig->variableData[nextPos+1],
194 sig->variableData[nextPos+2], sig->variableData[nextPos+3],
195 sig->variableData[nextPos+4]);
196 nextPos += 5;
197 }
198 }
199 return true;
200 }
201
202 bool
printLQHKEYCONF(FILE * output,const Uint32 * theData,Uint32 len,Uint16 receiverBlockNo)203 printLQHKEYCONF(FILE * output, const Uint32 * theData, Uint32 len, Uint16 receiverBlockNo){
204 // const LqhKeyConf * const sig = (LqhKeyConf *) theData;
205
206 fprintf(output, "Signal data: ");
207 Uint32 i = 0;
208 while (i < len)
209 fprintf(output, "H\'%.8x ", theData[i++]);
210 fprintf(output,"\n");
211
212 return true;
213 }
214
215 bool
printLQHKEYREF(FILE * output,const Uint32 * theData,Uint32 len,Uint16 receiverBlockNo)216 printLQHKEYREF(FILE * output, const Uint32 * theData, Uint32 len, Uint16 receiverBlockNo){
217 // const LqhKeyRef * const sig = (LqhKeyRef *) theData;
218
219 fprintf(output, "Signal data: ");
220 Uint32 i = 0;
221 while (i < len)
222 fprintf(output, "H\'%.8x ", theData[i++]);
223 fprintf(output,"\n");
224
225 return true;
226 }
227