📄 trx0undo.h
字号:
/******************************************************Transaction undo log(c) 1996 Innobase OyCreated 3/26/1996 Heikki Tuuri*******************************************************/#ifndef trx0undo_h#define trx0undo_h#include "univ.i"#include "trx0types.h"#include "mtr0mtr.h"#include "trx0sys.h"#include "page0types.h"#include "trx0xa.h"/***************************************************************************Builds a roll pointer dulint. */UNIV_INLINEdulinttrx_undo_build_roll_ptr(/*====================*/ /* out: roll pointer */ ibool is_insert, /* in: TRUE if insert undo log */ ulint rseg_id, /* in: rollback segment id */ ulint page_no, /* in: page number */ ulint offset); /* in: offset of the undo entry within page *//***************************************************************************Decodes a roll pointer dulint. */UNIV_INLINEvoidtrx_undo_decode_roll_ptr(/*=====================*/ dulint roll_ptr, /* in: roll pointer */ ibool* is_insert, /* out: TRUE if insert undo log */ ulint* rseg_id, /* out: rollback segment id */ ulint* page_no, /* out: page number */ ulint* offset); /* out: offset of the undo entry within page *//***************************************************************************Returns TRUE if the roll pointer is of the insert type. */UNIV_INLINEibooltrx_undo_roll_ptr_is_insert(/*========================*/ /* out: TRUE if insert undo log */ dulint roll_ptr); /* in: roll pointer *//*********************************************************************Writes a roll ptr to an index page. In case that the size changes insome future version, this function should be used instead ofmach_write_... */UNIV_INLINEvoidtrx_write_roll_ptr(/*===============*/ byte* ptr, /* in: pointer to memory where written */ dulint roll_ptr); /* in: roll ptr *//*********************************************************************Reads a roll ptr from an index page. In case that the roll ptr sizechanges in some future version, this function should be used instead ofmach_read_... */UNIV_INLINEdulinttrx_read_roll_ptr(/*==============*/ /* out: roll ptr */ byte* ptr); /* in: pointer to memory from where to read *//**********************************************************************Gets an undo log page and x-latches it. */UNIV_INLINEpage_t*trx_undo_page_get(/*===============*/ /* out: pointer to page x-latched */ ulint space, /* in: space where placed */ ulint page_no, /* in: page number */ mtr_t* mtr); /* in: mtr *//**********************************************************************Gets an undo log page and s-latches it. */UNIV_INLINEpage_t*trx_undo_page_get_s_latched(/*=========================*/ /* out: pointer to page s-latched */ ulint space, /* in: space where placed */ ulint page_no, /* in: page number */ mtr_t* mtr); /* in: mtr *//**********************************************************************Returns the previous undo record on the page in the specified log, orNULL if none exists. */UNIV_INLINEtrx_undo_rec_t*trx_undo_page_get_prev_rec(/*=======================*/ /* out: pointer to record, NULL if none */ trx_undo_rec_t* rec, /* in: undo log record */ ulint page_no,/* in: undo log header page number */ ulint offset); /* in: undo log header offset on page *//**********************************************************************Returns the next undo log record on the page in the specified log, orNULL if none exists. */UNIV_INLINEtrx_undo_rec_t*trx_undo_page_get_next_rec(/*=======================*/ /* out: pointer to record, NULL if none */ trx_undo_rec_t* rec, /* in: undo log record */ ulint page_no,/* in: undo log header page number */ ulint offset); /* in: undo log header offset on page *//**********************************************************************Returns the last undo record on the page in the specified undo log, orNULL if none exists. */UNIV_INLINEtrx_undo_rec_t*trx_undo_page_get_last_rec(/*=======================*/ /* out: pointer to record, NULL if none */ page_t* undo_page,/* in: undo log page */ ulint page_no,/* in: undo log header page number */ ulint offset); /* in: undo log header offset on page *//**********************************************************************Returns the first undo record on the page in the specified undo log, orNULL if none exists. */UNIV_INLINEtrx_undo_rec_t*trx_undo_page_get_first_rec(/*========================*/ /* out: pointer to record, NULL if none */ page_t* undo_page,/* in: undo log page */ ulint page_no,/* in: undo log header page number */ ulint offset); /* in: undo log header offset on page *//***************************************************************************Gets the previous record in an undo log. */trx_undo_rec_t*trx_undo_get_prev_rec(/*==================*/ /* out: undo log record, the page s-latched, NULL if none */ trx_undo_rec_t* rec, /* in: undo record */ ulint page_no,/* in: undo log header page number */ ulint offset, /* in: undo log header offset on page */ mtr_t* mtr); /* in: mtr *//***************************************************************************Gets the next record in an undo log. */trx_undo_rec_t*trx_undo_get_next_rec(/*==================*/ /* out: undo log record, the page s-latched, NULL if none */ trx_undo_rec_t* rec, /* in: undo record */ ulint page_no,/* in: undo log header page number */ ulint offset, /* in: undo log header offset on page */ mtr_t* mtr); /* in: mtr *//***************************************************************************Gets the first record in an undo log. */trx_undo_rec_t*trx_undo_get_first_rec(/*===================*/ /* out: undo log record, the page latched, NULL if none */ ulint space, /* in: undo log header space */ ulint page_no,/* in: undo log header page number */ ulint offset, /* in: undo log header offset on page */ ulint mode, /* in: latching mode: RW_S_LATCH or RW_X_LATCH */ mtr_t* mtr); /* in: mtr *//************************************************************************Tries to add a page to the undo log segment where the undo log is placed. */ulinttrx_undo_add_page(/*==============*/ /* out: page number if success, else FIL_NULL */ trx_t* trx, /* in: transaction */ trx_undo_t* undo, /* in: undo log memory object */ mtr_t* mtr); /* in: mtr which does not have a latch to any undo log page; the caller must have reserved the rollback segment mutex *//***************************************************************************Truncates an undo log from the end. This function is used during a rollbackto free space from an undo log. */voidtrx_undo_truncate_end(/*==================*/ trx_t* trx, /* in: transaction whose undo log it is */ trx_undo_t* undo, /* in: undo log */ dulint limit); /* in: all undo records with undo number >= this value should be truncated *//***************************************************************************Truncates an undo log from the start. This function is used during a purgeoperation. */voidtrx_undo_truncate_start(/*====================*/ trx_rseg_t* rseg, /* in: rollback segment */ ulint space, /* in: space id of the log */ ulint hdr_page_no, /* in: header page number */ ulint hdr_offset, /* in: header offset on the page */ dulint limit); /* in: all undo pages with undo numbers < this value should be truncated; NOTE that the function only frees whole pages; the header page is not freed, but emptied, if all the records there are < limit *//************************************************************************Initializes the undo log lists for a rollback segment memory copy.This function is only called when the database is started or a newrollback segment created. */ulinttrx_undo_lists_init(/*================*/ /* out: the combined size of undo log segments in pages */ trx_rseg_t* rseg); /* in: rollback segment memory object */ /**************************************************************************Assigns an undo log for a transaction. A new undo log is created or a cachedundo log reused. */trx_undo_t*trx_undo_assign_undo(/*=================*/ /* out: the undo log, NULL if did not succeed: out of space */ trx_t* trx, /* in: transaction */ ulint type); /* in: TRX_UNDO_INSERT or TRX_UNDO_UPDATE *//**********************************************************************Sets the state of the undo log segment at a transaction finish. */page_t*trx_undo_set_state_at_finish(/*=========================*/ /* out: undo log segment header page, x-latched */ trx_t* trx, /* in: transaction */ trx_undo_t* undo, /* in: undo log memory copy */ mtr_t* mtr); /* in: mtr *//**********************************************************************Sets the state of the undo log segment at a transaction prepare. */page_t*trx_undo_set_state_at_prepare(/*==========================*/ /* out: undo log segment header page, x-latched */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -