19 #include "records.hpp"
21 void printOut(
const char *
string, Uint32 value) {
22 ndbout_c(
"%-30s%-12u%-12x",
string, value, value);
29 bool AbortTransactionRecord::check() {
34 Uint32 AbortTransactionRecord::getLogRecordSize() {
35 return ABORTTRANSACTIONRECORDSIZE;
39 no <<
"----------ABORT TRANSACTION RECORD-------------" << endl << endl;
40 printOut(
"Record type:", atr.m_recordType);
41 printOut(
"TransactionId1:", atr.m_transactionId1);
42 printOut(
"TransactionId2:", atr.m_transactionId2);
51 bool NextMbyteRecord::check() {
56 Uint32 NextMbyteRecord::getLogRecordSize() {
57 return NEXTMBYTERECORDSIZE;
61 no <<
"----------NEXT MBYTE RECORD--------------------" << endl << endl;
62 printOut(
"Record type:", nmr.m_recordType);
71 bool CommitTransactionRecord::check() {
76 Uint32 CommitTransactionRecord::getLogRecordSize() {
77 return COMMITTRANSACTIONRECORDSIZE;
81 no <<
"----------COMMIT TRANSACTION RECORD------------" << endl << endl;
82 printOut(
"Record type:", ctr.m_recordType);
83 printOut(
"TableId", ctr.m_tableId);
84 printOut(
"SchemaVersion:", ctr.m_schemaVersion);
85 printOut(
"FfragmentId", ctr.m_fragmentId);
86 printOut(
"File no. of Prep. Op.", ctr.m_fileNumberOfPrepareOperation);
87 printOut(
"Start page no. of Prep. Op.", ctr.m_startPageNumberOfPrepareOperation);
88 printOut(
"Start page index of Prep. Op.", ctr.m_startPageIndexOfPrepareOperation);
89 printOut(
"Stop page no. of Prep. Op.", ctr.m_stopPageNumberOfPrepareOperation);
90 printOut(
"GlobalCheckpoint", ctr.m_globalCheckpoint);
100 bool InvalidCommitTransactionRecord::check() {
105 Uint32 InvalidCommitTransactionRecord::getLogRecordSize() {
106 return COMMITTRANSACTIONRECORDSIZE;
110 no <<
"------INVALID COMMIT TRANSACTION RECORD--------" << endl << endl;
111 printOut(
"Record type:", ictr.m_recordType);
112 printOut(
"TableId", ictr.m_tableId);
113 printOut(
"FfragmentId", ictr.m_fragmentId);
114 printOut(
"File no. of Prep. Op.", ictr.m_fileNumberOfPrepareOperation);
115 printOut(
"Start page no. of Prep. Op.", ictr.m_startPageNumberOfPrepareOperation);
116 printOut(
"Start page index of Prep. Op.", ictr.m_startPageIndexOfPrepareOperation);
117 printOut(
"Stop page no. of Prep. Op.", ictr.m_stopPageNumberOfPrepareOperation);
118 printOut(
"GlobalCheckpoint", ictr.m_globalCheckpoint);
128 bool PrepareOperationRecord::check() {
130 if (m_operationType == 3 && m_attributeLength != 0)
133 if (m_logRecordSize != (m_attributeLength + m_keyLength + 8))
139 Uint32 PrepareOperationRecord::getLogRecordSize(Uint32 wordsRead) {
142 return m_logRecordSize;
146 no <<
"-----------PREPARE OPERATION RECORD------------" << endl << endl;
147 printOut(
"Record type:", por.m_recordType);
148 printOut(
"logRecordSize:", por.m_logRecordSize);
149 printOut(
"hashValue:", por.m_hashValue);
150 switch (por.m_operationType) {
152 ndbout_c(
"%-30s%-12u%-6s",
"operationType:",
153 por.m_operationType,
"read");
156 ndbout_c(
"%-30s%-12u%-6s",
"operationType:",
157 por.m_operationType,
"update");
160 ndbout_c(
"%-30s%-12u%-6s",
"operationType:",
161 por.m_operationType,
"insert");
164 ndbout_c(
"%-30s%-12u%-6s",
"operationType:",
165 por.m_operationType,
"delete");
168 printOut(
"operationType:", por.m_operationType);
170 printOut(
"page_no: ", por.m_page_no);
171 printOut(
"page_idx: ", por.m_page_idx);
172 printOut(
"attributeLength:", por.m_attributeLength);
173 printOut(
"keyLength:", por.m_keyLength);
177 Uint32* p = (Uint32*)&por.m_keyInfo;
178 for(Uint32
i=0;
i < por.m_keyLength;
i++){
179 printOut(
"keydata:", *p);
184 for(Uint32
i=0;
i < por.m_attributeLength;
i++){
185 printOut(
"attrdata:", *p);
198 bool CompletedGCIRecord::check() {
203 Uint32 CompletedGCIRecord::getLogRecordSize() {
204 return COMPLETEDGCIRECORDSIZE;
208 no <<
"-----------COMPLETED GCI RECORD----------------" << endl << endl;
209 printOut(
"Record type:", cGCIr.m_recordType);
210 printOut(
"Completed GCI:", cGCIr.m_theCompletedGCI);
219 bool NextLogRecord::check() {
224 Uint32 NextLogRecord::getLogRecordSize(Uint32 pageIndex) {
225 return PAGESIZE - pageIndex;
229 no <<
"-----------NEXT LOG RECORD --------------------" << endl << endl;
230 printOut(
"Record type:", nl.m_recordType);
239 Uint32 PageHeader::getLogRecordSize() {
240 return PAGEHEADERSIZE;
243 bool PageHeader::check() {
248 bool PageHeader::lastPage()
250 return m_next_page == 0xffffff00;
253 Uint32 PageHeader::lastWord()
255 return m_current_page_index;
259 NdbOut& operator<<(NdbOut& no,
const PageHeader& ph) {
260 no <<
"------------PAGE HEADER------------------------" << endl << endl;
261 ndbout_c(
"%-30s%-12s%-12s\n",
"",
"Decimal",
"Hex");
262 printOut(
"Checksum:", ph.m_checksum);
263 printOut(
"Laps since initial start:", ph.m_lap);
264 printOut(
"Max gci completed:", ph.m_max_gci_completed);
265 printOut(
"Max gci started:", ph.m_max_gci_started);
266 printOut(
"Ptr to next page:", ph.m_next_page);
267 printOut(
"Ptr to previous page:", ph.m_previous_page);
268 printOut(
"Ndb version:", ph.m_ndb_version);
269 printOut(
"Number of log files:", ph.m_number_of_logfiles);
270 printOut(
"Current page index:", ph.m_current_page_index);
271 printOut(
"Oldest prepare op. file No.:", ph.m_old_prepare_file_number);
272 printOut(
"Oldest prepare op. page ref.:", ph.m_old_prepare_page_reference);
273 printOut(
"Dirty flag:", ph.m_dirty_flag);
274 printOut(
"Write Timer:", ph.m_log_timer);
275 printOut(
"Page i-val:", ph.m_page_i_value);
276 printOut(
"Place written:", ph.m_place_written_from);
277 printOut(
"Page No in File:", ph.m_page_no);
278 printOut(
"File No:", ph.m_file_no);
279 printOut(
"Word Written:", ph.m_word_written);
280 printOut(
"In Writing (should be 1)", ph.m_in_writing_flag);
281 printOut(
"Prev Page No (can be garbage)", ph.m_prev_page_no);
282 printOut(
"In Free List (should be 0):", ph.m_in_free_list);
291 Uint32 FileDescriptor::getLogRecordSize() {
292 return FILEDESCRIPTORHEADERSIZE
293 + m_fdHeader.m_noOfDescriptors * NO_MBYTE_IN_FILE * FILEDESCRIPTORENTRYSIZE;
298 printFileDescriptorRecord(Uint32 no,
const Uint32 * ptr)
300 ndbout <<
"------------------FILE DESCRIPTOR " << no
301 <<
" ---------------------" << endl << endl;
302 ndbout_c(
"%-30s%-12s%-12s\n",
"",
"Decimal",
"Hex");
304 const Uint32 * completed = ptr;
305 const Uint32 * started = (ptr + NO_MBYTE_IN_FILE);
306 const Uint32 * prepref = (ptr + 2 * NO_MBYTE_IN_FILE);
307 for(
unsigned i = 0;
i < NO_MBYTE_IN_FILE;
i++)
309 ndbout_c(
" mb: %u Max GCI completed: %u"
310 " Max GCI started: %u Last prepared ref: %u (file: %u mb: %u)",
316 (prepref[i] & 65535));
319 return ptr + 3 * NO_MBYTE_IN_FILE;
324 no <<
"-------FILE DESCRIPTOR HEADER------------------" << endl << endl;
325 printOut(
"Record type:", fd.m_fdHeader.m_recordType);
326 printOut(
"Number of file descriptors:", fd.m_fdHeader.m_noOfDescriptors);
327 printOut(
"File number:", fd.m_fdHeader.m_fileNo);
329 const Uint32 * ptr = fd.m_fdRecord;
330 for(Uint32
i = 0;
i < fd.m_fdHeader.m_noOfDescriptors;
i++)
332 ptr = printFileDescriptorRecord(
i, ptr);
337 bool FileDescriptor::check() {