MySQL 8.0.32
Source Code Documentation
rec.h File Reference

Record manager. More...

#include "dict0boot.h"
#include "dict0dict.h"

Go to the source code of this file.

Enumerations

enum  REC_INSERT_STATE {
  INSERTED_BEFORE_INSTANT_ADD_OLD_IMPLEMENTATION , INSERTED_AFTER_INSTANT_ADD_OLD_IMPLEMENTATION , INSERTED_AFTER_UPGRADE_BEFORE_INSTANT_ADD_NEW_IMPLEMENTATION , INSERTED_BEFORE_INSTANT_ADD_NEW_IMPLEMENTATION ,
  INSERTED_AFTER_INSTANT_ADD_NEW_IMPLEMENTATION , INSERTED_INTO_TABLE_WITH_NO_INSTANT_NO_VERSION , NONE
}
 

Functions

static const ulintrec_offs_base (const ulint *offsets)
 
static ulintrec_offs_base (ulint *offsets)
 
ulintrec_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...
 

Detailed Description

Record manager.

Created 5/30/1994 Heikki Tuuri

Enumeration Type Documentation

◆ REC_INSERT_STATE

Enumerator
INSERTED_BEFORE_INSTANT_ADD_OLD_IMPLEMENTATION 
INSERTED_AFTER_INSTANT_ADD_OLD_IMPLEMENTATION 
INSERTED_AFTER_UPGRADE_BEFORE_INSTANT_ADD_NEW_IMPLEMENTATION 
INSERTED_BEFORE_INSTANT_ADD_NEW_IMPLEMENTATION 
INSERTED_AFTER_INSTANT_ADD_NEW_IMPLEMENTATION 
INSERTED_INTO_TABLE_WITH_NO_INSTANT_NO_VERSION 
NONE 

Function Documentation

◆ get_rec_insert_state()

static enum REC_INSERT_STATE get_rec_insert_state ( const dict_index_t index,
const rec_t rec,
bool  temp 
)
inlinestatic

◆ init_nulls_lens_for_temp_redundant()

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 
)
inlinestatic

◆ rec_get_1byte_offs_flag()

static bool rec_get_1byte_offs_flag ( const rec_t rec)
inlinestatic

The following function is used to test whether the data offsets in the record are stored in one-byte or two-byte format.

Returns
true if 1-byte form
Parameters
recin: physical record

◆ rec_get_bit_field_1()

static ulint rec_get_bit_field_1 ( const rec_t rec,
ulint  offs,
ulint  mask,
ulint  shift 
)
inlinestatic

Gets a bit field from within 1 byte.

Parameters
recin: pointer to record origin
offsin: offset from the origin down
maskin: mask used to filter bits
shiftin: shift right applied after masking

◆ rec_get_bit_field_2()

static uint16_t rec_get_bit_field_2 ( const rec_t rec,
ulint  offs,
ulint  mask,
ulint  shift 
)
inlinestatic

Gets a bit field from within 2 bytes.

Parameters
recin: pointer to record origin
offsin: offset from the origin down
maskin: mask used to filter bits
shiftin: shift right applied after masking

◆ rec_get_info_bits()

static ulint rec_get_info_bits ( const rec_t rec,
ulint  comp 
)
inlinestatic

The following function is used to retrieve the info bits of a record.

Parameters
[in]recphysical record
[in]compnonzero=compact page format
Returns
info bits

◆ rec_get_info_bits_temp()

static ulint rec_get_info_bits_temp ( const rec_t rec)
inlinestatic

The following function is used to retrieve the info bits of a temporary record.

Parameters
[in]recphysical record
Returns
info bits

◆ rec_get_instant_flag_new()

static bool rec_get_instant_flag_new ( const rec_t rec)
inlinestatic

The following function tells if a new-style record is instant record.

Parameters
[in]recnew-style record
Returns
true if it is instant affected

◆ rec_get_instant_flag_new_temp()

static bool rec_get_instant_flag_new_temp ( const rec_t rec)
inlinestatic

The following function tells if a new-style temp record is instant record.

Parameters
[in]recnew-style temp record
Returns
true if it is instant affected

◆ rec_get_instant_offset()

static uint64_t rec_get_instant_offset ( const dict_index_t index,
ulint  n,
uint64_t  offs 
)
inlinestatic

Determine the offset of a specified field in the record, when this field is a field added after an instant ADD COLUMN.

Parameters
[in]indexClustered index where the record resides
[in]nNth field to get offset
[in]offsLast offset before current field
Returns
The offset of the specified field

◆ rec_get_n_fields()

static ulint rec_get_n_fields ( const rec_t rec,
const dict_index_t index 
)
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.

Returns
number of data fields
Parameters
recin: physical record
indexin: record descriptor

◆ rec_get_n_fields_instant()

static uint32_t rec_get_n_fields_instant ( const rec_t rec,
const ulint  extra_bytes,
uint16_t *  length 
)
inlinestatic

Get the number of fields for one new style leaf page record.

This is only needed for table after instant ADD COLUMN.

Parameters
[in]recleaf page record
[in]extra_bytesextra bytes of this record
[in,out]lengthlength of number of fields
Returns
number of fields

◆ rec_get_n_fields_old()

static uint16_t rec_get_n_fields_old ( const rec_t rec,
const dict_index_t index 
)
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.

Parameters
[in]recphysical record
[in]indexindex where the record resides
Returns
number of data fields

◆ rec_get_n_fields_old_raw()

static uint16_t rec_get_n_fields_old_raw ( const rec_t rec)
inlinestatic

The following function is used to get the number of fields in an old-style record, which is stored in the rec.

Returns
number of data fields
Parameters
recin: physical record

◆ rec_get_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.

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.

Parameters
[in]recphysical record
[in]indexrecord descriptor
[in,out]offsetsarray consisting of offsets[0] allocated elements, or an array from rec_get_offsets(), or NULL
[in]n_fieldsmaximum number of initialized fields (ULINT_UNDEFINED is all fields)
[in]locationlocation where called
[in,out]heapmemory heap
Returns
the new offsets

◆ rec_get_offsets_reverse()

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.

Parameters
extrain: the extra bytes of a compact record in reverse order, excluding the fixed-size REC_N_NEW_EXTRA_BYTES
indexin: record descriptor
node_ptrin: nonzero=node pointer, 0=leaf node
offsetsin/out: array consisting of offsets[0] allocated elements

◆ rec_get_status()

static ulint rec_get_status ( const rec_t rec)
inlinestatic

The following function retrieves the status bits of a new-style record.

Returns
status bits
Parameters
recin: physical record

◆ rec_info_bits_valid()

bool rec_info_bits_valid ( ulint  bits)
inline

Check if the info bits are valid.

Parameters
[in]bitsinfo bits to check
Returns
true if valid

◆ rec_init_fixed_offsets()

void rec_init_fixed_offsets ( const dict_index_t index,
ulint offsets 
)
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.

See also
rec_init_offsets for more details
Parameters
[in]indexThe index for which we want to cache the fixed offsets
[in,out]offsetsThe 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.

◆ rec_init_null_and_len_comp()

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 
)
inlinestatic

Determines the information about null bytes and variable length bytes for a new style record.

Parameters
[in]recphysical record
[in]indexindex where the record resides
[out]nullsthe start of null bytes
[out]lensthe start of variable length bytes
[out]n_nullnumber of null fields
[out]non_default_fieldsnon default fields from record
[out]row_versionrow version of the record
Returns
number of fields with no default or the row version of record

◆ rec_init_null_and_len_temp()

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 
)
inlinestatic

Determines the information about null bytes and variable length bytes for a new-style temporary record.

Parameters
[in]recphysical record
[in]indexindex where the record resides
[out]nullsthe start of null bytes
[out]lensthe start of variable length bytes
[out]n_nullnumber of null fields
[out]non_default_fieldsnon default fields from record
[out]row_versionrow version of the record
Returns
the row inserted state

◆ rec_init_offsets()

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.

  • rec_offs_base(offsets)[0] will be set to the extra size (if REC_OFFS_COMPACT is set, the record is in the new format; if REC_OFFS_EXTERNAL is set, the record contains externally stored columns).
  • rec_offs_base(offsets)[1..n_fields] will be set to offsets past the end of fields 0..n_fields, or to the beginning of fields 1..n_fields+1.
  • If the high-order bit of the offset at [i+1] is set (REC_OFFS_SQL_NULL), the field i is NULL.
  • If the second high-order bit of the offset at [i+1] is set (REC_OFFS_EXTERNAL), the field i is being stored externally.
    Parameters
    [in]recphysical record
    [in]indexrecord descriptor
    [in,out]offsetsarray of offsets

◆ rec_init_offsets_comp_ordinary()

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.

This is a special case of rec_init_offsets() and rec_get_offsets().

Parameters
[in]recphysical record in ROW_FORMAT=COMPACT
[in]tempwhether to use the format for temporary files in index creation
[in]indexrecord descriptor
[in,out]offsetsarray of offsets

◆ rec_n_fields_is_sane()

static bool rec_n_fields_is_sane ( dict_index_t index,
const rec_t rec,
const dtuple_t entry 
)
inlinestatic

Confirms the n_fields of the entry is sane with comparing the other record in the same page specified.

Parameters
[in]indexindex
[in]recrecord of the same page
[in]entryindex entry
Returns
true if n_fields is sane

◆ rec_new_is_versioned()

static bool rec_new_is_versioned ( const rec_t rec)
inlinestatic

The following function tells if a new-style record is versioned.

Parameters
[in]recnew-style (COMPACT/DYNAMIC) record
Returns
true if it is versioned

◆ rec_new_temp_is_versioned()

static bool rec_new_temp_is_versioned ( const rec_t rec)
inlinestatic

The following function tells if a temporary record is versioned.

Parameters
[in]recnew-style temporary record
Returns
true if it's instant affected

◆ rec_offs_base() [1/2]

static const ulint * rec_offs_base ( const ulint offsets)
inlinestatic

◆ rec_offs_base() [2/2]

static ulint * rec_offs_base ( ulint offsets)
inlinestatic

◆ rec_offs_cmp()

bool rec_offs_cmp ( ulint offsets1,
ulint offsets2 
)

Check if the given two record offsets are identical.

Parameters
[in]offsets1field offsets of a record
[in]offsets2field offsets of a record
Returns
true if they are identical, false otherwise.

◆ rec_offs_get_n_alloc()

static ulint rec_offs_get_n_alloc ( const ulint offsets)
inlinestatic

The following function returns the number of allocated elements for an array of offsets.

Returns
number of elements
Parameters
offsetsin: array for rec_get_offsets()

◆ rec_offs_make_valid()

static void rec_offs_make_valid ( const rec_t rec,
const dict_index_t index,
ulint offsets 
)
inlinestatic

Updates debug data in offsets, in order to avoid bogus rec_offs_validate() failures.

Parameters
recin: record
indexin: record descriptor
offsetsin: array returned by rec_get_offsets()

◆ rec_offs_n_fields()

static ulint rec_offs_n_fields ( const ulint offsets)
inlinestatic

The following function returns the number of fields in a record.

Returns
number of fields
Parameters
offsetsin: array returned by rec_get_offsets()

◆ rec_offs_print()

std::ostream & rec_offs_print ( std::ostream &  out,
const ulint offsets 
)

Print the record offsets.

Parameters
[in]outthe output stream to which offsets are printed.
[in]offsetsthe field offsets of the record.
Returns
the output stream.

◆ rec_offs_set_n_alloc()

static void rec_offs_set_n_alloc ( ulint offsets,
ulint  n_alloc 
)
inlinestatic

The following function sets the number of allocated elements for an array of offsets.

Parameters
offsetsout: array for rec_get_offsets(), must be allocated
n_allocin: number of elements

◆ rec_offs_set_n_fields()

static void rec_offs_set_n_fields ( ulint offsets,
ulint  n_fields 
)
inlinestatic

The following function sets the number of fields in offsets.

Parameters
offsetsin/out: array returned by rec_get_offsets()
n_fieldsin: number of fields

◆ rec_offs_validate()

static bool rec_offs_validate ( const rec_t rec,
const dict_index_t index,
const ulint offsets 
)
inlinestatic

Validates offsets returned by rec_get_offsets().

Returns
true if valid
Parameters
recin: record or NULL
indexin: record descriptor or NULL
offsetsin: array returned by rec_get_offsets()

◆ rec_old_is_versioned()

static bool rec_old_is_versioned ( const rec_t rec)
inlinestatic

The following function tells if an old-style record is versioned.

Parameters
[in]recold-style (REDUNDANT) record
Returns
true if it's versioned

Variable Documentation

◆ MAX_REC_PER_PAGE

constexpr auto MAX_REC_PER_PAGE = UNIV_PAGE_SIZE_MAX / REC_N_NEW_EXTRA_BYTES
constexpr

Maximum number of records in a page.

◆ REC_1BYTE_SQL_NULL_MASK

constexpr uint32_t REC_1BYTE_SQL_NULL_MASK = 0x80UL
constexpr

SQL null flag in a 1-byte offset of ROW_FORMAT=REDUNDANT records.

◆ REC_2BYTE_EXTERN_MASK

constexpr uint32_t REC_2BYTE_EXTERN_MASK = 0x4000UL
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.

◆ REC_2BYTE_SQL_NULL_MASK

constexpr uint32_t REC_2BYTE_SQL_NULL_MASK = 0x8000UL
constexpr

SQL null flag in a 2-byte offset of ROW_FORMAT=REDUNDANT records.

◆ REC_HEAP_NO_MASK

constexpr uint32_t REC_HEAP_NO_MASK = 0xFFF8UL
constexpr

◆ REC_HEAP_NO_SHIFT

constexpr uint32_t REC_HEAP_NO_SHIFT = 3
constexpr

◆ REC_INFO_BITS_MASK

constexpr uint32_t REC_INFO_BITS_MASK = 0xF0UL
constexpr

◆ REC_INFO_BITS_SHIFT

constexpr uint32_t REC_INFO_BITS_SHIFT = 0
constexpr

◆ REC_INFO_DELETED_FLAG

constexpr uint32_t REC_INFO_DELETED_FLAG = 0x20UL
constexpr

The deleted flag in info bits; when bit is set to 1, it means the record has been delete marked.

◆ REC_INFO_INSTANT_FLAG

constexpr uint32_t REC_INFO_INSTANT_FLAG = 0x80UL
constexpr

The instant ADD COLUMN flag.

When it is set to 1, it means this record was inserted/updated after an instant ADD COLUMN.

◆ REC_INFO_MIN_REC_FLAG

constexpr uint32_t REC_INFO_MIN_REC_FLAG = 0x10UL
constexpr

◆ REC_INFO_VERSION_FLAG

constexpr uint32_t REC_INFO_VERSION_FLAG = 0x40UL
constexpr

◆ REC_N_FIELDS_ONE_BYTE_MAX

const uint8_t REC_N_FIELDS_ONE_BYTE_MAX = 0x7F
static

Max number of fields which can be stored in one byte.

◆ REC_N_FIELDS_TWO_BYTES_FLAG

const uint8_t REC_N_FIELDS_TWO_BYTES_FLAG = 0x80
static

Number of fields flag which means it occupies two bytes.

◆ REC_N_NEW_EXTRA_BYTES

constexpr int32_t REC_N_NEW_EXTRA_BYTES = 5
constexpr

◆ REC_N_OLD_EXTRA_BYTES

constexpr uint32_t REC_N_OLD_EXTRA_BYTES = 6
constexpr

◆ REC_N_OWNED_MASK

constexpr uint32_t REC_N_OWNED_MASK = 0xFUL
constexpr

◆ REC_N_OWNED_SHIFT

constexpr uint32_t REC_N_OWNED_SHIFT = 0
constexpr

◆ REC_N_TMP_EXTRA_BYTES

constexpr uint32_t REC_N_TMP_EXTRA_BYTES = 1
constexpr

◆ REC_NEW_HEAP_NO

constexpr uint32_t REC_NEW_HEAP_NO = 4
constexpr

◆ REC_NEW_INFO_BITS

constexpr uint32_t REC_NEW_INFO_BITS = 5
constexpr

◆ REC_NEW_N_OWNED

constexpr uint32_t REC_NEW_N_OWNED = 5
constexpr

◆ REC_NEW_STATUS

constexpr uint32_t REC_NEW_STATUS = 3
constexpr

◆ REC_NEW_STATUS_MASK

constexpr uint32_t REC_NEW_STATUS_MASK = 0x7UL
constexpr

◆ REC_NEW_STATUS_SHIFT

constexpr uint32_t REC_NEW_STATUS_SHIFT = 0
constexpr

◆ REC_NEXT

constexpr uint32_t REC_NEXT = 2
constexpr

◆ REC_NEXT_MASK

constexpr uint32_t REC_NEXT_MASK = 0xFFFFUL
constexpr

◆ REC_NEXT_SHIFT

constexpr uint32_t REC_NEXT_SHIFT = 0
constexpr

◆ REC_NODE_PTR_SIZE

constexpr uint32_t REC_NODE_PTR_SIZE = 4
constexpr

◆ REC_OFFS_COMPACT

constexpr uint32_t REC_OFFS_COMPACT = 1U << 31
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.

◆ REC_OFFS_DEFAULT

constexpr uint32_t REC_OFFS_DEFAULT = 1 << 29
constexpr

◆ REC_OFFS_DROP

constexpr uint32_t REC_OFFS_DROP = 1 << 28
constexpr

◆ REC_OFFS_EXTERNAL

constexpr uint32_t REC_OFFS_EXTERNAL = 1 << 30
constexpr

◆ REC_OFFS_HEADER_SIZE

constexpr uint32_t REC_OFFS_HEADER_SIZE = 4
constexpr

◆ REC_OFFS_MASK

constexpr uint32_t REC_OFFS_MASK = REC_OFFS_DROP - 1
constexpr

◆ REC_OFFS_NORMAL_SIZE

constexpr uint32_t REC_OFFS_NORMAL_SIZE = 100
constexpr

◆ REC_OFFS_SMALL_SIZE

constexpr uint32_t REC_OFFS_SMALL_SIZE = 10
constexpr

◆ REC_OFFS_SQL_NULL

constexpr uint32_t REC_OFFS_SQL_NULL = 1U << 31
constexpr

◆ REC_OLD_HEAP_NO

constexpr uint32_t REC_OLD_HEAP_NO = 5
constexpr

◆ REC_OLD_INFO_BITS

constexpr uint32_t REC_OLD_INFO_BITS = 6
constexpr

◆ REC_OLD_N_FIELDS

constexpr uint32_t REC_OLD_N_FIELDS = 4
constexpr

◆ REC_OLD_N_FIELDS_MASK

constexpr uint32_t REC_OLD_N_FIELDS_MASK = 0x7FEUL
constexpr

◆ REC_OLD_N_FIELDS_SHIFT

constexpr uint32_t REC_OLD_N_FIELDS_SHIFT = 1
constexpr

◆ REC_OLD_N_OWNED

constexpr uint32_t REC_OLD_N_OWNED = 6
constexpr

◆ REC_OLD_SHORT

constexpr uint32_t REC_OLD_SHORT = 3
constexpr

◆ REC_OLD_SHORT_MASK

constexpr uint32_t REC_OLD_SHORT_MASK = 0x1UL
constexpr

◆ REC_OLD_SHORT_SHIFT

constexpr uint32_t REC_OLD_SHORT_SHIFT = 0
constexpr

◆ REC_STATUS_INFIMUM

constexpr uint32_t REC_STATUS_INFIMUM = 2
constexpr

◆ REC_STATUS_NODE_PTR

constexpr uint32_t REC_STATUS_NODE_PTR = 1
constexpr

◆ REC_STATUS_ORDINARY

constexpr uint32_t REC_STATUS_ORDINARY = 0
constexpr

◆ REC_STATUS_SUPREMUM

constexpr uint32_t REC_STATUS_SUPREMUM = 3
constexpr

◆ REC_TMP_INFO_BITS

constexpr uint32_t REC_TMP_INFO_BITS = 1
constexpr