diff options
Diffstat (limited to 'storage/ndb/src/kernel/blocks/dblqh/redoLogReader')
3 files changed, 0 insertions, 1002 deletions
diff --git a/storage/ndb/src/kernel/blocks/dblqh/redoLogReader/reader.cpp b/storage/ndb/src/kernel/blocks/dblqh/redoLogReader/reader.cpp deleted file mode 100644 index ea483527c15..00000000000 --- a/storage/ndb/src/kernel/blocks/dblqh/redoLogReader/reader.cpp +++ /dev/null @@ -1,416 +0,0 @@ -/* Copyright (c) 2003-2005, 2007 MySQL AB - Use is subject to license terms - - 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ - -//---------------------------------------------------------------- -// REDOLOGFILEREADER -// Reads a redo log file and checks it for errors and/or prints -// the file in a human readable format. -// -// Usage: redoLogFileReader <file> [-noprint] [-nocheck] -// [-mbyte <0-15>] [-mbyteHeaders] [-pageHeaders] -// -//---------------------------------------------------------------- - - -#include <ndb_global.h> - -#include "records.hpp" - -#define RETURN_ERROR 1 -#define RETURN_OK 0 - -#define FROM_BEGINNING 0 - -void usage(const char * prg); -Uint32 readFromFile(FILE * f, Uint32 *toPtr, Uint32 sizeInWords); -void readArguments(int argc, const char** argv); -void doExit(); - -FILE * f= 0; -char fileName[256]; -bool theDumpFlag = false; -bool thePrintFlag = true; -bool theCheckFlag = true; -bool onlyPageHeaders = false; -bool onlyMbyteHeaders = false; -bool onlyFileDesc = false; -bool firstLap = true; -Uint32 startAtMbyte = 0; -Uint32 startAtPage = 0; -Uint32 startAtPageIndex = 0; -Uint32 *redoLogPage; - -NDB_COMMAND(redoLogFileReader, "redoLogFileReader", "redoLogFileReader", "Read a redo log file", 16384) { - int wordIndex = 0; - int oldWordIndex = 0; - Uint32 recordType = 1234567890; - - PageHeader *thePageHeader; - CompletedGCIRecord *cGCIrecord; - PrepareOperationRecord *poRecord; - NextLogRecord *nlRecord; - FileDescriptor *fdRecord; - CommitTransactionRecord *ctRecord; - InvalidCommitTransactionRecord *ictRecord; - NextMbyteRecord *nmRecord; - AbortTransactionRecord *atRecord; - - readArguments(argc, argv); - - f = fopen(fileName, "rb"); - if(!f){ - perror("Error: open file"); - exit(RETURN_ERROR); - } - - Uint32 tmpFileOffset = startAtMbyte * PAGESIZE * NO_PAGES_IN_MBYTE * sizeof(Uint32); - if (fseek(f, tmpFileOffset, FROM_BEGINNING)) { - perror("Error: Move in file"); - exit(RETURN_ERROR); - } - - redoLogPage = new Uint32[PAGESIZE*NO_PAGES_IN_MBYTE]; - Uint32 words_from_previous_page = 0; - - // Loop for every mbyte. - bool lastPage = false; - for (Uint32 j = startAtMbyte; j < NO_MBYTE_IN_FILE && !lastPage; j++) { - - readFromFile(f, redoLogPage, PAGESIZE*NO_PAGES_IN_MBYTE); - - words_from_previous_page = 0; - - // Loop for every page. - for (int i = 0; i < NO_PAGES_IN_MBYTE; i++) { - wordIndex = 0; - thePageHeader = (PageHeader *) &redoLogPage[i*PAGESIZE]; - // Print out mbyte number, page number and page index. - ndbout << j << ":" << i << ":" << wordIndex << endl - << " " << j*32 + i << ":" << wordIndex << " "; - if (thePrintFlag) ndbout << (*thePageHeader); - if (theCheckFlag) { - if(!thePageHeader->check()) { - ndbout << "Error in thePageHeader->check()" << endl; - doExit(); - } - - Uint32 checkSum = 37; - for (int ps = 1; ps < PAGESIZE; ps++) - checkSum = redoLogPage[i*PAGESIZE+ps] ^ checkSum; - - if (checkSum != redoLogPage[i*PAGESIZE]){ - ndbout << "WRONG CHECKSUM: checksum = " << redoLogPage[i*PAGESIZE] - << " expected = " << checkSum << endl; - doExit(); - } - else - ndbout << "expected checksum: " << checkSum << endl; - - } - - lastPage = i != 0 && thePageHeader->lastPage(); - Uint32 lastWord = thePageHeader->lastWord(); - - if (onlyMbyteHeaders) { - // Show only the first page header in every mbyte of the file. - break; - } - - if (onlyPageHeaders) { - // Show only page headers. Continue with the next page in this for loop. - continue; - } - - - wordIndex = thePageHeader->getLogRecordSize() - words_from_previous_page; - Uint32 *redoLogPagePos = redoLogPage + i*PAGESIZE; - if (words_from_previous_page) - { - memmove(redoLogPagePos + wordIndex , - redoLogPagePos - words_from_previous_page, - words_from_previous_page*4); - } - - do { - if (words_from_previous_page) - { - // Print out mbyte number, page number and word index. - ndbout << j << ":" << i-1 << ":" << PAGESIZE-words_from_previous_page << endl - << j << ":" << i << ":" << wordIndex+words_from_previous_page << endl - << " " << j*32 + i-1 << ":" << PAGESIZE-words_from_previous_page << " "; - words_from_previous_page = 0; - } - else - { - // Print out mbyte number, page number and word index. - ndbout << j << ":" << i << ":" << wordIndex << endl - << " " << j*32 + i << ":" << wordIndex << " "; - } - redoLogPagePos = redoLogPage + i*PAGESIZE + wordIndex; - oldWordIndex = wordIndex; - recordType = *redoLogPagePos; - switch(recordType) { - case ZFD_TYPE: - fdRecord = (FileDescriptor *) redoLogPagePos; - if (thePrintFlag) ndbout << (*fdRecord); - if (theCheckFlag) { - if(!fdRecord->check()) { - ndbout << "Error in fdRecord->check()" << endl; - doExit(); - } - } - if (onlyFileDesc) { - delete [] redoLogPage; - exit(RETURN_OK); - } - wordIndex += fdRecord->getLogRecordSize(); - break; - - case ZNEXT_LOG_RECORD_TYPE: - nlRecord = (NextLogRecord *) redoLogPagePos; - wordIndex += nlRecord->getLogRecordSize(wordIndex); - if (wordIndex <= PAGESIZE) { - if (thePrintFlag) ndbout << (*nlRecord); - if (theCheckFlag) { - if(!nlRecord->check()) { - ndbout << "Error in nlRecord->check()" << endl; - doExit(); - } - } - } - break; - - case ZCOMPLETED_GCI_TYPE: - cGCIrecord = (CompletedGCIRecord *) redoLogPagePos; - wordIndex += cGCIrecord->getLogRecordSize(); - if (wordIndex <= PAGESIZE) { - if (thePrintFlag) ndbout << (*cGCIrecord); - if (theCheckFlag) { - if(!cGCIrecord->check()) { - ndbout << "Error in cGCIrecord->check()" << endl; - doExit(); - } - } - } - break; - - case ZPREP_OP_TYPE: - poRecord = (PrepareOperationRecord *) redoLogPagePos; - wordIndex += poRecord->getLogRecordSize(PAGESIZE-wordIndex); - if (wordIndex <= PAGESIZE) { - if (thePrintFlag) ndbout << (*poRecord); - if (theCheckFlag) { - if(!poRecord->check()) { - ndbout << "Error in poRecord->check()" << endl; - doExit(); - } - } - } - break; - - case ZCOMMIT_TYPE: - ctRecord = (CommitTransactionRecord *) redoLogPagePos; - wordIndex += ctRecord->getLogRecordSize(); - if (wordIndex <= PAGESIZE) { - if (thePrintFlag) ndbout << (*ctRecord); - if (theCheckFlag) { - if(!ctRecord->check()) { - ndbout << "Error in ctRecord->check()" << endl; - doExit(); - } - } - } - break; - - case ZINVALID_COMMIT_TYPE: - ictRecord = (InvalidCommitTransactionRecord *) redoLogPagePos; - wordIndex += ictRecord->getLogRecordSize(); - if (wordIndex <= PAGESIZE) { - if (thePrintFlag) ndbout << (*ictRecord); - if (theCheckFlag) { - if(!ictRecord->check()) { - ndbout << "Error in ictRecord->check()" << endl; - doExit(); - } - } - } - break; - - case ZNEXT_MBYTE_TYPE: - nmRecord = (NextMbyteRecord *) redoLogPagePos; - if (thePrintFlag) ndbout << (*nmRecord); - i = NO_PAGES_IN_MBYTE; - break; - - case ZABORT_TYPE: - atRecord = (AbortTransactionRecord *) redoLogPagePos; - wordIndex += atRecord->getLogRecordSize(); - if (wordIndex <= PAGESIZE) { - if (thePrintFlag) ndbout << (*atRecord); - if (theCheckFlag) { - if(!atRecord->check()) { - ndbout << "Error in atRecord->check()" << endl; - doExit(); - } - } - } - break; - - case ZNEW_PREP_OP_TYPE: - case ZFRAG_SPLIT_TYPE: - ndbout << endl << "Record type = " << recordType << " not implemented." << endl; - doExit(); - - default: - ndbout << " ------ERROR: UNKNOWN RECORD TYPE------" << endl; - - // Print out remaining data in this page - for (int k = wordIndex; k < PAGESIZE; k++){ - Uint32 unknown = redoLogPage[i*PAGESIZE + k]; - ndbout_c("%-30d%-12u%-12x", k, unknown, unknown); - } - - doExit(); - } - } while(wordIndex < lastWord && i < NO_PAGES_IN_MBYTE); - - - if (lastPage) - { - if (theDumpFlag) - { - ndbout << " ------PAGE END: DUMPING REST OF PAGE------" << endl; - for (int k = wordIndex > PAGESIZE ? oldWordIndex : wordIndex; - k < PAGESIZE; k++) - { - Uint32 word = redoLogPage[i*PAGESIZE + k]; - ndbout_c("%-30d%-12u%-12x", k, word, word); - } - } - break; - } - if (wordIndex > PAGESIZE) { - words_from_previous_page = PAGESIZE - oldWordIndex; - ndbout << " ----------- Record continues on next page -----------" << endl; - } else { - wordIndex = 0; - words_from_previous_page = 0; - } - ndbout << endl; - }//for - ndbout << endl; - if (startAtMbyte != 0) { - break; - } - }//for - fclose(f); - delete [] redoLogPage; - exit(RETURN_OK); -} - -//---------------------------------------------------------------- -// -//---------------------------------------------------------------- - -Uint32 readFromFile(FILE * f, Uint32 *toPtr, Uint32 sizeInWords) { - Uint32 noOfReadWords; - if ( !(noOfReadWords = fread(toPtr, sizeof(Uint32), sizeInWords, f)) ) { - ndbout << "Error reading file" << endl; - doExit(); - } - - return noOfReadWords; -} - - -//---------------------------------------------------------------- -// -//---------------------------------------------------------------- - - -void usage(const char * prg){ - ndbout << endl << "Usage: " << endl << prg - << " <Binary log file> [-noprint] [-nocheck] [-mbyte <0-15>] " - << "[-mbyteheaders] [-pageheaders] [-filedescriptors] [-page <0-31>] " - << "[-pageindex <12-8191>]" - << endl << endl; - -} -void readArguments(int argc, const char** argv) -{ - if(argc < 2 || argc > 9){ - usage(argv[0]); - doExit(); - } - - strcpy(fileName, argv[1]); - argc--; - - int i = 2; - while (argc > 1) - { - if (strcmp(argv[i], "-noprint") == 0) { - thePrintFlag = false; - } else if (strcmp(argv[i], "-dump") == 0) { - theDumpFlag = true; - } else if (strcmp(argv[i], "-nocheck") == 0) { - theCheckFlag = false; - } else if (strcmp(argv[i], "-mbyteheaders") == 0) { - onlyMbyteHeaders = true; - } else if (strcmp(argv[i], "-pageheaders") == 0) { - onlyPageHeaders = true; - } else if (strcmp(argv[i], "-filedescriptors") == 0) { - onlyFileDesc = true; - } else if (strcmp(argv[i], "-mbyte") == 0) { - startAtMbyte = atoi(argv[i+1]); - if (startAtMbyte > 15) { - usage(argv[0]); - doExit(); - } - argc--; - i++; - } else if (strcmp(argv[i], "-page") == 0) { - startAtPage = atoi(argv[i+1]); - if (startAtPage > 31) { - usage(argv[0]); - doExit(); - } - argc--; - i++; - } else if (strcmp(argv[i], "-pageindex") == 0) { - startAtPageIndex = atoi(argv[i+1]); - if (startAtPageIndex > 8191 || startAtPageIndex < 12) { - usage(argv[0]); - doExit(); - } - argc--; - i++; - } else { - usage(argv[0]); - doExit(); - } - argc--; - i++; - } - -} - -void doExit() { - ndbout << "Error in redoLogReader(). Exiting!" << endl; - if (f) fclose(f); - delete [] redoLogPage; - exit(RETURN_ERROR); -} diff --git a/storage/ndb/src/kernel/blocks/dblqh/redoLogReader/records.cpp b/storage/ndb/src/kernel/blocks/dblqh/redoLogReader/records.cpp deleted file mode 100644 index 6431b4ba9b6..00000000000 --- a/storage/ndb/src/kernel/blocks/dblqh/redoLogReader/records.cpp +++ /dev/null @@ -1,336 +0,0 @@ -/* Copyright (c) 2003, 2005, 2006 MySQL AB - Use is subject to license terms - - 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ - -#include "records.hpp" - -void printOut(const char *string, Uint32 value) { - ndbout_c("%-30s%-12u%-12x", string, value, value); -} - -//---------------------------------------------------------------- -// -//---------------------------------------------------------------- - -bool AbortTransactionRecord::check() { - // Not implemented yet. - return true; -} - -Uint32 AbortTransactionRecord::getLogRecordSize() { - return ABORTTRANSACTIONRECORDSIZE; -} - -NdbOut& operator<<(NdbOut& no, const AbortTransactionRecord& atr) { - no << "----------ABORT TRANSACTION RECORD-------------" << endl << endl; - printOut("Record type:", atr.m_recordType); - printOut("TransactionId1:", atr.m_transactionId1); - printOut("TransactionId2:", atr.m_transactionId2); - no << endl; - return no; -} - -//---------------------------------------------------------------- -// -//---------------------------------------------------------------- - -bool NextMbyteRecord::check() { - // Not implemented yet. - return true; -} - -Uint32 NextMbyteRecord::getLogRecordSize() { - return NEXTMBYTERECORDSIZE; -} - -NdbOut& operator<<(NdbOut& no, const NextMbyteRecord& nmr) { - no << "----------NEXT MBYTE RECORD--------------------" << endl << endl; - printOut("Record type:", nmr.m_recordType); - no << endl; - return no; -} - -//---------------------------------------------------------------- -// -//---------------------------------------------------------------- - -bool CommitTransactionRecord::check() { - // Not implemented yet. - return true; -} - -Uint32 CommitTransactionRecord::getLogRecordSize() { - return COMMITTRANSACTIONRECORDSIZE; -} - -NdbOut& operator<<(NdbOut& no, const CommitTransactionRecord& ctr) { - no << "----------COMMIT TRANSACTION RECORD------------" << endl << endl; - printOut("Record type:", ctr.m_recordType); - printOut("TableId", ctr.m_tableId); - printOut("SchemaVersion:", ctr.m_schemaVersion); - printOut("FfragmentId", ctr.m_fragmentId); - printOut("File no. of Prep. Op.", ctr.m_fileNumberOfPrepareOperation); - printOut("Start page no. of Prep. Op.", ctr.m_startPageNumberOfPrepareOperation); - printOut("Start page index of Prep. Op.", ctr.m_startPageIndexOfPrepareOperation); - printOut("Stop page no. of Prep. Op.", ctr.m_stopPageNumberOfPrepareOperation); - printOut("GlobalCheckpoint", ctr.m_globalCheckpoint); - - no << endl; - return no; -} - -//---------------------------------------------------------------- -// -//---------------------------------------------------------------- - -bool InvalidCommitTransactionRecord::check() { - // Not implemented yet. - return true; -} - -Uint32 InvalidCommitTransactionRecord::getLogRecordSize() { - return COMMITTRANSACTIONRECORDSIZE; -} - -NdbOut& operator<<(NdbOut& no, const InvalidCommitTransactionRecord& ictr) { - no << "------INVALID COMMIT TRANSACTION RECORD--------" << endl << endl; - printOut("Record type:", ictr.m_recordType); - printOut("TableId", ictr.m_tableId); - printOut("FfragmentId", ictr.m_fragmentId); - printOut("File no. of Prep. Op.", ictr.m_fileNumberOfPrepareOperation); - printOut("Start page no. of Prep. Op.", ictr.m_startPageNumberOfPrepareOperation); - printOut("Start page index of Prep. Op.", ictr.m_startPageIndexOfPrepareOperation); - printOut("Stop page no. of Prep. Op.", ictr.m_stopPageNumberOfPrepareOperation); - printOut("GlobalCheckpoint", ictr.m_globalCheckpoint); - - no << endl; - return no; -} - -//---------------------------------------------------------------- -// -//---------------------------------------------------------------- - -bool PrepareOperationRecord::check() { - // Not fully implemented. - if (m_operationType == 3 && m_attributeLength != 0) - return false; - - if (m_logRecordSize != (m_attributeLength + m_keyLength + 8)) - return false; - - return true; -} - -Uint32 PrepareOperationRecord::getLogRecordSize(Uint32 wordsRead) { - if (wordsRead < 2) - return 2; // make sure we read more - return m_logRecordSize; -} - -NdbOut& operator<<(NdbOut& no, const PrepareOperationRecord& por) { - no << "-----------PREPARE OPERATION RECORD------------" << endl << endl; - printOut("Record type:", por.m_recordType); - printOut("logRecordSize:", por.m_logRecordSize); - printOut("hashValue:", por.m_hashValue); - switch (por.m_operationType) { - case 0: - ndbout_c("%-30s%-12u%-6s", "operationType:", - por.m_operationType, "read"); - break; - case 1: - ndbout_c("%-30s%-12u%-6s", "operationType:", - por.m_operationType, "update"); - break; - case 2: - ndbout_c("%-30s%-12u%-6s", "operationType:", - por.m_operationType, "insert"); - break; - case 3: - ndbout_c("%-30s%-12u%-6s", "operationType:", - por.m_operationType, "delete"); - break; - default: - printOut("operationType:", por.m_operationType); - } - printOut("page_no: ", por.m_page_no); - printOut("page_idx: ", por.m_page_idx); - printOut("attributeLength:", por.m_attributeLength); - printOut("keyLength:", por.m_keyLength); - -#if 1 - // Print keydata - Uint32* p = (Uint32*)&por.m_keyInfo; - for(Uint32 i=0; i < por.m_keyLength; i++){ - printOut("keydata:", *p); - p++; - } - - // Print attrdata - for(Uint32 i=0; i < por.m_attributeLength; i++){ - printOut("attrdata:", *p); - p++; - } -#endif - - no << endl; - return no; -} - -//---------------------------------------------------------------- -// -//---------------------------------------------------------------- - -bool CompletedGCIRecord::check() { - // Not implemented yet. - return true; -} - -Uint32 CompletedGCIRecord::getLogRecordSize() { - return COMPLETEDGCIRECORDSIZE; -} - -NdbOut& operator<<(NdbOut& no, const CompletedGCIRecord& cGCIr) { - no << "-----------COMPLETED GCI RECORD----------------" << endl << endl; - printOut("Record type:", cGCIr.m_recordType); - printOut("Completed GCI:", cGCIr.m_theCompletedGCI); - no << endl; - return no; -} - -//---------------------------------------------------------------- -// -//---------------------------------------------------------------- - -bool NextLogRecord::check() { - // Not implemented yet. - return true; -} - -Uint32 NextLogRecord::getLogRecordSize(Uint32 pageIndex) { - return PAGESIZE - pageIndex; -} - -NdbOut& operator<<(NdbOut& no, const NextLogRecord& nl) { - no << "-----------NEXT LOG RECORD --------------------" << endl << endl; - printOut("Record type:", nl.m_recordType); - no << endl; - return no; -} - -//---------------------------------------------------------------- -// -//---------------------------------------------------------------- - -Uint32 PageHeader::getLogRecordSize() { - return PAGEHEADERSIZE; -} - -bool PageHeader::check() { - // Not implemented yet. - return true; -} - -bool PageHeader::lastPage() -{ - return m_next_page == 0xffffff00; -} - -Uint32 PageHeader::lastWord() -{ - return m_current_page_index; -} - - -NdbOut& operator<<(NdbOut& no, const PageHeader& ph) { - no << "------------PAGE HEADER------------------------" << endl << endl; - ndbout_c("%-30s%-12s%-12s\n", "", "Decimal", "Hex"); - printOut("Checksum:", ph.m_checksum); - printOut("Laps since initial start:", ph.m_lap); - printOut("Max gci completed:", ph.m_max_gci_completed); - printOut("Max gci started:", ph.m_max_gci_started); - printOut("Ptr to next page:", ph.m_next_page); - printOut("Ptr to previous page:", ph.m_previous_page); - printOut("Ndb version:", ph.m_ndb_version); - printOut("Number of log files:", ph.m_number_of_logfiles); - printOut("Current page index:", ph.m_current_page_index); - printOut("Oldest prepare op. file No.:", ph.m_old_prepare_file_number); - printOut("Oldest prepare op. page ref.:", ph.m_old_prepare_page_reference); - printOut("Dirty flag:", ph.m_dirty_flag); - printOut("Write Timer:", ph.m_log_timer); - printOut("Page i-val:", ph.m_page_i_value); - printOut("Place written:", ph.m_place_written_from); - printOut("Page No in File:", ph.m_page_no); - printOut("File No:", ph.m_file_no); - printOut("Word Written:", ph.m_word_written); - printOut("In Writing (should be 1)", ph.m_in_writing_flag); - printOut("Prev Page No (can be garbage)", ph.m_prev_page_no); - printOut("In Free List (should be 0):", ph.m_in_free_list); - no << endl; - return no; -} - -//---------------------------------------------------------------- -// -//---------------------------------------------------------------- - -Uint32 FileDescriptor::getLogRecordSize() { - return FILEDESCRIPTORHEADERSIZE - + m_fdHeader.m_noOfDescriptors * FILEDESCRIPTORRECORDSIZE; -} - -NdbOut& operator<<(NdbOut& no, const FileDescriptor& fd) { - no << "-------FILE DESCRIPTOR HEADER------------------" << endl << endl; - printOut("Record type:", fd.m_fdHeader.m_recordType); - printOut("Number of file descriptors:", fd.m_fdHeader.m_noOfDescriptors); - printOut("File number:", fd.m_fdHeader.m_fileNo); - ndbout << endl; - for(Uint32 i = 0; i < fd.m_fdHeader.m_noOfDescriptors; i++) { - fd.printARecord(i); - } - return no; -} - -void FileDescriptor::printARecord( Uint32 recordIndex ) const { - ndbout << "------------------FILE DESCRIPTOR " << recordIndex - <<" ---------------------" << endl << endl; - ndbout_c("%-30s%-12s%-12s\n", "", "Decimal", "Hex"); - - for(int i = 1; i <= NO_MBYTE_IN_FILE; i++) { - ndbout_c("%s%2d%s%-12u%-12x", "Max GCI completed, mbyte ", i, ": ", - m_fdRecord[recordIndex].m_maxGciCompleted[i-1], - m_fdRecord[recordIndex].m_maxGciCompleted[i-1]); - } - for(int i = 1; i <= NO_MBYTE_IN_FILE; i++) { - ndbout_c("%s%2d%s%-12u%-12x", "Max GCI started, mbyte ", i, ": ", - m_fdRecord[recordIndex].m_maxGciStarted[i-1], - m_fdRecord[recordIndex].m_maxGciStarted[i-1]); - } - for(int i = 1; i <= NO_MBYTE_IN_FILE; i++) { - ndbout_c("%s%2d%s%-12u%-12x", "Last prepared ref, mbyte ", i, ": ", - m_fdRecord[recordIndex].m_lastPreparedReference[i-1], - m_fdRecord[recordIndex].m_lastPreparedReference[i-1]); - } - ndbout << endl; -} - -bool FileDescriptor::check() { - // Not implemented yet. - return true; -} - -//---------------------------------------------------------------- -// -//---------------------------------------------------------------- diff --git a/storage/ndb/src/kernel/blocks/dblqh/redoLogReader/records.hpp b/storage/ndb/src/kernel/blocks/dblqh/redoLogReader/records.hpp deleted file mode 100644 index abdb57e8646..00000000000 --- a/storage/ndb/src/kernel/blocks/dblqh/redoLogReader/records.hpp +++ /dev/null @@ -1,250 +0,0 @@ -/* Copyright (c) 2003, 2005, 2006 MySQL AB - Use is subject to license terms - - 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, 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 { - -}; |