📄 dblqh.hpp
字号:
Uint8 logTailMbyte; /** * The mbyte within the starting log file where to start * executing the log. */ Uint8 startMbyte; /** * The last mbyte in which to execute the log during system * restart. */ Uint8 stopMbyte; /** * This variable refers to the file where invalidation is * occuring during system/node restart. */ Uint16 invalidateFileNo; /** * This variable refers to the page where invalidation is * occuring during system/node restart. */ Uint16 invalidatePageNo; }; // Size 164 Bytes typedef Ptr<LogPartRecord> LogPartRecordPtr; /* $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ */ /* $$$$$$$ LOG FILE RECORD $$$$$$$ */ /* $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ */ /* THIS RECORD IS ALIGNED TO BE 288 (256 + 32) BYTES. */ /* $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ */ /** * This record contains information about a log file. * A log file contains log records from several tables and * fragments of a table. LQH can contain more than * one log file to ensure faster log processing. * * The number of pages to write to disk at a time is * configurable. */ struct LogFileRecord { enum FileChangeState { NOT_ONGOING = 0, BOTH_WRITES_ONGOING = 1, LAST_WRITE_ONGOING = 2, FIRST_WRITE_ONGOING = 3, WRITE_PAGE_ZERO_ONGOING = 4 }; enum LogFileStatus { LFS_IDLE = 0, ///< Log file record not in use CLOSED = 1, ///< Log file closed OPENING_INIT = 2, OPEN_SR_FRONTPAGE = 3, ///< Log file opened as part of system ///< restart. Open file 0 to find ///< the front page of the log part. OPEN_SR_LAST_FILE = 4, ///< Open last log file that was written ///< before the system restart. OPEN_SR_NEXT_FILE = 5, ///< Open a log file which is 16 files ///< backwards to find the next ///< information about GCPs. OPEN_EXEC_SR_START = 6, ///< Log file opened as part of ///< executing ///< log during system restart. OPEN_EXEC_SR_NEW_MBYTE = 7, OPEN_SR_FOURTH_PHASE = 8, OPEN_SR_FOURTH_NEXT = 9, OPEN_SR_FOURTH_ZERO = 10, OPENING_WRITE_LOG = 11, ///< Log file opened as part of writing ///< log during normal operation. OPEN_EXEC_LOG = 12, CLOSING_INIT = 13, CLOSING_SR = 14, ///< Log file closed as part of system ///< restart. Currently trying to ///< find where to start executing the ///< log CLOSING_EXEC_SR = 15, ///< Log file closed as part of ///< executing log during system restart CLOSING_EXEC_SR_COMPLETED = 16, CLOSING_WRITE_LOG = 17, ///< Log file closed as part of writing ///< log during normal operation. CLOSING_EXEC_LOG = 18, OPEN_INIT = 19, OPEN = 20, ///< Log file open OPEN_SR_INVALIDATE_PAGES = 21, CLOSE_SR_INVALIDATE_PAGES = 22 }; /** * When a new mbyte is started in the log we have to find out * how far back in the log we still have prepared operations * which have been neither committed or aborted. This variable * keeps track of this value for each of the mbytes in this * log file. This is used in writing down these values in the * header of each log file. That information is used during * system restart to find the tail of the log. */ UintR logLastPrepRef[16]; /** * The max global checkpoint completed before the mbyte in the * log file was started. One variable per mbyte. */ UintR logMaxGciCompleted[16]; /** * The max global checkpoint started before the mbyte in the log * file was started. One variable per mbyte. */ UintR logMaxGciStarted[16]; /** * This variable contains the file name as needed by the file * system when opening the file. */ UintR fileName[4]; /** * This variable has a reference to the log page which is * currently in use by the log. */ UintR currentLogpage; /** * The number of the current mbyte in the log file. */ UintR currentMbyte; /** * This variable is used when changing files. It is to find * out when both the last write in the previous file and the * first write in this file has been completed. After these * writes have completed the variable keeps track of when the * write to page zero in file zero is completed. */ FileChangeState fileChangeState; /** * The number of the file within this log part. */ UintR fileNo; /** * This variable shows where to read/write the next pages into * the log. Used when writing the log during normal operation * and when reading the log during system restart. It * specifies the page position where each page is 8 kbyte. */ UintR filePosition; /** * This contains the file pointer needed by the file system * when reading/writing/closing and synching. */ UintR fileRef; /** * The head of the pages waiting for shipment to disk. * They are filled with log info. */ UintR firstFilledPage; /** * A list of active read/write operations on the log file. * Operations are always put in last and the first should * always complete first. */ UintR firstLfo; UintR lastLfo; /** * The tail of the pages waiting for shipment to disk. * They are filled with log info. */ UintR lastFilledPage; /** * This variable keeps track of the last written page in the * file while writing page zero in file zero when changing log * file. */ UintR lastPageWritten; /** * This variable keeps track of the last written word in the * last page written in the file while writing page zero in * file zero when changing log file. */ UintR lastWordWritten; /** * This variable contains the last word written in the last page. */ UintR logFilePagesToDiskWithoutSynch; /** * This variable keeps track of the number of pages written since * last synch on this log file. */ LogFileStatus logFileStatus; /** * A reference to page zero in this file. * This page is written before the file is closed. */ UintR logPageZero; /** * This variable contains a reference to the record describing * this log part. One of four records (0,1,2 or 3). */ UintR logPartRec; /** * Next free log file record or next log file in this log. */ UintR nextLogFile; /** * The previous log file. */ UintR prevLogFile; /** * The number of remaining words in this mbyte of the log file. */ UintR remainingWordsInMbyte; /** * The current file page within the current log file. This is * a reference within the file and not a reference to a log * page record. It is used to deduce where log records are * written. Particularly completed gcp records and prepare log * records. */ Uint16 currentFilepage; /** * The number of pages in the list referenced by * LOG_PAGE_BUFFER. */ Uint16 noLogpagesInBuffer; }; // Size 288 bytes typedef Ptr<LogFileRecord> LogFileRecordPtr; /* $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ */ /* $$$$$$$ LOG OPERATION RECORD $$$$$$$ */ /* $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ */ /** * This record contains a currently active file operation * that has started by the log module. */ struct LogFileOperationRecord { enum LfoState { IDLE = 0, ///< Operation is not used at the moment INIT_WRITE_AT_END = 1, ///< Write in file so that it grows to ///< 16 Mbyte INIT_FIRST_PAGE = 2, ///< Initialise the first page in a file WRITE_GCI_ZERO = 3, WRITE_INIT_MBYTE = 4, WRITE_DIRTY = 5, READ_SR_FRONTPAGE = 6, ///< Read page zero in file zero during ///< system restart READ_SR_LAST_FILE = 7, ///< Read page zero in last file open ///< before system crash READ_SR_NEXT_FILE = 8, ///< Read 60 files backwards to find ///< further information GCPs in page ///< zero READ_SR_LAST_MBYTE = 9, READ_EXEC_SR = 10, READ_EXEC_LOG = 11, READ_SR_FOURTH_PHASE = 12, READ_SR_FOURTH_ZERO = 13, FIRST_PAGE_WRITE_IN_LOGFILE = 14, LAST_WRITE_IN_FILE = 15, WRITE_PAGE_ZERO = 16, ACTIVE_WRITE_LOG = 17, ///< A write operation during ///< writing of log READ_SR_INVALIDATE_PAGES = 18, WRITE_SR_INVALIDATE_PAGES = 19 }; /** * We have to remember the log pages read. * Otherwise we cannot build the linked list after the pages have * arrived to main memory. */ UintR logPageArray[16]; /** * A list of the pages that are part of this active operation. */ UintR firstLfoPage; /** * A timer to ensure that records are not lost. */ UintR lfoTimer; /** * The word number of the last written word in the last during * a file write. */ UintR lfoWordWritten; /** * This variable contains the state of the log file operation. */ LfoState lfoState; /** * The log file that the file operation affects. */ UintR logFileRec; /** * The log file operations on a file are kept in a linked list. */ UintR nextLfo; /** * The page number of the first read/written page during a file * read/write. */ Uint16 lfoPageNo; /** * The number of pages written or read during an operation to * the log file. */ Uint16 noPagesRw; }; // 92 bytes typedef Ptr<LogFileOperationRecord> LogFileOperationRecordPtr; /* $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ */ /* $$$$$$$ LOG PAGE RECORD $$$$$$$ */ /* $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ */ /** * These are the 8 k pages used to store log records before storing * them in the file system. * Since 64 kbyte is sent to disk at a time it is necessary to have * at least 4*64 kbytes of log pages. * To handle multiple outstanding requests we need some additional pages. * Thus we allocate 1 mbyte to ensure that we do not get problems with * insufficient number of pages. */ struct LogPageRecord { /** * This variable contains the pages that are sent to disk. * * All pages contain a header of 12 words: * - WORD 0: CHECKSUM Calculated before storing on disk and * checked when read from disk. * - WORD 1: LAP How many wraparounds have the log * experienced since initial start of the * system. * - WORD 2: MAX_GCI_COMPLETED Which is the maximum gci which have * completed before this page. This * gci will not be found in this * page and hereafter in the log. * - WORD 3: MAX_GCI_STARTED The maximum gci which have started * before this page. * - WORD 4: NEXT_PAGE Pointer to the next page. * Only used in main memory * - WORD 5: PREVIOUS_PAGE Pointer to the previous page. * Currently not used. * - WORD 6: VERSION NDB version that wrote the page. * - WORD 7: NO_LOG_FILES Number of log files in this log part. * - WORD 8: CURRENT PAGE INDEX This keeps track of where we are in the * page. * This is only used when pages is in * memory. * - WORD 9: OLD PREPARE FILE NO This keeps track of the olde
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -