MySQL 5.6.14 Source Code Document
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
SchemaTransImpl.cpp
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 as published by
6  the Free Software Foundation; version 2 of the License.
7 
8  This program is distributed in the hope that it will be useful,
9  but WITHOUT ANY WARRANTY; without even the implied warranty of
10  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  GNU General Public License for more details.
12 
13  You should have received a copy of the GNU General Public License
14  along with this program; if not, write to the Free Software
15  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */
16 
17 #include <signaldata/SchemaTransImpl.hpp>
18 #include <signaldata/DictSignal.hpp>
19 #include <signaldata/SignalData.hpp>
20 #include <SignalLoggerManager.hpp>
21 #include <DebuggerNames.hpp>
22 
23 bool
24 printSCHEMA_TRANS_IMPL_REQ(FILE* output, const Uint32* theData,
25  Uint32 len, Uint16 rbn)
26 {
27  const SchemaTransImplReq* sig = (const SchemaTransImplReq*)theData;
28  //const Uint32 phaseInfo = sig->phaseInfo;
29  //Uint32 mode = SchemaTransImplReq::getMode(phaseInfo);
30  //Uint32 phase = SchemaTransImplReq::getPhase(phaseInfo);
31  const Uint32 requestInfo = sig->requestInfo;
32  const Uint32 rt = DictSignal::getRequestType(requestInfo);
33  Uint32 opExtra = DictSignal::getRequestExtra(requestInfo);
34  //const Uint32 operationInfo = sig->operationInfo;
35  //Uint32 opIndex = SchemaTransImplReq::getOpIndex(operationInfo);
36  //Uint32 opDepth = SchemaTransImplReq::getOpDepth(operationInfo);
37  //const Uint32 iteratorInfo = sig->iteratorInfo;
38  //Uint32 listId = SchemaTransImplReq::getListId(iteratorInfo);
39  //Uint32 listIndex = SchemaTransImplReq::getListIndex(iteratorInfo);
40  //Uint32 itRepeat = SchemaTransImplReq::getItRepeat(iteratorInfo);
41  fprintf(output, " senderRef: 0x%x", sig->senderRef);
42  fprintf(output, " transKey: %u", sig->transKey);
43  fprintf(output, " opKey: %u", sig->opKey);
44  fprintf(output, "\n");
45 /*
46  fprintf(output, " mode: %u [%s] phase: %u [%s]",
47  mode, DictSignal::getTransModeName(mode),
48  phase, DictSignal::getTransPhaseName(phase));
49  fprintf(output, "\n");
50 */
51  fprintf(output, " requestInfo: 0x%x", requestInfo);
52  switch(rt) {
53  case(SchemaTransImplReq::RT_START):
54  fprintf(output, " RequestType: RT_START");
55  break;
56  case(SchemaTransImplReq::RT_PARSE):
57  fprintf(output, " RequestType: RT_PARSE");
58  break;
59  case(SchemaTransImplReq::RT_FLUSH_PREPARE):
60  fprintf(output, " RequestType: RT_FLUSH_PREPARE");
61  break;
62  case(SchemaTransImplReq::RT_PREPARE):
63  fprintf(output, " RequestType: RT_PREPARE");
64  break;
65  case(SchemaTransImplReq::RT_ABORT_PARSE):
66  fprintf(output, " RequestType: RT_ABORT_PARSE");
67  break;
68  case(SchemaTransImplReq::RT_ABORT_PREPARE):
69  fprintf(output, " RequestType: RT_ABORT_PREPARE");
70  break;
71  case(SchemaTransImplReq::RT_FLUSH_COMMIT):
72  fprintf(output, " RequestType: RT_FLUSH_COMMIT");
73  break;
74  case(SchemaTransImplReq::RT_COMMIT):
75  fprintf(output, " RequestType: RT_COMMIT");
76  break;
77  case(SchemaTransImplReq::RT_FLUSH_COMPLETE):
78  fprintf(output, " RequestType: RT_FLUSH_COMPLETE");
79  break;
80  case(SchemaTransImplReq::RT_COMPLETE):
81  fprintf(output, " RequestType: RT_COMPLETE");
82  break;
83  case(SchemaTransImplReq::RT_END):
84  fprintf(output, " RequestType: RT_END");
85  break;
86  }
87  fprintf(output, " opExtra: %u", opExtra);
88  fprintf(output, " requestFlags: [%s]",
89  DictSignal::getRequestFlagsText(requestInfo));
90  fprintf(output, "\n");
91 // fprintf(output, " opIndex: %u", opIndex);
92 // fprintf(output, " opDepth: %u", opDepth);
93 // fprintf(output, "\n");
94 // fprintf(output, " listId: %u", listId);
95 // fprintf(output, " listIndex: %u", listIndex);
96 // fprintf(output, " itRepeat: %u", itRepeat);
97 // fprintf(output, "\n");
98  if (len == SchemaTransImplReq::SignalLength)
99  fprintf(output, " clientRef: 0x%x", sig->start.clientRef);
100  fprintf(output, " transId: 0x%x", sig->transId);
101  fprintf(output, "\n");
102  const Uint32 fixed_len = SchemaTransImplReq::SignalLength;
103  if (len > fixed_len) {
104  Uint32 gsn = sig->parse.gsn;
105  fprintf(output, "piggy-backed: %u %s\n", gsn, getSignalName(gsn));
106  const Uint32* pb_data = &theData[fixed_len];
107  const Uint32 pb_len = len - fixed_len;
108  switch (gsn) {
109  // internal operation signals
110  case GSN_SCHEMA_TRANS_BEGIN_REQ:
111  printSCHEMA_TRANS_BEGIN_REQ(output, pb_data, pb_len, rbn);
112  break;
113  case GSN_CREATE_TAB_REQ:
114  printCREATE_TAB_REQ(output, pb_data, pb_len, rbn);
115  break;
116  case GSN_DROP_TAB_REQ:
117  printDROP_TAB_REQ(output, pb_data, pb_len, rbn);
118  break;
119  case GSN_ALTER_TAB_REQ:
120  printALTER_TAB_REQ(output, pb_data, pb_len, rbn);
121  break;
122  case GSN_CREATE_TRIG_IMPL_REQ:
123  printCREATE_TRIG_IMPL_REQ(output, pb_data, pb_len, rbn);
124  break;
125  case GSN_DROP_TRIG_IMPL_REQ:
126  printDROP_TRIG_IMPL_REQ(output, pb_data, pb_len, rbn);
127  break;
128  case GSN_CREATE_INDX_IMPL_REQ:
129  printCREATE_INDX_IMPL_REQ(output, pb_data, pb_len, rbn);
130  break;
131  case GSN_DROP_INDX_IMPL_REQ:
132  printDROP_INDX_IMPL_REQ(output, pb_data, pb_len, rbn);
133  break;
134  case GSN_ALTER_INDX_IMPL_REQ:
135  printALTER_INDX_IMPL_REQ(output, pb_data, pb_len, rbn);
136  break;
137  case GSN_BUILD_INDX_IMPL_REQ:
138  printBUILD_INDX_IMPL_REQ(output, pb_data, pb_len, rbn);
139  break;
140  case GSN_INDEX_STAT_IMPL_REQ:
141  printINDEX_STAT_IMPL_REQ(output, pb_data, pb_len, rbn);
142  break;
143  default:
144  {
145  Uint32 i;
146  for (i = 0; i < len - fixed_len; i++) {
147  if (i > 0 && i % 7 == 0)
148  fprintf(output, "\n");
149  fprintf(output, " H'%08x", theData[fixed_len + i]);
150  }
151  fprintf(output, "\n");
152  }
153  break;
154  }
155  }
156  return true;
157 }
158 
159 bool
160 printSCHEMA_TRANS_IMPL_CONF(FILE* output, const Uint32* theData, Uint32 len, Uint16 rbn)
161 {
162  const SchemaTransImplConf* sig = (const SchemaTransImplConf*)theData;
163  fprintf(output, " senderRef: 0x%x", sig->senderRef);
164  fprintf(output, " transKey: %u", sig->transKey);
165  fprintf(output, "\n");
166  return true;
167 }
168 
169 bool
170 printSCHEMA_TRANS_IMPL_REF(FILE* output, const Uint32* theData, Uint32 len, Uint16 rbn)
171 {
172  const SchemaTransImplRef* sig = (const SchemaTransImplRef*)theData;
173  fprintf(output, " senderRef: 0x%x", sig->senderRef);
174  fprintf(output, " transKey: %u", sig->transKey);
175  fprintf(output, "\n");
176  fprintf(output, " errorCode: %u", sig->errorCode);
177  fprintf(output, " errorLine: %u", sig->errorLine);
178  fprintf(output, "\n");
179  return true;
180 }