MySQL 5.6.14 Source Code Document
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
records.hpp
1 /*
2  Copyright (C) 2003, 2005-2007 MySQL AB, 2009 Sun Microsystems, Inc.
3  All rights reserved. Use is subject to license terms.
4 
5  This program is free software; you can redistribute it and/or modify
6  it under the terms of the GNU General Public License as published by
7  the Free Software Foundation; version 2 of the License.
8 
9  This program is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  GNU General Public License for more details.
13 
14  You should have received a copy of the GNU General Public License
15  along with this program; if not, write to the Free Software
16  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17 */
18 
19 #include <NdbMain.h>
20 #include <NdbOut.hpp>
21 #include <ndb_types.h>
22 
23 #define ZNEW_PREP_OP_TYPE 0
24 #define ZPREP_OP_TYPE 1
25 #define ZCOMMIT_TYPE 2
26 #define ZABORT_TYPE 3
27 #define ZFD_TYPE 4
28 #define ZFRAG_SPLIT_TYPE 5
29 #define ZNEXT_LOG_RECORD_TYPE 6
30 #define ZNEXT_MBYTE_TYPE 7
31 #define ZCOMPLETED_GCI_TYPE 8
32 #define ZINVALID_COMMIT_TYPE 9
33 
34 #define MAX_FILE_DESCRIPTORS 40
35 
36 #define PAGESIZE 8192
37 #define NO_PAGES_IN_MBYTE 32
38 
39 #define COMMITTRANSACTIONRECORDSIZE 9
40 #define COMPLETEDGCIRECORDSIZE 2
41 #define PAGEHEADERSIZE 32
42 #define FILEDESCRIPTORHEADERSIZE 3
43 #define FILEDESCRIPTORENTRYSIZE 3
44 #define NEXTMBYTERECORDSIZE 1
45 #define ABORTTRANSACTIONRECORDSIZE 3
46 
47 extern unsigned NO_MBYTE_IN_FILE;
48 
49 //----------------------------------------------------------------
50 //
51 //----------------------------------------------------------------
52 
54  friend NdbOut& operator<<(NdbOut&, const AbortTransactionRecord&);
55 public:
56  bool check();
57  Uint32 getLogRecordSize();
58 protected:
59  Uint32 m_recordType;
60  Uint32 m_transactionId1;
61  Uint32 m_transactionId2;
62 };
63 
64 
65 //----------------------------------------------------------------
66 //
67 //----------------------------------------------------------------
68 
70  friend NdbOut& operator<<(NdbOut&, const NextMbyteRecord&);
71 public:
72  bool check();
73  Uint32 getLogRecordSize();
74 protected:
75  Uint32 m_recordType;
76 };
77 
78 //----------------------------------------------------------------
79 //
80 //----------------------------------------------------------------
81 
82 
84  friend NdbOut& operator<<(NdbOut&, const PrepareOperationRecord&);
85 public:
86  bool check();
87  Uint32 getLogRecordSize(Uint32 wordsRead);
88 
89 protected:
90  Uint32 m_recordType;
91  Uint32 m_logRecordSize;
92  Uint32 m_hashValue;
93  Uint32 m_operationType; // 0 READ, 1 UPDATE, 2 INSERT, 3 DELETE
94  Uint32 m_attributeLength;
95  Uint32 m_keyLength;
96  Uint32 m_page_no;
97  Uint32 m_page_idx;
98  Uint32 *m_keyInfo; // In this order
99  Uint32 *m_attrInfo;// In this order
100 };
101 
102 //----------------------------------------------------------------
103 //
104 //----------------------------------------------------------------
105 
107  friend NdbOut& operator<<(NdbOut&, const CompletedGCIRecord&);
108 public:
109  bool check();
110  Uint32 getLogRecordSize();
111 protected:
112  Uint32 m_recordType;
113  Uint32 m_theCompletedGCI;
114 };
115 
116 //----------------------------------------------------------------
117 //
118 //----------------------------------------------------------------
119 
121  friend NdbOut& operator<<(NdbOut&, const NextLogRecord&);
122 public:
123  bool check();
124  Uint32 getLogRecordSize(Uint32);
125 protected:
126  Uint32 m_recordType;
127 };
128 
129 //----------------------------------------------------------------
130 //
131 //----------------------------------------------------------------
132 
133 class PageHeader {
134  friend NdbOut& operator<<(NdbOut&, const PageHeader&);
135 public:
136  bool check();
137  Uint32 getLogRecordSize();
138  bool lastPage();
139  Uint32 lastWord();
140 //protected:
141  Uint32 m_checksum;
142  Uint32 m_lap;
143  Uint32 m_max_gci_completed;
144  Uint32 m_max_gci_started;
145  Uint32 m_next_page;
146  Uint32 m_previous_page;
147  Uint32 m_ndb_version;
148  Uint32 m_number_of_logfiles;
149  Uint32 m_current_page_index;
150  Uint32 m_old_prepare_file_number;
151  Uint32 m_old_prepare_page_reference;
152  Uint32 m_dirty_flag;
153 /* Debug info Start */
154  Uint32 m_log_timer;
155  Uint32 m_page_i_value;
156  Uint32 m_place_written_from;
157  Uint32 m_page_no;
158  Uint32 m_file_no;
159  Uint32 m_word_written;
160  Uint32 m_in_writing_flag;
161  Uint32 m_prev_page_no;
162  Uint32 m_in_free_list;
163 /* Debug info End */
164 };
165 
166 //----------------------------------------------------------------
167 // File descriptor.
168 //----------------------------------------------------------------
169 
171 public:
172  Uint32 m_recordType;
173  Uint32 m_noOfDescriptors;
174  Uint32 m_fileNo;
175 };
176 
178 {
179  friend NdbOut& operator<<(NdbOut&, const FileDescriptor&);
180 public:
181  bool check();
182  Uint32 getLogRecordSize();
183 protected:
184  void printARecord( Uint32 ) const;
185  FileDescriptorHeader m_fdHeader;
186  Uint32 m_fdRecord[1];
187 };
188 
189 
190 //----------------------------------------------------------------
191 //
192 //----------------------------------------------------------------
193 
195  friend NdbOut& operator<<(NdbOut&, const CommitTransactionRecord&);
196 public:
197  bool check();
198  Uint32 getLogRecordSize();
199 protected:
200  Uint32 m_recordType;
201  Uint32 m_tableId;
202  Uint32 m_schemaVersion;
203  Uint32 m_fragmentId;
204  Uint32 m_fileNumberOfPrepareOperation;
205  Uint32 m_startPageNumberOfPrepareOperation;
206  Uint32 m_startPageIndexOfPrepareOperation;
207  Uint32 m_stopPageNumberOfPrepareOperation;
208  Uint32 m_globalCheckpoint;
209 };
210 
211 //----------------------------------------------------------------
212 //
213 //----------------------------------------------------------------
214 
216  friend NdbOut& operator<<(NdbOut&, const InvalidCommitTransactionRecord&);
217 public:
218  bool check();
219  Uint32 getLogRecordSize();
220 protected:
221  Uint32 m_recordType;
222  Uint32 m_tableId;
223  Uint32 m_fragmentId;
224  Uint32 m_fileNumberOfPrepareOperation;
225  Uint32 m_startPageNumberOfPrepareOperation;
226  Uint32 m_startPageIndexOfPrepareOperation;
227  Uint32 m_stopPageNumberOfPrepareOperation;
228  Uint32 m_globalCheckpoint;
229 };
230 
231 //----------------------------------------------------------------
232 //
233 //----------------------------------------------------------------
234 
235 struct NextLogRec {
236 
237 };
238 
240 
241 };
242 
244 
245 };