![]() |
MySQL 8.4.4
Source Code Documentation
|
Transaction rollback. More...
#include "mtr0mtr.h"
#include "trx0sys.h"
#include "trx0trx.h"
#include "trx0types.h"
#include "univ.i"
#include "trx0roll.ic"
Go to the source code of this file.
Classes | |
struct | roll_node_t |
Rollback command node in a query graph. More... | |
struct | trx_named_savept_t |
A savepoint set with SQL's "SAVEPOINT savepoint_id" command. More... | |
Enumerations | |
enum | roll_node_state { ROLL_NODE_NONE = 0 , ROLL_NODE_SEND , ROLL_NODE_WAIT } |
Rollback node states. More... | |
Functions | |
bool | trx_is_recv (const trx_t *trx) |
Determines if this transaction is rolling back an incomplete transaction in crash recovery. More... | |
trx_savept_t | trx_savept_take (trx_t *trx) |
Returns a transaction savepoint taken at this point in time. More... | |
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) |
Get next undo log record from redo and noredo rollback segments. More... | |
void | trx_rollback_or_clean_recovered (bool all) |
Rollback or clean up any incomplete transactions which were encountered in crash recovery. More... | |
void | trx_recovery_rollback_thread () |
Rollback or clean up any incomplete transactions which were encountered in crash recovery. More... | |
roll_node_t * | roll_node_create (mem_heap_t *heap) |
Creates a rollback command node struct. More... | |
que_thr_t * | trx_rollback_step (que_thr_t *thr) |
Performs an execution step for a rollback command node in a query graph. More... | |
dberr_t | trx_rollback_for_mysql (trx_t *trx) |
Rollback a transaction used in MySQL. More... | |
dberr_t | trx_rollback_last_sql_stat_for_mysql (trx_t *trx) |
Rollback the latest SQL statement for MySQL. More... | |
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. More... | |
dberr_t | trx_rollback_to_savepoint_for_mysql (trx_t *trx, const char *savepoint_name, int64_t *mysql_binlog_cache_pos) |
Rolls back a transaction back to a named savepoint. More... | |
dberr_t | trx_savepoint_for_mysql (trx_t *trx, const char *savepoint_name, int64_t binlog_cache_pos) |
Creates a named savepoint. More... | |
dberr_t | trx_release_savepoint_for_mysql (trx_t *trx, const char *savepoint_name) |
Releases a named savepoint. More... | |
void | trx_roll_savepoints_free (trx_t *trx, trx_named_savept_t *savep) |
Frees savepoint structs starting from savep. More... | |
Variables | |
os_event_t | recovery_lock_taken |
Transaction rollback.
Created 3/26/1996 Heikki Tuuri
enum roll_node_state |
roll_node_t * roll_node_create | ( | mem_heap_t * | heap | ) |
Creates a rollback command node struct.
heap | in: mem heap where created |
bool trx_is_recv | ( | const trx_t * | trx | ) |
Determines if this transaction is rolling back an incomplete transaction in crash recovery.
trx | in: transaction |
void trx_recovery_rollback_thread | ( | ) |
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.
Releases a named savepoint.
Savepoints which were set after this savepoint are deleted.
Releases a named savepoint.
Savepoints which were set after this savepoint are left as is.
trx | in: transaction handle |
savepoint_name | in: savepoint name |
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 | ||
) |
Get next undo log record from redo and noredo rollback segments.
trx | in: transaction |
limit | in: least undo number we need |
roll_ptr | out: roll pointer to undo record |
heap | in: memory heap where copied |
void trx_roll_savepoints_free | ( | trx_t * | trx, |
trx_named_savept_t * | savep | ||
) |
Frees savepoint structs starting from savep.
[in] | trx | Transaction handle |
[in] | savep | Free all savepoints starting with this savepoint i, if savep is nullptr free all save points |
Rollback a transaction used in MySQL.
trx | in/out: transaction |
Rollback the latest SQL statement for MySQL.
trx | in/out: transaction |
void trx_rollback_or_clean_recovered | ( | bool | 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
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.
all | in: false=roll back dictionary transactions; true=roll back all non-PREPARED transactions |
Performs an execution step for a rollback command node in a query graph.
thr | in: query thread |
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.
trx | in: transaction handle |
savept | in: pointer to savepoint undo number, if partial rollback requested, or NULL for complete rollback |
dberr_t trx_rollback_to_savepoint_for_mysql | ( | trx_t * | trx, |
const char * | savepoint_name, | ||
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.
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.
trx | in: transaction handle |
savepoint_name | in: savepoint name |
mysql_binlog_cache_pos | out: 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 |
dberr_t trx_savepoint_for_mysql | ( | trx_t * | trx, |
const char * | savepoint_name, | ||
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.
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.
trx | in: transaction handle |
savepoint_name | in: savepoint name |
binlog_cache_pos | in: MySQL binlog cache position corresponding to this connection at the time of the savepoint |
trx_savept_t trx_savept_take | ( | trx_t * | trx | ) |
Returns a transaction savepoint taken at this point in time.
trx | in: transaction |
|
extern |