#include "univ.i"
#include "trx0types.h"
#include "mtr0mtr.h"
#include "trx0sys.h"
#include "que0types.h"
#include "page0page.h"
#include "usr0sess.h"
#include "fil0fil.h"
Go to the source code of this file.
Classes | |
struct | trx_purge_struct |
Macros | |
#define | trx0purge_h |
#define | TRX_PURGE_ON 1 /* purge operation is running */ |
#define | TRX_STOP_PURGE |
Functions | |
UNIV_INLINE fil_addr_t | trx_purge_get_log_from_hist (fil_addr_t node_addr) |
UNIV_INTERN ibool | trx_purge_update_undo_must_exist (trx_id_t trx_id) |
UNIV_INTERN void | trx_purge_sys_create (void) |
UNIV_INTERN void | trx_purge_sys_close (void) |
UNIV_INTERN void | trx_purge_add_update_undo_to_history (trx_t *trx, page_t *undo_page, mtr_t *mtr) |
UNIV_INTERN trx_undo_rec_t * | trx_purge_fetch_next_rec (roll_ptr_t *roll_ptr, trx_undo_inf_t **cell, mem_heap_t *heap) |
UNIV_INTERN void | trx_purge_rec_release (trx_undo_inf_t *cell) |
UNIV_INTERN ulint | trx_purge (ulint limit) |
UNIV_INTERN void | trx_purge_sys_print (void) |
Variables | |
trx_purge_t * | purge_sys |
trx_undo_rec_t | trx_purge_dummy_rec |
#define TRX_STOP_PURGE |
Definition at line 186 of file trx0purge.h.
UNIV_INTERN ulint trx_purge | ( | ulint | limit | ) |
This function runs a purge batch.
This function runs a purge batch.
limit | in: the maximum number of records to purge in one batch |
Definition at line 1094 of file trx0purge.cc.
References trx_purge_struct::handle_limit, trx_purge_struct::heap, trx_purge_struct::latch, mem_heap_empty(), trx_purge_struct::mutex, trx_struct::n_active_thrs, trx_purge_struct::n_pages_handled, purge_sys, que_fork_start_command(), que_run_threads(), trx_purge_struct::query, read_view_close(), read_view_oldest_copy_or_open_new(), trx_sys_struct::rseg_history_len, trx_purge_struct::state, trx_purge_struct::trx, trx_purge(), trx_sys, ut_ad, ut_error, UT_LIST_GET_LAST, and trx_purge_struct::view.
Referenced by srv_purge_thread(), and trx_purge().
UNIV_INTERN void trx_purge_add_update_undo_to_history | ( | trx_t * | trx, |
page_t * | undo_page, | ||
mtr_t * | mtr | ||
) |
in: mtr
Adds the update undo log as the first log in the history list. Removes the update undo log segment from the rseg slot if it is too big for reuse.
trx | in: transaction |
undo_page | in: update undo log header page, x-latched |
mtr | in: mtr |
Definition at line 306 of file trx0purge.cc.
References trx_undo_struct::del_marks, FIL_NULL, flst_get_len(), trx_undo_struct::hdr_offset, trx_undo_struct::hdr_page_no, trx_undo_struct::id, trx_rseg_struct::last_del_marks, trx_rseg_struct::last_offset, trx_rseg_struct::last_page_no, trx_rseg_struct::last_trx_no, MLOG_2BYTES, MLOG_4BYTES, mlog_write_ulint(), mlog_write_ull(), mtr_read_ulint(), trx_rseg_struct::mutex, trx_struct::no, trx_undo_struct::rseg, trx_sys_struct::rseg_history_len, trx_undo_struct::size, trx_rseg_struct::space, srv_wake_purge_thread_if_not_active(), trx_undo_struct::state, trx_purge_add_update_undo_to_history(), trx_rsegf_get(), trx_rsegf_set_nth_undo(), trx_sys, TRX_UNDO_DEL_MARKS, TRX_UNDO_HISTORY_NODE, TRX_UNDO_PAGE_LIST, TRX_UNDO_SEG_HDR, TRX_UNDO_TRX_NO, trx_struct::update_undo, ut_ad, and ut_error.
Referenced by trx_purge_add_update_undo_to_history(), and trx_undo_update_cleanup().
UNIV_INTERN trx_undo_rec_t* trx_purge_fetch_next_rec | ( | roll_ptr_t * | roll_ptr, |
trx_undo_inf_t ** | cell, | ||
mem_heap_t * | heap | ||
) |
Fetches the next undo log record from the history list to purge. It must be released with the corresponding release function.
Fetches the next undo log record from the history list to purge. It must be released with the corresponding release function.
roll_ptr | out: roll pointer to undo record |
cell | out: storage cell for the record in the purge array |
heap | in: memory heap where copied |
Definition at line 989 of file trx0purge.cc.
References trx_purge_struct::handle_limit, read_view_struct::low_limit_no, trx_purge_struct::mutex, trx_purge_struct::n_pages_handled, trx_purge_struct::next_stored, trx_purge_struct::offset, trx_purge_struct::page_no, purge_sys, trx_purge_struct::purge_trx_no, trx_purge_struct::purge_undo_no, trx_purge_struct::rseg, trx_purge_struct::state, trx_purge_fetch_next_rec(), trx_undo_build_roll_ptr(), ut_ad, and trx_purge_struct::view.
Referenced by trx_purge_fetch_next_rec().
UNIV_INLINE fil_addr_t trx_purge_get_log_from_hist | ( | fil_addr_t | node_addr | ) |
Calculates the file address of an undo log header when we have the file address of its history list node.
UNIV_INTERN void trx_purge_rec_release | ( | trx_undo_inf_t * | cell | ) |
Releases a reserved purge undo record. in: storage cell
Releases a reserved purge undo record.
cell | in: storage cell |
Definition at line 1078 of file trx0purge.cc.
References trx_purge_struct::mutex, purge_sys, and trx_purge_rec_release().
Referenced by trx_purge_rec_release().
UNIV_INTERN void trx_purge_sys_close | ( | void | ) |
Frees the global purge system control structure.
Definition at line 265 of file trx0purge.cc.
References trx_purge_struct::arr, trx_struct::conc_state, trx_purge_struct::heap, trx_struct::is_purge, trx_purge_struct::latch, mem_free, mem_heap_free, trx_purge_struct::mutex, purge_sys, que_graph_free(), trx_purge_struct::query, read_view_close(), trx_purge_struct::sess, sess_close(), sess_struct::trx, trx_purge_sys_close(), trx_undo_arr_free(), ut_a, ut_ad, and trx_purge_struct::view.
Referenced by trx_purge_sys_close(), and trx_sys_close().
UNIV_INTERN void trx_purge_sys_create | ( | void | ) |
Creates the global purge system control structure and inits the history mutex.
Definition at line 222 of file trx0purge.cc.
References trx_purge_struct::arr, trx_purge_struct::heap, trx_struct::is_purge, trx_purge_struct::latch, mem_heap_create, trx_purge_struct::mutex, trx_purge_struct::n_pages_handled, trx_purge_struct::next_stored, purge_sys, trx_purge_struct::purge_trx_no, trx_purge_struct::purge_undo_no, trx_purge_struct::query, read_view_oldest_copy_or_open_new(), rw_lock_create, trx_purge_struct::sess, sess_open(), trx_purge_struct::state, sess_struct::trx, trx_purge_struct::trx, trx_purge_sys_create(), trx_start_low(), trx_undo_arr_create(), ut_a, ut_ad, and trx_purge_struct::view.
Referenced by trx_purge_sys_create(), and trx_sys_init_at_db_start().
UNIV_INTERN void trx_purge_sys_print | ( | void | ) |
Prints information of the purge system to stderr.
Definition at line 1203 of file trx0purge.cc.
References trx_purge_struct::hdr_offset, trx_purge_struct::hdr_page_no, trx_purge_struct::next_stored, trx_purge_struct::offset, trx_purge_struct::page_no, purge_sys, trx_purge_struct::purge_trx_no, trx_purge_struct::purge_undo_no, read_view_print(), TRX_ID_FMT, trx_purge_sys_print(), and trx_purge_struct::view.
Referenced by trx_purge_sys_print(), and trx_undo_prev_version_build().
UNIV_INTERN ibool trx_purge_update_undo_must_exist | ( | trx_id_t | trx_id | ) |
Checks if trx_id is >= purge_view: then it is guaranteed that its update undo log still exists in the system.
Checks if trx_id is >= purge_view: then it is guaranteed that its update undo log still exists in the system.
trx_id | in: transaction id |
Definition at line 72 of file trx0purge.cc.
References trx_purge_struct::latch, purge_sys, read_view_sees_trx_id(), trx_purge_update_undo_must_exist(), ut_ad, and trx_purge_struct::view.
Referenced by row_vers_must_preserve_del_marked(), trx_purge_update_undo_must_exist(), and trx_undo_get_undo_rec().
trx_purge_t* purge_sys |
The global data structure coordinating a purge
Definition at line 48 of file trx0purge.cc.
Referenced by lock_print_info_summary(), row_vers_build_for_consistent_read(), row_vers_build_for_semi_consistent_read(), row_vers_impl_x_locked_off_kernel(), row_vers_must_preserve_del_marked(), row_vers_old_has_index_entry(), trx_purge(), trx_purge_fetch_next_rec(), trx_purge_rec_release(), trx_purge_sys_close(), trx_purge_sys_create(), trx_purge_sys_print(), trx_purge_update_undo_must_exist(), trx_undo_get_undo_rec(), and trx_undo_prev_version_build().
trx_undo_rec_t trx_purge_dummy_rec |
A dummy undo record used as a return value when we have a whole undo log
which needs no purge
Definition at line 52 of file trx0purge.cc.