MySQL 5.6.14 Source Code Document
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ScanTab.cpp
1 /*
2  Copyright (c) 2003, 2010, 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 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 St, Fifth Floor, Boston, MA 02110-1301 USA
16 */
17 
18 
19 
20 #include <BlockNumbers.h>
21 #include <signaldata/ScanTab.hpp>
22 #include <signaldata/ScanFrag.hpp>
23 
24 bool
25 printSCANTABREQ(FILE * output, const Uint32 * theData, Uint32 len, Uint16 receiverBlockNo){
26 
27  const ScanTabReq * const sig = (ScanTabReq *) theData;
28 
29  const UintR requestInfo = sig->requestInfo;
30 
31  fprintf(output, " apiConnectPtr: H\'%.8x",
32  sig->apiConnectPtr);
33  fprintf(output, " requestInfo: H\'%.8x:\n", requestInfo);
34  fprintf(output, " Parallellism: %u Batch: %u LockMode: %u Keyinfo: %u Holdlock: %u RangeScan: %u Descending: %u TupScan: %u\n ReadCommitted: %u DistributionKeyFlag: %u NoDisk: %u spj: %u",
35  sig->getParallelism(requestInfo),
36  sig->getScanBatch(requestInfo),
37  sig->getLockMode(requestInfo),
38  sig->getKeyinfoFlag(requestInfo),
39  sig->getHoldLockFlag(requestInfo),
40  sig->getRangeScanFlag(requestInfo),
41  sig->getDescendingFlag(requestInfo),
42  sig->getTupScanFlag(requestInfo),
43  sig->getReadCommittedFlag(requestInfo),
44  sig->getDistributionKeyFlag(requestInfo),
45  sig->getNoDiskFlag(requestInfo),
46  sig->getViaSPJFlag(requestInfo));
47 
48  if(sig->getDistributionKeyFlag(requestInfo))
49  fprintf(output, " DKey: %x", sig->distributionKey);
50 
51  Uint32 keyLen = (sig->attrLenKeyLen >> 16);
52  Uint32 attrLen = (sig->attrLenKeyLen & 0xFFFF);
53  fprintf(output, " attrLen: %d, keyLen: %d tableId: %d, tableSchemaVer: %d\n",
54  attrLen, keyLen, sig->tableId, sig->tableSchemaVersion);
55 
56  fprintf(output, " transId(1, 2): (H\'%.8x, H\'%.8x) storedProcId: H\'%.8x\n",
57  sig->transId1, sig->transId2, sig->storedProcId);
58  fprintf(output, " batch_byte_size: %d, first_batch_size: %d\n",
59  sig->batch_byte_size, sig->first_batch_size);
60  return false;
61 }
62 
63 bool
64 printSCANTABCONF(FILE * output, const Uint32 * theData, Uint32 len, Uint16 receiverBlockNo){
65 
66  const ScanTabConf * const sig = (ScanTabConf *) theData;
67 
68  const UintR requestInfo = sig->requestInfo;
69 
70  fprintf(output, " apiConnectPtr: H\'%.8x\n",
71  sig->apiConnectPtr);
72  fprintf(output, " transId(1, 2): (H\'%.8x, H\'%.8x)\n",
73  sig->transId1, sig->transId2);
74 
75  fprintf(output, " requestInfo: Eod: %d OpCount: %d\n",
76  (requestInfo & ScanTabConf::EndOfData) == ScanTabConf::EndOfData,
77  (requestInfo & (~ScanTabConf::EndOfData)));
78  size_t op_count= requestInfo & (~ScanTabConf::EndOfData);
79  if (op_count)
80  {
81  fprintf(output, " Operation(s) [api tc rows len]:\n");
82  if (len == ScanTabConf::SignalLength + 4 * op_count)
83  {
84  ScanTabConf::OpData * op = (ScanTabConf::OpData*)
85  (theData + ScanTabConf::SignalLength);
86  for(size_t i = 0; i<op_count; i++)
87  {
88  fprintf(output, " [0x%x 0x%x %d %d]",
89  op->apiPtrI, op->tcPtrI,
90  op->rows, op->len);
91  op++;
92  }
93  }
94  else
95  {
96  assert(len == ScanTabConf::SignalLength + 3 * op_count);
97  for(size_t i = 0; i<op_count; i++)
98  {
99  ScanTabConf::OpData * op = (ScanTabConf::OpData*)
100  (theData + ScanTabConf::SignalLength + 3 * i);
101  fprintf(output, " [0x%x 0x%x %d %d]",
102  op->apiPtrI, op->tcPtrI,
103  ScanTabConf::getRows(op->rows),
104  ScanTabConf::getLength(op->rows));
105  }
106  }
107  fprintf(output, "\n");
108  }
109  return false;
110 }
111 
112 bool
113 printSCANTABREF(FILE * output, const Uint32 * theData, Uint32 len, Uint16 receiverBlockNo){
114 
115  const ScanTabRef * const sig = (ScanTabRef *) theData;
116 
117  fprintf(output, " apiConnectPtr: H\'%.8x\n",
118  sig->apiConnectPtr);
119 
120  fprintf(output, " transId(1, 2): (H\'%.8x, H\'%.8x)\n",
121  sig->transId1, sig->transId2);
122 
123  fprintf(output, " Errorcode: %u\n", sig->errorCode);
124 
125  fprintf(output, " closeNeeded: %u\n", sig->closeNeeded);
126  return false;
127 }
128 
129 
130 bool
131 printSCANFRAGNEXTREQ(FILE * output, const Uint32 * theData, Uint32 len, Uint16 receiverBlockNo){
132  const ScanFragNextReq * const sig = (ScanFragNextReq *) theData;
133 
134  fprintf(output, " senderData: H\'%.8x\n",
135  sig->senderData);
136 
137  fprintf(output, " transId(1, 2): (H\'%.8x, H\'%.8x)\n",
138  sig->transId1, sig->transId2);
139 
140  fprintf(output, " requestInfo: 0x%.8x\n", sig->requestInfo);
141 
142  fprintf(output, " batch_size_rows: %u\n", sig->batch_size_rows);
143  fprintf(output, " batch_size_bytes: %u\n", sig->batch_size_bytes);
144 
145  return false;
146 }
147 
148 bool
149 printSCANNEXTREQ(FILE * output, const Uint32 * theData, Uint32 len, Uint16 receiverBlockNo){
150 
151  if(receiverBlockNo == DBTC){
152  const ScanNextReq * const sig = (ScanNextReq *) theData;
153 
154  fprintf(output, " apiConnectPtr: H\'%.8x\n",
155  sig->apiConnectPtr);
156 
157  fprintf(output, " transId(1, 2): (H\'%.8x, H\'%.8x) ",
158  sig->transId1, sig->transId2);
159 
160  fprintf(output, " Stop this scan: %u\n", sig->stopScan);
161 
162  const Uint32 * ops = theData + ScanNextReq::SignalLength;
163  if(len > ScanNextReq::SignalLength){
164  fprintf(output, " tcFragPtr(s): ");
165  for(size_t i = ScanNextReq::SignalLength; i<len; i++)
166  fprintf(output, " 0x%x", * ops++);
167  fprintf(output, "\n");
168  }
169  }
170  if (receiverBlockNo == DBLQH){
171  return printSCANFRAGNEXTREQ(output, theData, len, receiverBlockNo);
172  }
173  return false;
174 }
175