MySQL 8.0.40
Source Code Documentation
|
Record manager. More...
Go to the source code of this file.
Functions | |
static const ulint * | rec_offs_base (const ulint *offsets) |
static ulint * | rec_offs_base (ulint *offsets) |
ulint * | rec_get_offsets (const rec_t *rec, const dict_index_t *index, ulint *offsets, ulint n_fields, ut::Location location, mem_heap_t **heap) |
The following function determines the offsets to each field in the record. More... | |
void | rec_get_offsets_reverse (const byte *extra, const dict_index_t *index, ulint node_ptr, ulint *offsets) |
The following function determines the offsets to each field in the record. More... | |
static ulint | rec_get_bit_field_1 (const rec_t *rec, ulint offs, ulint mask, ulint shift) |
Gets a bit field from within 1 byte. More... | |
static uint16_t | rec_get_bit_field_2 (const rec_t *rec, ulint offs, ulint mask, ulint shift) |
Gets a bit field from within 2 bytes. More... | |
static ulint | rec_get_status (const rec_t *rec) |
The following function retrieves the status bits of a new-style record. More... | |
bool | rec_info_bits_valid (ulint bits) |
Check if the info bits are valid. More... | |
static ulint | rec_get_info_bits (const rec_t *rec, ulint comp) |
The following function is used to retrieve the info bits of a record. More... | |
static ulint | rec_get_info_bits_temp (const rec_t *rec) |
The following function is used to retrieve the info bits of a temporary record. More... | |
static uint16_t | rec_get_n_fields_old_raw (const rec_t *rec) |
The following function is used to get the number of fields in an old-style record, which is stored in the rec. More... | |
static uint16_t | rec_get_n_fields_old (const rec_t *rec, const dict_index_t *index) |
The following function is used to get the number of fields in an old-style record. More... | |
static ulint | rec_get_n_fields (const rec_t *rec, const dict_index_t *index) |
The following function is used to get the number of fields in a record. More... | |
static bool | rec_n_fields_is_sane (dict_index_t *index, const rec_t *rec, const dtuple_t *entry) |
Confirms the n_fields of the entry is sane with comparing the other record in the same page specified. More... | |
static ulint | rec_offs_get_n_alloc (const ulint *offsets) |
The following function returns the number of allocated elements for an array of offsets. More... | |
static void | rec_offs_set_n_alloc (ulint *offsets, ulint n_alloc) |
The following function sets the number of allocated elements for an array of offsets. More... | |
static void | rec_offs_set_n_fields (ulint *offsets, ulint n_fields) |
The following function sets the number of fields in offsets. More... | |
static ulint | rec_offs_n_fields (const ulint *offsets) |
The following function returns the number of fields in a record. More... | |
static uint64_t | rec_get_instant_offset (const dict_index_t *index, ulint n, uint64_t offs) |
Determine the offset of a specified field in the record, when this field is a field added after an instant ADD COLUMN. More... | |
void | rec_init_offsets (const rec_t *rec, const dict_index_t *index, ulint *offsets) |
The following function determines the offsets to each field in the record. More... | |
static bool | rec_offs_validate (const rec_t *rec, const dict_index_t *index, const ulint *offsets) |
Validates offsets returned by rec_get_offsets(). More... | |
static void | rec_offs_make_valid (const rec_t *rec, const dict_index_t *index, ulint *offsets) |
Updates debug data in offsets, in order to avoid bogus rec_offs_validate() failures. More... | |
bool | rec_offs_cmp (ulint *offsets1, ulint *offsets2) |
Check if the given two record offsets are identical. More... | |
std::ostream & | rec_offs_print (std::ostream &out, const ulint *offsets) |
Print the record offsets. More... | |
static bool | rec_get_instant_flag_new (const rec_t *rec) |
The following function tells if a new-style record is instant record. More... | |
static bool | rec_get_instant_flag_new_temp (const rec_t *rec) |
The following function tells if a new-style temp record is instant record. More... | |
void | rec_init_fixed_offsets (const dict_index_t *index, ulint *offsets) |
A simplified variant rec_init_offsets(rec, index, offsets) for the case in which the rec contains only fixed-length columns and non-NULL values in them, thus we can compute the offsets without looking at the rec. More... | |
static bool | rec_new_is_versioned (const rec_t *rec) |
The following function tells if a new-style record is versioned. More... | |
static bool | rec_old_is_versioned (const rec_t *rec) |
The following function tells if an old-style record is versioned. More... | |
static bool | rec_new_temp_is_versioned (const rec_t *rec) |
The following function tells if a temporary record is versioned. More... | |
static uint32_t | rec_get_n_fields_instant (const rec_t *rec, const ulint extra_bytes, uint16_t *length) |
Get the number of fields for one new style leaf page record. More... | |
static enum REC_INSERT_STATE | get_rec_insert_state (const dict_index_t *index, const rec_t *rec, bool temp) |
static enum REC_INSERT_STATE | init_nulls_lens_for_temp_redundant (const dict_index_t *index, const rec_t *rec, uint16_t *n_null, const byte **nulls, const byte **lens, uint16_t &non_default_fields, uint8_t &row_version) |
static enum REC_INSERT_STATE | rec_init_null_and_len_temp (const rec_t *rec, const dict_index_t *index, const byte **nulls, const byte **lens, uint16_t *n_null, uint16_t &non_default_fields, uint8_t &row_version) |
Determines the information about null bytes and variable length bytes for a new-style temporary record. More... | |
static enum REC_INSERT_STATE | rec_init_null_and_len_comp (const rec_t *rec, const dict_index_t *index, const byte **nulls, const byte **lens, uint16_t *n_null, uint16_t &non_default_fields, uint8_t &row_version) |
Determines the information about null bytes and variable length bytes for a new style record. More... | |
void | rec_init_offsets_comp_ordinary (const rec_t *rec, bool temp, const dict_index_t *index, ulint *offsets) |
Determine the offset to each field in a leaf-page record in ROW_FORMAT=COMPACT. More... | |
static bool | rec_get_1byte_offs_flag (const rec_t *rec) |
The following function is used to test whether the data offsets in the record are stored in one-byte or two-byte format. More... | |
Variables | |
constexpr uint32_t | REC_OFFS_COMPACT = 1U << 31 |
NOTE: The functions in this file should only use functions from other files in library. More... | |
constexpr uint32_t | REC_OFFS_SQL_NULL = 1U << 31 |
constexpr uint32_t | REC_OFFS_EXTERNAL = 1 << 30 |
constexpr uint32_t | REC_OFFS_DEFAULT = 1 << 29 |
constexpr uint32_t | REC_OFFS_DROP = 1 << 28 |
constexpr uint32_t | REC_OFFS_MASK = REC_OFFS_DROP - 1 |
constexpr uint32_t | REC_NEW_HEAP_NO = 4 |
constexpr uint32_t | REC_HEAP_NO_SHIFT = 3 |
constexpr uint32_t | REC_NEXT = 2 |
constexpr uint32_t | REC_NEXT_MASK = 0xFFFFUL |
constexpr uint32_t | REC_NEXT_SHIFT = 0 |
constexpr uint32_t | REC_OLD_SHORT = 3 |
constexpr uint32_t | REC_OLD_SHORT_MASK = 0x1UL |
constexpr uint32_t | REC_OLD_SHORT_SHIFT = 0 |
constexpr uint32_t | REC_OLD_N_FIELDS = 4 |
constexpr uint32_t | REC_OLD_N_FIELDS_MASK = 0x7FEUL |
constexpr uint32_t | REC_OLD_N_FIELDS_SHIFT = 1 |
constexpr uint32_t | REC_NEW_STATUS = 3 |
constexpr uint32_t | REC_NEW_STATUS_MASK = 0x7UL |
constexpr uint32_t | REC_NEW_STATUS_SHIFT = 0 |
constexpr uint32_t | REC_OLD_HEAP_NO = 5 |
constexpr uint32_t | REC_HEAP_NO_MASK = 0xFFF8UL |
constexpr uint32_t | REC_OLD_N_OWNED = 6 |
constexpr uint32_t | REC_NEW_N_OWNED = 5 |
constexpr uint32_t | REC_N_OWNED_MASK = 0xFUL |
constexpr uint32_t | REC_N_OWNED_SHIFT = 0 |
constexpr uint32_t | REC_OLD_INFO_BITS = 6 |
constexpr uint32_t | REC_NEW_INFO_BITS = 5 |
constexpr uint32_t | REC_TMP_INFO_BITS = 1 |
constexpr uint32_t | REC_INFO_BITS_MASK = 0xF0UL |
constexpr uint32_t | REC_INFO_BITS_SHIFT = 0 |
constexpr uint32_t | REC_INFO_MIN_REC_FLAG = 0x10UL |
constexpr uint32_t | REC_INFO_DELETED_FLAG = 0x20UL |
The deleted flag in info bits; when bit is set to 1, it means the record has been delete marked. More... | |
constexpr uint32_t | REC_INFO_VERSION_FLAG = 0x40UL |
constexpr uint32_t | REC_INFO_INSTANT_FLAG = 0x80UL |
The instant ADD COLUMN flag. More... | |
constexpr uint32_t | REC_N_OLD_EXTRA_BYTES = 6 |
constexpr int32_t | REC_N_NEW_EXTRA_BYTES = 5 |
constexpr uint32_t | REC_N_TMP_EXTRA_BYTES = 1 |
constexpr auto | MAX_REC_PER_PAGE = UNIV_PAGE_SIZE_MAX / REC_N_NEW_EXTRA_BYTES |
Maximum number of records in a page. More... | |
constexpr uint32_t | REC_STATUS_ORDINARY = 0 |
constexpr uint32_t | REC_STATUS_NODE_PTR = 1 |
constexpr uint32_t | REC_STATUS_INFIMUM = 2 |
constexpr uint32_t | REC_STATUS_SUPREMUM = 3 |
constexpr uint32_t | REC_NODE_PTR_SIZE = 4 |
constexpr uint32_t | REC_1BYTE_SQL_NULL_MASK = 0x80UL |
SQL null flag in a 1-byte offset of ROW_FORMAT=REDUNDANT records. More... | |
constexpr uint32_t | REC_2BYTE_SQL_NULL_MASK = 0x8000UL |
SQL null flag in a 2-byte offset of ROW_FORMAT=REDUNDANT records. More... | |
constexpr uint32_t | REC_2BYTE_EXTERN_MASK = 0x4000UL |
In a 2-byte offset of ROW_FORMAT=REDUNDANT records, the second most significant bit denotes that the tail of a field is stored off-page. More... | |
constexpr uint32_t | REC_OFFS_HEADER_SIZE = 4 |
constexpr uint32_t | REC_OFFS_NORMAL_SIZE = 100 |
constexpr uint32_t | REC_OFFS_SMALL_SIZE = 10 |
static const uint8_t | REC_N_FIELDS_TWO_BYTES_FLAG = 0x80 |
Number of fields flag which means it occupies two bytes. More... | |
static const uint8_t | REC_N_FIELDS_ONE_BYTE_MAX = 0x7F |
Max number of fields which can be stored in one byte. More... | |
Record manager.
Created 5/30/1994 Heikki Tuuri
enum REC_INSERT_STATE |
|
strong |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
The following function is used to test whether the data offsets in the record are stored in one-byte or two-byte format.
rec | in: physical record |
|
inlinestatic |
Gets a bit field from within 1 byte.
rec | in: pointer to record origin |
offs | in: offset from the origin down |
mask | in: mask used to filter bits |
shift | in: shift right applied after masking |
|
inlinestatic |
Gets a bit field from within 2 bytes.
rec | in: pointer to record origin |
offs | in: offset from the origin down |
mask | in: mask used to filter bits |
shift | in: shift right applied after masking |
The following function is used to retrieve the info bits of a record.
[in] | rec | physical record |
[in] | comp | nonzero=compact page format |
The following function is used to retrieve the info bits of a temporary record.
[in] | rec | physical record |
|
inlinestatic |
The following function tells if a new-style record is instant record.
[in] | rec | new-style record |
|
inlinestatic |
The following function tells if a new-style temp record is instant record.
[in] | rec | new-style temp record |
|
inlinestatic |
Determine the offset of a specified field in the record, when this field is a field added after an instant ADD COLUMN.
[in] | index | Clustered index where the record resides |
[in] | n | Nth field to get offset |
[in] | offs | Last offset before current field |
|
inlinestatic |
The following function is used to get the number of fields in a record.
If it's REDUNDANT record, the returned number would be a logic one which considers the fact that after instant ADD COLUMN, some records may have less fields than index.
rec | in: physical record |
index | in: record descriptor |
|
inlinestatic |
Get the number of fields for one new style leaf page record.
This is only needed for table after instant ADD COLUMN.
[in] | rec | leaf page record |
[in] | extra_bytes | extra bytes of this record |
[in,out] | length | length of number of fields |
|
inlinestatic |
The following function is used to get the number of fields in an old-style record.
Have to consider the case that after instant ADD COLUMN, this record may have less fields than current index.
[in] | rec | physical record |
[in] | index | index where the record resides |
|
inlinestatic |
The following function is used to get the number of fields in an old-style record, which is stored in the rec.
rec | in: physical record |
ulint * rec_get_offsets | ( | const rec_t * | rec, |
const dict_index_t * | index, | ||
ulint * | offsets, | ||
ulint | n_fields, | ||
ut::Location | location, | ||
mem_heap_t ** | heap | ||
) |
The following function determines the offsets to each field in the record.
It can reuse a previously allocated array. Note that after instant ADD COLUMN, if this is a record from clustered index, fields in the record may be less than the fields defined in the clustered index. So the offsets size is allocated according to the clustered index fields.
[in] | rec | physical record |
[in] | index | record descriptor |
[in,out] | offsets | array consisting of offsets[0] allocated elements, or an array from rec_get_offsets(), or NULL |
[in] | n_fields | maximum number of initialized fields (ULINT_UNDEFINED is all fields) |
[in] | location | location where called |
[in,out] | heap | memory heap |
void rec_get_offsets_reverse | ( | const byte * | extra, |
const dict_index_t * | index, | ||
ulint | node_ptr, | ||
ulint * | offsets | ||
) |
The following function determines the offsets to each field in the record.
It can reuse a previously allocated array. in/out: array consisting of offsets[0] allocated elements
It can reuse a previously allocated array.
extra | in: the extra bytes of a compact record in reverse order, excluding the fixed-size REC_N_NEW_EXTRA_BYTES |
index | in: record descriptor |
node_ptr | in: nonzero=node pointer, 0=leaf node |
offsets | in/out: array consisting of offsets[0] allocated elements |
The following function retrieves the status bits of a new-style record.
rec | in: physical record |
|
inline |
Check if the info bits are valid.
[in] | bits | info bits to check |
|
inline |
A simplified variant rec_init_offsets(rec, index, offsets) for the case in which the rec contains only fixed-length columns and non-NULL values in them, thus we can compute the offsets without looking at the rec.
Such offsets can be cached and reused for many recs which don't contain NULLs.
[in] | index | The index for which we want to cache the fixed offsets |
[in,out] | offsets | The already allocated array to store the offsets. It should already have been initialized with rec_offs_set_n_alloc() and rec_offs_set_n_fields() before the call. This function will fill all the other elements. |
|
inlinestatic |
Determines the information about null bytes and variable length bytes for a new style record.
[in] | rec | physical record |
[in] | index | index where the record resides |
[out] | nulls | the start of null bytes |
[out] | lens | the start of variable length bytes |
[out] | n_null | number of null fields |
[out] | non_default_fields | non default fields from record |
[out] | row_version | row version of the record |
|
inlinestatic |
Determines the information about null bytes and variable length bytes for a new-style temporary record.
[in] | rec | physical record |
[in] | index | index where the record resides |
[out] | nulls | the start of null bytes |
[out] | lens | the start of variable length bytes |
[out] | n_null | number of null fields |
[out] | non_default_fields | non default fields from record |
[out] | row_version | row version of the record |
void rec_init_offsets | ( | const rec_t * | rec, |
const dict_index_t * | index, | ||
ulint * | offsets | ||
) |
The following function determines the offsets to each field in the record.
The offsets are written to a previously allocated array of ulint, where rec_offs_n_fields(offsets) has been initialized to the number of fields in the record. The rest of the array will be initialized by this function.
[in] | rec | physical record |
[in] | index | record descriptor |
[in,out] | offsets | array of offsets |
|
inline |
Determine the offset to each field in a leaf-page record in ROW_FORMAT=COMPACT.
This is a special case of rec_init_offsets() and rec_get_offsets().
[in] | rec | physical record in ROW_FORMAT=COMPACT |
[in] | temp | whether to use the format for temporary files in index creation |
[in] | index | record descriptor |
[in,out] | offsets | array of offsets |
|
inlinestatic |
Confirms the n_fields of the entry is sane with comparing the other record in the same page specified.
[in] | index | index |
[in] | rec | record of the same page |
[in] | entry | index entry |
|
inlinestatic |
The following function tells if a new-style record is versioned.
[in] | rec | new-style (COMPACT/DYNAMIC) record |
|
inlinestatic |
The following function tells if a temporary record is versioned.
[in] | rec | new-style temporary record |
Check if the given two record offsets are identical.
[in] | offsets1 | field offsets of a record |
[in] | offsets2 | field offsets of a record |
The following function returns the number of allocated elements for an array of offsets.
offsets | in: array for rec_get_offsets() |
|
inlinestatic |
Updates debug data in offsets, in order to avoid bogus rec_offs_validate() failures.
rec | in: record |
index | in: record descriptor |
offsets | in: array returned by rec_get_offsets() |
The following function returns the number of fields in a record.
offsets | in: array returned by rec_get_offsets() |
std::ostream & rec_offs_print | ( | std::ostream & | out, |
const ulint * | offsets | ||
) |
Print the record offsets.
[in] | out | the output stream to which offsets are printed. |
[in] | offsets | the field offsets of the record. |
The following function sets the number of allocated elements for an array of offsets.
offsets | out: array for rec_get_offsets(), must be allocated |
n_alloc | in: number of elements |
The following function sets the number of fields in offsets.
offsets | in/out: array returned by rec_get_offsets() |
n_fields | in: number of fields |
|
inlinestatic |
Validates offsets returned by rec_get_offsets().
rec | in: record or NULL |
index | in: record descriptor or NULL |
offsets | in: array returned by rec_get_offsets() |
|
inlinestatic |
The following function tells if an old-style record is versioned.
[in] | rec | old-style (REDUNDANT) record |
|
constexpr |
Maximum number of records in a page.
|
constexpr |
SQL null flag in a 1-byte offset of ROW_FORMAT=REDUNDANT records.
|
constexpr |
In a 2-byte offset of ROW_FORMAT=REDUNDANT records, the second most significant bit denotes that the tail of a field is stored off-page.
|
constexpr |
SQL null flag in a 2-byte offset of ROW_FORMAT=REDUNDANT records.
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
The deleted flag in info bits; when bit is set to 1, it means the record has been delete marked.
|
constexpr |
The instant ADD COLUMN flag.
When it is set to 1, it means this record was inserted/updated after an instant ADD COLUMN.
|
constexpr |
|
constexpr |
|
static |
Max number of fields which can be stored in one byte.
|
static |
Number of fields flag which means it occupies two bytes.
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
NOTE: The functions in this file should only use functions from other files in library.
The code in this file is used to make a library for external tools.
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |