📄 trx0sys.h
字号:
trx_t*trx_get_on_id(/*==========*/ /* out: the trx handle or NULL if not found */ dulint trx_id); /* in: trx id to search for *//********************************************************************Returns the minumum trx id in trx list. This is the smallest id for whichthe trx can possibly be active. (But, you must look at the trx->conc_state tofind out if the minimum trx id transaction itself is active, or alreadycommitted.) */UNIV_INLINEdulinttrx_list_get_min_trx_id(void);/*=========================*/ /* out: the minimum trx id, or trx_sys->max_trx_id if the trx list is empty *//********************************************************************Checks if a transaction with the given id is active. */UNIV_INLINEibooltrx_is_active(/*==========*/ /* out: TRUE if active */ dulint trx_id);/* in: trx id of the transaction *//********************************************************************Checks that trx is in the trx list. */ibooltrx_in_trx_list(/*============*/ /* out: TRUE if is in */ trx_t* in_trx);/* in: trx *//*********************************************************************Updates the offset information about the end of the MySQL binlog entrywhich corresponds to the transaction just being committed. In a MySQLreplication slave updates the latest master binlog position up to whichreplication has proceeded. */voidtrx_sys_update_mysql_binlog_offset(/*===============================*/ const char* file_name,/* in: MySQL log file name */ ib_longlong offset, /* in: position in that log file */ ulint field, /* in: offset of the MySQL log info field in the trx sys header */ mtr_t* mtr); /* in: mtr *//*********************************************************************Prints to stderr the MySQL binlog offset info in the trx system header ifthe magic number shows it valid. */voidtrx_sys_print_mysql_binlog_offset(void);/*===================================*/#ifdef UNIV_HOTBACKUP/*********************************************************************Prints to stderr the MySQL binlog info in the system header if themagic number shows it valid. */voidtrx_sys_print_mysql_binlog_offset_from_page(/*========================================*/ byte* page); /* in: buffer containing the trx system header page, i.e., page number TRX_SYS_PAGE_NO in the tablespace */#endif /* UNIV_HOTBACKUP *//*********************************************************************Prints to stderr the MySQL master log offset info in the trx system header ifthe magic number shows it valid. */voidtrx_sys_print_mysql_master_log_pos(void);/*====================================*//* The automatically created system rollback segment has this id */#define TRX_SYS_SYSTEM_RSEG_ID 0/* Space id and page no where the trx system file copy resides */#define TRX_SYS_SPACE 0 /* the SYSTEM tablespace */#define TRX_SYS_PAGE_NO FSP_TRX_SYS_PAGE_NO/* The offset of the transaction system header on the page */#define TRX_SYS FSEG_PAGE_DATA/* Transaction system header *//*-------------------------------------------------------------*/#define TRX_SYS_TRX_ID_STORE 0 /* the maximum trx id or trx number modulo TRX_SYS_TRX_ID_UPDATE_MARGIN written to a file page by any transaction; the assignment of transaction ids continues from this number rounded up by .._MARGIN plus .._MARGIN when the database is started */#define TRX_SYS_FSEG_HEADER 8 /* segment header for the tablespace segment the trx system is created into */#define TRX_SYS_RSEGS (8 + FSEG_HEADER_SIZE) /* the start of the array of rollback segment specification slots *//*-------------------------------------------------------------*//* Max number of rollback segments: the number of segment specification slotsin the transaction system array; rollback segment id must fit in one byte,therefore 256; each slot is currently 8 bytes in size */#define TRX_SYS_N_RSEGS 256#define TRX_SYS_MYSQL_LOG_NAME_LEN 512#define TRX_SYS_MYSQL_LOG_MAGIC_N 873422344/* The offset of the MySQL replication info in the trx system header;this contains the same fields as TRX_SYS_MYSQL_LOG_INFO below */#define TRX_SYS_MYSQL_MASTER_LOG_INFO (UNIV_PAGE_SIZE - 2000)/* The offset of the MySQL binlog offset info in the trx system header */#define TRX_SYS_MYSQL_LOG_INFO (UNIV_PAGE_SIZE - 1000)#define TRX_SYS_MYSQL_LOG_MAGIC_N_FLD 0 /* magic number which shows if we have valid data in the MySQL binlog info; the value is ..._MAGIC_N if yes */#define TRX_SYS_MYSQL_LOG_OFFSET_HIGH 4 /* high 4 bytes of the offset within that file */#define TRX_SYS_MYSQL_LOG_OFFSET_LOW 8 /* low 4 bytes of the offset within that file */#define TRX_SYS_MYSQL_LOG_NAME 12 /* MySQL log file name *//* The offset of the doublewrite buffer header on the trx system header page */#define TRX_SYS_DOUBLEWRITE (UNIV_PAGE_SIZE - 200)/*-------------------------------------------------------------*/#define TRX_SYS_DOUBLEWRITE_FSEG 0 /* fseg header of the fseg containing the doublewrite buffer */#define TRX_SYS_DOUBLEWRITE_MAGIC FSEG_HEADER_SIZE /* 4-byte magic number which shows if we already have created the doublewrite buffer */#define TRX_SYS_DOUBLEWRITE_BLOCK1 (4 + FSEG_HEADER_SIZE) /* page number of the first page in the first sequence of 64 (= FSP_EXTENT_SIZE) consecutive pages in the doublewrite buffer */#define TRX_SYS_DOUBLEWRITE_BLOCK2 (8 + FSEG_HEADER_SIZE) /* page number of the first page in the second sequence of 64 consecutive pages in the doublewrite buffer */#define TRX_SYS_DOUBLEWRITE_REPEAT 12 /* we repeat the above 3 numbers so that if the trx sys header is half-written to disk, we still may be able to recover the information */#define TRX_SYS_DOUBLEWRITE_SPACE_ID_STORED (24 + FSEG_HEADER_SIZE) /* If this is not yet set to .._N, we must reset the doublewrite buffer, because starting from 4.1.x the space id of a data page is stored to FIL_PAGE_ARCH_LOG_NO_OR_SPACE_NO *//*-------------------------------------------------------------*/#define TRX_SYS_DOUBLEWRITE_MAGIC_N 536853855#define TRX_SYS_DOUBLEWRITE_SPACE_ID_STORED_N 1783657386#define TRX_SYS_DOUBLEWRITE_BLOCK_SIZE FSP_EXTENT_SIZE /* Doublewrite control struct */struct trx_doublewrite_struct{ mutex_t mutex; /* mutex protecting the first_free field and write_buf */ ulint block1; /* the page number of the first doublewrite block (64 pages) */ ulint block2; /* page number of the second block */ ulint first_free; /* first free position in write_buf measured in units of UNIV_PAGE_SIZE */ byte* write_buf; /* write buffer used in writing to the doublewrite buffer, aligned to an address divisible by UNIV_PAGE_SIZE (which is required by Windows aio) */ byte* write_buf_unaligned; /* pointer to write_buf, but unaligned */ buf_block_t** buf_block_arr; /* array to store pointers to the buffer blocks which have been cached to write_buf */};/* The transaction system central memory data structure; protected by thekernel mutex */struct trx_sys_struct{ dulint max_trx_id; /* The smallest number not yet assigned as a transaction id or transaction number */ UT_LIST_BASE_NODE_T(trx_t) trx_list; /* List of active and committed in memory transactions, sorted on trx id, biggest first */ UT_LIST_BASE_NODE_T(trx_t) mysql_trx_list; /* List of transactions created for MySQL */ UT_LIST_BASE_NODE_T(trx_rseg_t) rseg_list; /* List of rollback segment objects */ trx_rseg_t* latest_rseg; /* Latest rollback segment in the round-robin assignment of rollback segments to transactions */ trx_rseg_t* rseg_array[TRX_SYS_N_RSEGS]; /* Pointer array to rollback segments; NULL if slot not in use */ ulint rseg_history_len;/* Length of the TRX_RSEG_HISTORY list (update undo logs for committed transactions), protected by rseg->mutex */ UT_LIST_BASE_NODE_T(read_view_t) view_list; /* List of read views sorted on trx no, biggest first */};/* When a trx id which is zero modulo this number (which must be a power oftwo) is assigned, the field TRX_SYS_TRX_ID_STORE on the transaction systempage is updated */#define TRX_SYS_TRX_ID_WRITE_MARGIN 256#ifndef UNIV_NONINL#include "trx0sys.ic"#endif#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -