#include "univ.i"#include "trx0types.h"#include "mtr0mtr.h"#include "trx0sys.h"#include "page0types.h"#include "trx0xa.h"Include dependency graph for trx0undo.h:

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.
| #define TRX_UNDO_ACTIVE 1 |
Definition at line 318 of file trx0undo.h.
Referenced by trx_lists_init_at_db_start(), trx_undo_header_create(), trx_undo_insert_header_reuse(), trx_undo_mem_create(), and trx_undo_mem_init_for_reuse().
| #define TRX_UNDO_CACHED 2 |
Definition at line 320 of file trx0undo.h.
Referenced by trx_purge_add_update_undo_to_history(), trx_undo_discard_latest_update_undo(), trx_undo_insert_cleanup(), trx_undo_mem_create_at_db_start(), trx_undo_set_state_at_finish(), and trx_undo_update_cleanup().
| #define TRX_UNDO_DEL_MARKS 16 |
Definition at line 446 of file trx0undo.h.
Referenced by trx_purge_add_update_undo_to_history(), trx_purge_free_segment(), trx_purge_rseg_get_next_history_log(), trx_rseg_mem_create(), and trx_undo_header_create().
| #define TRX_UNDO_DICT_TRANS 21 |
Definition at line 459 of file trx0undo.h.
Referenced by trx_undo_header_create(), trx_undo_insert_header_reuse(), trx_undo_mark_as_dict_operation(), and trx_undo_mem_create_at_db_start().
| #define TRX_UNDO_FSEG_HEADER 4 |
Definition at line 428 of file trx0undo.h.
Referenced by trx_purge_free_segment(), trx_undo_add_page(), trx_undo_free_page(), trx_undo_seg_create(), and trx_undo_seg_free().
| #define TRX_UNDO_HISTORY_NODE 34 |
Definition at line 472 of file trx0undo.h.
Referenced by trx_purge_add_update_undo_to_history(), trx_purge_free_segment(), trx_purge_rseg_get_next_history_log(), and trx_purge_truncate_rseg_history().
| #define TRX_UNDO_INSERT 1 |
Definition at line 312 of file trx0undo.h.
Referenced by buf_page_print(), trx_undo_assign_undo(), trx_undo_insert_header_reuse(), trx_undo_mem_create_at_db_start(), trx_undo_page_report_insert(), trx_undo_report_row_operation(), trx_undo_reuse_cached(), and trx_undo_set_state_at_finish().
| #define TRX_UNDO_LAST_LOG 2 |
Definition at line 425 of file trx0undo.h.
Referenced by trx_undo_discard_latest_update_undo(), trx_undo_header_create(), trx_undo_mem_create_at_db_start(), trx_undo_seg_create(), and trx_undo_set_state_at_prepare().
| #define TRX_UNDO_LOG_OLD_HDR_SIZE (34 + FLST_NODE_SIZE) |
Definition at line 475 of file trx0undo.h.
Referenced by trx_undo_header_add_space_for_xid(), trx_undo_header_create(), and trx_undo_insert_header_reuse().
| #define TRX_UNDO_LOG_START 18 |
Definition at line 450 of file trx0undo.h.
Referenced by trx_undo_discard_latest_update_undo(), trx_undo_empty_header_page(), trx_undo_header_add_space_for_xid(), trx_undo_header_create(), and trx_undo_insert_header_reuse().
| #define TRX_UNDO_LOG_XA_HDR_SIZE (TRX_UNDO_XA_XID + XIDDATASIZE) |
Definition at line 492 of file trx0undo.h.
Referenced by trx_undo_header_add_space_for_xid(), trx_undo_header_create(), and trx_undo_insert_header_reuse().
| #define TRX_UNDO_NEXT_LOG 30 |
Definition at line 468 of file trx0undo.h.
Referenced by trx_purge_truncate_rseg_history(), trx_undo_discard_latest_update_undo(), trx_undo_get_next_rec_from_next_page(), and trx_undo_header_create().
| #define TRX_UNDO_PAGE_FREE 4 |
Definition at line 396 of file trx0undo.h.
Referenced by trx_undo_discard_latest_update_undo(), trx_undo_erase_page_end(), trx_undo_header_add_space_for_xid(), trx_undo_header_create(), trx_undo_insert_header_reuse(), trx_undo_page_init(), trx_undo_page_report_insert(), trx_undo_page_report_modify(), trx_undo_parse_add_undo_rec(), trx_undo_seg_create(), and trx_undo_set_state_at_finish().
| #define TRX_UNDO_PAGE_HDR FSEG_PAGE_DATA |
Definition at line 386 of file trx0undo.h.
Referenced by buf_page_print(), trx_purge_add_update_undo_to_history(), trx_undo_add_page(), trx_undo_discard_latest_update_undo(), trx_undo_erase_page_end(), trx_undo_free_page(), trx_undo_get_next_rec_from_next_page(), trx_undo_get_prev_rec_from_prev_page(), trx_undo_header_add_space_for_xid(), trx_undo_header_create(), trx_undo_insert_header_reuse(), trx_undo_mem_create_at_db_start(), trx_undo_page_init(), trx_undo_page_report_insert(), trx_undo_page_report_modify(), trx_undo_parse_add_undo_rec(), trx_undo_reuse_cached(), trx_undo_seg_create(), trx_undo_set_state_at_finish(), and trx_undo_set_state_at_prepare().
| #define TRX_UNDO_PAGE_HDR_SIZE (6 + FLST_NODE_SIZE) |
| #define TRX_UNDO_PAGE_LIST (4 + FSEG_HEADER_SIZE) |
Definition at line 430 of file trx0undo.h.
Referenced by trx_purge_add_update_undo_to_history(), trx_purge_free_segment(), trx_undo_add_page(), trx_undo_free_page(), trx_undo_mem_create_at_db_start(), and trx_undo_seg_create().
| #define TRX_UNDO_PAGE_NODE 6 |
Definition at line 399 of file trx0undo.h.
Referenced by trx_undo_add_page(), trx_undo_free_page(), trx_undo_get_next_rec_from_next_page(), trx_undo_get_prev_rec_from_prev_page(), and trx_undo_seg_create().
| #define TRX_UNDO_PAGE_REUSE_LIMIT (3 * UNIV_PAGE_SIZE / 4) |
| #define TRX_UNDO_PAGE_START 2 |
Definition at line 391 of file trx0undo.h.
Referenced by trx_undo_discard_latest_update_undo(), trx_undo_header_add_space_for_xid(), trx_undo_header_create(), trx_undo_insert_header_reuse(), and trx_undo_page_init().
| #define TRX_UNDO_PAGE_TYPE 0 |
Definition at line 389 of file trx0undo.h.
Referenced by buf_page_print(), trx_undo_insert_header_reuse(), trx_undo_mem_create_at_db_start(), trx_undo_page_init(), trx_undo_page_report_insert(), trx_undo_page_report_modify(), and trx_undo_reuse_cached().
| #define TRX_UNDO_PREPARED 5 |
Definition at line 325 of file trx0undo.h.
Referenced by trx_lists_init_at_db_start(), and trx_undo_set_state_at_prepare().
| #define TRX_UNDO_PREV_LOG 32 |
Definition at line 470 of file trx0undo.h.
Referenced by trx_undo_discard_latest_update_undo(), and trx_undo_header_create().
| #define TRX_UNDO_SEG_HDR (TRX_UNDO_PAGE_HDR + TRX_UNDO_PAGE_HDR_SIZE) |
Definition at line 422 of file trx0undo.h.
Referenced by trx_purge_add_update_undo_to_history(), trx_purge_free_segment(), trx_purge_rseg_get_next_history_log(), trx_purge_truncate_rseg_history(), trx_undo_add_page(), trx_undo_discard_latest_update_undo(), trx_undo_free_page(), trx_undo_header_create(), trx_undo_insert_header_reuse(), trx_undo_mem_create_at_db_start(), trx_undo_seg_create(), trx_undo_seg_free(), trx_undo_set_state_at_finish(), and trx_undo_set_state_at_prepare().
| #define TRX_UNDO_SEG_HDR_SIZE (4 + FSEG_HEADER_SIZE + FLST_BASE_NODE_SIZE) |
Definition at line 436 of file trx0undo.h.
Referenced by trx_undo_insert_header_reuse(), and trx_undo_seg_create().
| #define TRX_UNDO_STATE 0 |
Definition at line 424 of file trx0undo.h.
Referenced by trx_purge_truncate_rseg_history(), trx_undo_discard_latest_update_undo(), trx_undo_header_create(), trx_undo_insert_header_reuse(), trx_undo_mem_create_at_db_start(), trx_undo_set_state_at_finish(), and trx_undo_set_state_at_prepare().
| #define TRX_UNDO_TABLE_ID 22 |
Definition at line 466 of file trx0undo.h.
Referenced by trx_undo_mark_as_dict_operation(), and trx_undo_mem_create_at_db_start().
| #define TRX_UNDO_TO_FREE 3 |
Definition at line 321 of file trx0undo.h.
Referenced by trx_undo_insert_cleanup(), trx_undo_mem_create_at_db_start(), and trx_undo_set_state_at_finish().
| #define TRX_UNDO_TO_PURGE 4 |
Definition at line 322 of file trx0undo.h.
Referenced by trx_purge_truncate_rseg_history(), trx_undo_set_state_at_finish(), and trx_undo_update_cleanup().
| #define TRX_UNDO_TRX_ID 0 |
Definition at line 442 of file trx0undo.h.
Referenced by trx_undo_header_create(), trx_undo_insert_header_reuse(), and trx_undo_mem_create_at_db_start().
| #define TRX_UNDO_TRX_NO 8 |
Definition at line 443 of file trx0undo.h.
Referenced by trx_purge_add_update_undo_to_history(), trx_purge_rseg_get_next_history_log(), trx_purge_truncate_rseg_history(), and trx_rseg_mem_create().
| #define TRX_UNDO_UPDATE 2 |
Definition at line 313 of file trx0undo.h.
Referenced by buf_page_print(), trx_undo_mem_create_at_db_start(), trx_undo_page_report_modify(), trx_undo_report_row_operation(), and trx_undo_reuse_cached().
| #define TRX_UNDO_XA_BQUAL_LEN (TRX_UNDO_XA_TRID_LEN + 4) |
Definition at line 489 of file trx0undo.h.
Referenced by trx_undo_read_xid(), and trx_undo_write_xid().
| #define TRX_UNDO_XA_FORMAT (TRX_UNDO_LOG_OLD_HDR_SIZE) |
Definition at line 487 of file trx0undo.h.
Referenced by trx_undo_read_xid(), and trx_undo_write_xid().
| #define TRX_UNDO_XA_TRID_LEN (TRX_UNDO_XA_FORMAT + 4) |
Definition at line 488 of file trx0undo.h.
Referenced by trx_undo_read_xid(), and trx_undo_write_xid().
| #define TRX_UNDO_XA_XID (TRX_UNDO_XA_BQUAL_LEN + 4) |
Definition at line 490 of file trx0undo.h.
Referenced by trx_undo_read_xid(), and trx_undo_write_xid().
| #define TRX_UNDO_XID_EXISTS 20 |
Definition at line 456 of file trx0undo.h.
Referenced by trx_undo_header_create(), trx_undo_insert_header_reuse(), trx_undo_mem_create_at_db_start(), and trx_undo_set_state_at_prepare().
Referenced by row_get_rec_sys_field(), row_upd_parse_sys_vals(), and trx_undo_page_report_modify().
Here is the caller graph for this function:

| ulint trx_undo_add_page | ( | trx_t * | trx, | |
| trx_undo_t * | undo, | |||
| mtr_t * | mtr | |||
| ) |
Definition at line 819 of file trx0undo.c.
References trx_rseg_struct::curr_size, FIL_NULL, fil_space_release_free_extents(), flst_add_last(), fseg_alloc_free_page_general(), fsp_reserve_free_extents(), FSP_UNDO, FSP_UP, trx_undo_struct::hdr_page_no, kernel_mutex, trx_undo_struct::last_page_no, trx_rseg_struct::max_size, trx_rseg_struct::mutex, page_t, trx_struct::rseg, trx_undo_struct::size, trx_undo_struct::space, trx_undo_struct::top_page_no, TRUE, TRX_UNDO_FSEG_HEADER, trx_undo_page_get(), TRX_UNDO_PAGE_HDR, trx_undo_page_init(), TRX_UNDO_PAGE_LIST, TRX_UNDO_PAGE_NODE, TRX_UNDO_SEG_HDR, trx_undo_struct::type, trx_struct::undo_mutex, and ut_ad.
Referenced by trx_undo_report_row_operation().
00821 : page number if success, else 00822 FIL_NULL */ 00823 trx_t* trx, /* in: transaction */ 00824 trx_undo_t* undo, /* in: undo log memory object */ 00825 mtr_t* mtr) /* in: mtr which does not have a latch to any 00826 undo log page; the caller must have reserved 00827 the rollback segment mutex */ 00828 { 00829 page_t* header_page; 00830 page_t* new_page; 00831 trx_rseg_t* rseg; 00832 ulint page_no; 00833 ulint n_reserved; 00834 ibool success; 00835 00836 #ifdef UNIV_SYNC_DEBUG 00837 ut_ad(mutex_own(&(trx->undo_mutex))); 00838 ut_ad(!mutex_own(&kernel_mutex)); 00839 ut_ad(mutex_own(&(trx->rseg->mutex))); 00840 #endif /* UNIV_SYNC_DEBUG */ 00841 00842 rseg = trx->rseg; 00843 00844 if (rseg->curr_size == rseg->max_size) { 00845 00846 return(FIL_NULL); 00847 } 00848 00849 header_page = trx_undo_page_get(undo->space, undo->hdr_page_no, mtr); 00850 00851 success = fsp_reserve_free_extents(&n_reserved, undo->space, 1, 00852 FSP_UNDO, mtr); 00853 if (!success) { 00854 00855 return(FIL_NULL); 00856 } 00857 00858 page_no = fseg_alloc_free_page_general(header_page + TRX_UNDO_SEG_HDR 00859 + TRX_UNDO_FSEG_HEADER, 00860 undo->top_page_no + 1, FSP_UP, 00861 TRUE, mtr); 00862 00863 fil_space_release_free_extents(undo->space, n_reserved); 00864 00865 if (page_no == FIL_NULL) { 00866 00867 /* No space left */ 00868 00869 return(FIL_NULL); 00870 } 00871 00872 undo->last_page_no = page_no; 00873 00874 new_page = trx_undo_page_get(undo->space, page_no, mtr); 00875 00876 trx_undo_page_init(new_page, undo->type, mtr); 00877 00878 flst_add_last(header_page + TRX_UNDO_SEG_HDR + TRX_UNDO_PAGE_LIST, 00879 new_page + TRX_UNDO_PAGE_HDR + TRX_UNDO_PAGE_NODE, mtr); 00880 undo->size++; 00881 rseg->curr_size++; 00882 00883 return(page_no); 00884 }
Here is the call graph for this function:

Here is the caller graph for this function:

| trx_undo_t* trx_undo_assign_undo | ( | trx_t * | trx, | |
| ulint | type | |||
| ) |
Definition at line 1656 of file trx0undo.c.
References trx_struct::dict_operation, trx_struct::id, trx_struct::insert_undo, kernel_mutex, mtr_commit(), mtr_start(), trx_rseg_struct::mutex, mutex_enter, mutex_exit(), NULL, trx_struct::rseg, trx_undo_create(), TRX_UNDO_INSERT, trx_undo_mark_as_dict_operation(), trx_undo_reuse_cached(), trx_struct::undo_mutex, trx_struct::update_undo, ut_ad, UT_LIST_ADD_FIRST, and trx_struct::xid.
Referenced by trx_undo_report_row_operation().
01658 : the undo log, NULL if did not succeed: out of 01659 space */ 01660 trx_t* trx, /* in: transaction */ 01661 ulint type) /* in: TRX_UNDO_INSERT or TRX_UNDO_UPDATE */ 01662 { 01663 trx_rseg_t* rseg; 01664 trx_undo_t* undo; 01665 mtr_t mtr; 01666 01667 ut_ad(trx); 01668 ut_ad(trx->rseg); 01669 01670 rseg = trx->rseg; 01671 01672 #ifdef UNIV_SYNC_DEBUG 01673 ut_ad(mutex_own(&(trx->undo_mutex))); 01674 #endif /* UNIV_SYNC_DEBUG */ 01675 01676 mtr_start(&mtr); 01677 01678 #ifdef UNIV_SYNC_DEBUG 01679 ut_ad(!mutex_own(&kernel_mutex)); 01680 #endif /* UNIV_SYNC_DEBUG */ 01681 mutex_enter(&(rseg->mutex)); 01682 01683 undo = trx_undo_reuse_cached(trx, rseg, type, trx->id, &trx->xid, 01684 &mtr); 01685 if (undo == NULL) { 01686 undo = trx_undo_create(trx, rseg, type, trx->id, &trx->xid, 01687 &mtr); 01688 if (undo == NULL) { 01689 /* Did not succeed */ 01690 01691 mutex_exit(&(rseg->mutex)); 01692 mtr_commit(&mtr); 01693 01694 return(NULL); 01695 } 01696 } 01697 01698 if (type == TRX_UNDO_INSERT) { 01699 UT_LIST_ADD_FIRST(undo_list, rseg->insert_undo_list, undo); 01700 ut_ad(trx->insert_undo == NULL); 01701 trx->insert_undo = undo; 01702 } else { 01703 UT_LIST_ADD_FIRST(undo_list, rseg->update_undo_list, undo); 01704 ut_ad(trx->update_undo == NULL); 01705 trx->update_undo = undo; 01706 } 01707 01708 if (trx->dict_operation) { 01709 trx_undo_mark_as_dict_operation(trx, undo, &mtr); 01710 } 01711 01712 mutex_exit(&(rseg->mutex)); 01713 mtr_commit(&mtr); 01714 01715 return(undo); 01716 }
Here is the call graph for this function:

Here is the caller graph for this function:

| UNIV_INLINE dulint trx_undo_build_roll_ptr | ( | ibool | is_insert, | |
| ulint | rseg_id, | |||
| ulint | page_no, | |||
| ulint | offset | |||
| ) |
Referenced by trx_purge_fetch_next_rec(), trx_roll_pop_top_rec_of_trx(), and trx_undo_report_row_operation().
Here is the caller graph for this function:

| UNIV_INLINE void trx_undo_decode_roll_ptr | ( | dulint | roll_ptr, | |
| ibool * | is_insert, | |||
| ulint * | rseg_id, | |||
| ulint * | page_no, | |||
| ulint * | offset | |||
| ) |
Referenced by row_purge_upd_exist_or_extern(), and trx_undo_get_undo_rec_low().
Here is the caller graph for this function:

| trx_undo_rec_t* trx_undo_get_first_rec | ( | ulint | space, | |
| ulint | page_no, | |||
| ulint | offset, | |||
| ulint | mode, | |||
| mtr_t * | mtr | |||
| ) |
Definition at line 274 of file trx0undo.c.
References page_t, RW_S_LATCH, trx_undo_get_next_rec_from_next_page(), trx_undo_page_get(), trx_undo_page_get_first_rec(), and trx_undo_page_get_s_latched().
Referenced by trx_purge_choose_next_log(), and trx_undo_truncate_start().
00276 : undo log record, the page latched, NULL if 00277 none */ 00278 ulint space, /* in: undo log header space */ 00279 ulint page_no,/* in: undo log header page number */ 00280 ulint offset, /* in: undo log header offset on page */ 00281 ulint mode, /* in: latching mode: RW_S_LATCH or RW_X_LATCH */ 00282 mtr_t* mtr) /* in: mtr */ 00283 { 00284 page_t* undo_page; 00285 trx_undo_rec_t* rec; 00286 00287 if (mode == RW_S_LATCH) { 00288 undo_page = trx_undo_page_get_s_latched(space, page_no, mtr); 00289 } else { 00290 undo_page = trx_undo_page_get(space, page_no, mtr); 00291 } 00292 00293 rec = trx_undo_page_get_first_rec(undo_page, page_no, offset); 00294 00295 if (rec) { 00296 return(rec); 00297 } 00298 00299 return(trx_undo_get_next_rec_from_next_page(undo_page, page_no, offset, 00300 mode, mtr)); 00301 }
Here is the call graph for this function:

Here is the caller graph for this function:

| trx_undo_rec_t* trx_undo_get_next_rec | ( | trx_undo_rec_t * | rec, | |
| ulint | page_no, | |||
| ulint | offset, | |||
| mtr_t * | mtr | |||
| ) |
Definition at line 248 of file trx0undo.c.
References buf_frame_align(), RW_S_LATCH, trx_undo_get_next_rec_from_next_page(), and trx_undo_page_get_next_rec().
Referenced by trx_purge_get_next_rec().
00250 : undo log record, the page s-latched, 00251 NULL if none */ 00252 trx_undo_rec_t* rec, /* in: undo record */ 00253 ulint page_no,/* in: undo log header page number */ 00254 ulint offset, /* in: undo log header offset on page */ 00255 mtr_t* mtr) /* in: mtr */ 00256 { 00257 trx_undo_rec_t* next_rec; 00258 00259 next_rec = trx_undo_page_get_next_rec(rec, page_no, offset); 00260 00261 if (next_rec) { 00262 return(next_rec); 00263 } 00264 00265 return(trx_undo_get_next_rec_from_next_page(buf_frame_align(rec), 00266 page_no, offset, 00267 RW_S_LATCH, mtr)); 00268 }
Here is the call graph for this function:

Here is the caller graph for this function:

| trx_undo_rec_t* trx_undo_get_prev_rec | ( | trx_undo_rec_t * | rec, | |
| ulint | page_no, | |||
| ulint | offset, | |||
| mtr_t * | mtr | |||
| ) |
Definition at line 167 of file trx0undo.c.
References trx_undo_get_prev_rec_from_prev_page(), and trx_undo_page_get_prev_rec().
Referenced by trx_roll_pop_top_rec().
00169 : undo log record, the page s-latched, 00170 NULL if none */ 00171 trx_undo_rec_t* rec, /* in: undo record */ 00172 ulint page_no,/* in: undo log header page number */ 00173 ulint offset, /* in: undo log header offset on page */ 00174 mtr_t* mtr) /* in: mtr */ 00175 { 00176 trx_undo_rec_t* prev_rec; 00177 00178 prev_rec = trx_undo_page_get_prev_rec(rec, page_no, offset); 00179 00180 if (prev_rec) { 00181 00182 return(prev_rec); 00183 } 00184 00185 /* We have to go to the previous undo log page to look for the 00186 previous record */ 00187 00188 return(trx_undo_get_prev_rec_from_prev_page(rec, page_no, offset, 00189 mtr)); 00190 }
Here is the call graph for this function:

Here is the caller graph for this function:

| void trx_undo_insert_cleanup | ( | trx_t * | trx | ) |
Definition at line 1862 of file trx0undo.c.
References trx_rseg_struct::curr_size, trx_struct::insert_undo, trx_rseg_struct::mutex, mutex_enter, mutex_exit(), NULL, trx_struct::rseg, trx_undo_struct::size, trx_undo_struct::state, TRX_UNDO_CACHED, trx_undo_mem_free(), trx_undo_seg_free(), TRX_UNDO_TO_FREE, ut_ad, UT_LIST_ADD_FIRST, and UT_LIST_REMOVE.
Referenced by trx_cleanup_at_db_startup(), and trx_commit_off_kernel().
01864 : transaction handle */ 01865 { 01866 trx_undo_t* undo; 01867 trx_rseg_t* rseg; 01868 01869 undo = trx->insert_undo; 01870 ut_ad(undo); 01871 01872 rseg = trx->rseg; 01873 01874 mutex_enter(&(rseg->mutex)); 01875 01876 UT_LIST_REMOVE(undo_list, rseg->insert_undo_list, undo); 01877 trx->insert_undo = NULL; 01878 01879 if (undo->state == TRX_UNDO_CACHED) { 01880 01881 UT_LIST_ADD_FIRST(undo_list, rseg->insert_undo_cached, undo); 01882 } else { 01883 ut_ad(undo->state == TRX_UNDO_TO_FREE); 01884 01885 /* Delete first the undo log segment in the file */ 01886 01887 mutex_exit(&(rseg->mutex)); 01888 01889 trx_undo_seg_free(undo); 01890 01891 mutex_enter(&(rseg->mutex)); 01892 01893 ut_ad(rseg->curr_size > undo->size); 01894 01895 rseg->curr_size -= undo->size; 01896 01897 trx_undo_mem_free(undo); 01898 } 01899 01900 mutex_exit(&(rseg->mutex)); 01901 }
Here is the call graph for this function:

Here is the caller graph for this function:

| ulint trx_undo_lists_init | ( | trx_rseg_t * | rseg | ) |
Definition at line 1320 of file trx0undo.c.
References FIL_NULL, mtr_commit(), mtr_start(), trx_rseg_struct::page_no, trx_undo_struct::size, trx_rseg_struct::space, SRV_FORCE_NO_UNDO_LOG_SCAN, srv_force_recovery, TRX_RSEG_N_SLOTS, trx_rsegf_get(), trx_rsegf_get_new(), trx_rsegf_get_nth_undo(), trx_undo_mem_create_at_db_start(), and UT_LIST_INIT.
Referenced by trx_rseg_mem_create().
01322 : the combined size of undo log segments 01323 in pages */ 01324 trx_rseg_t* rseg) /* in: rollback segment memory object */ 01325 { 01326 ulint page_no; 01327 trx_undo_t* undo; 01328 ulint size = 0; 01329 trx_rsegf_t* rseg_header; 01330 ulint i; 01331 mtr_t mtr; 01332 01333 UT_LIST_INIT(rseg->update_undo_list); 01334 UT_LIST_INIT(rseg->update_undo_cached); 01335 UT_LIST_INIT(rseg->insert_undo_list); 01336 UT_LIST_INIT(rseg->insert_undo_cached); 01337 01338 mtr_start(&mtr); 01339 01340 rseg_header = trx_rsegf_get_new(rseg->space, rseg->page_no, &mtr); 01341 01342 for (i = 0; i < TRX_RSEG_N_SLOTS; i++) { 01343 page_no = trx_rsegf_get_nth_undo(rseg_header, i, &mtr); 01344 01345 /* In forced recovery: try to avoid operations which look 01346 at database pages; undo logs are rapidly changing data, and 01347 the probability that they are in an inconsistent state is 01348 high */ 01349 01350 if (page_no != FIL_NULL 01351 && srv_force_recovery < SRV_FORCE_NO_UNDO_LOG_SCAN) { 01352 01353 undo = trx_undo_mem_create_at_db_start(rseg, i, 01354 page_no, &mtr); 01355 size += undo->size; 01356 01357 mtr_commit(&mtr); 01358 01359 mtr_start(&mtr); 01360 01361 rseg_header = trx_rsegf_get(rseg->space, 01362 rseg->page_no, &mtr); 01363 } 01364 } 01365 01366 mtr_commit(&mtr); 01367 01368 return(size); 01369 }
Here is the call graph for this function:

Here is the caller graph for this function:

Referenced by trx_purge_free_segment(), trx_purge_truncate_rseg_history(), trx_rseg_mem_create(), trx_undo_add_page(), trx_undo_empty_header_page(), trx_undo_free_page(), trx_undo_get_first_rec(), trx_undo_get_next_rec_from_next_page(), trx_undo_mark_as_dict_operation(), trx_undo_mem_create_at_db_start(), trx_undo_reuse_cached(), trx_undo_seg_free(), trx_undo_set_state_at_finish(), trx_undo_set_state_at_prepare(), and trx_undo_truncate_end().
Here is the caller graph for this function:

| UNIV_INLINE trx_undo_rec_t* trx_undo_page_get_first_rec | ( | page_t * | undo_page, | |
| ulint | page_no, | |||
| ulint | offset | |||
| ) |
Referenced by trx_undo_get_first_rec(), and trx_undo_get_next_rec_from_next_page().
Here is the caller graph for this function:

| UNIV_INLINE trx_undo_rec_t* trx_undo_page_get_last_rec | ( | page_t * | undo_page, | |
| ulint | page_no, | |||
| ulint | offset | |||
| ) |
Referenced by trx_undo_get_prev_rec_from_prev_page(), trx_undo_mem_create_at_db_start(), trx_undo_truncate_end(), and trx_undo_truncate_start().
Here is the caller graph for this function:

| UNIV_INLINE trx_undo_rec_t* trx_undo_page_get_next_rec | ( | trx_undo_rec_t * | rec, | |
| ulint | page_no, | |||
| ulint | offset | |||
| ) |
Referenced by trx_purge_get_next_rec(), and trx_undo_get_next_rec().
Here is the caller graph for this function:

| UNIV_INLINE trx_undo_rec_t* trx_undo_page_get_prev_rec | ( | trx_undo_rec_t * | rec, | |
| ulint | page_no, | |||
| ulint | offset | |||
| ) |
Referenced by trx_undo_get_prev_rec(), and trx_undo_truncate_end().
Here is the caller graph for this function:

Referenced by trx_purge_get_next_rec(), trx_purge_rseg_get_next_history_log(), trx_roll_pop_top_rec(), trx_undo_get_first_rec(), trx_undo_get_next_rec_from_next_page(), trx_undo_get_prev_rec_from_prev_page(), and trx_undo_get_undo_rec_low().
Here is the caller graph for this function:

| byte* trx_undo_parse_page_header | ( | ulint | type, | |
| byte * | ptr, | |||
| byte * | end_ptr, | |||
| page_t * | page, | |||
| mtr_t * | mtr | |||
| ) |
Definition at line 651 of file trx0undo.c.
References mach_dulint_parse_compressed(), MLOG_UNDO_HDR_CREATE, MLOG_UNDO_HDR_REUSE, NULL, trx_undo_header_create(), trx_undo_insert_header_reuse(), and ut_ad.
Referenced by recv_parse_or_apply_log_rec_body().
00653 : end of log record or NULL */ 00654 ulint type, /* in: MLOG_UNDO_HDR_CREATE or MLOG_UNDO_HDR_REUSE */ 00655 byte* ptr, /* in: buffer */ 00656 byte* end_ptr,/* in: buffer end */ 00657 page_t* page, /* in: page or NULL */ 00658 mtr_t* mtr) /* in: mtr or NULL */ 00659 { 00660 dulint trx_id; 00661 00662 ptr = mach_dulint_parse_compressed(ptr, end_ptr, &trx_id); 00663 00664 if (ptr == NULL) { 00665 00666 return(NULL); 00667 } 00668 00669 if (page) { 00670 if (type == MLOG_UNDO_HDR_CREATE) { 00671 trx_undo_header_create(page, trx_id, mtr); 00672 } else { 00673 ut_ad(type == MLOG_UNDO_HDR_REUSE); 00674 trx_undo_insert_header_reuse(page, trx_id, mtr); 00675 } 00676 } 00677 00678 return(ptr); 00679 }
Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 324 of file trx0undo.c.
References mach_parse_compressed(), NULL, and trx_undo_page_init().
Referenced by recv_parse_or_apply_log_rec_body().
00326 : end of log record or NULL */ 00327 byte* ptr, /* in: buffer */ 00328 byte* end_ptr,/* in: buffer end */ 00329 page_t* page, /* in: page or NULL */ 00330 mtr_t* mtr) /* in: mtr or NULL */ 00331 { 00332 ulint type; 00333 00334 ptr = mach_parse_compressed(ptr, end_ptr, &type); 00335 00336 if (ptr == NULL) { 00337 00338 return(NULL); 00339 } 00340 00341 if (page) { 00342 trx_undo_page_init(page, type, mtr); 00343 } 00344 00345 return(ptr); 00346 }
Here is the call graph for this function:

Here is the caller graph for this function:

| UNIV_INLINE ibool trx_undo_roll_ptr_is_insert | ( | dulint | roll_ptr | ) |
Referenced by row_undo(), and trx_undo_prev_version_build().
Here is the caller graph for this function:

| page_t* trx_undo_set_state_at_finish | ( | trx_t * | trx, | |
| trx_undo_t * | undo, | |||
| mtr_t * | mtr | |||
| ) |
| page_t* trx_undo_set_state_at_prepare | ( | trx_t * | trx, | |
| trx_undo_t * | undo, | |||
| mtr_t * | mtr | |||
| ) |
Definition at line 1771 of file trx0undo.c.
References trx_undo_struct::hdr_page_no, trx_undo_struct::id, mach_read_from_2(), mem_analyze_corruption(), MLOG_1BYTE, MLOG_2BYTES, mlog_write_ulint(), offset, page_t, trx_undo_struct::space, trx_undo_struct::state, TRUE, TRX_RSEG_N_SLOTS, TRX_UNDO_LAST_LOG, trx_undo_page_get(), TRX_UNDO_PAGE_HDR, TRX_UNDO_PREPARED, TRX_UNDO_SEG_HDR, TRX_UNDO_STATE, trx_undo_write_xid(), TRX_UNDO_XID_EXISTS, ut_ad, ut_error, trx_undo_struct::xid, and trx_struct::xid.
Referenced by trx_prepare_off_kernel().
01773 : undo log segment header page, 01774 x-latched */ 01775 trx_t* trx, /* in: transaction */ 01776 trx_undo_t* undo, /* in: undo log memory copy */ 01777 mtr_t* mtr) /* in: mtr */ 01778 { 01779 trx_usegf_t* seg_hdr; 01780 trx_upagef_t* page_hdr; 01781 trx_ulogf_t* undo_header; 01782 page_t* undo_page; 01783 ulint offset; 01784 01785 ut_ad(trx && undo && mtr); 01786 01787 if (undo->id >= TRX_RSEG_N_SLOTS) { 01788 fprintf(stderr, "InnoDB: Error: undo->id is %lu\n", 01789 (ulong) undo->id); 01790 mem_analyze_corruption(undo); 01791 ut_error; 01792 } 01793 01794 undo_page = trx_undo_page_get(undo->space, undo->hdr_page_no, mtr); 01795 01796 seg_hdr = undo_page + TRX_UNDO_SEG_HDR; 01797 page_hdr = undo_page + TRX_UNDO_PAGE_HDR; 01798 01799 /*------------------------------*/ 01800 undo->state = TRX_UNDO_PREPARED; 01801 undo->xid = trx->xid; 01802 /*------------------------------*/ 01803 01804 mlog_write_ulint(seg_hdr + TRX_UNDO_STATE, undo->state, 01805 MLOG_2BYTES, mtr); 01806 01807 offset = mach_read_from_2(seg_hdr + TRX_UNDO_LAST_LOG); 01808 undo_header = undo_page + offset; 01809 01810 mlog_write_ulint(undo_header + TRX_UNDO_XID_EXISTS, 01811 TRUE, MLOG_1BYTE, mtr); 01812 01813 trx_undo_write_xid(undo_header, &undo->xid, mtr); 01814 01815 return(undo_page); 01816 }
Here is the call graph for this function:

Here is the caller graph for this function:

| void trx_undo_truncate_end | ( | trx_t * | trx, | |
| trx_undo_t * | undo, | |||
| dulint | limit | |||
| ) |
Definition at line 1002 of file trx0undo.c.
References trx_undo_struct::hdr_offset, trx_undo_struct::hdr_page_no, trx_undo_struct::last_page_no, mtr_commit(), mtr_start(), trx_rseg_struct::mutex, NULL, page_t, trx_struct::rseg, trx_undo_struct::space, trx_undo_free_page_in_rollback(), trx_undo_page_get(), trx_undo_page_get_last_rec(), trx_undo_page_get_prev_rec(), trx_undo_rec_get_undo_no(), trx_struct::undo_mutex, ut_ad, and ut_dulint_cmp().
Referenced by trx_roll_try_truncate().
01004 : transaction whose undo log it is */ 01005 trx_undo_t* undo, /* in: undo log */ 01006 dulint limit) /* in: all undo records with undo number 01007 >= this value should be truncated */ 01008 { 01009 page_t* undo_page; 01010 ulint last_page_no; 01011 trx_undo_rec_t* rec; 01012 trx_undo_rec_t* trunc_here; 01013 trx_rseg_t* rseg; 01014 mtr_t mtr; 01015 01016 #ifdef UNIV_SYNC_DEBUG 01017 ut_ad(mutex_own(&(trx->undo_mutex))); 01018 ut_ad(mutex_own(&(trx->rseg->mutex))); 01019 #endif /* UNIV_SYNC_DEBUG */ 01020 01021 rseg = trx->rseg; 01022 01023 for (;;) { 01024 mtr_start(&mtr); 01025 01026 trunc_here = NULL; 01027 01028 last_page_no = undo->last_page_no; 01029 01030 undo_page = trx_undo_page_get(undo->space, last_page_no, &mtr); 01031 01032 rec = trx_undo_page_get_last_rec(undo_page, undo->hdr_page_no, 01033 undo->hdr_offset); 01034 for (;;) { 01035 if (rec == NULL) { 01036 if (last_page_no == undo->hdr_page_no) { 01037 01038 goto function_exit; 01039 } 01040 01041 trx_undo_free_page_in_rollback(trx, undo, 01042 last_page_no, &mtr); 01043 break; 01044 } 01045 01046 if (ut_dulint_cmp(trx_undo_rec_get_undo_no(rec), limit) 01047 >= 0) { 01048 /* Truncate at least this record off, maybe 01049 more */ 01050 trunc_here = rec; 01051 } else { 01052 goto function_exit; 01053 } 01054 01055 rec = trx_undo_page_get_prev_rec(rec, 01056 undo->hdr_page_no, 01057 undo->hdr_offset); 01058 } 01059 01060 mtr_commit(&mtr); 01061 } 01062 01063 function_exit: 01064 if (trunc_here) { 01065 mlog_write_ulint(undo_page + TRX_UNDO_PAGE_HDR 01066 + TRX_UNDO_PAGE_FREE, 01067 trunc_here - undo_page, MLOG_2BYTES, &mtr); 01068 } 01069 01070 mtr_commit(&mtr); 01071 }
Here is the call graph for this function:

Here is the caller graph for this function:

| void trx_undo_truncate_start | ( | trx_rseg_t * | rseg, | |
| ulint | space, | |||
| ulint | hdr_page_no, | |||
| ulint | hdr_offset, | |||
| dulint | limit | |||
| ) |
Definition at line 1078 of file trx0undo.c.
References buf_frame_align(), buf_frame_get_page_no(), mtr_commit(), mtr_start(), trx_rseg_struct::mutex, NULL, page_t, RW_X_LATCH, TRUE, trx_undo_empty_header_page(), trx_undo_free_page(), trx_undo_get_first_rec(), trx_undo_page_get_last_rec(), trx_undo_rec_get_undo_no(), ut_ad, ut_dulint_cmp(), and ut_dulint_zero.
Referenced by trx_purge_truncate_rseg_history().
01080 : rollback segment */ 01081 ulint space, /* in: space id of the log */ 01082 ulint hdr_page_no, /* in: header page number */ 01083 ulint hdr_offset, /* in: header offset on the page */ 01084 dulint limit) /* in: all undo pages with undo numbers < 01085 this value should be truncated; NOTE that 01086 the function only frees whole pages; the 01087 header page is not freed, but emptied, if 01088 all the records there are < limit */ 01089 { 01090 page_t* undo_page; 01091 trx_undo_rec_t* rec; 01092 trx_undo_rec_t* last_rec; 01093 ulint page_no; 01094 mtr_t mtr; 01095 01096 #ifdef UNIV_SYNC_DEBUG 01097 ut_ad(mutex_own(&(rseg->mutex))); 01098 #endif /* UNIV_SYNC_DEBUG */ 01099 01100 if (0 == ut_dulint_cmp(limit, ut_dulint_zero)) { 01101 01102 return; 01103 } 01104 loop: 01105 mtr_start(&mtr); 01106 01107 rec = trx_undo_get_first_rec(space, hdr_page_no, hdr_offset, 01108 RW_X_LATCH, &mtr); 01109 if (rec == NULL) { 01110 /* Already empty */ 01111 01112 mtr_commit(&mtr); 01113 01114 return; 01115 } 01116 01117 undo_page = buf_frame_align(rec); 01118 01119 last_rec = trx_undo_page_get_last_rec(undo_page, hdr_page_no, 01120 hdr_offset); 01121 if (ut_dulint_cmp(trx_undo_rec_get_undo_no(last_rec), limit) >= 0) { 01122 01123 mtr_commit(&mtr); 01124 01125 return; 01126 } 01127 01128 page_no = buf_frame_get_page_no(undo_page); 01129 01130 if (page_no == hdr_page_no) { 01131 trx_undo_empty_header_page(space, hdr_page_no, hdr_offset, 01132 &mtr); 01133 } else { 01134 trx_undo_free_page(rseg, TRUE, space, hdr_page_no, 01135 page_no, &mtr); 01136 } 01137 01138 mtr_commit(&mtr); 01139 01140 goto loop; 01141 }
Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 1824 of file trx0undo.c.
References trx_rseg_struct::mutex, NULL, trx_struct::rseg, trx_undo_struct::state, trx_purge_add_update_undo_to_history(), TRX_UNDO_CACHED, trx_undo_mem_free(), TRX_UNDO_TO_PURGE, trx_struct::update_undo, ut_ad, UT_LIST_ADD_FIRST, and UT_LIST_REMOVE.
Referenced by trx_commit_off_kernel().
01826 : trx owning the update undo log */ 01827 page_t* undo_page, /* in: update undo log header page, 01828 x-latched */ 01829 mtr_t* mtr) /* in: mtr */ 01830 { 01831 trx_rseg_t* rseg; 01832 trx_undo_t* undo; 01833 01834 undo = trx->update_undo; 01835 rseg = trx->rseg; 01836 01837 #ifdef UNIV_SYNC_DEBUG 01838 ut_ad(mutex_own(&(rseg->mutex))); 01839 #endif /* UNIV_SYNC_DEBUG */ 01840 trx_purge_add_update_undo_to_history(trx, undo_page, mtr); 01841 01842 UT_LIST_REMOVE(undo_list, rseg->update_undo_list, undo); 01843 01844 trx->update_undo = NULL; 01845 01846 if (undo->state == TRX_UNDO_CACHED) { 01847 01848 UT_LIST_ADD_FIRST(undo_list, rseg->update_undo_cached, undo); 01849 } else { 01850 ut_ad(undo->state == TRX_UNDO_TO_PURGE); 01851 01852 trx_undo_mem_free(undo); 01853 } 01854 }
Here is the call graph for this function:

Here is the caller graph for this function:

Referenced by row_set_rec_sys_field(), row_upd_index_entry_sys_field(), row_upd_rec_sys_fields_in_recovery(), row_upd_write_sys_vals_to_log(), and trx_undo_update_rec_get_update().
Here is the caller graph for this function:

1.4.7

