MySQL  8.0.20
Source Code Documentation
rec.h File Reference

Record manager. More...

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

Go to the source code of this file.

Macros

#define REC_OFFS_COMPACT   ((ulint)1 << 31)
 NOTE: The functions in this file should only use functions from other files in library. More...
 
#define REC_OFFS_SQL_NULL   ((ulint)1 << 31)
 
#define REC_OFFS_EXTERNAL   ((ulint)1 << 30)
 
#define REC_OFFS_DEFAULT   ((ulint)1 << 29)
 
#define REC_OFFS_MASK   (REC_OFFS_DEFAULT - 1)
 
#define REC_NEW_HEAP_NO   4
 
#define REC_HEAP_NO_SHIFT   3
 
#define REC_NEXT   2
 
#define REC_NEXT_MASK   0xFFFFUL
 
#define REC_NEXT_SHIFT   0
 
#define REC_OLD_SHORT   3 /* This is single byte bit-field */
 
#define REC_OLD_SHORT_MASK   0x1UL
 
#define REC_OLD_SHORT_SHIFT   0
 
#define REC_OLD_N_FIELDS   4
 
#define REC_OLD_N_FIELDS_MASK   0x7FEUL
 
#define REC_OLD_N_FIELDS_SHIFT   1
 
#define REC_NEW_STATUS   3 /* This is single byte bit-field */
 
#define REC_NEW_STATUS_MASK   0x7UL
 
#define REC_NEW_STATUS_SHIFT   0
 
#define REC_OLD_HEAP_NO   5
 
#define REC_HEAP_NO_MASK   0xFFF8UL
 
#define REC_OLD_N_OWNED   6 /* This is single byte bit-field */
 
#define REC_NEW_N_OWNED   5 /* This is single byte bit-field */
 
#define REC_N_OWNED_MASK   0xFUL
 
#define REC_N_OWNED_SHIFT   0
 
#define REC_OLD_INFO_BITS   6 /* This is single byte bit-field */
 
#define REC_NEW_INFO_BITS   5 /* This is single byte bit-field */
 
#define REC_TMP_INFO_BITS   1 /* This is single byte bit-field */
 
#define REC_INFO_BITS_MASK   0xF0UL
 
#define REC_INFO_BITS_SHIFT   0
 
#define REC_INFO_MIN_REC_FLAG   0x10UL
 
#define REC_INFO_DELETED_FLAG
 
#define REC_INFO_INSTANT_FLAG   0x80UL
 
#define REC_N_OLD_EXTRA_BYTES   6
 
#define REC_N_NEW_EXTRA_BYTES   5
 
#define REC_N_TMP_EXTRA_BYTES   1
 
#define REC_STATUS_ORDINARY   0
 
#define REC_STATUS_NODE_PTR   1
 
#define REC_STATUS_INFIMUM   2
 
#define REC_STATUS_SUPREMUM   3
 
#define REC_NODE_PTR_SIZE   4
 
#define REC_1BYTE_SQL_NULL_MASK   0x80UL
 SQL null flag in a 1-byte offset of ROW_FORMAT=REDUNDANT records. More...
 
#define REC_2BYTE_SQL_NULL_MASK   0x8000UL
 SQL null flag in a 2-byte offset of ROW_FORMAT=REDUNDANT records. More...
 
#define 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...
 
#define REC_OFFS_HEADER_SIZE   4
 
#define REC_OFFS_NORMAL_SIZE   100
 
#define REC_OFFS_SMALL_SIZE   10
 
#define rec_offs_base(offsets)   (offsets + REC_OFFS_HEADER_SIZE)
 

Functions

ulint * rec_get_offsets_func (const rec_t *rec, const dict_index_t *index, ulint *offsets, ulint n_fields, const char *file, ulint line, 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...
 
UNIV_INLINE 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...
 
UNIV_INLINE 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...
 
UNIV_INLINE 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...
 
UNIV_INLINE 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...
 
UNIV_INLINE 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...
 
UNIV_INLINE 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...
 
UNIV_INLINE 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...
 
UNIV_INLINE 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...
 
UNIV_INLINE 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...
 
UNIV_INLINE ulint rec_offs_get_n_alloc (const ulint *offsets)
 The following function returns the number of allocated elements for an array of offsets. More...
 
UNIV_INLINE 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...
 
UNIV_INLINE void rec_offs_set_n_fields (ulint *offsets, ulint n_fields)
 The following function sets the number of fields in offsets. More...
 
UNIV_INLINE ulint rec_offs_n_fields (const ulint *offsets)
 The following function returns the number of fields in a record. More...
 
UNIV_INLINE 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...
 
UNIV_INLINE ibool rec_offs_validate (const rec_t *rec, const dict_index_t *index, const ulint *offsets)
 Validates offsets returned by rec_get_offsets(). More...
 
UNIV_INLINE 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...
 
UNIV_INLINE bool rec_get_instant_flag_new (const rec_t *rec)
 The following function tells if a new-style record is instant record or not. More...
 
UNIV_INLINE bool rec_get_instant_flag_new_temp (const rec_t *rec)
 The following function tells if a new-style temporary record is instant record or not. More...
 
UNIV_INLINE 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...
 
UNIV_INLINE uint16_t 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)
 Determines the information about null bytes and variable length bytes for a new-style temporary record. More...
 
UNIV_INLINE uint16_t 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)
 Determines the information about null bytes and variable length bytes for a new style record. More...
 
UNIV_INLINE 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...
 
UNIV_INLINE ibool 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...
 
UNIV_INLINE ulint rec_1_get_field_end_info (const rec_t *rec, ulint n)
 Returns the offset of nth field end if the record is stored in the 1-byte offsets form. More...
 
UNIV_INLINE ulint rec_2_get_field_end_info (const rec_t *rec, ulint n)
 Returns the offset of nth field end if the record is stored in the 2-byte offsets form. More...
 

Variables

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

Macro Definition Documentation

◆ REC_1BYTE_SQL_NULL_MASK

#define REC_1BYTE_SQL_NULL_MASK   0x80UL

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

◆ REC_2BYTE_EXTERN_MASK

#define 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.

◆ REC_2BYTE_SQL_NULL_MASK

#define REC_2BYTE_SQL_NULL_MASK   0x8000UL

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

◆ REC_HEAP_NO_MASK

#define REC_HEAP_NO_MASK   0xFFF8UL

◆ REC_HEAP_NO_SHIFT

#define REC_HEAP_NO_SHIFT   3

◆ REC_INFO_BITS_MASK

#define REC_INFO_BITS_MASK   0xF0UL

◆ REC_INFO_BITS_SHIFT

#define REC_INFO_BITS_SHIFT   0

◆ REC_INFO_DELETED_FLAG

#define REC_INFO_DELETED_FLAG
Value:
0x20UL /* when bit is set to 1, it means the \
record has been delete marked */

◆ REC_INFO_INSTANT_FLAG

#define REC_INFO_INSTANT_FLAG   0x80UL

◆ REC_INFO_MIN_REC_FLAG

#define REC_INFO_MIN_REC_FLAG   0x10UL

◆ REC_N_NEW_EXTRA_BYTES

#define REC_N_NEW_EXTRA_BYTES   5

◆ REC_N_OLD_EXTRA_BYTES

#define REC_N_OLD_EXTRA_BYTES   6

◆ REC_N_OWNED_MASK

#define REC_N_OWNED_MASK   0xFUL

◆ REC_N_OWNED_SHIFT

#define REC_N_OWNED_SHIFT   0

◆ REC_N_TMP_EXTRA_BYTES

#define REC_N_TMP_EXTRA_BYTES   1

◆ REC_NEW_HEAP_NO

#define REC_NEW_HEAP_NO   4

◆ REC_NEW_INFO_BITS

#define REC_NEW_INFO_BITS   5 /* This is single byte bit-field */

◆ REC_NEW_N_OWNED

#define REC_NEW_N_OWNED   5 /* This is single byte bit-field */

◆ REC_NEW_STATUS

#define REC_NEW_STATUS   3 /* This is single byte bit-field */

◆ REC_NEW_STATUS_MASK

#define REC_NEW_STATUS_MASK   0x7UL

◆ REC_NEW_STATUS_SHIFT

#define REC_NEW_STATUS_SHIFT   0

◆ REC_NEXT

#define REC_NEXT   2

◆ REC_NEXT_MASK

#define REC_NEXT_MASK   0xFFFFUL

◆ REC_NEXT_SHIFT

#define REC_NEXT_SHIFT   0

◆ REC_NODE_PTR_SIZE

#define REC_NODE_PTR_SIZE   4

◆ rec_offs_base

#define rec_offs_base (   offsets)    (offsets + REC_OFFS_HEADER_SIZE)

◆ REC_OFFS_COMPACT

#define REC_OFFS_COMPACT   ((ulint)1 << 31)

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

#define REC_OFFS_DEFAULT   ((ulint)1 << 29)

◆ REC_OFFS_EXTERNAL

#define REC_OFFS_EXTERNAL   ((ulint)1 << 30)

◆ REC_OFFS_HEADER_SIZE

#define REC_OFFS_HEADER_SIZE   4

◆ REC_OFFS_MASK

#define REC_OFFS_MASK   (REC_OFFS_DEFAULT - 1)

◆ REC_OFFS_NORMAL_SIZE

#define REC_OFFS_NORMAL_SIZE   100

◆ REC_OFFS_SMALL_SIZE

#define REC_OFFS_SMALL_SIZE   10

◆ REC_OFFS_SQL_NULL

#define REC_OFFS_SQL_NULL   ((ulint)1 << 31)

◆ REC_OLD_HEAP_NO

#define REC_OLD_HEAP_NO   5

◆ REC_OLD_INFO_BITS

#define REC_OLD_INFO_BITS   6 /* This is single byte bit-field */

◆ REC_OLD_N_FIELDS

#define REC_OLD_N_FIELDS   4

◆ REC_OLD_N_FIELDS_MASK

#define REC_OLD_N_FIELDS_MASK   0x7FEUL

◆ REC_OLD_N_FIELDS_SHIFT

#define REC_OLD_N_FIELDS_SHIFT   1

◆ REC_OLD_N_OWNED

#define REC_OLD_N_OWNED   6 /* This is single byte bit-field */

◆ REC_OLD_SHORT

#define REC_OLD_SHORT   3 /* This is single byte bit-field */

◆ REC_OLD_SHORT_MASK

#define REC_OLD_SHORT_MASK   0x1UL

◆ REC_OLD_SHORT_SHIFT

#define REC_OLD_SHORT_SHIFT   0

◆ REC_STATUS_INFIMUM

#define REC_STATUS_INFIMUM   2

◆ REC_STATUS_NODE_PTR

#define REC_STATUS_NODE_PTR   1

◆ REC_STATUS_ORDINARY

#define REC_STATUS_ORDINARY   0

◆ REC_STATUS_SUPREMUM

#define REC_STATUS_SUPREMUM   3

◆ REC_TMP_INFO_BITS

#define REC_TMP_INFO_BITS   1 /* This is single byte bit-field */

Function Documentation

◆ rec_1_get_field_end_info()

UNIV_INLINE ulint rec_1_get_field_end_info ( const rec_t rec,
ulint  n 
)

Returns the offset of nth field end if the record is stored in the 1-byte offsets form.

If the field is SQL null, the flag is ORed in the returned value.

Returns
offset of the start of the field, SQL null flag ORed
Parameters
recin: record
nin: field index

◆ rec_2_get_field_end_info()

UNIV_INLINE ulint rec_2_get_field_end_info ( const rec_t rec,
ulint  n 
)

Returns the offset of nth field end if the record is stored in the 2-byte offsets form.

If the field is SQL null, the flag is ORed in the returned value.

Returns
offset of the start of the field, SQL null flag and extern storage flag ORed
Parameters
recin: record
nin: field index

◆ rec_get_1byte_offs_flag()

UNIV_INLINE ibool 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.

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

◆ rec_get_bit_field_1()

UNIV_INLINE ulint rec_get_bit_field_1 ( const rec_t rec,
ulint  offs,
ulint  mask,
ulint  shift 
)

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

UNIV_INLINE 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.

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

UNIV_INLINE ulint rec_get_info_bits ( const rec_t rec,
ulint  comp 
)

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

UNIV_INLINE ulint rec_get_info_bits_temp ( const rec_t rec)

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

UNIV_INLINE bool rec_get_instant_flag_new ( const rec_t rec)

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

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

◆ rec_get_instant_flag_new_temp()

UNIV_INLINE bool rec_get_instant_flag_new_temp ( const rec_t rec)

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

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

◆ rec_get_instant_offset()

UNIV_INLINE 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.

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

UNIV_INLINE 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.

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

UNIV_INLINE 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.

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

UNIV_INLINE 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.

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

UNIV_INLINE 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.

Returns
number of data fields
Parameters
recin: physical record

◆ rec_get_offsets_func()

ulint* rec_get_offsets_func ( const rec_t rec,
const dict_index_t index,
ulint *  offsets,
ulint  n_fields,
const char *  file,
ulint  line,
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.

Returns
the new offsets

It can reuse a previously returned 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.

Returns
the new offsets
Parameters
recin: physical record
indexin: record descriptor
offsetsin/out: array consisting of offsets[0] allocated elements, or an array from rec_get_offsets(), or NULL
n_fieldsin: maximum number of initialized fields (ULINT_UNDEFINED if all fields)
filein: file name where called
linein: line number where called
heapin/out: memory heap

◆ 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()

UNIV_INLINE ulint rec_get_status ( const rec_t rec)

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_null_and_len_comp()

UNIV_INLINE uint16_t 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 
)

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
Returns
the number of fields which are inlined of the record

◆ rec_init_null_and_len_temp()

UNIV_INLINE uint16_t 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 
)

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
Returns
the number of fields which are inlined of the record

◆ 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), and 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. When the high-order bit of the offset at [i+1] is set (REC_OFFS_SQL_NULL), the field i is NULL. When the second high-order bit of the offset at [i+1] is set (REC_OFFS_EXTERNAL), the field i is being stored externally. in/out: array of offsets; in: n=rec_offs_n_fields(offsets)

The following function determines the offsets to each field in the record.

The code in this file is used to make a library for external tools. 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), and 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. When the high-order bit of the offset at [i+1] is set (REC_OFFS_SQL_NULL), the field i is NULL. When the second high-order bit of the offset at [i+1] is set (REC_OFFS_EXTERNAL), the field i is being stored externally.

Parameters
recin: physical record
indexin: record descriptor
offsetsin/out: array of offsets; in: n=rec_offs_n_fields(offsets)

◆ rec_init_offsets_comp_ordinary()

UNIV_INLINE 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_func().

Parameters
recin: physical record in ROW_FORMAT=COMPACT
tempin: whether to use the format for temporary files in index creation
indexin: record descriptor
offsetsin/out: array of offsets; in: n=rec_offs_n_fields(offsets)

◆ rec_n_fields_is_sane()

UNIV_INLINE 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.

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

◆ 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()

UNIV_INLINE ulint rec_offs_get_n_alloc ( const ulint *  offsets)

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

UNIV_INLINE 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.

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

◆ rec_offs_n_fields()

UNIV_INLINE ulint rec_offs_n_fields ( const ulint *  offsets)

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

UNIV_INLINE 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.

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

◆ rec_offs_set_n_fields()

UNIV_INLINE void rec_offs_set_n_fields ( ulint *  offsets,
ulint  n_fields 
)

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

UNIV_INLINE ibool rec_offs_validate ( const rec_t rec,
const dict_index_t index,
const ulint *  offsets 
)

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

Variable Documentation

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