1 /* Copyright (C) 2007, 2008 MySQL AB, 2008 Sun Microsystems, Inc.
2 All rights reserved. Use is subject to license terms.
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 Street, Fifth Floor, Boston, MA 02110-1301, USA */
23
24 #include <signaldata/SchemaTransImpl.hpp>
25 #include <signaldata/DictSignal.hpp>
26 #include <signaldata/SignalData.hpp>
27 #include <SignalLoggerManager.hpp>
28 #include <DebuggerNames.hpp>
29
30 bool
printSCHEMA_TRANS_IMPL_REQ(FILE * output,const Uint32 * theData,Uint32 len,Uint16 rbn)31 printSCHEMA_TRANS_IMPL_REQ(FILE* output, const Uint32* theData,
32 Uint32 len, Uint16 rbn)
33 {
34 const SchemaTransImplReq* sig = (const SchemaTransImplReq*)theData;
35 //const Uint32 phaseInfo = sig->phaseInfo;
36 //Uint32 mode = SchemaTransImplReq::getMode(phaseInfo);
37 //Uint32 phase = SchemaTransImplReq::getPhase(phaseInfo);
38 const Uint32 requestInfo = sig->requestInfo;
39 const Uint32 rt = DictSignal::getRequestType(requestInfo);
40 Uint32 opExtra = DictSignal::getRequestExtra(requestInfo);
41 //const Uint32 operationInfo = sig->operationInfo;
42 //Uint32 opIndex = SchemaTransImplReq::getOpIndex(operationInfo);
43 //Uint32 opDepth = SchemaTransImplReq::getOpDepth(operationInfo);
44 //const Uint32 iteratorInfo = sig->iteratorInfo;
45 //Uint32 listId = SchemaTransImplReq::getListId(iteratorInfo);
46 //Uint32 listIndex = SchemaTransImplReq::getListIndex(iteratorInfo);
47 //Uint32 itRepeat = SchemaTransImplReq::getItRepeat(iteratorInfo);
48 fprintf(output, " senderRef: 0x%x", sig->senderRef);
49 fprintf(output, " transKey: %u", sig->transKey);
50 fprintf(output, " opKey: %u", sig->opKey);
51 fprintf(output, "\n");
52 /*
53 fprintf(output, " mode: %u [%s] phase: %u [%s]",
54 mode, DictSignal::getTransModeName(mode),
55 phase, DictSignal::getTransPhaseName(phase));
56 fprintf(output, "\n");
57 */
58 fprintf(output, " requestInfo: 0x%x", requestInfo);
59 switch(rt) {
60 case(SchemaTransImplReq::RT_START):
61 fprintf(output, " RequestType: RT_START");
62 break;
63 case(SchemaTransImplReq::RT_PARSE):
64 fprintf(output, " RequestType: RT_PARSE");
65 break;
66 case(SchemaTransImplReq::RT_FLUSH_PREPARE):
67 fprintf(output, " RequestType: RT_FLUSH_PREPARE");
68 break;
69 case(SchemaTransImplReq::RT_PREPARE):
70 fprintf(output, " RequestType: RT_PREPARE");
71 break;
72 case(SchemaTransImplReq::RT_ABORT_PARSE):
73 fprintf(output, " RequestType: RT_ABORT_PARSE");
74 break;
75 case(SchemaTransImplReq::RT_ABORT_PREPARE):
76 fprintf(output, " RequestType: RT_ABORT_PREPARE");
77 break;
78 case(SchemaTransImplReq::RT_FLUSH_COMMIT):
79 fprintf(output, " RequestType: RT_FLUSH_COMMIT");
80 break;
81 case(SchemaTransImplReq::RT_COMMIT):
82 fprintf(output, " RequestType: RT_COMMIT");
83 break;
84 case(SchemaTransImplReq::RT_FLUSH_COMPLETE):
85 fprintf(output, " RequestType: RT_FLUSH_COMPLETE");
86 break;
87 case(SchemaTransImplReq::RT_COMPLETE):
88 fprintf(output, " RequestType: RT_COMPLETE");
89 break;
90 case(SchemaTransImplReq::RT_END):
91 fprintf(output, " RequestType: RT_END");
92 break;
93 }
94 fprintf(output, " opExtra: %u", opExtra);
95 fprintf(output, " requestFlags: [%s]",
96 DictSignal::getRequestFlagsText(requestInfo));
97 fprintf(output, "\n");
98 // fprintf(output, " opIndex: %u", opIndex);
99 // fprintf(output, " opDepth: %u", opDepth);
100 // fprintf(output, "\n");
101 // fprintf(output, " listId: %u", listId);
102 // fprintf(output, " listIndex: %u", listIndex);
103 // fprintf(output, " itRepeat: %u", itRepeat);
104 // fprintf(output, "\n");
105 if (len == SchemaTransImplReq::SignalLength)
106 fprintf(output, " clientRef: 0x%x", sig->start.clientRef);
107 fprintf(output, " transId: 0x%x", sig->transId);
108 fprintf(output, "\n");
109 const Uint32 fixed_len = SchemaTransImplReq::SignalLength;
110 if (len > fixed_len) {
111 Uint32 gsn = sig->parse.gsn;
112 fprintf(output, "piggy-backed: %u %s\n", gsn, getSignalName(gsn));
113 const Uint32* pb_data = &theData[fixed_len];
114 const Uint32 pb_len = len - fixed_len;
115 switch (gsn) {
116 // internal operation signals
117 case GSN_SCHEMA_TRANS_BEGIN_REQ:
118 printSCHEMA_TRANS_BEGIN_REQ(output, pb_data, pb_len, rbn);
119 break;
120 case GSN_CREATE_TAB_REQ:
121 printCREATE_TAB_REQ(output, pb_data, pb_len, rbn);
122 break;
123 case GSN_DROP_TAB_REQ:
124 printDROP_TAB_REQ(output, pb_data, pb_len, rbn);
125 break;
126 case GSN_ALTER_TAB_REQ:
127 printALTER_TAB_REQ(output, pb_data, pb_len, rbn);
128 break;
129 case GSN_CREATE_TRIG_IMPL_REQ:
130 printCREATE_TRIG_IMPL_REQ(output, pb_data, pb_len, rbn);
131 break;
132 case GSN_DROP_TRIG_IMPL_REQ:
133 printDROP_TRIG_IMPL_REQ(output, pb_data, pb_len, rbn);
134 break;
135 case GSN_CREATE_INDX_IMPL_REQ:
136 printCREATE_INDX_IMPL_REQ(output, pb_data, pb_len, rbn);
137 break;
138 case GSN_DROP_INDX_IMPL_REQ:
139 printDROP_INDX_IMPL_REQ(output, pb_data, pb_len, rbn);
140 break;
141 case GSN_ALTER_INDX_IMPL_REQ:
142 printALTER_INDX_IMPL_REQ(output, pb_data, pb_len, rbn);
143 break;
144 case GSN_BUILD_INDX_IMPL_REQ:
145 printBUILD_INDX_IMPL_REQ(output, pb_data, pb_len, rbn);
146 break;
147 case GSN_INDEX_STAT_IMPL_REQ:
148 printINDEX_STAT_IMPL_REQ(output, pb_data, pb_len, rbn);
149 break;
150 default:
151 {
152 Uint32 i;
153 for (i = 0; i < len - fixed_len; i++) {
154 if (i > 0 && i % 7 == 0)
155 fprintf(output, "\n");
156 fprintf(output, " H'%08x", theData[fixed_len + i]);
157 }
158 fprintf(output, "\n");
159 }
160 break;
161 }
162 }
163 return true;
164 }
165
166 bool
printSCHEMA_TRANS_IMPL_CONF(FILE * output,const Uint32 * theData,Uint32 len,Uint16 rbn)167 printSCHEMA_TRANS_IMPL_CONF(FILE* output, const Uint32* theData, Uint32 len, Uint16 rbn)
168 {
169 const SchemaTransImplConf* sig = (const SchemaTransImplConf*)theData;
170 fprintf(output, " senderRef: 0x%x", sig->senderRef);
171 fprintf(output, " transKey: %u", sig->transKey);
172 fprintf(output, "\n");
173 return true;
174 }
175
176 bool
printSCHEMA_TRANS_IMPL_REF(FILE * output,const Uint32 * theData,Uint32 len,Uint16 rbn)177 printSCHEMA_TRANS_IMPL_REF(FILE* output, const Uint32* theData, Uint32 len, Uint16 rbn)
178 {
179 const SchemaTransImplRef* sig = (const SchemaTransImplRef*)theData;
180 fprintf(output, " senderRef: 0x%x", sig->senderRef);
181 fprintf(output, " transKey: %u", sig->transKey);
182 fprintf(output, "\n");
183 fprintf(output, " errorCode: %u", sig->errorCode);
184 fprintf(output, " errorLine: %u", sig->errorLine);
185 fprintf(output, "\n");
186 return true;
187 }
188