#include "univ.i"
#include "data0data.h"
#include "dict0types.h"
#include "trx0types.h"
#include "que0types.h"
#include "mtr0mtr.h"
#include "rem0types.h"
#include "read0types.h"
#include "row0types.h"
#include "btr0types.h"
Go to the source code of this file.
Macros | |
#define | row0row_h |
#define | ROW_COPY_DATA 1 |
#define | ROW_COPY_POINTERS 2 |
Enumerations | |
enum | row_search_result { ROW_FOUND = 0, ROW_NOT_FOUND, ROW_BUFFERED, ROW_NOT_DELETED_REF } |
Functions | |
UNIV_INTERN ulint | row_get_trx_id_offset (const rec_t *rec, dict_index_t *index, const ulint *offsets) |
UNIV_INLINE trx_id_t | row_get_rec_trx_id (const rec_t *rec, dict_index_t *index, const ulint *offsets) |
UNIV_INLINE roll_ptr_t | row_get_rec_roll_ptr (const rec_t *rec, dict_index_t *index, const ulint *offsets) |
UNIV_INTERN dtuple_t * | row_build_index_entry (const dtuple_t *row, row_ext_t *ext, dict_index_t *index, mem_heap_t *heap) |
UNIV_INTERN dtuple_t * | row_build (ulint type, const dict_index_t *index, const rec_t *rec, const ulint *offsets, const dict_table_t *col_table, row_ext_t **ext, mem_heap_t *heap) |
UNIV_INTERN dtuple_t * | row_rec_to_index_entry_low (const rec_t *rec, const dict_index_t *index, const ulint *offsets, ulint *n_ext, mem_heap_t *heap) |
UNIV_INTERN dtuple_t * | row_rec_to_index_entry (ulint type, const rec_t *rec, const dict_index_t *index, ulint *offsets, ulint *n_ext, mem_heap_t *heap) |
UNIV_INTERN dtuple_t * | row_build_row_ref (ulint type, dict_index_t *index, const rec_t *rec, mem_heap_t *heap) |
UNIV_INTERN void | row_build_row_ref_in_tuple (dtuple_t *ref, const rec_t *rec, const dict_index_t *index, ulint *offsets, trx_t *trx) |
UNIV_INLINE void | row_build_row_ref_fast (dtuple_t *ref, const ulint *map, const rec_t *rec, const ulint *offsets) |
UNIV_INTERN ibool | row_search_on_row_ref (btr_pcur_t *pcur, ulint mode, const dict_table_t *table, const dtuple_t *ref, mtr_t *mtr) |
UNIV_INTERN rec_t * | row_get_clust_rec (ulint mode, const rec_t *rec, dict_index_t *index, dict_index_t **clust_index, mtr_t *mtr) |
UNIV_INTERN enum row_search_result | row_search_index_entry (dict_index_t *index, const dtuple_t *entry, ulint mode, btr_pcur_t *pcur, mtr_t *mtr) |
UNIV_INTERN ulint | row_raw_format (const char *data, ulint data_len, const dict_field_t *dict_field, char *buf, ulint buf_size) |
enum row_search_result |
Result of row_search_index_entry
Enumerator | |
---|---|
ROW_FOUND |
the record was found |
ROW_NOT_FOUND |
record not found |
ROW_BUFFERED |
one of BTR_INSERT, BTR_DELETE, or BTR_DELETE_MARK was specified, the secondary index leaf page was not in the buffer pool, and the operation was enqueued in the insert/delete buffer |
ROW_NOT_DELETED_REF |
BTR_DELETE was specified, and row_purge_poss_sec() failed |
UNIV_INTERN dtuple_t* row_build | ( | ulint | type, |
const dict_index_t * | index, | ||
const rec_t * | rec, | ||
const ulint * | offsets, | ||
const dict_table_t * | col_table, | ||
row_ext_t ** | ext, | ||
mem_heap_t * | heap | ||
) |
An inverse function to row_build_index_entry. Builds a row from a record in a clustered index.
An inverse function to row_build_index_entry. Builds a row from a record in a clustered index.
type | in: ROW_COPY_POINTERS or ROW_COPY_DATA; the latter copies also the data fields to heap while the first only places pointers to data fields on the index page, and thus is more efficient |
index | in: clustered index |
rec | in: record in the clustered index; NOTE: in the case ROW_COPY_POINTERS the data fields in the row will point directly into this record, therefore, the buffer page of this record must be at least s-latched and the latch held as long as the row dtuple is used! |
offsets | in: rec_get_offsets(rec,index) or NULL, in which case this function will invoke rec_get_offsets() |
col_table | in: table, to check which externally stored columns occur in the ordering columns of an index, or NULL if index->table should be consulted instead |
ext | out, own: cache of externally stored column prefixes, or NULL |
heap | in: memory heap from which the memory needed is allocated |
Definition at line 175 of file row0row.cc.
References dfield_set_data(), dfield_set_ext(), dict_col_get_no(), dict_field_get_col(), dict_index_is_clust(), dict_table_get_format(), dict_table_get_n_cols(), dict_table_is_comp(), dict_table_zip_size(), DICT_TF_FORMAT_ZIP, dtuple_check_typed(), dtuple_create(), dtuple_set_info_bits(), mem_heap_alloc(), mem_heap_free, dict_col_struct::ord_part, dict_field_struct::prefix_len, rec_copy(), rec_get_info_bits(), rec_offs_n_extern(), rec_offs_n_fields(), rec_offs_nth_extern(), rec_offs_size(), rec_offs_validate(), row_build(), row_ext_create(), dict_index_struct::table, ut_a, and ut_ad.
Referenced by row_build(), row_undo_search_clust_to_pcur(), row_vers_impl_x_locked_off_kernel(), and row_vers_old_has_index_entry().
UNIV_INTERN dtuple_t* row_build_index_entry | ( | const dtuple_t * | row, |
row_ext_t * | ext, | ||
dict_index_t * | index, | ||
mem_heap_t * | heap | ||
) |
When an insert or purge to a table is performed, this function builds the entry to be inserted into or purged from an index on the table.
When an insert or purge to a table is performed, this function builds the entry to be inserted into or purged from an index on the table.
row | in: row which should be inserted or purged |
ext | in: externally stored column prefixes, or NULL |
index | in: index on the table |
heap | in: memory heap from which the memory for the index entry is allocated |
Definition at line 87 of file row0row.cc.
References BTR_EXTERN_FIELD_REF_SIZE, dict_field_struct::col, dfield_copy(), dfield_get_len(), dfield_is_ext(), dfield_is_null(), dfield_set_data(), dfield_set_len(), dict_col_get_no(), dict_index_get_n_fields(), dict_index_get_n_unique_in_tree(), dict_index_is_clust(), DICT_UNIVERSAL, dtuple_check_typed(), dtuple_create(), dtuple_set_n_fields_cmp(), dict_col_struct::mbminmaxlen, dict_col_struct::ord_part, dict_field_struct::prefix_len, dict_col_struct::prtype, row_build_index_entry(), row_ext_lookup(), dict_index_struct::type, ut_a, and ut_ad.
Referenced by ins_node_create_entry_list(), row_build_index_entry(), row_undo_ins(), row_vers_impl_x_locked_off_kernel(), and row_vers_old_has_index_entry().
UNIV_INTERN dtuple_t* row_build_row_ref | ( | ulint | type, |
dict_index_t * | index, | ||
const rec_t * | rec, | ||
mem_heap_t * | heap | ||
) |
Builds from a secondary index record a row reference with which we can search the clustered index record.
Builds from a secondary index record a row reference with which we can search the clustered index record.
type | in: ROW_COPY_DATA, or ROW_COPY_POINTERS: the former copies also the data fields to heap, whereas the latter only places pointers to data fields on the index page |
index | in: secondary index |
rec | in: record in the index; NOTE: in the case ROW_COPY_POINTERS the data fields in the row will point directly into this record, therefore, the buffer page of this record must be at least s-latched and the latch held as long as the row reference is used! |
heap | in: memory heap from which the memory needed is allocated |
Definition at line 434 of file row0row.cc.
References dfield_set_data(), dfield_set_len(), dict_index_get_n_unique(), dict_index_is_clust(), dtuple_check_typed(), dtuple_create(), dtype_struct::mbminmaxlen, mem_heap_alloc(), mem_heap_free, dtype_struct::prtype, rec_copy(), rec_offs_any_extern(), rec_offs_size(), row_build_row_ref(), dict_index_struct::table, ut_a, and ut_ad.
Referenced by row_build_row_ref(), and row_get_clust_rec().
UNIV_INLINE void row_build_row_ref_fast | ( | dtuple_t * | ref, |
const ulint * | map, | ||
const rec_t * | rec, | ||
const ulint * | offsets | ||
) |
Builds from a secondary index record a row reference with which we can search the clustered index record. in: array returned by rec_get_offsets()
ref | in/out: typed data tuple where the reference is built |
map | in: array of field numbers in rec telling how ref should be built from the fields of rec |
rec | in: record in the index; must be preserved while ref is used, as we do not copy field values to heap |
UNIV_INTERN void row_build_row_ref_in_tuple | ( | dtuple_t * | ref, |
const rec_t * | rec, | ||
const dict_index_t * | index, | ||
ulint * | offsets, | ||
trx_t * | trx | ||
) |
Builds from a secondary index record a row reference with which we can search the clustered index record. in: transaction
Builds from a secondary index record a row reference with which we can search the clustered index record.
ref | in/out: row reference built; see the NOTE below! |
rec | in: record in the index; NOTE: the data fields in ref will point directly into this record, therefore, the buffer page of this record must be at least s-latched and the latch held as long as the row reference is used! |
index | in: secondary index |
offsets | in: rec_get_offsets(rec, index) or NULL |
trx | in: transaction |
Definition at line 543 of file row0row.cc.
References dfield_set_data(), dfield_set_len(), dict_index_get_n_unique(), dict_index_is_clust(), dtuple_check_typed(), dtuple_get_n_fields(), dtype_struct::mbminmaxlen, mem_heap_free, dict_index_struct::name, dtype_struct::prtype, rec_offs_any_extern(), rec_offs_validate(), row_build_row_ref_in_tuple(), dict_index_struct::table, dict_index_struct::table_name, ut_a, ut_ad, ut_error, and ut_print_name().
Referenced by row_build_row_ref_in_tuple().
UNIV_INTERN rec_t* row_get_clust_rec | ( | ulint | mode, |
const rec_t * | rec, | ||
dict_index_t * | index, | ||
dict_index_t ** | clust_index, | ||
mtr_t * | mtr | ||
) |
Fetches the clustered index record for a secondary index record. The latches on the secondary index record are preserved.
Fetches the clustered index record for a secondary index record. The latches on the secondary index record are preserved.
mode | in: BTR_MODIFY_LEAF, ... |
rec | in: record in a secondary index |
index | in: secondary index |
clust_index | out: clustered index |
mtr | in: mtr |
Definition at line 699 of file row0row.cc.
References btr_pcur_close(), btr_pcur_get_rec(), dict_index_is_clust(), mem_heap_create, mem_heap_free, row_build_row_ref(), row_get_clust_rec(), row_search_on_row_ref(), dict_index_struct::table, and ut_ad.
Referenced by row_get_clust_rec(), and row_vers_impl_x_locked_off_kernel().
UNIV_INLINE roll_ptr_t row_get_rec_roll_ptr | ( | const rec_t * | rec, |
dict_index_t * | index, | ||
const ulint * | offsets | ||
) |
Reads the roll pointer field from a clustered index record.
rec | in: record |
index | in: clustered index |
Referenced by row_undo_search_clust_to_pcur(), row_vers_build_for_consistent_read(), and trx_undo_prev_version_build().
UNIV_INLINE trx_id_t row_get_rec_trx_id | ( | const rec_t * | rec, |
dict_index_t * | index, | ||
const ulint * | offsets | ||
) |
Reads the trx id field from a clustered index record.
rec | in: record |
index | in: clustered index |
Referenced by lock_clust_rec_cons_read_sees(), row_unlock_for_mysql(), row_vers_build_for_consistent_read(), row_vers_build_for_semi_consistent_read(), row_vers_impl_x_locked_off_kernel(), and trx_undo_prev_version_build().
UNIV_INTERN ulint row_get_trx_id_offset | ( | const rec_t * | , |
dict_index_t * | index, | ||
const ulint * | offsets | ||
) |
Gets the offset of the trx id field, in bytes relative to the origin of a clustered index record.
Gets the offset of trx id field, in bytes relative to the origin of a clustered index record.
index | in: clustered index |
offsets | in: rec_get_offsets(rec, index) |
Definition at line 56 of file row0row.cc.
References dict_index_get_sys_col_pos(), dict_index_is_clust(), rec_get_nth_field_offs(), rec_offs_validate(), row_get_trx_id_offset(), and ut_ad.
Referenced by row_get_trx_id_offset().
UNIV_INTERN ulint row_raw_format | ( | const char * | data, |
ulint | data_len, | ||
const dict_field_t * | dict_field, | ||
char * | buf, | ||
ulint | buf_size | ||
) |
Formats the raw data in "data" (in InnoDB on-disk format) using "dict_field" and writes the result to "buf". Not more than "buf_size" bytes are written to "buf". The result is always NUL-terminated (provided buf_size is positive) and the number of bytes that were written to "buf" is returned (including the terminating NUL).
Formats the raw data in "data" (in InnoDB on-disk format) using "dict_field" and writes the result to "buf". Not more than "buf_size" bytes are written to "buf". The result is always NUL-terminated (provided buf_size is positive) and the number of bytes that were written to "buf" is returned (including the terminating NUL).
data | in: raw data |
data_len | in: raw data length in bytes |
dict_field | in: index field |
buf | out: output buffer |
buf_size | in: output buffer size in bytes |
Definition at line 913 of file row0row.cc.
References dict_field_struct::col, dict_col_struct::mtype, dict_col_struct::prtype, row_raw_format(), ut_min(), ut_raw_to_hex(), and ut_snprintf.
Referenced by row_raw_format().
UNIV_INTERN dtuple_t* row_rec_to_index_entry | ( | ulint | type, |
const rec_t * | rec, | ||
const dict_index_t * | index, | ||
ulint * | offsets, | ||
ulint * | n_ext, | ||
mem_heap_t * | heap | ||
) |
Converts an index record to a typed data tuple. NOTE that externally stored (often big) fields are NOT copied to heap.
Converts an index record to a typed data tuple. NOTE that externally stored (often big) fields are NOT copied to heap.
type | in: ROW_COPY_DATA, or ROW_COPY_POINTERS: the former copies also the data fields to heap as the latter only places pointers to data fields on the index page |
rec | in: record in the index; NOTE: in the case ROW_COPY_POINTERS the data fields in the row will point directly into this record, therefore, the buffer page of this record must be at least s-latched and the latch held as long as the dtuple is used! |
index | in: index |
offsets | in/out: rec_get_offsets(rec) |
n_ext | out: number of externally stored columns |
heap | in: memory heap from which the memory needed is allocated |
Definition at line 382 of file row0row.cc.
References dtuple_set_info_bits(), mem_heap_alloc(), rec_copy(), rec_get_info_bits(), rec_offs_comp(), rec_offs_size(), rec_offs_validate(), row_rec_to_index_entry(), row_rec_to_index_entry_low(), and ut_ad.
Referenced by btr_cur_optimistic_update(), row_check_index_for_mysql(), row_rec_to_index_entry(), and trx_undo_prev_version_build().
UNIV_INTERN dtuple_t* row_rec_to_index_entry_low | ( | const rec_t * | rec, |
const dict_index_t * | index, | ||
const ulint * | offsets, | ||
ulint * | n_ext, | ||
mem_heap_t * | heap | ||
) |
Converts an index record to a typed data tuple.
Converts an index record to a typed data tuple.
rec | in: record in the index |
index | in: index |
offsets | in: rec_get_offsets(rec, index) |
n_ext | out: number of externally stored columns |
heap | in: memory heap from which the memory needed is allocated |
Definition at line 324 of file row0row.cc.
References dfield_set_data(), dfield_set_ext(), dict_index_get_n_fields(), dict_index_get_n_unique_in_tree(), dtuple_check_typed(), dtuple_create(), dtuple_set_n_fields_cmp(), rec_offs_n_fields(), rec_offs_nth_extern(), row_rec_to_index_entry_low(), and ut_ad.
Referenced by row_rec_to_index_entry(), and row_rec_to_index_entry_low().
UNIV_INTERN enum row_search_result row_search_index_entry | ( | dict_index_t * | index, |
const dtuple_t * | entry, | ||
ulint | mode, | ||
btr_pcur_t * | pcur, | ||
mtr_t * | mtr | ||
) |
Searches an index record.
Searches an index record.
index | in: index |
entry | in: index entry |
mode | in: BTR_MODIFY_LEAF, ... |
pcur | in/out: persistent cursor, which must be closed by the caller |
mtr | in: mtr |
Definition at line 740 of file row0row.cc.
References BTR_CUR_BINARY, BTR_CUR_DEL_MARK_IBUF, BTR_CUR_DELETE_IBUF, BTR_CUR_DELETE_REF, BTR_CUR_HASH, BTR_CUR_HASH_FAIL, BTR_CUR_INSERT_TO_IBUF, BTR_DELETE, btr_pcur_get_low_match(), btr_pcur_get_rec(), dtuple_check_typed(), dtuple_get_n_fields(), page_rec_is_infimum(), ROW_BUFFERED, ROW_FOUND, ROW_NOT_DELETED_REF, ROW_NOT_FOUND, row_search_index_entry(), ut_a, and ut_ad.
Referenced by row_search_index_entry().
UNIV_INTERN ibool row_search_on_row_ref | ( | btr_pcur_t * | pcur, |
ulint | mode, | ||
const dict_table_t * | table, | ||
const dtuple_t * | ref, | ||
mtr_t * | mtr | ||
) |
Searches the clustered index record for a row, if we have the row reference.
Searches the clustered index record for a row, if we have the row reference.
pcur | out: persistent cursor, which must be closed by the caller |
mode | in: BTR_MODIFY_LEAF, ... |
table | in: table |
ref | in: row reference |
mtr | in/out: mtr |
Definition at line 655 of file row0row.cc.
References btr_pcur_get_low_match(), btr_pcur_get_rec(), dict_index_get_n_unique(), dtuple_check_typed(), dtuple_get_n_fields(), page_rec_is_infimum(), row_search_on_row_ref(), ut_a, and ut_ad.
Referenced by row_get_clust_rec(), row_search_on_row_ref(), and row_undo_search_clust_to_pcur().