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 
  377  if (
index->has_instant_cols_or_row_versions()) {
 
  400    if (
n > n_uniq + 1) {
 
  405      if (
index->has_instant_cols() && !
index->has_row_versions()) {
 
  409        ut_ad(rec_diff <= col_diff);
 
  413        ut_ad(
index->has_instant_cols_or_row_versions());
 
  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];
 
  530  ut_ad(
index->has_instant_cols_or_row_versions());
 
  570    const bool check_status = 
true) {
 
  582          ((
ulint) 
nullptr == offsets[2] &&
 
  583           (
index != 
nullptr && offsets == 
index->rec_cache.offsets)));
 
  584    if (!comp && 
index != 
nullptr) {
 
  594    max_n_fields = 
std::max(n_fields, n_unique_in_tree);
 
  596      ut_a(
index->has_instant_cols_or_row_versions());
 
  620    ut_a(!
index->n_def || i <= max_n_fields);
 
  639  ut_ad(rec || offsets == 
index->rec_cache.offsets);
 
  642  ut_ad(rec == 
nullptr ||
 
  644  offsets[2] = (
ulint)rec;
 
  660#define rec_offs_make_valid(rec, index, offsets) ((void)0) 
  691  ut_ad(!
index->has_instant_cols_or_row_versions());
 
  699  for (
size_t i = 0; i < n_fields; i++) {
 
  700    field_end[i] = (i ? field_end[i - 1] : 0) + 
index->get_field(i)->fixed_len;
 
  735                                                const ulint extra_bytes,
 
  740  ptr = rec - (extra_bytes + 1);
 
  751  ut_ad(n_fields != 0);
 
  798  if (!
index->has_instant_cols_or_row_versions()) {
 
  806  const bool is_versioned =
 
  816    ib::error() << 
"Record has both instant and version bit set in Table '" 
  817                << 
index->table_name << 
"', Index '" << 
index->name()
 
  818                << 
"'. This indicates that the table may be corrupt. Please " 
  819                   "run CHECK TABLE before proceeding.";
 
  823    ib::error() << 
"Record has both instant and version bit set in Table '" 
  824                << 
index->table_name << 
"', Index '" << 
index->name()
 
  825                << 
"'. This indicates that the table may be corrupt. Please " 
  826                   "run CHECK TABLE before proceeding.";
 
  844  } 
else if (
index->table->has_instant_cols()) {
 
  851  return rec_insert_state;
 
  864    const byte **nulls, 
const byte **lens, uint16_t &non_default_fields,
 
  879    *n_null = 
index->n_nullable;
 
  881    return rec_insert_state;
 
  887  switch (rec_insert_state) {
 
  891      *n_null = 
index->get_nullable_in_version(0);
 
  898      row_version = (uint8_t)(**nulls);
 
  903      *n_null = 
index->get_nullable_in_version(row_version);
 
  912  return rec_insert_state;
 
  927    const byte **lens, uint16_t *n_null, uint16_t &non_default_fields,
 
  948                                              non_default_fields, row_version);
 
  962    *n_null = 
index->n_nullable;
 
  964    return rec_insert_state;
 
  970  switch (rec_insert_state) {
 
  974      row_version = (uint8_t)(**nulls);
 
  980      *n_null = 
index->get_nullable_in_version(row_version);
 
  993      *n_null = 
index->get_n_nullable_before(non_default_fields);
 
  997      *n_null = 
index->get_nullable_before_instant_add_drop();
 
  998      non_default_fields = 
index->get_instant_fields();
 
 1003      *n_null = 
index->get_nullable_before_instant_add_drop();
 
 1014  return (rec_insert_state);
 
 1029    const byte **lens, uint16_t *n_null, uint16_t &non_default_fields,
 
 1041  switch (rec_insert_state) {
 
 1046      *n_null = 
index->n_nullable;
 
 1052      row_version = (uint8_t)(**nulls);
 
 1057        if (row_version > 0) {
 
 1069      *n_null = 
index->get_nullable_in_version(row_version);
 
 1075      non_default_fields =
 
 1081      *n_null = 
index->calculate_n_instant_nullable(non_default_fields);
 
 1085      *n_null = 
index->get_nullable_before_instant_add_drop();
 
 1086      non_default_fields = 
index->get_instant_fields();
 
 1091      *n_null = 
index->get_nullable_before_instant_add_drop();
 
 1102  return (rec_insert_state);
 
 1122  offsets[2] = (
ulint)rec;
 
 1126  const byte *nulls = 
nullptr;
 
 1127  const byte *lens = 
nullptr;
 
 1128  uint16_t n_null = 0;
 
 1131  uint16_t non_default_fields = 0;
 
 1135        rec, 
index, &nulls, &lens, &n_null, non_default_fields, row_version);
 
 1138        rec, 
index, &nulls, &lens, &n_null, non_default_fields, row_version);
 
 1161  ulint null_mask = 1;
 
 1170    switch (rec_insert_state) {
 
 1172        ut_ad(!
index->has_instant_cols_or_row_versions());
 
 1187              (
index->table->is_upgraded_instant() && row_version == 0));
 
 1213        ut_ad(non_default_fields > 0);
 
 1217        if (i >= non_default_fields) {
 
 1243      if (*nulls & null_mask) {
 
 1272          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 row_version_t version)
Definition: dict0mem.h:422
 
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:922
 
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 index(const std::string &value, const String &search_for, uint32_t *idx)
Definition: contains.h:76
 
ValueType max(X &&first)
Definition: gtid.h:103
 
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
 
constexpr uint32_t REC_OFFS_EXTERNAL
Definition: rec.h:75
 
constexpr uint32_t REC_OFFS_HEADER_SIZE
Definition: rec.h:201
 
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:1115
 
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:690
 
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, row_version_t &row_version)
Determines the information about null bytes and variable length bytes for a new-style temporary recor...
Definition: rec.h:925
 
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:674
 
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
 
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, row_version_t &row_version)
Determines the information about null bytes and variable length bytes for a new style record.
Definition: rec.h:1027
 
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:773
 
@ INSERTED_AFTER_UPGRADE_BEFORE_INSTANT_ADD_NEW_IMPLEMENTATION
Definition: rec.h:782
 
@ INSERTED_AFTER_INSTANT_ADD_OLD_IMPLEMENTATION
Definition: rec.h:779
 
@ INSERTED_AFTER_INSTANT_ADD_NEW_IMPLEMENTATION
Definition: rec.h:788
 
@ INSERTED_BEFORE_INSTANT_ADD_NEW_IMPLEMENTATION
Definition: rec.h:785
 
@ INSERTED_INTO_TABLE_WITH_NO_INSTANT_NO_VERSION
Definition: rec.h:790
 
@ NONE
Definition: rec.h:791
 
@ INSERTED_BEFORE_INSTANT_ADD_OLD_IMPLEMENTATION
Definition: rec.h:776
 
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:794
 
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:632
 
static bool rec_new_is_versioned(const rec_t *rec)
The following function tells if a new-style record is versioned.
Definition: rec.h:707
 
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:723
 
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 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, row_version_t &row_version)
Definition: rec.h:862
 
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:715
 
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:1299
 
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:734
 
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:666
 
constexpr uint32_t REC_OLD_N_FIELDS_MASK
Definition: rec.h:101
 
constexpr uint32_t REC_OFFS_SMALL_SIZE
Definition: rec.h:210
 
const row_version_t INVALID_ROW_VERSION
Definition: rem0types.h:56
 
byte rec_t
Definition: rem0types.h:41
 
constexpr uint32_t REC_MAX_N_FIELDS
Definition: rem0types.h:59
 
uint16_t row_version_t
Definition: rem0types.h:53
 
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:1842
 
Data structure for a column in a table.
Definition: dict0mem.h:484
 
bool is_dropped_in_or_before(row_version_t version) const
Check if column is dropped before the given version.
Definition: dict0mem.h:735
 
unsigned mtype
main data type
Definition: dict0mem.h:501
 
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:693
 
bool is_added_after(row_version_t version) const
Check if column is added after the current version.
Definition: dict0mem.h:748
 
unsigned prtype
precise type; MySQL data type, charset code, flags to indicate nullability, signedness,...
Definition: dict0mem.h:494
 
Data structure for a field in an index.
Definition: dict0mem.h:890
 
dict_col_t * col
pointer to the table column
Definition: dict0mem.h:893
 
unsigned fixed_len
0 or the fixed length of the column if smaller than DICT_ANTELOPE_MAX_INDEX_COL_LEN
Definition: dict0mem.h:903
 
Data structure for an index.
Definition: dict0mem.h:1041
 
Structure for an SQL data tuple of fields (logical record)
Definition: data0data.h:696
 
The info structure stored at the beginning of a heap block.
Definition: mem0mem.h:302
 
#define UNIV_MEM_ASSERT_W(addr, size)
Definition: univ.i:618
 
#define UNIV_UNLIKELY(cond)
Definition: univ.i:521
 
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:195
 
int n
Definition: xcom_base.cc:509