#include "univ.i"
#include "mem0mem.h"
#include "dyn0dyn.h"
#include "buf0types.h"
#include "sync0rw.h"
#include "ut0byte.h"
#include "mtr0types.h"
#include "page0types.h"
Go to the source code of this file.
Classes | |
struct | mtr_memo_slot_struct |
struct | mtr_struct |
Defines | |
#define | MTR_LOG_ALL |
#define | MTR_LOG_NONE 22 /* log no operations */ |
#define | MTR_LOG_SHORT_INSERTS |
#define | MTR_MEMO_PAGE_S_FIX RW_S_LATCH |
#define | MTR_MEMO_PAGE_X_FIX RW_X_LATCH |
#define | MTR_MEMO_BUF_FIX RW_NO_LATCH |
#define | MTR_MEMO_MODIFY 54 |
#define | MTR_MEMO_S_LOCK 55 |
#define | MTR_MEMO_X_LOCK 56 |
#define | mtr_s_lock(B, MTR) |
#define | mtr_x_lock(B, MTR) |
#define | MTR_BUF_MEMO_SIZE 200 /* number of slots in memo */ |
#define | MTR_ACTIVE 12231 |
#define | MTR_COMMITTING 56456 |
#define | MTR_COMMITTED 34676 |
Log item types | |
The log items are declared 'byte' so that the compiler can warn if val and type parameters are switched in a call to mlog_write_ulint. NOTE! For 1 - 8 bytes, the flag value must give the length also! | |
#define | MLOG_SINGLE_REC_FLAG 128 |
#define | MLOG_1BYTE (1) |
#define | MLOG_2BYTES (2) |
#define | MLOG_4BYTES (4) |
#define | MLOG_8BYTES (8) |
#define | MLOG_REC_INSERT ((byte)9) |
#define | MLOG_REC_CLUST_DELETE_MARK ((byte)10) |
#define | MLOG_REC_SEC_DELETE_MARK ((byte)11) |
#define | MLOG_REC_UPDATE_IN_PLACE ((byte)13) |
#define | MLOG_REC_DELETE ((byte)14) |
#define | MLOG_LIST_END_DELETE ((byte)15) |
#define | MLOG_LIST_START_DELETE ((byte)16) |
#define | MLOG_LIST_END_COPY_CREATED ((byte)17) |
#define | MLOG_PAGE_REORGANIZE ((byte)18) |
#define | MLOG_PAGE_CREATE ((byte)19) |
#define | MLOG_UNDO_INSERT ((byte)20) |
#define | MLOG_UNDO_ERASE_END ((byte)21) |
#define | MLOG_UNDO_INIT ((byte)22) |
#define | MLOG_UNDO_HDR_DISCARD ((byte)23) |
#define | MLOG_UNDO_HDR_REUSE ((byte)24) |
#define | MLOG_UNDO_HDR_CREATE ((byte)25) |
#define | MLOG_REC_MIN_MARK ((byte)26) |
#define | MLOG_IBUF_BITMAP_INIT ((byte)27) |
#define | MLOG_INIT_FILE_PAGE ((byte)29) |
#define | MLOG_WRITE_STRING ((byte)30) |
#define | MLOG_MULTI_REC_END ((byte)31) |
#define | MLOG_DUMMY_RECORD ((byte)32) |
#define | MLOG_FILE_CREATE ((byte)33) |
#define | MLOG_FILE_RENAME ((byte)34) |
#define | MLOG_FILE_DELETE ((byte)35) |
#define | MLOG_COMP_REC_MIN_MARK ((byte)36) |
#define | MLOG_COMP_PAGE_CREATE ((byte)37) |
#define | MLOG_COMP_REC_INSERT ((byte)38) |
#define | MLOG_COMP_REC_CLUST_DELETE_MARK ((byte)39) |
#define | MLOG_COMP_REC_SEC_DELETE_MARK ((byte)40) |
#define | MLOG_COMP_REC_UPDATE_IN_PLACE ((byte)41) |
#define | MLOG_COMP_REC_DELETE ((byte)42) |
#define | MLOG_COMP_LIST_END_DELETE ((byte)43) |
#define | MLOG_COMP_LIST_START_DELETE ((byte)44) |
#define | MLOG_COMP_LIST_END_COPY_CREATED ((byte)45) |
#define | MLOG_COMP_PAGE_REORGANIZE ((byte)46) |
#define | MLOG_FILE_CREATE2 ((byte)47) |
#define | MLOG_ZIP_WRITE_NODE_PTR ((byte)48) |
#define | MLOG_ZIP_WRITE_BLOB_PTR ((byte)49) |
#define | MLOG_ZIP_WRITE_HEADER ((byte)50) |
#define | MLOG_ZIP_PAGE_COMPRESS ((byte)51) |
#define | MLOG_BIGGEST_TYPE ((byte)51) |
Flags for MLOG_FILE operations | |
(stored in the page number parameter, called log_flags in the functions). The page number parameter was originally written as 0. | |
#define | MLOG_FILE_FLAG_TEMP 1 |
Typedefs | |
typedef struct mtr_memo_slot_struct | mtr_memo_slot_t |
Functions | |
UNIV_INLINE mtr_t * | mtr_start (mtr_t *mtr) |
UNIV_INTERN void | mtr_commit (mtr_t *mtr) |
UNIV_INLINE ulint | mtr_set_savepoint (mtr_t *mtr) |
UNIV_INTERN void | mtr_rollback_to_savepoint (mtr_t *mtr, ulint savepoint) |
UNIV_INLINE void | mtr_release_s_latch_at_savepoint (mtr_t *mtr, ulint savepoint, rw_lock_t *lock) |
UNIV_INLINE ulint | mtr_get_log_mode (mtr_t *mtr) |
UNIV_INLINE ulint | mtr_set_log_mode (mtr_t *mtr, ulint mode) |
UNIV_INTERN ulint | mtr_read_ulint (const byte *ptr, ulint type, mtr_t *mtr) |
UNIV_INLINE void | mtr_s_lock_func (rw_lock_t *lock, const char *file, ulint line, mtr_t *mtr) |
UNIV_INLINE void | mtr_x_lock_func (rw_lock_t *lock, const char *file, ulint line, mtr_t *mtr) |
UNIV_INTERN void | mtr_memo_release (mtr_t *mtr, void *object, ulint type) |
UNIV_INLINE dyn_array_t * | mtr_get_log (mtr_t *mtr) |
UNIV_INLINE void | mtr_memo_push (mtr_t *mtr, void *object, ulint type) |
#define MLOG_1BYTE (1) |
one byte is written
Definition at line 66 of file mtr0mtr.h.
Referenced by mlog_parse_nbytes(), mlog_write_ulint(), mtr_read_ulint(), and trx_undo_set_state_at_prepare().
#define MLOG_2BYTES (2) |
2 bytes ...
Definition at line 67 of file mtr0mtr.h.
Referenced by btr_store_big_rec_extern_fields(), mlog_parse_nbytes(), mlog_write_ulint(), mtr_read_ulint(), trx_purge_add_update_undo_to_history(), trx_undo_set_state_at_finish(), trx_undo_set_state_at_prepare(), and trx_undo_truncate_end().
#define MLOG_4BYTES (4) |
4 bytes ...
Definition at line 68 of file mtr0mtr.h.
Referenced by btr_free_externally_stored_field(), btr_store_big_rec_extern_fields(), dict_boot(), dict_check_tablespaces_and_store_max_id(), dict_drop_index_tree(), dict_hdr_get_new_id(), dict_truncate_index_tree(), flst_cut_end(), flst_insert_after(), flst_insert_before(), flst_remove(), flst_truncate_end(), fsp_header_get_tablespace_size(), mlog_parse_nbytes(), mlog_write_ulint(), mtr_read_ulint(), page_rec_write_index_page_no(), trx_purge_add_update_undo_to_history(), trx_rseg_header_create(), trx_sys_create_doublewrite_buf(), and trx_sys_mark_upgraded_to_multiple_tablespaces().
#define MLOG_8BYTES (8) |
8 bytes ...
Definition at line 69 of file mtr0mtr.h.
Referenced by mlog_parse_nbytes(), mlog_write_initial_log_record(), and mlog_write_ull().
#define MLOG_BIGGEST_TYPE ((byte)51) |
biggest value (used in assertions)
Definition at line 180 of file mtr0mtr.h.
Referenced by mlog_parse_initial_log_record(), and mlog_write_initial_log_record().
#define MLOG_COMP_LIST_END_COPY_CREATED ((byte)45) |
#define MLOG_COMP_LIST_END_DELETE ((byte)43) |
delete compact record list end on index page
Definition at line 159 of file mtr0mtr.h.
Referenced by page_delete_rec_list_end(), and page_parse_delete_rec_list().
#define MLOG_COMP_LIST_START_DELETE ((byte)44) |
delete compact record list start on index page
Definition at line 161 of file mtr0mtr.h.
Referenced by page_delete_rec_list_start(), and page_parse_delete_rec_list().
#define MLOG_COMP_PAGE_CREATE ((byte)37) |
#define MLOG_COMP_PAGE_REORGANIZE ((byte)46) |
#define MLOG_COMP_REC_CLUST_DELETE_MARK ((byte)39) |
#define MLOG_COMP_REC_DELETE ((byte)42) |
#define MLOG_COMP_REC_INSERT ((byte)38) |
#define MLOG_COMP_REC_MIN_MARK ((byte)36) |
mark a compact index record as the predefined minimum record
Definition at line 134 of file mtr0mtr.h.
Referenced by btr_set_min_rec_mark().
#define MLOG_COMP_REC_SEC_DELETE_MARK ((byte)40) |
#define MLOG_COMP_REC_UPDATE_IN_PLACE ((byte)41) |
#define MLOG_DUMMY_RECORD ((byte)32) |
#define MLOG_FILE_CREATE ((byte)33) |
log record about an .ibd file creation
Definition at line 128 of file mtr0mtr.h.
Referenced by fil_create_new_single_table_tablespace(), and fil_op_log_parse_or_replay().
#define MLOG_FILE_CREATE2 ((byte)47) |
log record about creating an .ibd file, with format
Definition at line 169 of file mtr0mtr.h.
Referenced by fil_create_new_single_table_tablespace(), and fil_op_log_parse_or_replay().
#define MLOG_FILE_DELETE ((byte)35) |
log record about an .ibd file deletion
Definition at line 132 of file mtr0mtr.h.
Referenced by fil_delete_tablespace(), and fil_op_log_parse_or_replay().
#define MLOG_FILE_FLAG_TEMP 1 |
identifies TEMPORARY TABLE in MLOG_FILE_CREATE, MLOG_FILE_CREATE2
Definition at line 187 of file mtr0mtr.h.
Referenced by fil_create_new_single_table_tablespace(), and fil_op_log_parse_or_replay().
#define MLOG_FILE_RENAME ((byte)34) |
log record about an .ibd file rename
Definition at line 130 of file mtr0mtr.h.
Referenced by fil_op_log_parse_or_replay(), and fil_rename_tablespace().
#define MLOG_IBUF_BITMAP_INIT ((byte)27) |
initialize an ibuf bitmap page
Definition at line 105 of file mtr0mtr.h.
Referenced by ibuf_bitmap_page_init().
#define MLOG_INIT_FILE_PAGE ((byte)29) |
this means that a file page is taken into use and the prior contents of the page should be ignored: in recovery we must not trust the lsn values stored to the file page
Definition at line 111 of file mtr0mtr.h.
Referenced by recv_recover_page_func().
#define MLOG_LIST_END_COPY_CREATED ((byte)17) |
#define MLOG_LIST_END_DELETE ((byte)15) |
delete record list end on index page
Definition at line 79 of file mtr0mtr.h.
Referenced by page_delete_rec_list_end(), and page_parse_delete_rec_list().
#define MLOG_LIST_START_DELETE ((byte)16) |
delete record list start on index page
Definition at line 81 of file mtr0mtr.h.
Referenced by page_delete_rec_list_start(), and page_parse_delete_rec_list().
#define MLOG_MULTI_REC_END ((byte)31) |
#define MLOG_PAGE_CREATE ((byte)19) |
#define MLOG_PAGE_REORGANIZE ((byte)18) |
#define MLOG_REC_CLUST_DELETE_MARK ((byte)10) |
#define MLOG_REC_DELETE ((byte)14) |
#define MLOG_REC_INSERT ((byte)9) |
#define MLOG_REC_MIN_MARK ((byte)26) |
mark an index record as the predefined minimum record
Definition at line 101 of file mtr0mtr.h.
Referenced by btr_set_min_rec_mark().
#define MLOG_REC_SEC_DELETE_MARK ((byte)11) |
#define MLOG_REC_UPDATE_IN_PLACE ((byte)13) |
#define MLOG_SINGLE_REC_FLAG 128 |
if the mtr contains only one log record for one page, i.e., write_initial_log_record has been called only once, this flag is ORed to the type of that first log record
Definition at line 60 of file mtr0mtr.h.
Referenced by mlog_parse_initial_log_record().
#define MLOG_UNDO_ERASE_END ((byte)21) |
#define MLOG_UNDO_HDR_CREATE ((byte)25) |
create an undo log header
Definition at line 99 of file mtr0mtr.h.
Referenced by trx_undo_parse_page_header().
#define MLOG_UNDO_HDR_DISCARD ((byte)23) |
#define MLOG_UNDO_HDR_REUSE ((byte)24) |
reuse an insert undo log header
Definition at line 97 of file mtr0mtr.h.
Referenced by trx_undo_parse_page_header().
#define MLOG_UNDO_INIT ((byte)22) |
#define MLOG_UNDO_INSERT ((byte)20) |
#define MLOG_WRITE_STRING ((byte)30) |
#define MLOG_ZIP_PAGE_COMPRESS ((byte)51) |
#define MLOG_ZIP_WRITE_BLOB_PTR ((byte)49) |
#define MLOG_ZIP_WRITE_HEADER ((byte)50) |
#define MLOG_ZIP_WRITE_NODE_PTR ((byte)48) |
#define MTR_LOG_ALL |
#define MTR_LOG_SHORT_INSERTS |
#define mtr_s_lock | ( | B, | |
MTR | |||
) |
mtr_s_lock_func((B), __FILE__, __LINE__,\ (MTR))
This macro locks an rw-lock in s-mode.
Definition at line 269 of file mtr0mtr.h.
Referenced by btr_cur_open_at_index_side_func(), btr_cur_open_at_rnd_pos_func(), btr_cur_search_to_nth_level(), btr_get_size(), row_vers_impl_x_locked_off_kernel(), row_vers_must_preserve_del_marked(), and row_vers_old_has_index_entry().
#define mtr_x_lock | ( | B, | |
MTR | |||
) |
mtr_x_lock_func((B), __FILE__, __LINE__,\ (MTR))
This macro locks an rw-lock in x-mode.
Definition at line 273 of file mtr0mtr.h.
Referenced by btr_cur_open_at_index_side_func(), btr_cur_open_at_rnd_pos_func(), btr_cur_search_to_nth_level(), btr_validate_index(), fsp_header_get_tablespace_size(), and ibuf_init_at_db_start().
UNIV_INTERN void mtr_commit | ( | mtr_t * | mtr | ) |
Commits a mini-transaction. in: mini-transaction
Commits a mini-transaction.
mtr | in: mini-transaction |
Definition at line 247 of file mtr0mtr.cc.
References dyn_array_free(), mtr_struct::log, mtr_struct::memo, mtr_commit(), ut_ad, and ut_d.
Referenced by btr_estimate_n_rows_in_range(), btr_estimate_number_of_different_key_vals(), btr_free_but_not_root(), btr_free_externally_stored_field(), btr_get_size(), btr_pcur_move_backward_from_page(), btr_search_drop_page_hash_when_freed(), btr_store_big_rec_extern_fields(), btr_validate_index(), buf_page_init_for_read(), dict_boot(), dict_check_tablespaces_and_store_max_id(), dict_create(), dict_get_first_table_name_in_db(), dict_hdr_get_new_id(), dict_load_foreigns(), dict_load_table(), dict_load_table_on_id(), dict_print(), dict_truncate_index_tree(), fil_create_new_single_table_tablespace(), fil_delete_tablespace(), fil_rename_tablespace(), flst_validate(), fsp_header_get_tablespace_size(), ibuf_init_at_db_start(), ibuf_page(), ibuf_update_max_tablespace_id(), innobase_start_or_create_for_mysql(), lock_print_info_all_transactions(), lock_rec_print(), mtr_commit(), recv_apply_hashed_log_recs(), recv_recover_page_func(), row_ins_check_foreign_constraint(), row_mysql_drop_temp_tables(), row_search_for_mysql(), row_search_max_autoinc(), row_truncate_table_for_mysql(), row_unlock_for_mysql(), row_vers_impl_x_locked_off_kernel(), trx_commit_off_kernel(), trx_roll_pop_top_rec_of_trx(), trx_sys_create(), trx_sys_create_doublewrite_buf(), trx_sys_init_at_db_start(), trx_sys_mark_upgraded_to_multiple_tablespaces(), trx_sys_read_commit_id(), trx_undo_assign_undo(), trx_undo_get_undo_rec_low(), trx_undo_lists_init(), trx_undo_report_row_operation(), trx_undo_truncate_end(), and trx_undo_truncate_start().
UNIV_INLINE dyn_array_t* mtr_get_log | ( | mtr_t * | mtr | ) |
Returns the log object of a mini-transaction buffer.
UNIV_INLINE ulint mtr_get_log_mode | ( | mtr_t * | mtr | ) |
Gets the logging mode of a mini-transaction.
Referenced by mlog_catenate_string().
UNIV_INLINE void mtr_memo_push | ( | mtr_t * | mtr, |
void * | object, | ||
ulint | type | ||
) |
Pushes an object to an mtr memo stack. in: object type: MTR_MEMO_S_LOCK, ...
mtr | in: mtr |
object | in: object |
Referenced by buf_page_create(), buf_page_get_gen(), buf_page_get_known_nowait(), buf_page_optimistic_get(), and buf_page_try_get_func().
UNIV_INTERN void mtr_memo_release | ( | mtr_t * | mtr, |
void * | object, | ||
ulint | type | ||
) |
Releases an object in the memo stack. in: object type: MTR_MEMO_S_LOCK, ...
Releases an object in the memo stack.
mtr | in: mtr |
object | in: object |
type | in: object type: MTR_MEMO_S_LOCK, ... |
Definition at line 315 of file mtr0mtr.cc.
References dyn_array_get_data_size(), dyn_array_get_element(), log_flush_order_mutex_enter, log_flush_order_mutex_exit, mtr_struct::memo, mtr_memo_release(), mtr_memo_slot_struct::object, mtr_memo_slot_struct::type, and ut_ad.
Referenced by btr_page_split_and_insert(), and mtr_memo_release().
UNIV_INTERN ulint mtr_read_ulint | ( | const byte * | ptr, |
ulint | type, | ||
mtr_t * | |||
) |
Reads 1 - 4 bytes from a file page buffered in the buffer pool.
Reads 1 - 4 bytes from a file page buffered in the buffer pool.
ptr | in: pointer from where to read |
type | in: MLOG_1BYTE, MLOG_2BYTES, MLOG_4BYTES |
Definition at line 361 of file mtr0mtr.cc.
References mach_read_from_1(), mach_read_from_2(), mach_read_from_4(), MLOG_1BYTE, MLOG_2BYTES, MLOG_4BYTES, mtr_read_ulint(), and ut_ad.
Referenced by dict_boot(), dict_check_tablespaces_and_store_max_id(), dict_drop_index_tree(), dict_hdr_get_new_id(), dict_truncate_index_tree(), fsp_header_get_tablespace_size(), mtr_read_ulint(), and trx_purge_add_update_undo_to_history().
UNIV_INLINE void mtr_release_s_latch_at_savepoint | ( | mtr_t * | mtr, |
ulint | savepoint, | ||
rw_lock_t * | lock | ||
) |
Releases the (index tree) s-latch stored in an mtr memo after a savepoint. in: latch to release
mtr | in: mtr |
savepoint | in: savepoint |
Referenced by btr_cur_open_at_index_side_func(), and btr_cur_search_to_nth_level().
UNIV_INTERN void mtr_rollback_to_savepoint | ( | mtr_t * | mtr, |
ulint | savepoint | ||
) |
Releases the latches stored in an mtr memo down to a savepoint. NOTE! The mtr must not have made changes to buffer pages after the savepoint, as these can be handled only by mtr_commit. in: savepoint
Releases the latches stored in an mtr memo down to a savepoint. NOTE! The mtr must not have made changes to buffer pages after the savepoint, as these can be handled only by mtr_commit.
mtr | in: mtr |
savepoint | in: savepoint |
Definition at line 279 of file mtr0mtr.cc.
References dyn_array_get_data_size(), dyn_array_get_element(), mtr_struct::memo, mtr_rollback_to_savepoint(), mtr_memo_slot_struct::type, and ut_ad.
Referenced by mtr_rollback_to_savepoint().
UNIV_INLINE void mtr_s_lock_func | ( | rw_lock_t * | lock, |
const char * | file, | ||
ulint | line, | ||
mtr_t * | mtr | ||
) |
NOTE! Use the macro above! Locks a lock in s-mode. in: mtr
lock | in: rw-lock |
file | in: file name |
line | in: line number |
UNIV_INLINE ulint mtr_set_log_mode | ( | mtr_t * | mtr, |
ulint | mode | ||
) |
Changes the logging mode of a mini-transaction.
mtr | in: mtr |
Referenced by page_copy_rec_list_end(), page_copy_rec_list_end_to_created_page(), page_copy_rec_list_start(), page_delete_rec_list_end(), page_delete_rec_list_start(), page_zip_reorganize(), and recv_recover_page_func().
UNIV_INLINE ulint mtr_set_savepoint | ( | mtr_t * | mtr | ) |
Sets and returns a savepoint in mtr.
Referenced by btr_cur_open_at_index_side_func(), and btr_cur_search_to_nth_level().
Starts a mini-transaction and creates a mini-transaction handle and buffer in the memory buffer given by the caller.
Referenced by btr_estimate_n_rows_in_range(), btr_estimate_number_of_different_key_vals(), btr_free_but_not_root(), btr_free_externally_stored_field(), btr_get_size(), btr_pcur_move_backward_from_page(), btr_search_drop_page_hash_when_freed(), btr_store_big_rec_extern_fields(), btr_validate_index(), buf_page_init_for_read(), dict_boot(), dict_check_tablespaces_and_store_max_id(), dict_create(), dict_get_first_table_name_in_db(), dict_hdr_get_new_id(), dict_load_foreigns(), dict_load_table(), dict_load_table_on_id(), dict_print(), dict_truncate_index_tree(), fil_create_new_single_table_tablespace(), fil_delete_tablespace(), fil_rename_tablespace(), flst_validate(), fsp_header_get_tablespace_size(), ibuf_init_at_db_start(), ibuf_page(), ibuf_update_max_tablespace_id(), innobase_start_or_create_for_mysql(), lock_print_info_all_transactions(), lock_rec_print(), recv_apply_hashed_log_recs(), recv_recover_page_func(), row_ins_check_foreign_constraint(), row_mysql_drop_temp_tables(), row_purge_poss_sec(), row_search_for_mysql(), row_search_max_autoinc(), row_truncate_table_for_mysql(), row_undo_search_clust_to_pcur(), row_unlock_for_mysql(), row_vers_impl_x_locked_off_kernel(), trx_commit_off_kernel(), trx_roll_pop_top_rec_of_trx(), trx_sys_create(), trx_sys_create_doublewrite_buf(), trx_sys_init_at_db_start(), trx_sys_mark_upgraded_to_multiple_tablespaces(), trx_sys_read_commit_id(), trx_undo_assign_undo(), trx_undo_get_undo_rec_low(), trx_undo_lists_init(), trx_undo_report_row_operation(), trx_undo_truncate_end(), and trx_undo_truncate_start().
UNIV_INLINE void mtr_x_lock_func | ( | rw_lock_t * | lock, |
const char * | file, | ||
ulint | line, | ||
mtr_t * | mtr | ||
) |
NOTE! Use the macro above! Locks a lock in x-mode. in: mtr
lock | in: rw-lock |
file | in: file name |
line | in: line number |