summaryrefslogtreecommitdiff
path: root/storage/ndb/src/kernel/blocks/dblqh/redoLogReader/records.hpp
blob: 49d69354b2a75eca022cf9023f7c73a55cfe291c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
/* Copyright (C) 2003 MySQL AB

   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
   the Free Software Foundation; version 2 of the License.

   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU General Public License for more details.

   You should have received a copy of the GNU General Public License
   along with this program; if not, write to the Free Software
   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */

#include <NdbMain.h>
#include <NdbOut.hpp>
#include <ndb_types.h>

#define ZNEW_PREP_OP_TYPE 0
#define ZPREP_OP_TYPE 1
#define ZCOMMIT_TYPE 2
#define ZABORT_TYPE 3
#define ZFD_TYPE 4
#define ZFRAG_SPLIT_TYPE 5
#define ZNEXT_LOG_RECORD_TYPE 6
#define ZNEXT_MBYTE_TYPE 7
#define ZCOMPLETED_GCI_TYPE 8
#define ZINVALID_COMMIT_TYPE 9

#define MAX_FILE_DESCRIPTORS 40
#define NO_MBYTE_IN_FILE 16

#define PAGESIZE 8192
#define NO_PAGES_IN_MBYTE 32
#define NO_MBYTE_IN_FILE 16

#define COMMITTRANSACTIONRECORDSIZE 9
#define COMPLETEDGCIRECORDSIZE 2
#define PAGEHEADERSIZE 32
#define FILEDESCRIPTORHEADERSIZE 3
#define FILEDESCRIPTORRECORDSIZE 48
#define NEXTMBYTERECORDSIZE 1
#define ABORTTRANSACTIONRECORDSIZE 3


//----------------------------------------------------------------
// 
//----------------------------------------------------------------

class AbortTransactionRecord {
  friend NdbOut& operator<<(NdbOut&, const AbortTransactionRecord&);
public:
  bool check();
  Uint32 getLogRecordSize();
protected:
  Uint32 m_recordType;
  Uint32 m_transactionId1;
  Uint32 m_transactionId2;
};


//----------------------------------------------------------------
// 
//----------------------------------------------------------------

class NextMbyteRecord {
  friend NdbOut& operator<<(NdbOut&, const NextMbyteRecord&);
public:
  bool check();
  Uint32 getLogRecordSize();
protected:
  Uint32 m_recordType;
};

//----------------------------------------------------------------
// 
//----------------------------------------------------------------


class PrepareOperationRecord {
  friend NdbOut& operator<<(NdbOut&, const PrepareOperationRecord&);
public:
  bool check();
  Uint32 getLogRecordSize(Uint32 wordsRead);

protected:
  Uint32 m_recordType;
  Uint32 m_logRecordSize;
  Uint32 m_hashValue;
  Uint32 m_operationType; // 0 READ, 1 UPDATE, 2 INSERT, 3 DELETE
  Uint32 m_attributeLength;
  Uint32 m_keyLength;
  Uint32 m_page_no;
  Uint32 m_page_idx;
  Uint32 *m_keyInfo; // In this order
  Uint32 *m_attrInfo;// In this order
};

//----------------------------------------------------------------
// 
//----------------------------------------------------------------

class CompletedGCIRecord {
  friend NdbOut& operator<<(NdbOut&, const CompletedGCIRecord&);
public:
  bool check();
  Uint32 getLogRecordSize();
protected:
  Uint32 m_recordType;
  Uint32 m_theCompletedGCI;
};

//----------------------------------------------------------------
// 
//----------------------------------------------------------------

class NextLogRecord {
  friend NdbOut& operator<<(NdbOut&, const NextLogRecord&);
public:
  bool check();
  Uint32 getLogRecordSize(Uint32);
protected:
  Uint32 m_recordType;
};

//----------------------------------------------------------------
// 
//----------------------------------------------------------------

class PageHeader {
  friend NdbOut& operator<<(NdbOut&, const PageHeader&);
public:
  bool check();
  Uint32 getLogRecordSize();
  bool lastPage();
  Uint32 lastWord();
protected:
  Uint32 m_checksum;
  Uint32 m_lap;
  Uint32 m_max_gci_completed;
  Uint32 m_max_gci_started;
  Uint32 m_next_page;
  Uint32 m_previous_page;
  Uint32 m_ndb_version;
  Uint32 m_number_of_logfiles;
  Uint32 m_current_page_index;
  Uint32 m_old_prepare_file_number;
  Uint32 m_old_prepare_page_reference;
  Uint32 m_dirty_flag;
/* Debug info Start */
  Uint32 m_log_timer;
  Uint32 m_page_i_value;
  Uint32 m_place_written_from;
  Uint32 m_page_no;
  Uint32 m_file_no;
  Uint32 m_word_written;
  Uint32 m_in_writing_flag;
  Uint32 m_prev_page_no;
  Uint32 m_in_free_list;
/* Debug info End */
};

//----------------------------------------------------------------
// File descriptor.
//----------------------------------------------------------------

class FileDescriptorHeader {
public:
 Uint32 m_recordType;
  Uint32 m_noOfDescriptors;
  Uint32 m_fileNo;
};

class FileDescriptorRecord {
public:
  Uint32 m_maxGciCompleted[16];
  Uint32 m_maxGciStarted[16];
  Uint32 m_lastPreparedReference[16];
};

class FileDescriptor {
  friend NdbOut& operator<<(NdbOut&, const FileDescriptor&);
public:
  bool check();
  Uint32 getLogRecordSize();
protected:
  void printARecord( Uint32 ) const;
  FileDescriptorHeader m_fdHeader;
  FileDescriptorRecord m_fdRecord[1];
};


//----------------------------------------------------------------
// 
//----------------------------------------------------------------

class CommitTransactionRecord {
  friend NdbOut& operator<<(NdbOut&, const CommitTransactionRecord&);
public:
  bool check();
  Uint32 getLogRecordSize();
protected:
  Uint32 m_recordType;
  Uint32 m_tableId;
  Uint32 m_schemaVersion;
  Uint32 m_fragmentId;
  Uint32 m_fileNumberOfPrepareOperation;
  Uint32 m_startPageNumberOfPrepareOperation;
  Uint32 m_startPageIndexOfPrepareOperation;
  Uint32 m_stopPageNumberOfPrepareOperation;
  Uint32 m_globalCheckpoint;
};

//----------------------------------------------------------------
// 
//----------------------------------------------------------------

class InvalidCommitTransactionRecord {
  friend NdbOut& operator<<(NdbOut&, const InvalidCommitTransactionRecord&);
public:
  bool check();
  Uint32 getLogRecordSize();
protected:
  Uint32 m_recordType;
  Uint32 m_tableId;
  Uint32 m_fragmentId;
  Uint32 m_fileNumberOfPrepareOperation;
  Uint32 m_startPageNumberOfPrepareOperation;
  Uint32 m_startPageIndexOfPrepareOperation;
  Uint32 m_stopPageNumberOfPrepareOperation;
  Uint32 m_globalCheckpoint;
};

//----------------------------------------------------------------
// 
//----------------------------------------------------------------

struct NextLogRec {

};

struct NewPrepareOperation {

};

struct FragmentSplit {

};