📄 trx0sys.h
字号:
/******************************************************Transaction system(c) 1996 Innobase OyCreated 3/26/1996 Heikki Tuuri*******************************************************/#ifndef trx0sys_h#define trx0sys_h#include "univ.i"#include "trx0types.h"#include "mtr0mtr.h"#include "mtr0log.h"#include "ut0byte.h"#include "mem0mem.h"#include "sync0sync.h"#include "ut0lst.h"#include "buf0buf.h"#include "fil0fil.h"#include "fut0lst.h"#include "fsp0fsp.h"#include "read0types.h"/* In a MySQL replication slave, in crash recovery we store the master logfile name and position here. We have successfully got the updates to InnoDBup to this position. If .._pos is -1, it means no crash recovery was needed,or there was no master log position info inside InnoDB. */extern char trx_sys_mysql_master_log_name[];extern ib_longlong trx_sys_mysql_master_log_pos;/* If this MySQL server uses binary logging, after InnoDB has been initedand if it has done a crash recovery, we store the binlog file name and positionhere. If .._pos is -1, it means there was no binlog position info insideInnoDB. */extern char trx_sys_mysql_bin_log_name[];extern ib_longlong trx_sys_mysql_bin_log_pos;/* The transaction system */extern trx_sys_t* trx_sys;/* Doublewrite system */extern trx_doublewrite_t* trx_doublewrite;extern ibool trx_doublewrite_must_reset_space_ids;extern ibool trx_sys_multiple_tablespace_format;/********************************************************************Creates the doublewrite buffer to a new InnoDB installation. The header of thedoublewrite buffer is placed on the trx system header page. */voidtrx_sys_create_doublewrite_buf(void);/*================================*//********************************************************************At a database startup initializes the doublewrite buffer memory structure ifwe already have a doublewrite buffer created in the data files. If we areupgrading to an InnoDB version which supports multiple tablespaces, then thisfunction performs the necessary update operations. If we are in a crashrecovery, this function uses a possible doublewrite buffer to restorehalf-written pages in the data files. */voidtrx_sys_doublewrite_init_or_restore_pages(/*======================================*/ ibool restore_corrupt_pages);/********************************************************************Marks the trx sys header when we have successfully upgraded to the >= 4.1.xmultiple tablespace format. */voidtrx_sys_mark_upgraded_to_multiple_tablespaces(void);/*===============================================*//********************************************************************Determines if a page number is located inside the doublewrite buffer. */ibooltrx_doublewrite_page_inside(/*========================*/ /* out: TRUE if the location is inside the two blocks of the doublewrite buffer */ ulint page_no); /* in: page number *//*******************************************************************Checks if a page address is the trx sys header page. */UNIV_INLINEibooltrx_sys_hdr_page(/*=============*/ /* out: TRUE if trx sys header page */ ulint space, /* in: space */ ulint page_no);/* in: page number *//*********************************************************************Creates and initializes the central memory structures for the transactionsystem. This is called when the database is started. */voidtrx_sys_init_at_db_start(void);/*==========================*//*********************************************************************Creates and initializes the transaction system at the database creation. */voidtrx_sys_create(void);/*================*//********************************************************************Looks for a free slot for a rollback segment in the trx system file copy. */ulinttrx_sysf_rseg_find_free(/*====================*/ /* out: slot index or ULINT_UNDEFINED if not found */ mtr_t* mtr); /* in: mtr *//*******************************************************************Gets the pointer in the nth slot of the rseg array. */UNIV_INLINEtrx_rseg_t*trx_sys_get_nth_rseg(/*=================*/ /* out: pointer to rseg object, NULL if slot not in use */ trx_sys_t* sys, /* in: trx system */ ulint n); /* in: index of slot *//*******************************************************************Sets the pointer in the nth slot of the rseg array. */UNIV_INLINEvoidtrx_sys_set_nth_rseg(/*=================*/ trx_sys_t* sys, /* in: trx system */ ulint n, /* in: index of slot */ trx_rseg_t* rseg); /* in: pointer to rseg object, NULL if slot not in use *//**************************************************************************Gets a pointer to the transaction system file copy and x-locks its page. */UNIV_INLINEtrx_sysf_t*trx_sysf_get(/*=========*/ /* out: pointer to system file copy, page x-locked */ mtr_t* mtr); /* in: mtr *//*********************************************************************Gets the space of the nth rollback segment slot in the trx systemfile copy. */UNIV_INLINEulinttrx_sysf_rseg_get_space(/*====================*/ /* out: space id */ trx_sysf_t* sys_header, /* in: trx sys file copy */ ulint i, /* in: slot index == rseg id */ mtr_t* mtr); /* in: mtr *//*********************************************************************Gets the page number of the nth rollback segment slot in the trx systemfile copy. */UNIV_INLINEulinttrx_sysf_rseg_get_page_no(/*======================*/ /* out: page number, FIL_NULL if slot unused */ trx_sysf_t* sys_header, /* in: trx sys file copy */ ulint i, /* in: slot index == rseg id */ mtr_t* mtr); /* in: mtr *//*********************************************************************Sets the space id of the nth rollback segment slot in the trx systemfile copy. */UNIV_INLINEvoidtrx_sysf_rseg_set_space(/*====================*/ trx_sysf_t* sys_header, /* in: trx sys file copy */ ulint i, /* in: slot index == rseg id */ ulint space, /* in: space id */ mtr_t* mtr); /* in: mtr *//*********************************************************************Sets the page number of the nth rollback segment slot in the trx systemfile copy. */UNIV_INLINEvoidtrx_sysf_rseg_set_page_no(/*======================*/ trx_sysf_t* sys_header, /* in: trx sys file copy */ ulint i, /* in: slot index == rseg id */ ulint page_no, /* in: page number, FIL_NULL if the slot is reset to unused */ mtr_t* mtr); /* in: mtr *//*********************************************************************Allocates a new transaction id. */UNIV_INLINEdulinttrx_sys_get_new_trx_id(void);/*========================*/ /* out: new, allocated trx id *//*********************************************************************Allocates a new transaction number. */UNIV_INLINEdulinttrx_sys_get_new_trx_no(void);/*========================*/ /* out: new, allocated trx number *//*********************************************************************Writes a trx id to an index page. In case that the id size changes insome future version, this function should be used instead ofmach_write_... */UNIV_INLINEvoidtrx_write_trx_id(/*=============*/ byte* ptr, /* in: pointer to memory where written */ dulint id); /* in: id *//*********************************************************************Reads a trx id from an index page. In case that the id size changes insome future version, this function should be used instead ofmach_read_... */UNIV_INLINEdulinttrx_read_trx_id(/*============*/ /* out: id */ byte* ptr); /* in: pointer to memory from where to read *//********************************************************************Looks for the trx handle with the given id in trx_list. */UNIV_INLINE
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -