InnoDB Plugin  1.0
Data Structures | Enumerations | Functions | Variables
trx0roll.h File Reference
#include "univ.i"
#include "trx0trx.h"
#include "trx0types.h"
#include "mtr0mtr.h"
#include "trx0sys.h"
#include "trx0roll.ic"
Include dependency graph for trx0roll.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  trx_undo_inf_t
struct  trx_undo_arr_t
struct  roll_node_t
struct  trx_named_savept_t

Enumerations

enum  roll_node_state { ROLL_NODE_NONE = 0, ROLL_NODE_SEND, ROLL_NODE_WAIT }

Functions

UNIV_INTERN ibool trx_is_recv (const trx_t *trx)
UNIV_INTERN trx_savept_t trx_savept_take (trx_t *trx)
UNIV_INTERN void trx_undo_arr_free (trx_undo_arr_t *arr)
UNIV_INLINE trx_undo_inf_ttrx_undo_arr_get_nth_info (trx_undo_arr_t *arr, ulint n)
UNIV_INTERN trx_undo_rec_ttrx_roll_pop_top_rec_of_trx (trx_t *trx, undo_no_t limit, roll_ptr_t *roll_ptr, mem_heap_t *heap)
UNIV_INTERN ibool trx_undo_rec_reserve (trx_t *trx, undo_no_t undo_no)
UNIV_INTERN void trx_undo_rec_release (trx_t *trx, undo_no_t undo_no)
UNIV_INTERN void trx_rollback_or_clean_recovered (ibool all)
UNIV_INTERN os_thread_ret_t
DECLARE_THREAD() 
trx_rollback_or_clean_all_recovered (void *arg))
UNIV_INTERN roll_node_troll_node_create (mem_heap_t *heap)
UNIV_INTERN que_thr_ttrx_rollback_step (que_thr_t *thr)
UNIV_INTERN dberr_t trx_rollback_for_mysql (trx_t *trx))
UNIV_INTERN dberr_t trx_rollback_last_sql_stat_for_mysql (trx_t *trx))
UNIV_INTERN dberr_t trx_rollback_to_savepoint (trx_t *trx, trx_savept_t *savept)))
UNIV_INTERN dberr_t trx_rollback_to_savepoint_for_mysql (trx_t *trx, const char *savepoint_name, ib_int64_t *mysql_binlog_cache_pos))
UNIV_INTERN dberr_t trx_savepoint_for_mysql (trx_t *trx, const char *savepoint_name, ib_int64_t binlog_cache_pos))
UNIV_INTERN dberr_t trx_release_savepoint_for_mysql (trx_t *trx, const char *savepoint_name))
UNIV_INTERN void trx_roll_savepoints_free (trx_t *trx, trx_named_savept_t *savep)

Variables

bool trx_rollback_or_clean_is_active

Detailed Description

Transaction rollback

Created 3/26/1996 Heikki Tuuri

Enumeration Type Documentation

Rollback node states

Enumerator:
ROLL_NODE_NONE 

Unknown state

ROLL_NODE_SEND 

about to send a rollback signal to the transaction

ROLL_NODE_WAIT 

rollback signal sent to the transaction, waiting for completion

Function Documentation

UNIV_INTERN roll_node_t* roll_node_create ( mem_heap_t heap)

Creates a rollback command node struct.

Returns
own: rollback node struct in: mem heap where created
UNIV_INTERN ibool trx_is_recv ( const trx_t trx)

Determines if this transaction is rolling back an incomplete transaction in crash recovery.

Returns
TRUE if trx is an incomplete transaction that is being rolled back in crash recovery in: transaction
UNIV_INTERN dberr_t trx_release_savepoint_for_mysql ( trx_t trx,
const char *  savepoint_name 
)

Releases a named savepoint. Savepoints which were set after this savepoint are deleted.

Returns
if no savepoint of the name found then DB_NO_SAVEPOINT, otherwise DB_SUCCESS
Parameters
trxin: transaction handle
savepoint_namein: savepoint name
UNIV_INTERN trx_undo_rec_t* trx_roll_pop_top_rec_of_trx ( trx_t trx,
undo_no_t  limit,
roll_ptr_t roll_ptr,
mem_heap_t heap 
)

Pops the topmost record when the two undo logs of a transaction are seen as a single stack of records ordered by their undo numbers. Inserts the undo number of the popped undo record to the array of currently processed undo numbers in the transaction. When the query thread finishes processing of this undo record, it must be released with trx_undo_rec_release.

Returns
undo log record copied to heap, NULL if none left, or if the undo number of the top record would be less than the limit in: memory heap where copied
Parameters
trxin: transaction
limitin: least undo number we need
roll_ptrout: roll pointer to undo record
UNIV_INTERN void trx_roll_savepoints_free ( trx_t trx,
trx_named_savept_t savep 
)

Frees savepoint structs starting from savep. in: free all savepoints > this one; if this is NULL, free all savepoints of trx

Parameters
trxin: transaction handle
UNIV_INTERN dberr_t trx_rollback_for_mysql ( trx_t trx)

Rollback a transaction used in MySQL.

Returns
error code or DB_SUCCESS
Parameters
trxin/out: transaction
UNIV_INTERN dberr_t trx_rollback_last_sql_stat_for_mysql ( trx_t trx)

Rollback the latest SQL statement for MySQL.

Returns
error code or DB_SUCCESS
Parameters
trxin/out: transaction
UNIV_INTERN os_thread_ret_t DECLARE_THREAD() trx_rollback_or_clean_all_recovered ( void *  arg)

Rollback or clean up any incomplete transactions which were encountered in crash recovery. If the transaction already was committed, then we clean up a possible insert undo log. If the transaction was not yet committed, then we roll it back. Note: this is done in a background thread.

Returns
a dummy parameter in: a dummy parameter required by os_thread_create
UNIV_INTERN void trx_rollback_or_clean_recovered ( ibool  all)

Rollback or clean up any incomplete transactions which were encountered in crash recovery. If the transaction already was committed, then we clean up a possible insert undo log. If the transaction was not yet committed, then we roll it back. in: FALSE=roll back dictionary transactions; TRUE=roll back all non-PREPARED transactions

UNIV_INTERN que_thr_t* trx_rollback_step ( que_thr_t thr)

Performs an execution step for a rollback command node in a query graph.

Returns
query thread to run next, or NULL in: query thread
UNIV_INTERN dberr_t trx_rollback_to_savepoint ( trx_t trx,
trx_savept_t savept 
)

Rollback a transaction to a given savepoint or do a complete rollback.

Returns
error code or DB_SUCCESS
Parameters
trxin: transaction handle
saveptin: pointer to savepoint undo number, if partial rollback requested, or NULL for complete rollback
UNIV_INTERN dberr_t trx_rollback_to_savepoint_for_mysql ( trx_t trx,
const char *  savepoint_name,
ib_int64_t *  mysql_binlog_cache_pos 
)

Rolls back a transaction back to a named savepoint. Modifications after the savepoint are undone but InnoDB does NOT release the corresponding locks which are stored in memory. If a lock is 'implicit', that is, a new inserted row holds a lock where the lock information is carried by the trx id stored in the row, these locks are naturally released in the rollback. Savepoints which were set after this savepoint are deleted.

Returns
if no savepoint of the name found then DB_NO_SAVEPOINT, otherwise DB_SUCCESS
Parameters
trxin: transaction handle
savepoint_namein: savepoint name
mysql_binlog_cache_posout: the MySQL binlog cache position corresponding to this savepoint; MySQL needs this information to remove the binlog entries of the queries executed after the savepoint
UNIV_INTERN dberr_t trx_savepoint_for_mysql ( trx_t trx,
const char *  savepoint_name,
ib_int64_t  binlog_cache_pos 
)

Creates a named savepoint. If the transaction is not yet started, starts it. If there is already a savepoint of the same name, this call erases that old savepoint and replaces it with a new. Savepoints are deleted in a transaction commit or rollback.

Returns
always DB_SUCCESS
Parameters
trxin: transaction handle
savepoint_namein: savepoint name
binlog_cache_posin: MySQL binlog cache position corresponding to this connection at the time of the savepoint
UNIV_INTERN trx_savept_t trx_savept_take ( trx_t trx)

Returns a transaction savepoint taken at this point in time.

Returns
savepoint in: transaction
UNIV_INTERN void trx_undo_arr_free ( trx_undo_arr_t arr)

Frees an undo number array. in: undo number array

UNIV_INLINE trx_undo_inf_t* trx_undo_arr_get_nth_info ( trx_undo_arr_t arr,
ulint  n 
)

Returns pointer to nth element in an undo number array.

Returns
pointer to the nth element in: position

Returns pointer to nth element in an undo number array.

Returns
pointer to the nth element
Parameters
arrin: undo number array
nin: position
UNIV_INTERN void trx_undo_rec_release ( trx_t trx,
undo_no_t  undo_no 
)

Releases a reserved undo record. in: undo number

Parameters
trxin/out: transaction
UNIV_INTERN ibool trx_undo_rec_reserve ( trx_t trx,
undo_no_t  undo_no 
)

Reserves an undo log record for a query thread to undo. This should be called if the query thread gets the undo log record not using the pop function above.

Returns
TRUE if succeeded in: undo number of the record
Parameters
trxin/out: transaction