MySQL 9.0.0
Source Code Documentation
row0umod.cc File Reference

Undo modify of a row. More...

#include <stddef.h>
#include "btr0btr.h"
#include "dict0boot.h"
#include "dict0dd.h"
#include "dict0dict.h"
#include "ha_prototypes.h"
#include "log0chkp.h"
#include "mach0data.h"
#include "que0que.h"
#include "row0log.h"
#include "row0row.h"
#include "row0umod.h"
#include "row0undo.h"
#include "row0upd.h"
#include "row0vers.h"
#include "trx0rec.h"
#include "trx0roll.h"
#include "trx0trx.h"
#include "trx0undo.h"
#include "current_thd.h"
#include "debug_sync.h"

Functions

static dberr_t row_undo_mod_clust_low (undo_node_t *node, ulint **offsets, mem_heap_t **offsets_heap, mem_heap_t *heap, const dtuple_t **rebuilt_old_pk, byte *sys, que_thr_t *thr, mtr_t *mtr, ulint mode)
 Undoes a modify in a clustered index record. More...
 
static dberr_t row_undo_mod_remove_clust_low (undo_node_t *node, mtr_t *mtr, ulint mode)
 Purges a clustered index record after undo if possible. More...
 
static dberr_t row_undo_mod_clust (undo_node_t *node, que_thr_t *thr)
 Undoes a modify in a clustered index record. More...
 
static dberr_t row_undo_mod_del_mark_or_remove_sec_low (undo_node_t *node, que_thr_t *thr, dict_index_t *index, dtuple_t *entry, ulint mode)
 Delete marks or removes a secondary index entry if found. More...
 
static dberr_t row_undo_mod_del_mark_or_remove_sec (undo_node_t *node, que_thr_t *thr, dict_index_t *index, dtuple_t *entry)
 Delete marks or removes a secondary index entry if found. More...
 
static dberr_t row_undo_mod_del_unmark_sec_and_undo_update (ulint mode, que_thr_t *thr, dict_index_t *index, dtuple_t *entry, undo_no_t undo_no)
 Delete unmarks a secondary index entry which must be found. More...
 
static void row_undo_mod_sec_flag_corrupted (trx_t *trx, dict_index_t *index)
 Flags a secondary index corrupted. More...
 
static dberr_t row_undo_mod_upd_del_multi_sec (undo_node_t *node, que_thr_t *thr, dict_index_t *index, mem_heap_t *heap)
 Undoes a modify in secondary indexes when undo record type is UPD_DEL. More...
 
static dberr_t row_undo_mod_upd_del_sec (undo_node_t *node, que_thr_t *thr)
 Undoes a modify in secondary indexes when undo record type is UPD_DEL. More...
 
static dberr_t row_undo_mod_del_mark_multi_sec (undo_node_t *node, que_thr_t *thr, dict_index_t *index, mem_heap_t *heap)
 Undoes a modify in secondary indexes when undo record type is DEL_MARK. More...
 
static dberr_t row_undo_mod_del_mark_sec (undo_node_t *node, que_thr_t *thr)
 Undoes a modify in secondary indexes when undo record type is DEL_MARK. More...
 
static dberr_t row_undo_mod_upd_exist_multi_sec (undo_node_t *node, que_thr_t *thr, dict_index_t *index, bool non_mv_upd, mem_heap_t *heap)
 Undoes a modify in secondary indexes when undo record type is UPD_EXIST. More...
 
static dberr_t row_undo_mod_upd_exist_sec (undo_node_t *node, que_thr_t *thr)
 Undoes a modify in secondary indexes when undo record type is UPD_EXIST. More...
 
static void row_undo_mod_parse_undo_rec (undo_node_t *node, THD *thd, MDL_ticket **mdl)
 Parses the row reference and other info in a modify undo log record. More...
 
dberr_t row_undo_mod (undo_node_t *node, que_thr_t *thr)
 Undoes a modify operation on a row of a table. More...
 

Detailed Description

Undo modify of a row.

Created 2/27/1997 Heikki Tuuri

Function Documentation

◆ row_undo_mod()

dberr_t row_undo_mod ( undo_node_t node,
que_thr_t thr 
)

Undoes a modify operation on a row of a table.

Returns
DB_SUCCESS or error code
Parameters
nodein: row undo node
thrin: query thread

◆ row_undo_mod_clust()

static dberr_t row_undo_mod_clust ( undo_node_t node,
que_thr_t thr 
)
static

Undoes a modify in a clustered index record.

Sets also the node state for the next round of undo.

Returns
DB_SUCCESS or error code: we may run out of file space
Parameters
nodein: row undo node
thrin: query thread

◆ row_undo_mod_clust_low()

static dberr_t row_undo_mod_clust_low ( undo_node_t node,
ulint **  offsets,
mem_heap_t **  offsets_heap,
mem_heap_t heap,
const dtuple_t **  rebuilt_old_pk,
byte sys,
que_thr_t thr,
mtr_t mtr,
ulint  mode 
)
static

Undoes a modify in a clustered index record.

Returns
DB_SUCCESS, DB_FAIL, or error code: we may run out of file space
Parameters
nodein: row undo node
offsetsout: rec_get_offsets() on the record
offsets_heapin/out: memory heap that can be emptied
heapin/out: memory heap
rebuilt_old_pkout: row_log_table_get_pk() before the update, or NULL if the table is not being rebuilt online or the PRIMARY KEY definition does not change
sysout: DB_TRX_ID, DB_ROLL_PTR for row_log_table_delete()
thrin: query thread
mtrin: mtr; must be committed before latching any further pages
modein: BTR_MODIFY_LEAF or BTR_MODIFY_TREE

◆ row_undo_mod_del_mark_multi_sec()

static dberr_t row_undo_mod_del_mark_multi_sec ( undo_node_t node,
que_thr_t thr,
dict_index_t index,
mem_heap_t heap 
)
static

Undoes a modify in secondary indexes when undo record type is DEL_MARK.

This is the specific function to handle the modify on multi-value indexes.

Parameters
[in,out]noderow undo node
[in,out]thrquery thread
[in]indexthe multi-value index
[in,out]heapmemory heap
Returns
DB_SUCCESS or DB_OUT_OF_FILE_SPACE

◆ row_undo_mod_del_mark_or_remove_sec()

static dberr_t row_undo_mod_del_mark_or_remove_sec ( undo_node_t node,
que_thr_t thr,
dict_index_t index,
dtuple_t entry 
)
static

Delete marks or removes a secondary index entry if found.

NOTE that if we updated the fields of a delete-marked secondary index record so that alphabetically they stayed the same, e.g., 'abc' -> 'aBc', we cannot return to the original values because we do not know them. But this should not cause problems because in row0sel.cc, in queries we always retrieve the clustered index record or an earlier version of it, if the secondary index record through which we do the search is delete-marked.

Returns
DB_SUCCESS or DB_OUT_OF_FILE_SPACE
Parameters
nodein: row undo node
thrin: query thread
indexin: index
entryin: index entry

◆ row_undo_mod_del_mark_or_remove_sec_low()

static dberr_t row_undo_mod_del_mark_or_remove_sec_low ( undo_node_t node,
que_thr_t thr,
dict_index_t index,
dtuple_t entry,
ulint  mode 
)
static

Delete marks or removes a secondary index entry if found.

Returns
DB_SUCCESS, DB_FAIL, or DB_OUT_OF_FILE_SPACE
Parameters
nodein: row undo node
thrin: query thread
indexin: index
entryin: index entry
modein: latch mode BTR_MODIFY_LEAF or BTR_MODIFY_TREE

◆ row_undo_mod_del_mark_sec()

static dberr_t row_undo_mod_del_mark_sec ( undo_node_t node,
que_thr_t thr 
)
static

Undoes a modify in secondary indexes when undo record type is DEL_MARK.

Returns
DB_SUCCESS or DB_OUT_OF_FILE_SPACE
Parameters
nodein: row undo node
thrin: query thread

◆ row_undo_mod_del_unmark_sec_and_undo_update()

static dberr_t row_undo_mod_del_unmark_sec_and_undo_update ( ulint  mode,
que_thr_t thr,
dict_index_t index,
dtuple_t entry,
undo_no_t  undo_no 
)
static

Delete unmarks a secondary index entry which must be found.

It might not be delete-marked at the moment, but it does not harm to unmark it anyway. We also need to update the fields of the secondary index record if we updated its fields but alphabetically they stayed the same, e.g., 'abc' -> 'aBc'.

Return values
DB_SUCCESSon success
DB_FAILif BTR_MODIFY_TREE should be tried
DB_OUT_OF_FILE_SPACEwhen running out of tablespace
DB_DUPLICATE_KEYif the value was missing and an insert would lead to a duplicate exists
Parameters
modein: search mode: BTR_MODIFY_LEAF or BTR_MODIFY_TREE
thrin: query thread
indexin: index
entryin: index entry
undo_noin: undo number up to which to rollback.

◆ row_undo_mod_parse_undo_rec()

static void row_undo_mod_parse_undo_rec ( undo_node_t node,
THD thd,
MDL_ticket **  mdl 
)
static

Parses the row reference and other info in a modify undo log record.

Parameters
[in]noderow undo node
[in]thdTHD associated with the node
[in,out]mdlMDL ticket or nullptr if unnecessary

◆ row_undo_mod_remove_clust_low()

static dberr_t row_undo_mod_remove_clust_low ( undo_node_t node,
mtr_t mtr,
ulint  mode 
)
static

Purges a clustered index record after undo if possible.

This is attempted when the record was inserted by updating a delete-marked record and there no longer exist transactions that would see the delete-marked record.

Returns
DB_SUCCESS, DB_FAIL, or error code: we may run out of file space
Parameters
nodein: row undo node
mtrin/out: mini-transaction
modein: BTR_MODIFY_LEAF or BTR_MODIFY_TREE

◆ row_undo_mod_sec_flag_corrupted()

static void row_undo_mod_sec_flag_corrupted ( trx_t trx,
dict_index_t index 
)
static

Flags a secondary index corrupted.

Parameters
trxin/out: transaction
indexin: secondary index

◆ row_undo_mod_upd_del_multi_sec()

static dberr_t row_undo_mod_upd_del_multi_sec ( undo_node_t node,
que_thr_t thr,
dict_index_t index,
mem_heap_t heap 
)
static

Undoes a modify in secondary indexes when undo record type is UPD_DEL.

This is the specific function to handle the modify on multi-value indexes.

Parameters
[in,out]noderow undo node
[in,out]thrquery thread
[in]indexthe multi-value index
[in,out]heapmemory heap
Returns
DB_SUCCESS or DB_OUT_OF_FILE_SPACE

◆ row_undo_mod_upd_del_sec()

static dberr_t row_undo_mod_upd_del_sec ( undo_node_t node,
que_thr_t thr 
)
static

Undoes a modify in secondary indexes when undo record type is UPD_DEL.

Returns
DB_SUCCESS or DB_OUT_OF_FILE_SPACE
Parameters
nodein: row undo node
thrin: query thread

◆ row_undo_mod_upd_exist_multi_sec()

static dberr_t row_undo_mod_upd_exist_multi_sec ( undo_node_t node,
que_thr_t thr,
dict_index_t index,
bool  non_mv_upd,
mem_heap_t heap 
)
static

Undoes a modify in secondary indexes when undo record type is UPD_EXIST.

This is the specific function to handle the modify on multi-value indexes.

Parameters
[in,out]noderow undo node
[in,out]thrquery thread
[in]indexthe multi-value index
[in]non_mv_updtrue if any non-multi-value field on the index gets updated too
[in,out]heapmemory heap
Returns
DB_SUCCESS or DB_OUT_OF_FILE_SPACE

◆ row_undo_mod_upd_exist_sec()

static dberr_t row_undo_mod_upd_exist_sec ( undo_node_t node,
que_thr_t thr 
)
static

Undoes a modify in secondary indexes when undo record type is UPD_EXIST.

Returns
DB_SUCCESS or DB_OUT_OF_FILE_SPACE
Parameters
nodein: row undo node
thrin: query thread