InnoDB Plugin  1.0
Macros | Typedefs | Functions
trx0sys.ic File Reference
#include "trx0trx.h"
#include "data0type.h"
#include "srv0srv.h"
#include "mtr0log.h"
Include dependency graph for trx0sys.ic:
This graph shows which files directly or indirectly include this file:

Macros

#define TRX_SYS_RSEG_SPACE
#define TRX_SYS_RSEG_PAGE_NO
#define TRX_SYS_RSEG_SLOT_SIZE   8

Typedefs

typedef byte trx_sysf_rseg_t

Functions

UNIV_INTERN void trx_sys_flush_max_trx_id (void)
UNIV_INLINE ibool trx_sys_hdr_page (ulint space, ulint page_no)
UNIV_INLINE trx_rseg_ttrx_sys_get_nth_rseg (trx_sys_t *sys, ulint n)
UNIV_INLINE trx_sysf_ttrx_sysf_get (mtr_t *mtr)
UNIV_INLINE ulint trx_sysf_rseg_get_space (trx_sysf_t *sys_header, ulint i, mtr_t *mtr)
UNIV_INLINE ulint trx_sysf_rseg_get_page_no (trx_sysf_t *sys_header, ulint i, mtr_t *mtr)
UNIV_INLINE void trx_sysf_rseg_set_space (trx_sysf_t *sys_header, ulint i, ulint space, mtr_t *mtr)
UNIV_INLINE void trx_sysf_rseg_set_page_no (trx_sysf_t *sys_header, ulint i, ulint page_no, mtr_t *mtr)
UNIV_INLINE void trx_write_trx_id (byte *ptr, trx_id_t id)
UNIV_INLINE trx_id_t trx_read_trx_id (const byte *ptr)
UNIV_INLINE trx_ttrx_get_rw_trx_by_id (trx_id_t trx_id)
UNIV_INLINE trx_id_t trx_rw_min_trx_id_low (void)
UNIV_INLINE ibool trx_assert_recovered (trx_id_t trx_id)
UNIV_INLINE trx_id_t trx_rw_min_trx_id (void)
UNIV_INLINE trx_ttrx_rw_is_active_low (trx_id_t trx_id, ibool *corrupt)
UNIV_INLINE trx_ttrx_rw_is_active (trx_id_t trx_id, ibool *corrupt)
UNIV_INLINE trx_id_t trx_sys_get_new_trx_id (void)
UNIV_INLINE trx_id_t trx_sys_get_max_trx_id (void)
UNIV_INLINE ulint trx_sys_get_n_rw_trx (void)

Detailed Description

Transaction system

Created 3/26/1996 Heikki Tuuri

Macro Definition Documentation

#define TRX_SYS_RSEG_PAGE_NO
Value:
4 /* page number where the segment
header is placed; this is FIL_NULL
if the slot is unused */
#define TRX_SYS_RSEG_SPACE
Value:
0 /* space where the segment
header is placed; starting with
MySQL/InnoDB 5.1.7, this is
UNIV_UNDEFINED if the slot is unused */

Function Documentation

UNIV_INLINE ibool trx_assert_recovered ( trx_id_t  trx_id)

Assert that a transaction has been recovered.

Returns
TRUE
Parameters
trx_idin: transaction identifier
UNIV_INLINE trx_t* trx_get_rw_trx_by_id ( trx_id_t  trx_id)

Looks for the trx handle with the given id in rw_trx_list. The caller must be holding trx_sys->mutex.

Returns
the trx handle or NULL if not found; the pointer must not be dereferenced unless lock_sys->mutex was acquired before calling this function and is still being held
Parameters
trx_idin: trx id to search for
UNIV_INLINE trx_id_t trx_read_trx_id ( const byte *  ptr)

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

Returns
id
Parameters
ptrin: pointer to memory from where to read
UNIV_INLINE trx_t* trx_rw_is_active ( trx_id_t  trx_id,
ibool corrupt 
)

Checks if a rw transaction with the given id is active. If the caller is not holding lock_sys->mutex, the transaction may already have been committed.

Returns
transaction instance if active, or NULL; the pointer must not be dereferenced unless lock_sys->mutex was acquired before calling this function and is still being held
Parameters
trx_idin: trx id of the transaction
corruptin: NULL or pointer to a flag that will be set if corrupt
UNIV_INLINE trx_t* trx_rw_is_active_low ( trx_id_t  trx_id,
ibool corrupt 
)

Checks if a rw transaction with the given id is active. Caller must hold trx_sys->mutex. If the caller is not holding lock_sys->mutex, the transaction may already have been committed.

Returns
transaction instance if active, or NULL; the pointer must not be dereferenced unless lock_sys->mutex was acquired before calling this function and is still being held
Parameters
trx_idin: trx id of the transaction
corruptin: NULL or pointer to a flag that will be set if corrupt
UNIV_INLINE trx_id_t trx_rw_min_trx_id ( void  )

Returns the minimum trx id in rw trx list. This is the smallest id for which the rw trx can possibly be active. (But, you must look at the trx->state to find out if the minimum trx id transaction itself is active, or already committed.)

Returns
the minimum trx id, or trx_sys->max_trx_id if rw trx list is empty
UNIV_INLINE trx_id_t trx_rw_min_trx_id_low ( void  )

Returns the minimum trx id in trx list. This is the smallest id for which the trx can possibly be active. (But, you must look at the trx->state to find out if the minimum trx id transaction itself is active, or already committed.). The caller must be holding the trx_sys_t::mutex in shared mode.

Returns
the minimum trx id, or trx_sys->max_trx_id if the trx list is empty
UNIV_INTERN void trx_sys_flush_max_trx_id ( void  )

Writes the value of max_trx_id to the file based trx system header.

UNIV_INLINE trx_id_t trx_sys_get_max_trx_id ( void  )

Determines the maximum transaction id.

Returns
maximum currently allocated trx id; will be stale after the next call to trx_sys_get_new_trx_id()
UNIV_INLINE ulint trx_sys_get_n_rw_trx ( void  )

Get the number of transaction in the system, independent of their state.

Returns
count of transactions in trx_sys_t::rw_trx_list
UNIV_INLINE trx_id_t trx_sys_get_new_trx_id ( void  )

Allocates a new transaction id.

Returns
new, allocated trx id
UNIV_INLINE trx_rseg_t* trx_sys_get_nth_rseg ( trx_sys_t sys,
ulint  n 
)

Gets the pointer in the nth slot of the rseg array.

Returns
pointer to rseg object, NULL if slot not in use
Parameters
sysin: trx system
nin: index of slot
UNIV_INLINE ibool trx_sys_hdr_page ( ulint  space,
ulint  page_no 
)

Checks if a page address is the trx sys header page.

Returns
TRUE if trx sys header page
Parameters
spacein: space
page_noin: page number
UNIV_INLINE trx_sysf_t* trx_sysf_get ( mtr_t mtr)

Gets a pointer to the transaction system header and x-latches its page.

Returns
pointer to system header, page x-latched.
Parameters
mtrin: mtr
UNIV_INLINE ulint trx_sysf_rseg_get_page_no ( trx_sysf_t sys_header,
ulint  i,
mtr_t mtr 
)

Gets the page number of the nth rollback segment slot in the trx system header.

Returns
page number, FIL_NULL if slot unused
Parameters
sys_headerin: trx system header
iin: slot index == rseg id
mtrin: mtr
UNIV_INLINE ulint trx_sysf_rseg_get_space ( trx_sysf_t sys_header,
ulint  i,
mtr_t mtr 
)

Gets the space of the nth rollback segment slot in the trx system file copy.

Returns
space id
Parameters
sys_headerin: trx sys header
iin: slot index == rseg id
mtrin: mtr
UNIV_INLINE void trx_sysf_rseg_set_page_no ( trx_sysf_t sys_header,
ulint  i,
ulint  page_no,
mtr_t mtr 
)

Sets the page number of the nth rollback segment slot in the trx system header.

Parameters
sys_headerin: trx sys header
iin: slot index == rseg id
page_noin: page number, FIL_NULL if the slot is reset to unused
mtrin: mtr
UNIV_INLINE void trx_sysf_rseg_set_space ( trx_sysf_t sys_header,
ulint  i,
ulint  space,
mtr_t mtr 
)

Sets the space id of the nth rollback segment slot in the trx system file copy.

Parameters
sys_headerin: trx sys file copy
iin: slot index == rseg id
spacein: space id
mtrin: mtr
UNIV_INLINE void trx_write_trx_id ( byte *  ptr,
trx_id_t  id 
)

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

Parameters
ptrin: pointer to memory where written
idin: id