/* Offsets of a log block header */ #define LOG_BLOCK_HDR_NO 0 /* block number which must be > 0 and is allowed to wrap around at 2G; the highest bit is set to 1 if this is the first log block in a log flush write segment */ #define LOG_BLOCK_FLUSH_BIT_MASK 0x80000000UL /* mask used to get the highest bit in the preceding field */ #define LOG_BLOCK_HDR_DATA_LEN 4 /* number of bytes of log written to this block */ #define LOG_BLOCK_FIRST_REC_GROUP 6 /* offset of the first start of an mtr log record group in this log block, 0 if none; if the value is the same as LOG_BLOCK_HDR_DATA_LEN, it means that the first rec group has not yet been catenated to this log block, but if it will, it will start at this offset; an archive recovery can start parsing the log records starting from this offset in this log block, if value not 0 */ #define LOG_BLOCK_CHECKPOINT_NO 8 /* 4 lower bytes of the value of log_sys->next_checkpoint_no when the log block was last written to: if the block has not yet been written full, this value is only updated before a log buffer flush */ #define LOG_BLOCK_HDR_SIZE 12 /* size of the log block header in bytes */ /* Offsets of a log file header */ #define LOG_GROUP_ID 0 /* log group number */ #define LOG_FILE_START_LSN 4 /* lsn of the start of data in this log file */ #define LOG_FILE_NO 12 /* 4-byte archived log file number; this field is only defined in an archived log file */ #define LOG_FILE_WAS_CREATED_BY_HOT_BACKUP 16 /* a 32-byte field which contains the string 'ibbackup' and the creation time if the log file was created by ibbackup --restore; when mysqld is first time started on the restored database, it can print helpful info for the user */ #define LOG_FILE_ARCH_COMPLETED OS_FILE_LOG_BLOCK_SIZE /* this 4-byte field is TRUE when the writing of an archived log file has been completed; this field is only defined in an archived log file */ #define LOG_FILE_END_LSN (OS_FILE_LOG_BLOCK_SIZE + 4) /* lsn where the archived log file at least extends: actually the archived log file may extend to a later lsn, as long as it is within the same log block as this lsn; this field is defined only when an archived log file has been completely written */ #define LOG_CHECKPOINT_1 OS_FILE_LOG_BLOCK_SIZE /* first checkpoint field in the log header; we write alternately to the checkpoint fields when we make new checkpoints; this field is only defined in the first log file of a log group */ #define LOG_CHECKPOINT_2 (3 * OS_FILE_LOG_BLOCK_SIZE) /* second checkpoint field in the log header */ #define LOG_FILE_HDR_SIZE (4 * OS_FILE_LOG_BLOCK_SIZE) /* 在insert时,新插入的日志记录格式为 列的个数(两个字节) | 唯一标记这个元组的列的个数(两个字节) | 各个节的长度(两个字节),最高位表明是否为空,大于255或blob用0x7fff表示 | 元级在页面的偏移(两个字节)| info bits,状态(1个字节)| the record origin offset,列的数据在写入的数据的移偏了解 | 数据,包含各个列的数据 */