MySQL 8.4.2
Source Code Documentation
rec.cc File Reference

Record manager. More...

#include <stddef.h>
#include "dict0dict.h"
#include "mem0mem.h"
#include "rem/rec.h"
#include "rem0lrec.h"
#include "rem0rec.h"

Functions

static void rec_init_offsets_new (const rec_t *rec, const dict_index_t *index, ulint *offsets)
 NOTE: The functions in this file should only use functions from other files in library. More...
 
static void rec_init_offset_old_1byte (const rec_t *rec, const dict_index_t *index, ulint *offsets, uint8_t row_version)
 Initialize offsets for record in REDUNDNT format when each field offsets is stored in 1 byte. More...
 
static void rec_init_offset_old_2byte (const rec_t *rec, const dict_index_t *index, ulint *offsets, uint8_t row_version)
 Initialize offsets for record in REDUNDNT format when each field offsets is stored in 2 byte. More...
 
static void rec_init_offsets_old (const rec_t *rec, const dict_index_t *index, ulint *offsets)
 Initialize offset for each field in an old style record. 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...
 
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...
 
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...
 
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...
 

Detailed Description

Record manager.

Created 5/30/1994 Heikki Tuuri

Function Documentation

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

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

static void rec_init_offset_old_1byte ( const rec_t rec,
const dict_index_t index,
ulint offsets,
uint8_t  row_version 
)
static

Initialize offsets for record in REDUNDNT format when each field offsets is stored in 1 byte.

Parameters
[in]recphysical record
[in]indexrecord descriptor
[in,out]offsetsarray of offsets
[in]row_versionrow version in record

◆ rec_init_offset_old_2byte()

static void rec_init_offset_old_2byte ( const rec_t rec,
const dict_index_t index,
ulint offsets,
uint8_t  row_version 
)
static

Initialize offsets for record in REDUNDNT format when each field offsets is stored in 2 byte.

Parameters
[in]recphysical record
[in]indexrecord descriptor
[in,out]offsetsarray of offsets
[in]row_versionrow version in 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).
  • 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_init_offsets_new()

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

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. Initialize offset for each field in a new style record.

Parameters
[in]recphysical record
[in]indexrecord descriptor
[in,out]offsetsarray of offsets

◆ rec_init_offsets_old()

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

Initialize offset for each field in an old style record.

Parameters
[in]recphysical record
[in]indexrecord descriptor
[in,out]offsetsarray of offsets

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