Drizzled Public API Documentation

trx0undo.h File Reference
#include "univ.i"
#include "trx0types.h"
#include "mtr0mtr.h"
#include "trx0sys.h"
#include "page0types.h"
#include "trx0xa.h"

Go to the source code of this file.

Classes

struct  trx_undo_struct

Macros

#define trx0undo_h
#define TRX_UNDO_INSERT   1 /* contains undo entries for inserts */
#define TRX_UNDO_UPDATE
#define TRX_UNDO_ACTIVE
#define TRX_UNDO_CACHED   2 /* cached for quick reuse */
#define TRX_UNDO_TO_FREE   3 /* insert undo segment can be freed */
#define TRX_UNDO_TO_PURGE
#define TRX_UNDO_PREPARED
#define TRX_UNDO_PAGE_HDR   FSEG_PAGE_DATA
#define TRX_UNDO_PAGE_REUSE_LIMIT   (3 * UNIV_PAGE_SIZE / 4)
#define TRX_UNDO_SEG_HDR   (TRX_UNDO_PAGE_HDR + TRX_UNDO_PAGE_HDR_SIZE)
#define TRX_UNDO_PAGE_TYPE   0
#define TRX_UNDO_PAGE_START   2
#define TRX_UNDO_PAGE_FREE   4
#define TRX_UNDO_PAGE_NODE   6
#define TRX_UNDO_PAGE_HDR_SIZE   (6 + FLST_NODE_SIZE)
#define TRX_UNDO_STATE   0
#define TRX_UNDO_LAST_LOG   2
#define TRX_UNDO_FSEG_HEADER   4
#define TRX_UNDO_PAGE_LIST   (4 + FSEG_HEADER_SIZE)
#define TRX_UNDO_SEG_HDR_SIZE   (4 + FSEG_HEADER_SIZE + FLST_BASE_NODE_SIZE)
#define TRX_UNDO_TRX_ID   0
#define TRX_UNDO_TRX_NO   8
#define TRX_UNDO_DEL_MARKS   16
#define TRX_UNDO_LOG_START   18
#define TRX_UNDO_XID_EXISTS   20
#define TRX_UNDO_DICT_TRANS   21
#define TRX_UNDO_TABLE_ID   22
#define TRX_UNDO_NEXT_LOG   30
#define TRX_UNDO_PREV_LOG   32
#define TRX_UNDO_HISTORY_NODE   34
#define TRX_UNDO_LOG_OLD_HDR_SIZE   (34 + FLST_NODE_SIZE)
#define TRX_UNDO_XA_FORMAT   (TRX_UNDO_LOG_OLD_HDR_SIZE)
#define TRX_UNDO_XA_TRID_LEN   (TRX_UNDO_XA_FORMAT + 4)
#define TRX_UNDO_XA_BQUAL_LEN   (TRX_UNDO_XA_TRID_LEN + 4)
#define TRX_UNDO_XA_XID   (TRX_UNDO_XA_BQUAL_LEN + 4)
#define TRX_UNDO_LOG_XA_HDR_SIZE   (TRX_UNDO_XA_XID + XIDDATASIZE)

Functions

UNIV_INLINE roll_ptr_t trx_undo_build_roll_ptr (ibool is_insert, ulint rseg_id, ulint page_no, ulint offset)
UNIV_INLINE void trx_undo_decode_roll_ptr (roll_ptr_t roll_ptr, ibool *is_insert, ulint *rseg_id, ulint *page_no, ulint *offset)
UNIV_INLINE ibool trx_undo_roll_ptr_is_insert (roll_ptr_t roll_ptr)
UNIV_INLINE void trx_write_roll_ptr (byte *ptr, roll_ptr_t roll_ptr)
UNIV_INLINE roll_ptr_t trx_read_roll_ptr (const byte *ptr)
UNIV_INLINE page_ttrx_undo_page_get (ulint space, ulint zip_size, ulint page_no, mtr_t *mtr)
UNIV_INLINE page_ttrx_undo_page_get_s_latched (ulint space, ulint zip_size, ulint page_no, mtr_t *mtr)
UNIV_INLINE trx_undo_rec_ttrx_undo_page_get_prev_rec (trx_undo_rec_t *rec, ulint page_no, ulint offset)
UNIV_INLINE trx_undo_rec_ttrx_undo_page_get_next_rec (trx_undo_rec_t *rec, ulint page_no, ulint offset)
UNIV_INLINE trx_undo_rec_ttrx_undo_page_get_last_rec (page_t *undo_page, ulint page_no, ulint offset)
UNIV_INLINE trx_undo_rec_ttrx_undo_page_get_first_rec (page_t *undo_page, ulint page_no, ulint offset)
UNIV_INTERN trx_undo_rec_ttrx_undo_get_prev_rec (trx_undo_rec_t *rec, ulint page_no, ulint offset, mtr_t *mtr)
UNIV_INTERN trx_undo_rec_ttrx_undo_get_next_rec (trx_undo_rec_t *rec, ulint page_no, ulint offset, mtr_t *mtr)
UNIV_INTERN trx_undo_rec_ttrx_undo_get_first_rec (ulint space, ulint zip_size, ulint page_no, ulint offset, ulint mode, mtr_t *mtr)
UNIV_INTERN ulint trx_undo_add_page (trx_t *trx, trx_undo_t *undo, mtr_t *mtr)
UNIV_INTERN void trx_undo_truncate_end (trx_t *trx, trx_undo_t *undo, undo_no_t limit)
UNIV_INTERN void trx_undo_truncate_start (trx_rseg_t *rseg, ulint space, ulint hdr_page_no, ulint hdr_offset, undo_no_t limit)
UNIV_INTERN ulint trx_undo_lists_init (trx_rseg_t *rseg)
UNIV_INTERN ulint trx_undo_assign_undo (trx_t *trx, ulint type)
UNIV_INTERN page_ttrx_undo_set_state_at_finish (trx_undo_t *undo, mtr_t *mtr)
UNIV_INTERN page_ttrx_undo_set_state_at_prepare (trx_t *trx, trx_undo_t *undo, mtr_t *mtr)
UNIV_INTERN void trx_undo_update_cleanup (trx_t *trx, page_t *undo_page, mtr_t *mtr)
UNIV_INTERN void trx_undo_insert_cleanup (trx_t *trx)
UNIV_INTERN byte * trx_undo_parse_page_init (byte *ptr, byte *end_ptr, page_t *page, mtr_t *mtr)
UNIV_INTERN byte * trx_undo_parse_page_header (ulint type, byte *ptr, byte *end_ptr, page_t *page, mtr_t *mtr)
UNIV_INTERN byte * trx_undo_parse_discard_latest (byte *ptr, byte *end_ptr, page_t *page, mtr_t *mtr)
UNIV_INTERN void trx_undo_mem_free (trx_undo_t *undo)

Detailed Description

Transaction undo log

Created 3/26/1996 Heikki Tuuri

Definition in file trx0undo.h.

Macro Definition Documentation

#define TRX_UNDO_ACTIVE
Value:
1 /* contains an undo log of an active
transaction */

Definition at line 347 of file trx0undo.h.

#define TRX_UNDO_DEL_MARKS   16

Defined only in an update undo log: TRUE if the transaction may have done delete markings of records, and thus purge is necessary

Definition at line 483 of file trx0undo.h.

Referenced by trx_purge_add_update_undo_to_history().

#define TRX_UNDO_DICT_TRANS   21

TRUE if the transaction is a table create, index create, or drop transaction: in recovery the transaction cannot be rolled back in the usual way: a 'rollback' rather means dropping the created or dropped table, if it still exists

Definition at line 496 of file trx0undo.h.

#define TRX_UNDO_FSEG_HEADER   4

Header for the file segment which the undo log segment occupies

Definition at line 463 of file trx0undo.h.

Referenced by trx_undo_add_page().

#define TRX_UNDO_HISTORY_NODE   34

If the log is put to the history list, the file list node is here

Definition at line 509 of file trx0undo.h.

Referenced by trx_purge_add_update_undo_to_history().

#define TRX_UNDO_LAST_LOG   2

Offset of the last undo log header on the segment header page, 0 if none

Definition at line 460 of file trx0undo.h.

Referenced by trx_undo_set_state_at_prepare().

#define TRX_UNDO_LOG_OLD_HDR_SIZE   (34 + FLST_NODE_SIZE)

Size of the undo log header without XID information

Definition at line 513 of file trx0undo.h.

#define TRX_UNDO_LOG_START   18

Offset of the first undo log record of this log on the header page; purge may remove undo log record from the log start, and therefore this is not necessarily the same as this log header end offset

Definition at line 487 of file trx0undo.h.

#define TRX_UNDO_LOG_XA_HDR_SIZE   (TRX_UNDO_XA_XID + XIDDATASIZE)

Total size of the undo log header with the XA XID

Definition at line 534 of file trx0undo.h.

#define TRX_UNDO_NEXT_LOG   30

Offset of the next undo log header on this page, 0 if none

Definition at line 505 of file trx0undo.h.

#define TRX_UNDO_PAGE_FREE   4

On each page of the undo log this field contains the byte offset of the first free byte on the page

Definition at line 426 of file trx0undo.h.

Referenced by trx_undo_parse_add_undo_rec(), trx_undo_set_state_at_finish(), and trx_undo_truncate_end().

#define TRX_UNDO_PAGE_HDR   FSEG_PAGE_DATA

The offset of the undo log page header on pages of the undo log

Definition at line 415 of file trx0undo.h.

Referenced by buf_page_print(), trx_undo_parse_add_undo_rec(), and trx_undo_set_state_at_finish().

#define TRX_UNDO_PAGE_HDR_SIZE   (6 + FLST_NODE_SIZE)

Size of the transaction undo log page header, in bytes

Definition at line 432 of file trx0undo.h.

#define TRX_UNDO_PAGE_LIST   (4 + FSEG_HEADER_SIZE)

Base node for the list of pages in the undo log segment; defined only on the undo log segment's first page

Definition at line 465 of file trx0undo.h.

Referenced by trx_purge_add_update_undo_to_history(), and trx_undo_add_page().

#define TRX_UNDO_PAGE_NODE   6

The file list node in the chain of undo log pages

Definition at line 429 of file trx0undo.h.

Referenced by trx_undo_add_page().

#define TRX_UNDO_PAGE_REUSE_LIMIT   (3 * UNIV_PAGE_SIZE / 4)
An update undo segment with just one page can be reused if it has

at most this many bytes used; we must leave space at least for one new undo log header on the page

Definition at line 441 of file trx0undo.h.

Referenced by trx_undo_set_state_at_finish().

#define TRX_UNDO_PAGE_START   2

Byte offset where the undo log records for the LATEST transaction start on this page (remember that in an update undo log, the first page can contain several undo logs)

Definition at line 421 of file trx0undo.h.

#define TRX_UNDO_PAGE_TYPE   0

Transaction undo log page header offsets TRX_UNDO_INSERT or TRX_UNDO_UPDATE

Definition at line 419 of file trx0undo.h.

Referenced by buf_page_print().

#define TRX_UNDO_PREPARED
Value:
5 /* contains an undo log of an
prepared transaction */

Definition at line 351 of file trx0undo.h.

#define TRX_UNDO_PREV_LOG   32

Offset of the previous undo log header on this page, 0 if none

Definition at line 507 of file trx0undo.h.

#define TRX_UNDO_SEG_HDR   (TRX_UNDO_PAGE_HDR + TRX_UNDO_PAGE_HDR_SIZE)
The offset of the undo log segment header on the first page of the undo

log segment

Definition at line 455 of file trx0undo.h.

Referenced by trx_purge_add_update_undo_to_history(), 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)

Size of the undo log segment header

Definition at line 471 of file trx0undo.h.

#define TRX_UNDO_STATE   0

Undo log segment header TRX_UNDO_ACTIVE, ...

Definition at line 459 of file trx0undo.h.

Referenced by trx_undo_set_state_at_finish(), and trx_undo_set_state_at_prepare().

#define TRX_UNDO_TABLE_ID   22

Id of the table if the preceding field is TRUE

Definition at line 503 of file trx0undo.h.

#define TRX_UNDO_TO_PURGE
Value:
4 /* update undo segment will not be
reused: it can be freed in purge when
all undo data in it is removed */

Definition at line 350 of file trx0undo.h.

#define TRX_UNDO_TRX_ID   0
The undo log header. There can be several undo log headers on the first

page of an update undo log segment. Transaction id

Definition at line 479 of file trx0undo.h.

#define TRX_UNDO_TRX_NO   8

Transaction number of the transaction; defined only if the log is in a history list

Definition at line 480 of file trx0undo.h.

Referenced by trx_purge_add_update_undo_to_history().

#define TRX_UNDO_UPDATE
Value:
2 /* contains undo entries for updates
and delete markings: in short,
modifys (the name 'UPDATE' is a
historical relic) */

Definition at line 345 of file trx0undo.h.

#define TRX_UNDO_XA_BQUAL_LEN   (TRX_UNDO_XA_TRID_LEN + 4)

xid_t::bqual_length

Definition at line 530 of file trx0undo.h.

#define TRX_UNDO_XA_FORMAT   (TRX_UNDO_LOG_OLD_HDR_SIZE)

X/Open XA Transaction Identification (XID) xid_t::formatID

Definition at line 526 of file trx0undo.h.

#define TRX_UNDO_XA_TRID_LEN   (TRX_UNDO_XA_FORMAT + 4)

xid_t::gtrid_length

Definition at line 528 of file trx0undo.h.

#define TRX_UNDO_XA_XID   (TRX_UNDO_XA_BQUAL_LEN + 4)

Distributed transaction identifier data

Definition at line 532 of file trx0undo.h.

#define TRX_UNDO_XID_EXISTS   20

TRUE if undo log header includes X/Open XA transaction identification XID

Definition at line 493 of file trx0undo.h.

Referenced by trx_undo_set_state_at_prepare().

Function Documentation

UNIV_INLINE roll_ptr_t trx_read_roll_ptr ( const byte *  ptr)

Reads a roll ptr from an index page. In case that the roll ptr size changes in some future version, this function should be used instead of mach_read_...

Returns
roll ptr in: pointer to memory from where to read

Referenced by row_upd_parse_sys_vals().

UNIV_INTERN ulint trx_undo_add_page ( trx_t trx,
trx_undo_t undo,
mtr_t mtr 
)

Tries to add a page to the undo log segment where the undo log is placed.

Returns
page number if success, else FIL_NULL in: mtr which does not have a latch to any undo log page; the caller must have reserved the rollback segment mutex

Tries to add a page to the undo log segment where the undo log is placed.

Returns
page number if success, else FIL_NULL
Parameters
trxin: transaction
undoin: undo log memory object
mtrin: mtr which does not have a latch to any undo log page; the caller must have reserved the rollback segment mutex

Definition at line 881 of file trx0undo.cc.

References FIL_NULL, trx_undo_struct::hdr_page_no, trx_undo_struct::last_page_no, trx_rseg_struct::mutex, trx_struct::rseg, trx_undo_struct::size, trx_undo_struct::space, trx_undo_struct::top_page_no, trx_undo_add_page(), TRX_UNDO_FSEG_HEADER, trx_undo_page_get(), TRX_UNDO_PAGE_LIST, TRX_UNDO_PAGE_NODE, trx_undo_struct::type, trx_struct::undo_mutex, ut_ad, and trx_undo_struct::zip_size.

Referenced by trx_undo_add_page(), and trx_undo_report_row_operation().

UNIV_INTERN ulint trx_undo_assign_undo ( trx_t trx,
ulint  type 
)

Assigns an undo log for a transaction. A new undo log is created or a cached undo log reused.

Returns
DB_SUCCESS if undo log assign successful, possible error codes are: DB_TOO_MANY_CONCURRENT_TRXS DB_OUT_OF_FILE_SPACE DB_OUT_OF_MEMORY in: TRX_UNDO_INSERT or TRX_UNDO_UPDATE

Assigns an undo log for a transaction. A new undo log is created or a cached undo log reused.

Returns
DB_SUCCESS if undo log assign successful, possible error codes are: DB_TOO_MANY_CONCURRENT_TRXS DB_OUT_OF_FILE_SPACE DB_OUT_OF_MEMORY
Parameters
trxin: transaction
typein: TRX_UNDO_INSERT or TRX_UNDO_UPDATE

Definition at line 1739 of file trx0undo.cc.

References trx_struct::id, trx_struct::insert_undo, mtr_commit(), mtr_start(), trx_rseg_struct::mutex, trx_struct::rseg, TRX_DICT_OP_NONE, trx_get_dict_operation(), trx_undo_assign_undo(), trx_struct::undo_mutex, trx_struct::update_undo, ut_ad, UT_LIST_ADD_FIRST, and trx_struct::xid.

Referenced by trx_undo_assign_undo(), and trx_undo_report_row_operation().

UNIV_INLINE roll_ptr_t trx_undo_build_roll_ptr ( ibool  is_insert,
ulint  rseg_id,
ulint  page_no,
ulint  offset 
)

Builds a roll pointer.

Returns
roll pointer in: offset of the undo entry within page
Parameters
is_insertin: TRUE if insert undo log
rseg_idin: rollback segment id
page_noin: page number

Referenced by trx_purge_fetch_next_rec(), trx_roll_pop_top_rec_of_trx(), and trx_undo_report_row_operation().

UNIV_INLINE void trx_undo_decode_roll_ptr ( roll_ptr_t  roll_ptr,
ibool *  is_insert,
ulint *  rseg_id,
ulint *  page_no,
ulint *  offset 
)

Decodes a roll pointer. out: offset of the undo entry within page

Parameters
roll_ptrin: roll pointer
is_insertout: TRUE if insert undo log
rseg_idout: rollback segment id
page_noout: page number

Referenced by trx_undo_get_undo_rec_low().

UNIV_INTERN trx_undo_rec_t* trx_undo_get_first_rec ( ulint  space,
ulint  zip_size,
ulint  page_no,
ulint  offset,
ulint  mode,
mtr_t mtr 
)

Gets the first record in an undo log.

Returns
undo log record, the page latched, NULL if none in: mtr

Gets the first record in an undo log.

Returns
undo log record, the page latched, NULL if none
Parameters
spacein: undo log header space
zip_sizein: compressed page size in bytes or 0 for uncompressed pages
page_noin: undo log header page number
offsetin: undo log header offset on page
modein: latching mode: RW_S_LATCH or RW_X_LATCH
mtrin: mtr

Definition at line 304 of file trx0undo.cc.

References trx_undo_get_first_rec(), trx_undo_page_get(), trx_undo_page_get_first_rec(), and trx_undo_page_get_s_latched().

Referenced by trx_undo_get_first_rec(), and trx_undo_truncate_start().

UNIV_INTERN trx_undo_rec_t* trx_undo_get_next_rec ( trx_undo_rec_t rec,
ulint  page_no,
ulint  offset,
mtr_t mtr 
)

Gets the next record in an undo log.

Returns
undo log record, the page s-latched, NULL if none in: mtr

Gets the next record in an undo log.

Returns
undo log record, the page s-latched, NULL if none
Parameters
recin: undo record
page_noin: undo log header page number
offsetin: undo log header offset on page
mtrin: mtr

Definition at line 273 of file trx0undo.cc.

References page_align(), page_get_space_id(), trx_undo_get_next_rec(), and trx_undo_page_get_next_rec().

Referenced by trx_undo_get_next_rec().

UNIV_INTERN trx_undo_rec_t* trx_undo_get_prev_rec ( trx_undo_rec_t rec,
ulint  page_no,
ulint  offset,
mtr_t mtr 
)

Gets the previous record in an undo log.

Returns
undo log record, the page s-latched, NULL if none in: mtr

Gets the previous record in an undo log.

Returns
undo log record, the page s-latched, NULL if none
Parameters
recin: undo record
page_noin: undo log header page number
offsetin: undo log header offset on page
mtrin: mtr

Definition at line 193 of file trx0undo.cc.

References trx_undo_get_prev_rec(), and trx_undo_page_get_prev_rec().

Referenced by trx_undo_get_prev_rec().

UNIV_INTERN void trx_undo_insert_cleanup ( trx_t trx)

Frees or caches an insert undo log after a transaction commit or rollback. Knowledge of inserts is not needed after a commit or rollback, therefore the data can be discarded. in: transaction handle

Frees or caches an insert undo log after a transaction commit or rollback. Knowledge of inserts is not needed after a commit or rollback, therefore the data can be discarded.

Parameters
trxin: transaction handle

Definition at line 1938 of file trx0undo.cc.

References trx_struct::insert_undo, trx_rseg_struct::mutex, trx_struct::rseg, trx_undo_struct::size, trx_undo_struct::state, trx_undo_insert_cleanup(), trx_undo_mem_free(), ut_ad, UT_LIST_ADD_FIRST, and UT_LIST_REMOVE.

Referenced by trx_cleanup_at_db_startup(), trx_commit_off_kernel(), and trx_undo_insert_cleanup().

UNIV_INTERN ulint trx_undo_lists_init ( trx_rseg_t rseg)

Initializes the undo log lists for a rollback segment memory copy. This function is only called when the database is started or a new rollback segment created.

Returns
the combined size of undo log segments in pages in: rollback segment memory object

Initializes the undo log lists for a rollback segment memory copy. This function is only called when the database is started or a new rollback segment is created.

Returns
the combined size of undo log segments in pages
Parameters
rsegin: rollback segment memory object

Definition at line 1382 of file trx0undo.cc.

References FIL_NULL, mtr_commit(), mtr_start(), trx_undo_struct::size, trx_rseg_struct::space, SRV_FORCE_NO_UNDO_LOG_SCAN, trx_rsegf_get(), trx_rsegf_get_new(), trx_rsegf_get_nth_undo(), trx_undo_lists_init(), and UT_LIST_INIT.

Referenced by trx_undo_lists_init().

UNIV_INTERN void trx_undo_mem_free ( trx_undo_t undo)

Frees an undo log memory copy.

Parameters
undoin: the undo object to be freed

Definition at line 1529 of file trx0undo.cc.

References trx_undo_struct::id, mem_free, trx_undo_mem_free(), and ut_error.

Referenced by trx_rseg_mem_free(), trx_undo_insert_cleanup(), trx_undo_mem_free(), and trx_undo_update_cleanup().

UNIV_INLINE page_t* trx_undo_page_get ( ulint  space,
ulint  zip_size,
ulint  page_no,
mtr_t mtr 
)

Gets an undo log page and x-latches it.

Returns
pointer to page x-latched in: mtr
Parameters
spacein: space where placed
zip_sizein: compressed page size in bytes or 0 for uncompressed pages
page_noin: page number

Referenced by trx_undo_add_page(), trx_undo_get_first_rec(), trx_undo_set_state_at_finish(), trx_undo_set_state_at_prepare(), and trx_undo_truncate_end().

UNIV_INLINE trx_undo_rec_t* trx_undo_page_get_first_rec ( page_t undo_page,
ulint  page_no,
ulint  offset 
)

Returns the first undo record on the page in the specified undo log, or NULL if none exists.

Returns
pointer to record, NULL if none in: undo log header offset on page
Parameters
undo_pagein: undo log page
page_noin: undo log header page number

Referenced by trx_undo_get_first_rec().

UNIV_INLINE trx_undo_rec_t* trx_undo_page_get_last_rec ( page_t undo_page,
ulint  page_no,
ulint  offset 
)

Returns the last undo record on the page in the specified undo log, or NULL if none exists.

Returns
pointer to record, NULL if none in: undo log header offset on page
Parameters
undo_pagein: undo log page
page_noin: undo log header page number

Referenced by trx_undo_truncate_end(), and trx_undo_truncate_start().

UNIV_INLINE trx_undo_rec_t* trx_undo_page_get_next_rec ( trx_undo_rec_t rec,
ulint  page_no,
ulint  offset 
)

Returns the next undo log record on the page in the specified log, or NULL if none exists.

Returns
pointer to record, NULL if none in: undo log header offset on page
Parameters
recin: undo log record
page_noin: undo log header page number

Referenced by trx_undo_get_next_rec().

UNIV_INLINE trx_undo_rec_t* trx_undo_page_get_prev_rec ( trx_undo_rec_t rec,
ulint  page_no,
ulint  offset 
)

Returns the previous undo record on the page in the specified log, or NULL if none exists.

Returns
pointer to record, NULL if none in: undo log header offset on page
Parameters
recin: undo log record
page_noin: undo log header page number

Referenced by trx_undo_get_prev_rec(), and trx_undo_truncate_end().

UNIV_INLINE page_t* trx_undo_page_get_s_latched ( ulint  space,
ulint  zip_size,
ulint  page_no,
mtr_t mtr 
)

Gets an undo log page and s-latches it.

Returns
pointer to page s-latched in: mtr
Parameters
spacein: space where placed
zip_sizein: compressed page size in bytes or 0 for uncompressed pages
page_noin: page number

Referenced by trx_undo_get_first_rec(), and trx_undo_get_undo_rec_low().

UNIV_INTERN byte* trx_undo_parse_discard_latest ( byte *  ptr,
byte *  ,
page_t page,
mtr_t mtr 
)

Parses the redo log entry of an undo log page header discard.

Returns
end of log record or NULL in: mtr or NULL

Parses the redo log entry of an undo log page header discard.

Returns
end of log record or NULL
Parameters
ptrin: buffer
pagein: page or NULL
mtrin: mtr or NULL

Definition at line 817 of file trx0undo.cc.

References trx_undo_parse_discard_latest(), and ut_ad.

Referenced by trx_undo_parse_discard_latest().

UNIV_INTERN byte* trx_undo_parse_page_header ( ulint  type,
byte *  ptr,
byte *  end_ptr,
page_t page,
mtr_t mtr 
)

Parses the redo log entry of an undo log page header create or reuse.

Returns
end of log record or NULL in: mtr or NULL

Parses the redo log entry of an undo log page header create or reuse.

Returns
end of log record or NULL
Parameters
typein: MLOG_UNDO_HDR_CREATE or MLOG_UNDO_HDR_REUSE
ptrin: buffer
end_ptrin: buffer end
pagein: page or NULL
mtrin: mtr or NULL

Definition at line 701 of file trx0undo.cc.

References mach_ull_parse_compressed(), MLOG_UNDO_HDR_CREATE, MLOG_UNDO_HDR_REUSE, trx_undo_parse_page_header(), ut_ad, and ut_d.

Referenced by trx_undo_parse_page_header().

UNIV_INTERN byte* trx_undo_parse_page_init ( byte *  ptr,
byte *  end_ptr,
page_t page,
mtr_t mtr 
)

Parses the redo log entry of an undo log page initialization.

Returns
end of log record or NULL in: mtr or NULL

Parses the redo log entry of an undo log page initialization.

Returns
end of log record or NULL
Parameters
ptrin: buffer
end_ptrin: buffer end
pagein: page or NULL
mtrin: mtr or NULL

Definition at line 360 of file trx0undo.cc.

References mach_parse_compressed(), and trx_undo_parse_page_init().

Referenced by trx_undo_parse_page_init().

UNIV_INLINE ibool trx_undo_roll_ptr_is_insert ( roll_ptr_t  roll_ptr)

Returns TRUE if the roll pointer is of the insert type.

Returns
TRUE if insert undo log in: roll pointer

Referenced by trx_undo_prev_version_build().

UNIV_INTERN page_t* trx_undo_set_state_at_finish ( trx_undo_t undo,
mtr_t mtr 
)

Sets the state of the undo log segment at a transaction finish.

Returns
undo log segment header page, x-latched in: mtr

Sets the state of the undo log segment at a transaction finish.

Returns
undo log segment header page, x-latched
Parameters
undoin: undo log memory copy
mtrin: mtr

Definition at line 1799 of file trx0undo.cc.

References trx_undo_struct::hdr_page_no, trx_undo_struct::id, mach_read_from_2(), mem_analyze_corruption(), MLOG_2BYTES, mlog_write_ulint(), trx_undo_struct::size, trx_undo_struct::space, trx_undo_struct::state, TRX_UNDO_PAGE_FREE, trx_undo_page_get(), TRX_UNDO_PAGE_HDR, TRX_UNDO_PAGE_REUSE_LIMIT, TRX_UNDO_SEG_HDR, trx_undo_set_state_at_finish(), TRX_UNDO_STATE, trx_undo_struct::type, ut_ad, ut_error, and trx_undo_struct::zip_size.

Referenced by trx_commit_off_kernel(), and trx_undo_set_state_at_finish().

UNIV_INTERN page_t* trx_undo_set_state_at_prepare ( trx_t trx,
trx_undo_t undo,
mtr_t mtr 
)

Sets the state of the undo log segment at a transaction prepare.

Returns
undo log segment header page, x-latched in: mtr

Sets the state of the undo log segment at a transaction prepare.

Returns
undo log segment header page, x-latched
Parameters
trxin: transaction
undoin: undo log memory copy
mtrin: mtr

Definition at line 1850 of file trx0undo.cc.

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(), trx_undo_struct::space, trx_undo_struct::state, TRX_UNDO_LAST_LOG, trx_undo_page_get(), TRX_UNDO_SEG_HDR, trx_undo_set_state_at_prepare(), TRX_UNDO_STATE, TRX_UNDO_XID_EXISTS, ut_ad, ut_error, trx_undo_struct::xid, trx_struct::xid, and trx_undo_struct::zip_size.

Referenced by trx_undo_set_state_at_prepare().

UNIV_INTERN void trx_undo_truncate_end ( trx_t trx,
trx_undo_t undo,
undo_no_t  limit 
)

Truncates an undo log from the end. This function is used during a rollback to free space from an undo log. in: all undo records with undo number >= this value should be truncated

Truncates an undo log from the end. This function is used during a rollback to free space from an undo log.

Parameters
trxin: transaction whose undo log it is
undoin: undo log
limitin: all undo records with undo number >= this value should be truncated

Definition at line 1064 of file trx0undo.cc.

References trx_undo_struct::hdr_offset, trx_undo_struct::hdr_page_no, trx_undo_struct::last_page_no, MLOG_2BYTES, mlog_write_ulint(), mtr_commit(), mtr_start(), trx_rseg_struct::mutex, trx_struct::rseg, trx_undo_struct::space, TRX_UNDO_PAGE_FREE, trx_undo_page_get(), trx_undo_page_get_last_rec(), trx_undo_page_get_prev_rec(), trx_undo_rec_get_undo_no(), trx_undo_truncate_end(), trx_struct::undo_mutex, ut_ad, and trx_undo_struct::zip_size.

Referenced by trx_roll_try_truncate(), and trx_undo_truncate_end().

UNIV_INTERN void trx_undo_truncate_start ( trx_rseg_t rseg,
ulint  space,
ulint  hdr_page_no,
ulint  hdr_offset,
undo_no_t  limit 
)

Truncates an undo log from the start. This function is used during a purge operation. 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

Truncates an undo log from the start. This function is used during a purge operation.

Parameters
rsegin: rollback segment
spacein: space id of the log
hdr_page_noin: header page number
hdr_offsetin: header offset on the page
limitin: 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

Definition at line 1135 of file trx0undo.cc.

References mtr_commit(), mtr_start(), trx_rseg_struct::mutex, page_align(), page_get_page_no(), trx_undo_get_first_rec(), trx_undo_page_get_last_rec(), trx_undo_rec_get_undo_no(), trx_undo_truncate_start(), and ut_ad.

Referenced by trx_undo_truncate_start().

UNIV_INTERN void trx_undo_update_cleanup ( trx_t trx,
page_t undo_page,
mtr_t mtr 
)

Adds the update undo log header as the first in the history list, and frees the memory object, or puts it to the list of cached update undo log segments. in: mtr

Adds the update undo log header as the first in the history list, and frees the memory object, or puts it to the list of cached update undo log segments.

Parameters
trxin: trx owning the update undo log
undo_pagein: update undo log header page, x-latched
mtrin: mtr

Definition at line 1900 of file trx0undo.cc.

References trx_rseg_struct::mutex, trx_struct::rseg, trx_undo_struct::state, trx_purge_add_update_undo_to_history(), trx_undo_mem_free(), trx_undo_update_cleanup(), trx_struct::update_undo, ut_ad, UT_LIST_ADD_FIRST, and UT_LIST_REMOVE.

Referenced by trx_commit_off_kernel(), and trx_undo_update_cleanup().

UNIV_INLINE void trx_write_roll_ptr ( byte *  ptr,
roll_ptr_t  roll_ptr 
)

Writes a roll ptr to an index page. In case that the size changes in some future version, this function should be used instead of mach_write_... in: roll ptr

Parameters
ptrin: pointer to memory where written

Referenced by 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().