drizzle
C++ MySQL-protocol-compatible database server
Loading...
Searching...
No Matches
row0upd.h File Reference
#include "univ.i"
#include "data0data.h"
#include "row0types.h"
#include "btr0types.h"
#include "dict0types.h"
#include "trx0types.h"
#include "btr0pcur.h"
#include "que0types.h"
#include "pars0types.h"
Include dependency graph for row0upd.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  upd_field_struct
struct  upd_struct
struct  upd_node_struct

Macros

#define row0upd_h
#define upd_get_nth_field(update, n)
#define row_upd_changes_ord_field_binary(index, update, thr, row, ext)
#define UPD_NODE_MAGIC_N   1579975
#define UPD_NODE_SET_IX_LOCK
#define UPD_NODE_UPDATE_CLUSTERED
#define UPD_NODE_INSERT_CLUSTERED
#define UPD_NODE_INSERT_BLOB
#define UPD_NODE_UPDATE_ALL_SEC
#define UPD_NODE_UPDATE_SOME_SEC
#define UPD_NODE_NO_ORD_CHANGE
#define UPD_NODE_NO_SIZE_CHANGE

Functions

UNIV_INLINE upd_t * upd_create (ulint n, mem_heap_t *heap)
UNIV_INLINE ulint upd_get_n_fields (const upd_t *update)
UNIV_INLINE void upd_field_set_field_no (upd_field_t *upd_field, ulint field_no, dict_index_t *index, trx_t *trx)
UNIV_INLINE const upd_field_t * upd_get_field_by_field_no (const upd_t *update, ulint no) __attribute__((nonnull
UNIV_INTERN byte * row_upd_write_sys_vals_to_log (dict_index_t *index, trx_t *trx, roll_ptr_t roll_ptr, byte *log_ptr, mtr_t *mtr)
UNIV_INLINE void row_upd_rec_sys_fields (rec_t *rec, page_zip_des_t *page_zip, dict_index_t *index, const ulint *offsets, trx_t *trx, roll_ptr_t roll_ptr)
UNIV_INTERN void row_upd_index_entry_sys_field (dtuple_t *entry, dict_index_t *index, ulint type, ib_uint64_t val)
UNIV_INTERN upd_node_t * upd_node_create (mem_heap_t *heap)
UNIV_INTERN void row_upd_index_write_log (const upd_t *update, byte *log_ptr, mtr_t *mtr)
UNIV_INTERN ibool row_upd_changes_field_size_or_external (dict_index_t *index, const ulint *offsets, const upd_t *update)
UNIV_INTERN void row_upd_rec_in_place (rec_t *rec, dict_index_t *index, const ulint *offsets, const upd_t *update, page_zip_des_t *page_zip)
UNIV_INTERN upd_t * row_upd_build_sec_rec_difference_binary (dict_index_t *index, const dtuple_t *entry, const rec_t *rec, trx_t *trx, mem_heap_t *heap)
UNIV_INTERN upd_t * row_upd_build_difference_binary (dict_index_t *index, const dtuple_t *entry, const rec_t *rec, trx_t *trx, mem_heap_t *heap)
UNIV_INTERN void row_upd_index_replace_new_col_vals_index_pos (dtuple_t *entry, dict_index_t *index, const upd_t *update, ibool order_only, mem_heap_t *heap) __attribute__((nonnull))
UNIV_INTERN void row_upd_index_replace_new_col_vals (dtuple_t *entry, dict_index_t *index, const upd_t *update, mem_heap_t *heap) __attribute__((nonnull))
UNIV_INTERN void row_upd_replace (dtuple_t *row, row_ext_t **ext, const dict_index_t *index, const upd_t *update, mem_heap_t *heap)
UNIV_INTERN ibool row_upd_changes_ord_field_binary_func (dict_index_t *index, const upd_t *update, const dtuple_t *row, const row_ext_t *ext) __attribute__((nonnull(1
UNIV_INTERN ibool row_upd_changes_some_index_ord_field_binary (const dict_table_t *table, const upd_t *update)
UNIV_INTERN que_thr_t * row_upd_step (que_thr_t *thr)
UNIV_INTERN byte * row_upd_parse_sys_vals (byte *ptr, byte *end_ptr, ulint *pos, trx_id_t *trx_id, roll_ptr_t *roll_ptr)
UNIV_INTERN void row_upd_rec_sys_fields_in_recovery (rec_t *rec, page_zip_des_t *page_zip, const ulint *offsets, ulint pos, trx_id_t trx_id, roll_ptr_t roll_ptr)
UNIV_INTERN byte * row_upd_index_parse (byte *ptr, byte *end_ptr, mem_heap_t *heap, upd_t **update_out)

Variables

UNIV_INLINE const upd_field_t pure
UNIV_INTERN ibool warn_unused_result

Detailed Description

Update of a row

Created 12/27/1996 Heikki Tuuri

Definition in file row0upd.h.

Macro Definition Documentation

◆ row0upd_h

#define row0upd_h

Definition at line 28 of file row0upd.h.

◆ row_upd_changes_ord_field_binary

#define row_upd_changes_ord_field_binary ( index,
update,
thr,
row,
ext )
Value:
UNIV_INTERN ibool row_upd_changes_ord_field_binary_func(dict_index_t *index, const upd_t *update, const dtuple_t *row, const row_ext_t *ext) __attribute__((nonnull(1

Definition at line 304 of file row0upd.h.

◆ upd_get_nth_field

#define upd_get_nth_field ( update,
n )
Value:
((update)->fields + (n))

Definition at line 72 of file row0upd.h.

◆ UPD_NODE_INSERT_BLOB

#define UPD_NODE_INSERT_BLOB
Value:
4 /* clustered index record should be
inserted, old record is already
delete-marked; non-updated BLOBs
should be inherited by the new record
and disowned by the old record */

Definition at line 472 of file row0upd.h.

◆ UPD_NODE_INSERT_CLUSTERED

#define UPD_NODE_INSERT_CLUSTERED
Value:
3 /* clustered index record should be
inserted, old record is already delete
marked */

Definition at line 471 of file row0upd.h.

◆ UPD_NODE_MAGIC_N

#define UPD_NODE_MAGIC_N   1579975

Definition at line 466 of file row0upd.h.

◆ UPD_NODE_NO_ORD_CHANGE

#define UPD_NODE_NO_ORD_CHANGE
Value:
1 /* no secondary index record will be
changed in the update and no ordering
field of the clustered index */

Definition at line 477 of file row0upd.h.

◆ UPD_NODE_NO_SIZE_CHANGE

#define UPD_NODE_NO_SIZE_CHANGE
Value:
2 /* no record field size will be
changed in the update */

Definition at line 478 of file row0upd.h.

◆ UPD_NODE_SET_IX_LOCK

#define UPD_NODE_SET_IX_LOCK
Value:
1 /* execution came to the node from
a node above and if the field
has_clust_rec_x_lock is FALSE, we
should set an intention x-lock on
the table */

Definition at line 469 of file row0upd.h.

◆ UPD_NODE_UPDATE_ALL_SEC

#define UPD_NODE_UPDATE_ALL_SEC
Value:
5 /* an ordering field of the clustered
index record was changed, or this is
a delete operation: should update
all the secondary index records */

Definition at line 473 of file row0upd.h.

◆ UPD_NODE_UPDATE_CLUSTERED

#define UPD_NODE_UPDATE_CLUSTERED
Value:
2 /* clustered index record should be
updated */

Definition at line 470 of file row0upd.h.

◆ UPD_NODE_UPDATE_SOME_SEC

#define UPD_NODE_UPDATE_SOME_SEC
Value:
6 /* secondary index entries should be
looked at and updated if an ordering
field changed */

Definition at line 474 of file row0upd.h.

Function Documentation

◆ row_upd_build_difference_binary()

UNIV_INTERN upd_t * row_upd_build_difference_binary ( dict_index_t * index,
const dtuple_t * entry,
const rec_t * rec,
trx_t * trx,
mem_heap_t * heap )

Builds an update vector from those fields, excluding the roll ptr and trx id fields, which in an index entry differ from a record that has the equal ordering fields. NOTE: we compare the fields as binary strings!

Returns
own: update vector of differing fields, excluding roll ptr and trx id in: memory heap from which allocated

Builds an update vector from those fields, excluding the roll ptr and trx id fields, which in an index entry differ from a record that has the equal ordering fields. NOTE: we compare the fields as binary strings!

Returns
own: update vector of differing fields, excluding roll ptr and trx id
Parameters
indexin: clustered index
entryin: entry to insert
recin: clustered index record
trxin: transaction
heapin: memory heap from which allocated

Definition at line 856 of file row0upd.cc.

◆ row_upd_build_sec_rec_difference_binary()

UNIV_INTERN upd_t * row_upd_build_sec_rec_difference_binary ( dict_index_t * index,
const dtuple_t * entry,
const rec_t * rec,
trx_t * trx,
mem_heap_t * heap )

Builds an update vector from those fields which in a secondary index entry differ from a record that has the equal ordering fields. NOTE: we compare the fields as binary strings!

Returns
own: update vector of differing fields in: memory heap from which allocated

Builds an update vector from those fields which in a secondary index entry differ from a record that has the equal ordering fields. NOTE: we compare the fields as binary strings!

Returns
own: update vector of differing fields
Parameters
indexin: index
entryin: entry to insert
recin: secondary index record
trxin: transaction
heapin: memory heap from which allocated

Definition at line 786 of file row0upd.cc.

◆ row_upd_changes_field_size_or_external()

UNIV_INTERN ibool row_upd_changes_field_size_or_external ( dict_index_t * index,
const ulint * offsets,
const upd_t * update )

Returns TRUE if row update changes size of some field in index or if some field to be updated is stored externally in rec or update.

Returns
TRUE if the update changes the size of some field in index or the field is external in rec or update in: update vector

Returns TRUE if row update changes size of some field in index or if some field to be updated is stored externally in rec or update.

Returns
TRUE if the update changes the size of some field in index or the field is external in rec or update
Parameters
indexin: index
offsetsin: rec_get_offsets(rec, index)
updatein: update vector

Definition at line 418 of file row0upd.cc.

◆ row_upd_changes_ord_field_binary_func()

UNIV_INTERN ibool row_upd_changes_ord_field_binary_func ( dict_index_t * index,
const upd_t * update,
const dtuple_t * row,
const row_ext_t * ext )

Checks if an update vector changes an ordering field of an index record.

This function is fast if the update vector is short or the number of ordering fields in the index is small. Otherwise, this can be quadratic. NOTE: we compare the fields as binary strings!

Returns
TRUE if update vector changes an ordering field in the index record
Parameters
indexin: index of the record
updatein: update vector for the row; NOTE: the field numbers in this MUST be clustered index positions!
rowin: old value of row, or NULL if the row and the data values in update are not known when this function is called, e.g., at compile time
extNULL, or prefixes of the externally stored columns in the old row

◆ row_upd_changes_some_index_ord_field_binary()

UNIV_INTERN ibool row_upd_changes_some_index_ord_field_binary ( const dict_table_t * table,
const upd_t * update )

Checks if an update vector changes an ordering field of an index record. This function is fast if the update vector is short or the number of ordering fields in the index is small. Otherwise, this can be quadratic. NOTE: we compare the fields as binary strings!

Returns
TRUE if update vector may change an ordering field in an index record in: update vector for the row

Checks if an update vector changes an ordering field of an index record. NOTE: we compare the fields as binary strings!

Returns
TRUE if update vector may change an ordering field in an index record
Parameters
tablein: table
updatein: update vector for the row

Definition at line 1362 of file row0upd.cc.

◆ row_upd_index_entry_sys_field()

UNIV_INTERN void row_upd_index_entry_sys_field ( dtuple_t * entry,
dict_index_t * index,
ulint type,
ib_uint64_t val )

Sets the trx id or roll ptr field of a clustered index entry. in: value to write

Sets the trx id or roll ptr field of a clustered index entry.

Parameters
entryin/out: index entry, where the memory buffers for sys fields are already allocated: the function just copies the new values to them
indexin: clustered index
typein: DATA_TRX_ID or DATA_ROLL_PTR
valin: value to write

Definition at line 382 of file row0upd.cc.

◆ row_upd_index_parse()

UNIV_INTERN byte * row_upd_index_parse ( byte * ptr,
byte * end_ptr,
mem_heap_t * heap,
upd_t ** update_out )

Parses the log data written by row_upd_index_write_log.

Returns
log data end or NULL out: update vector

Parses the log data written by row_upd_index_write_log.

Returns
log data end or NULL
Parameters
ptrin: buffer
end_ptrin: buffer end
heapin: memory heap where update vector is built
update_outout: update vector

Definition at line 704 of file row0upd.cc.

◆ row_upd_index_replace_new_col_vals()

UNIV_INTERN void row_upd_index_replace_new_col_vals ( dtuple_t * entry,
dict_index_t * index,
const upd_t * update,
mem_heap_t * heap )

Replaces the new column values stored in the update vector to the index entry given.

Parameters
entryin/out: index entry where replaced; the clustered index record must be covered by a lock or a page latch to prevent deletion (rollback or purge)
indexin: index; NOTE that this may also be a non-clustered index
updatein: an update vector built for the CLUSTERED index so that the field number in an upd_field is the clustered index position
heapin: memory heap for allocating and copying the new values

Definition at line 1108 of file row0upd.cc.

◆ row_upd_index_replace_new_col_vals_index_pos()

UNIV_INTERN void row_upd_index_replace_new_col_vals_index_pos ( dtuple_t * entry,
dict_index_t * index,
const upd_t * update,
ibool order_only,
mem_heap_t * heap )

Replaces the new column values stored in the update vector to the index entry given.

Parameters
entryin/out: index entry where replaced; the clustered index record must be covered by a lock or a page latch to prevent deletion (rollback or purge)
indexin: index; NOTE that this may also be a non-clustered index
updatein: an update vector built for the index so that the field number in an upd_field is the index position
order_onlyin: if TRUE, limit the replacement to ordering fields of index; note that this does not work for non-clustered indexes.
heapin: memory heap for allocating and copying the new values

Definition at line 1054 of file row0upd.cc.

◆ row_upd_index_write_log()

UNIV_INTERN void row_upd_index_write_log ( const upd_t * update,
byte * log_ptr,
mtr_t * mtr )

Writes to the redo log the new values of the fields occurring in the index. in: mtr into whose log to write

Writes to the redo log the new values of the fields occurring in the index.

Parameters
updatein: update vector
log_ptrin: pointer to mlog buffer: must contain at least MLOG_BUF_MARGIN bytes of free space; the buffer is closed within this function
mtrin: mtr into whose log to write

Definition at line 631 of file row0upd.cc.

◆ row_upd_parse_sys_vals()

UNIV_INTERN byte * row_upd_parse_sys_vals ( byte * ptr,
byte * end_ptr,
ulint * pos,
trx_id_t * trx_id,
roll_ptr_t * roll_ptr )

Parses the log data of system field values.

Returns
log data end or NULL out: roll ptr

Parses the log data of system field values.

Returns
log data end or NULL
Parameters
ptrin: buffer
end_ptrin: buffer end
posout: TRX_ID position in record
trx_idout: trx id
roll_ptrout: roll ptr

Definition at line 598 of file row0upd.cc.

◆ row_upd_rec_in_place()

UNIV_INTERN void row_upd_rec_in_place ( rec_t * rec,
dict_index_t * index,
const ulint * offsets,
const upd_t * update,
page_zip_des_t * page_zip )

Replaces the new column values stored in the update vector to the record given. No field size changes are allowed. This function is usually invoked on a clustered index. The only use case for a secondary index is row_ins_sec_index_entry_by_modify() or its counterpart in ibuf_insert_to_index_page(). in: compressed page with enough space available, or NULL

Replaces the new column values stored in the update vector to the record given. No field size changes are allowed. This function is usually invoked on a clustered index. The only use case for a secondary index is row_ins_sec_index_entry_by_modify() or its counterpart in ibuf_insert_to_index_page().

Parameters
recin/out: record where replaced
indexin: the index the record belongs to
offsetsin: array returned by rec_get_offsets()
updatein: update vector
page_zipin: compressed page with enough space available, or NULL

Definition at line 486 of file row0upd.cc.

◆ row_upd_rec_sys_fields()

UNIV_INLINE void row_upd_rec_sys_fields ( rec_t * rec,
page_zip_des_t * page_zip,
dict_index_t * index,
const ulint * offsets,
trx_t * trx,
roll_ptr_t roll_ptr )

Updates the trx id and roll ptr field in a clustered index record when a row is updated or marked deleted. in: roll ptr of the undo log record

Parameters
recin/out: record
page_zipin/out: compressed page whose uncompressed part will be updated, or NULL
indexin: clustered index
offsetsin: rec_get_offsets(rec, index)
trxin: transaction

◆ row_upd_rec_sys_fields_in_recovery()

UNIV_INTERN void row_upd_rec_sys_fields_in_recovery ( rec_t * rec,
page_zip_des_t * page_zip,
const ulint * offsets,
ulint pos,
trx_id_t trx_id,
roll_ptr_t roll_ptr )

Updates the trx id and roll ptr field in a clustered index record in database recovery. in: roll ptr of the undo log record

Updates the trx id and roll ptr field in a clustered index record in database recovery.

Parameters
recin/out: record
page_zipin/out: compressed page, or NULL
offsetsin: array returned by rec_get_offsets()
posin: TRX_ID position in rec
trx_idin: transaction id
roll_ptrin: roll ptr of the undo log record

Definition at line 349 of file row0upd.cc.

◆ row_upd_replace()

UNIV_INTERN void row_upd_replace ( dtuple_t * row,
row_ext_t ** ext,
const dict_index_t * index,
const upd_t * update,
mem_heap_t * heap )

Replaces the new column values stored in the update vector. in: memory heap

Replaces the new column values stored in the update vector.

Parameters
rowin/out: row where replaced, indexed by col_no; the clustered index record must be covered by a lock or a page latch to prevent deletion (rollback or purge)
extout, own: NULL, or externally stored column prefixes
indexin: clustered index
updatein: an update vector built for the clustered index
heapin: memory heap

Definition at line 1152 of file row0upd.cc.

◆ row_upd_step()

UNIV_INTERN que_thr_t * row_upd_step ( que_thr_t * thr)

Updates a row in a table. This is a high-level function used in SQL execution graphs.

Returns
query thread to run next or NULL in: query thread

Updates a row in a table. This is a high-level function used in SQL execution graphs.

Returns
query thread to run next or NULL
Parameters
thrin: query thread

Definition at line 2354 of file row0upd.cc.

◆ row_upd_write_sys_vals_to_log()

UNIV_INTERN byte * row_upd_write_sys_vals_to_log ( dict_index_t * index,
trx_t * trx,
roll_ptr_t roll_ptr,
byte * log_ptr,
mtr_t * mtr )

Writes into the redo log the values of trx id and roll ptr and enough info to determine their positions within a clustered index record.

Returns
new pointer to mlog in: mtr

Writes into the redo log the values of trx id and roll ptr and enough info to determine their positions within a clustered index record.

Returns
new pointer to mlog
Parameters
indexin: clustered index
trxin: transaction
roll_ptrin: roll ptr of the undo log record
log_ptrpointer to a buffer of size > 20 opened in mlog
mtrin: mtr

Definition at line 568 of file row0upd.cc.

◆ upd_create()

UNIV_INLINE upd_t * upd_create ( ulint n,
mem_heap_t * heap )

Creates an update vector object.

Returns
own: update vector object in: heap from which memory allocated
Parameters
nin: number of fields

◆ upd_field_set_field_no()

UNIV_INLINE void upd_field_set_field_no ( upd_field_t * upd_field,
ulint field_no,
dict_index_t * index,
trx_t * trx )

Sets an index field number to be updated by an update vector field. in: transaction

Parameters
upd_fieldin: update vector field
field_noin: field number in a clustered index
indexin: index

◆ upd_get_field_by_field_no()

UNIV_INLINE const upd_field_t * upd_get_field_by_field_no ( const upd_t * update,
ulint no )

Returns a field of an update vector by field_no.

Returns
update vector field, or NULL
Parameters
updatein: update vector
noin: field_no

◆ upd_get_n_fields()

UNIV_INLINE ulint upd_get_n_fields ( const upd_t * update)

Returns the number of fields in the update vector == number of columns to be updated by an update vector.

Returns
number of fields in: update vector

◆ upd_node_create()

UNIV_INTERN upd_node_t * upd_node_create ( mem_heap_t * heap)

Creates an update node for a query graph.

Returns
own: update node in: mem heap where created

Creates an update node for a query graph.

Returns
own: update node
Parameters
heapin: mem heap where created

Definition at line 310 of file row0upd.cc.

Variable Documentation

◆ pure

UNIV_INLINE const upd_field_t pure

Definition at line 95 of file row0upd.h.

◆ warn_unused_result

UNIV_INTERN ibool warn_unused_result

Definition at line 299 of file row0upd.h.