111#define REC_NEW_HEAP_NO 4 
  112#define REC_HEAP_NO_SHIFT 3 
  132              "sum of old-style masks != 0xFFFFFFFFUL");
 
  138              "sum of new-style masks != 0xFFFFFFUL");
 
  165#if defined UNIV_AHI_DEBUG || defined UNIV_DEBUG 
  400    if (
n > n_uniq + 1) {
 
  409        ut_ad(rec_diff <= col_diff);
 
  472    const ulint *offsets) 
 
  476  n_alloc = offsets[0];
 
  492  offsets[0] = n_alloc;
 
  505  offsets[1] = n_fields;
 
  511    const ulint *offsets) 
 
  515  n_fields = offsets[1];
 
  570    const bool check_status = 
true) {
 
  583    if (!comp && index != 
nullptr) {
 
  593    max_n_fields = std::max(n_fields, n_unique_in_tree);
 
  619    ut_a(!index->
n_def || i <= max_n_fields);
 
  641  ut_ad(rec == 
nullptr ||
 
  643  offsets[2] = (
ulint)rec;
 
  644  offsets[3] = (
ulint)index;
 
  659#define rec_offs_make_valid(rec, index, offsets) ((void)0) 
  698  for (
size_t i = 0; i < n_fields; i++) {
 
  734                                                const ulint extra_bytes,
 
  739  ptr = rec - (extra_bytes + 1);
 
  750  ut_ad(n_fields != 0);
 
  805  const bool is_versioned =
 
  814    ib::error() << 
"Record has both instant and version bit set in Table '" 
  816                << 
"'. This indicates that the table may be corrupt. Please " 
  817                   "run CHECK TABLE before proceeding.";
 
  821    ib::error() << 
"Record has both instant and version bit set in Table '" 
  823                << 
"'. This indicates that the table may be corrupt. Please " 
  824                   "run CHECK TABLE before proceeding.";
 
  849  return rec_insert_state;
 
  862    const byte **nulls, 
const byte **lens, uint16_t &non_default_fields,
 
  863    uint8_t &row_version) {
 
  879    return rec_insert_state;
 
  885  switch (rec_insert_state) {
 
  896      row_version = (uint8_t)(**nulls);
 
  910  return rec_insert_state;
 
  925    const byte **lens, uint16_t *n_null, uint16_t &non_default_fields,
 
  926    uint8_t &row_version) {
 
  946                                              non_default_fields, row_version);
 
  962    return rec_insert_state;
 
  968  switch (rec_insert_state) {
 
  972      row_version = (uint8_t)(**nulls);
 
 1012  return (rec_insert_state);
 
 1027    const byte **lens, uint16_t *n_null, uint16_t &non_default_fields,
 
 1028    uint8_t &row_version) {
 
 1039  switch (rec_insert_state) {
 
 1050      row_version = (uint8_t)(**nulls);
 
 1055        if (row_version > 0) {
 
 1073      non_default_fields =
 
 1100  return (rec_insert_state);
 
 1120  offsets[2] = (
ulint)rec;
 
 1121  offsets[3] = (
ulint)index;
 
 1124  const byte *nulls = 
nullptr;
 
 1125  const byte *lens = 
nullptr;
 
 1126  uint16_t n_null = 0;
 
 1129  uint16_t non_default_fields = 0;
 
 1133        rec, index, &nulls, &lens, &n_null, non_default_fields, row_version);
 
 1136        rec, index, &nulls, &lens, &n_null, non_default_fields, row_version);
 
 1159  ulint null_mask = 1;
 
 1168    switch (rec_insert_state) {
 
 1211        ut_ad(non_default_fields > 0);
 
 1215        if (i >= non_default_fields) {
 
 1241      if (*nulls & null_mask) {
 
 1270          offs += len & 0x3fff;
 
The class error is used to emit error messages.
Definition: ut0log.h:231
 
static ulint dtuple_get_n_fields(const dtuple_t *tuple)
Gets number of fields in a data tuple.
 
constexpr uint32_t DATA_POINT
geometry datatype of fixed length POINT
Definition: data0type.h:107
 
constexpr uint32_t DATA_NOT_NULL
this is ORed to the precise type when the column is declared as NOT NULL
Definition: data0type.h:207
 
#define DATA_BIG_COL(col)
Definition: data0type.h:286
 
Data dictionary creation and booting.
 
constexpr uint32_t DICT_INDEXES_ID
Definition: dict0boot.h:97
 
uint16_t dict_index_get_n_fields(const dict_index_t *index)
Gets the number of fields in the internal representation of an index, including fields added by the d...
Definition: dict0dict.ic:667
 
static bool dict_table_is_comp(const dict_table_t *table)
Check whether the table uses the compact page format.
 
uint16_t dict_index_get_n_unique_in_tree_nonleaf(const dict_index_t *index)
Gets the number of fields on nonleaf page level in the internal representation of an index which uniq...
Definition: dict0dict.ic:724
 
uint16_t dict_index_get_n_unique_in_tree(const dict_index_t *index)
Gets the number of fields in the internal representation of an index which uniquely determine the pos...
Definition: dict0dict.ic:702
 
static bool is_valid_row_version(const uint8_t version)
Definition: dict0mem.h:427
 
constexpr char RECOVERY_INDEX_TABLE_NAME[]
index/table name used while applying REDO logs during recovery
Definition: dict0mem.h:89
 
static bool is_instant(const Alter_inplace_info *ha_alter_info)
Determine if this is an instant ALTER TABLE.
Definition: handler0alter.cc:919
 
static uint16_t mach_read_from_2(const byte *b)
The following function is used to fetch data from 2 consecutive bytes.
 
static uint8_t mach_read_from_1(const byte *b)
The following function is used to fetch data from one byte.
 
static mi_bit_type mask[]
Definition: mi_packrec.cc:141
 
#define DBUG_EXECUTE_IF(keyword, a1)
Definition: my_dbug.h:171
 
bool length(const dd::Spatial_reference_system *srs, const Geometry *g1, double *length, bool *null) noexcept
Computes the length of linestrings and multilinestrings.
Definition: length.cc:76
 
bool rec_info_bits_valid(ulint bits)
Check if the info bits are valid.
Definition: rec.h:318
 
constexpr uint32_t REC_INFO_INSTANT_FLAG
The instant ADD COLUMN flag.
Definition: rec.h:152
 
static const uint8_t REC_N_FIELDS_TWO_BYTES_FLAG
Number of fields flag which means it occupies two bytes.
Definition: rec.h:236
 
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.
Definition: rec.h:287
 
constexpr uint32_t REC_N_OWNED_MASK
Definition: rec.h:117
 
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 recor...
Definition: rec.h:923
 
constexpr uint32_t REC_OFFS_EXTERNAL
Definition: rec.h:75
 
constexpr uint32_t REC_OFFS_HEADER_SIZE
Definition: rec.h:201
 
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)
Definition: rec.h:860
 
constexpr uint32_t REC_OFFS_DEFAULT
Definition: rec.h:77
 
constexpr uint32_t REC_NEW_HEAP_NO
Definition: rec.h:84
 
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.
Definition: rec.h:1113
 
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 onl...
Definition: rec.h:689
 
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.
Definition: rec.h:1025
 
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.
Definition: rec.h:673
 
constexpr uint32_t REC_NEXT
Definition: rec.h:92
 
constexpr uint32_t REC_N_OLD_EXTRA_BYTES
Definition: rec.h:156
 
constexpr uint32_t REC_STATUS_SUPREMUM
Definition: rec.h:182
 
constexpr uint32_t REC_NODE_PTR_SIZE
Definition: rec.h:188
 
constexpr uint32_t REC_INFO_BITS_SHIFT
Definition: rec.h:124
 
constexpr uint32_t REC_OFFS_DROP
Definition: rec.h:79
 
constexpr uint32_t REC_INFO_MIN_REC_FLAG
Definition: rec.h:144
 
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.
Definition: rec.h:328
 
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.
Definition: rec.cc:348
 
constexpr uint32_t REC_NEW_INFO_BITS
Definition: rec.h:121
 
constexpr uint32_t REC_OLD_INFO_BITS
Definition: rec.h:120
 
constexpr uint32_t REC_OFFS_MASK
Definition: rec.h:81
 
constexpr uint32_t REC_OLD_SHORT_MASK
Definition: rec.h:97
 
constexpr uint32_t REC_OLD_SHORT_SHIFT
Definition: rec.h:98
 
Rec_instant_state
Instant state of a record.
Definition: rec.h:214
 
constexpr uint32_t REC_INFO_BITS_MASK
Definition: rec.h:123
 
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.
Definition: rec.h:340
 
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 in...
Definition: rec.h:528
 
static const uint8_t REC_N_FIELDS_ONE_BYTE_MAX
Max number of fields which can be stored in one byte.
Definition: rec.h:239
 
constexpr uint32_t REC_HEAP_NO_MASK
Definition: rec.h:109
 
REC_INSERT_STATE
Definition: rec.h:772
 
@ INSERTED_AFTER_UPGRADE_BEFORE_INSTANT_ADD_NEW_IMPLEMENTATION
Definition: rec.h:781
 
@ INSERTED_AFTER_INSTANT_ADD_OLD_IMPLEMENTATION
Definition: rec.h:778
 
@ INSERTED_AFTER_INSTANT_ADD_NEW_IMPLEMENTATION
Definition: rec.h:787
 
@ INSERTED_BEFORE_INSTANT_ADD_NEW_IMPLEMENTATION
Definition: rec.h:784
 
@ INSERTED_INTO_TABLE_WITH_NO_INSTANT_NO_VERSION
Definition: rec.h:789
 
@ NONE
Definition: rec.h:790
 
@ INSERTED_BEFORE_INSTANT_ADD_OLD_IMPLEMENTATION
Definition: rec.h:775
 
constexpr uint32_t REC_TMP_INFO_BITS
Definition: rec.h:122
 
constexpr uint32_t REC_HEAP_NO_SHIFT
Definition: rec.h:87
 
constexpr uint32_t REC_STATUS_ORDINARY
Definition: rec.h:179
 
static enum REC_INSERT_STATE get_rec_insert_state(const dict_index_t *index, const rec_t *rec, bool temp)
Definition: rec.h:793
 
static ulint rec_offs_get_n_alloc(const ulint *offsets)
The following function returns the number of allocated elements for an array of offsets.
Definition: rec.h:471
 
constexpr uint32_t REC_STATUS_INFIMUM
Definition: rec.h:181
 
constexpr uint32_t REC_NEW_STATUS
Definition: rec.h:104
 
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.
Definition: rec.h:631
 
static bool rec_new_is_versioned(const rec_t *rec)
The following function tells if a new-style record is versioned.
Definition: rec.h:706
 
constexpr uint32_t REC_INFO_DELETED_FLAG
The deleted flag in info bits; when bit is set to 1, it means the record has been delete marked.
Definition: rec.h:147
 
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.
Definition: rec.h:373
 
constexpr uint32_t REC_1BYTE_SQL_NULL_MASK
SQL null flag in a 1-byte offset of ROW_FORMAT=REDUNDANT records.
Definition: rec.h:191
 
constexpr uint32_t REC_OLD_N_FIELDS
Definition: rec.h:100
 
constexpr auto MAX_REC_PER_PAGE
Maximum number of records in a page.
Definition: rec.h:167
 
constexpr uint32_t REC_OFFS_COMPACT
NOTE: The functions in this file should only use functions from other files in library.
Definition: rec.h:71
 
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.
Definition: rec.h:484
 
static bool rec_offs_validate(const rec_t *rec, const dict_index_t *index, const ulint *offsets, const bool check_status=true)
Validates offsets returned by rec_get_offsets().
Definition: rec.h:568
 
static bool rec_new_temp_is_versioned(const rec_t *rec)
The following function tells if a temporary record is versioned.
Definition: rec.h:722
 
constexpr uint32_t REC_NEW_STATUS_MASK
Definition: rec.h:105
 
constexpr uint32_t REC_OFFS_SQL_NULL
Definition: rec.h:73
 
constexpr uint32_t REC_N_TMP_EXTRA_BYTES
Definition: rec.h:163
 
constexpr uint32_t REC_OLD_N_OWNED
Definition: rec.h:115
 
static ulint rec_offs_n_fields(const ulint *offsets)
The following function returns the number of fields in a record.
Definition: rec.h:510
 
static const ulint * rec_offs_base(const ulint *offsets)
Definition: rec.h:227
 
constexpr int32_t REC_N_NEW_EXTRA_BYTES
Definition: rec.h:159
 
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,...
Definition: rec.h:350
 
constexpr uint32_t REC_NEXT_MASK
Definition: rec.h:93
 
constexpr uint32_t REC_2BYTE_SQL_NULL_MASK
SQL null flag in a 2-byte offset of ROW_FORMAT=REDUNDANT records.
Definition: rec.h:193
 
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.
Definition: rec.cc:359
 
constexpr uint32_t REC_INFO_VERSION_FLAG
Definition: rec.h:149
 
constexpr uint32_t REC_NEW_N_OWNED
Definition: rec.h:116
 
constexpr uint32_t REC_OLD_N_FIELDS_SHIFT
Definition: rec.h:102
 
constexpr uint32_t REC_OLD_HEAP_NO
Definition: rec.h:108
 
static bool rec_old_is_versioned(const rec_t *rec)
The following function tells if an old-style record is versioned.
Definition: rec.h:714
 
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 ...
Definition: rec.h:1297
 
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.
Definition: rec.cc:416
 
constexpr uint32_t REC_N_OWNED_SHIFT
Definition: rec.h:118
 
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.
Definition: rec.h:733
 
constexpr uint32_t REC_STATUS_NODE_PTR
Definition: rec.h:180
 
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...
Definition: rec.h:459
 
constexpr uint32_t REC_OLD_SHORT
Definition: rec.h:96
 
constexpr uint32_t REC_NEXT_SHIFT
Definition: rec.h:94
 
static void rec_offs_set_n_fields(ulint *offsets, ulint n_fields)
The following function sets the number of fields in offsets.
Definition: rec.h:496
 
constexpr uint32_t REC_OFFS_NORMAL_SIZE
Definition: rec.h:209
 
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.
Definition: rec.h:275
 
constexpr uint32_t REC_2BYTE_EXTERN_MASK
In a 2-byte offset of ROW_FORMAT=REDUNDANT records, the second most significant bit denotes that the ...
Definition: rec.h:197
 
constexpr uint32_t REC_NEW_STATUS_SHIFT
Definition: rec.h:106
 
bool rec_offs_cmp(ulint *offsets1, ulint *offsets2)
Check if the given two record offsets are identical.
Definition: rec.cc:535
 
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.
Definition: rec.h:429
 
std::ostream & rec_offs_print(std::ostream &out, const ulint *offsets)
Print the record offsets.
Definition: rec.cc:567
 
static ulint rec_get_status(const rec_t *rec)
The following function retrieves the status bits of a new-style record.
Definition: rec.h:300
 
static bool rec_get_instant_flag_new(const rec_t *rec)
The following function tells if a new-style record is instant record.
Definition: rec.h:665
 
constexpr uint32_t REC_OLD_N_FIELDS_MASK
Definition: rec.h:101
 
constexpr uint32_t REC_OFFS_SMALL_SIZE
Definition: rec.h:210
 
byte rec_t
Definition: rem0types.h:41
 
constexpr uint32_t REC_MAX_N_FIELDS
Definition: rem0types.h:44
 
required uint64 version
Definition: replication_group_member_actions.proto:41
 
Definition: completion_hash.h:35
 
std::atomic< uint16_t > n_pointers
Used in debugging.
Definition: buf0buf.h:1843
 
Data structure for a column in a table.
Definition: dict0mem.h:489
 
bool is_added_after(uint8_t version) const
Check if column is added after the current version.
Definition: dict0mem.h:753
 
unsigned mtype
main data type
Definition: dict0mem.h:506
 
ulint get_fixed_size(ulint comp) const
Returns the size of a fixed size column, 0 if not a fixed size column.
Definition: dict0mem.h:698
 
bool is_dropped_in_or_before(uint8_t version) const
Check if column is dropped before the given version.
Definition: dict0mem.h:740
 
unsigned prtype
precise type; MySQL data type, charset code, flags to indicate nullability, signedness,...
Definition: dict0mem.h:499
 
Data structure for a field in an index.
Definition: dict0mem.h:895
 
dict_col_t * col
pointer to the table column
Definition: dict0mem.h:898
 
unsigned fixed_len
0 or the fixed length of the column if smaller than DICT_ANTELOPE_MAX_INDEX_COL_LEN
Definition: dict0mem.h:908
 
Data structure for an index.
Definition: dict0mem.h:1046
 
uint32_t get_n_nullable_before(uint32_t nth) const
Returns the number of nullable fields before specified nth field.
Definition: dict0mem.h:1368
 
const char * table_name
table name
Definition: dict0mem.h:1057
 
id_name_t name
index name
Definition: dict0mem.h:1054
 
const byte * get_nth_default(ulint nth, ulint *length) const
Get the default value of nth field and its length if exists.
Definition: dict0mem.h:1575
 
bool has_instant_cols_or_row_versions() const
check if either instant or versioned.
Definition: dict0mem.h:1352
 
dict_field_t * get_physical_field(size_t pos) const
Gets the nth physical pos field.
Definition: dict0mem.h:1488
 
uint32_t get_instant_fields() const
Returns the number of fields before first instant ADD COLUMN.
Definition: dict0mem.ic:92
 
dict_field_t * get_field(ulint pos) const
Gets the nth field of an index.
Definition: dict0mem.h:1502
 
uint16_t get_nullable_before_instant_add_drop() const
Get the nullable fields before any INSTANT ADD/DROP.
Definition: dict0mem.h:1256
 
size_t calculate_n_instant_nullable(size_t _n_fields) const
Definition: dict0mem.h:1395
 
unsigned n_def
number of fields defined so far
Definition: dict0mem.h:1103
 
unsigned n_nullable
number of nullable fields
Definition: dict0mem.h:1112
 
rec_cache_t rec_cache
cache the field that needs to be re-computed on each insert.
Definition: dict0mem.h:1225
 
bool has_row_versions() const
Check whether index belongs to a table having row versions.
Definition: dict0mem.h:1348
 
bool is_clustered() const
Definition: dict0mem.h:1311
 
bool has_instant_cols() const
Check whether index has any instantly added columns.
Definition: dict0mem.h:1344
 
dict_table_t * table
back pointer to table
Definition: dict0mem.h:1060
 
uint32_t get_nullable_in_version(uint8_t version) const
Return nullable in a specific row version.
Definition: dict0mem.h:1436
 
bool has_instant_cols() const
Definition: dict0mem.h:2503
 
bool has_row_versions() const
Definition: dict0mem.h:2488
 
unsigned n_cols
Number of non-virtual columns.
Definition: dict0mem.h:2060
 
unsigned n_instant_cols
Number of non-virtual columns before first instant ADD COLUMN, including the system columns like n_co...
Definition: dict0mem.h:2065
 
table_id_t id
Id of the table.
Definition: dict0mem.h:1979
 
bool is_upgraded_instant() const
Checks if table is upgraded table with INSTANT ADD columns in V1.
Definition: dict0mem.h:2560
 
Structure for an SQL data tuple of fields (logical record)
Definition: data0data.h:694
 
The info structure stored at the beginning of a heap block.
Definition: mem0mem.h:302
 
const ulint * offsets
Holds reference to cached offsets for record.
Definition: dict0mem.h:982
 
#define UNIV_MEM_ASSERT_W(addr, size)
Definition: univ.i:618
 
#define UNIV_UNLIKELY(cond)
Definition: univ.i:521
 
constexpr uint8_t UINT8_UNDEFINED
The 'undefined' value for a 8-bit unsigned integer.
Definition: univ.i:434
 
constexpr uint32_t UNIV_SQL_NULL
The following number as the length of a logical field means that the field has the SQL NULL as its va...
Definition: univ.i:463
 
#define UNIV_MEM_ASSERT_AND_ALLOC(addr, size)
Definition: univ.i:630
 
constexpr ulint ULINT_MAX
Maximum value for a ulint.
Definition: univ.i:440
 
unsigned long int ulint
Definition: univ.i:406
 
constexpr size_t UNIV_PAGE_SIZE_MAX
Maximum page size InnoDB currently supports.
Definition: univ.i:323
 
#define ut_error
Abort execution.
Definition: ut0dbg.h:101
 
#define ut_ad(EXPR)
Debug assertion.
Definition: ut0dbg.h:105
 
#define ut_a(EXPR)
Abort execution if EXPR does not evaluate to nonzero.
Definition: ut0dbg.h:93
 
#define UT_BITS_IN_BYTES(b)
Determine how many bytes (groups of 8 bits) are needed to store the given number of bits.
Definition: ut0ut.h:198
 
int n
Definition: xcom_base.cc:509