110#define REC_NEW_HEAP_NO 4
111#define REC_HEAP_NO_SHIFT 3
131 "sum of old-style masks != 0xFFFFFFFFUL");
137 "sum of new-style masks != 0xFFFFFFUL");
164#if defined UNIV_AHI_DEBUG || defined UNIV_DEBUG
399 if (
n > n_uniq + 1) {
408 ut_ad(rec_diff <= col_diff);
471 const ulint *offsets)
475 n_alloc = offsets[0];
491 offsets[0] = n_alloc;
504 offsets[1] = n_fields;
510 const ulint *offsets)
514 n_fields = offsets[1];
569 const bool check_status =
true) {
582 if (!comp && index !=
nullptr) {
592 max_n_fields = std::max(n_fields, n_unique_in_tree);
618 ut_a(!index->
n_def || i <= max_n_fields);
640 ut_ad(rec ==
nullptr ||
642 offsets[2] = (
ulint)rec;
643 offsets[3] = (
ulint)index;
658#define rec_offs_make_valid(rec, index, offsets) ((void)0)
697 for (
size_t i = 0; i < n_fields; i++) {
733 const ulint extra_bytes,
738 ptr = rec - (extra_bytes + 1);
749 ut_ad(n_fields != 0);
804 const bool is_versioned =
813 ib::error() <<
"Record has both instant and version bit set in Table '"
815 <<
"'. This indicates that the table may be corrupt. Please "
816 "run CHECK TABLE before proceeding.";
820 ib::error() <<
"Record has both instant and version bit set in Table '"
822 <<
"'. This indicates that the table may be corrupt. Please "
823 "run CHECK TABLE before proceeding.";
848 return rec_insert_state;
861 const byte **nulls,
const byte **lens, uint16_t &non_default_fields,
862 uint8_t &row_version) {
878 return rec_insert_state;
884 switch (rec_insert_state) {
895 row_version = (uint8_t)(**nulls);
909 return rec_insert_state;
924 const byte **lens, uint16_t *n_null, uint16_t &non_default_fields,
925 uint8_t &row_version) {
945 non_default_fields, row_version);
961 return rec_insert_state;
967 switch (rec_insert_state) {
971 row_version = (uint8_t)(**nulls);
1011 return (rec_insert_state);
1026 const byte **lens, uint16_t *n_null, uint16_t &non_default_fields,
1027 uint8_t &row_version) {
1038 switch (rec_insert_state) {
1049 row_version = (uint8_t)(**nulls);
1054 if (row_version > 0) {
1072 non_default_fields =
1099 return (rec_insert_state);
The class error is used to emit error messages.
Definition: ut0log.h:230
static ulint dtuple_get_n_fields(const dtuple_t *tuple)
Gets number of fields in a data tuple.
Data dictionary creation and booting.
constexpr uint32_t DICT_INDEXES_ID
Definition: dict0boot.h:96
static 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...
static bool dict_table_is_comp(const dict_table_t *table)
Check whether the table uses the compact page format.
static ulint 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...
static ulint 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...
static bool is_valid_row_version(const uint8_t version)
Definition: dict0mem.h:426
constexpr char RECOVERY_INDEX_TABLE_NAME[]
index/table name used while applying REDO logs during recovery
Definition: dict0mem.h:88
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:140
#define DBUG_EXECUTE_IF(keyword, a1)
Definition: my_dbug.h:170
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:75
bool rec_info_bits_valid(ulint bits)
Check if the info bits are valid.
Definition: rec.h:317
constexpr uint32_t REC_INFO_INSTANT_FLAG
The instant ADD COLUMN flag.
Definition: rec.h:151
static const uint8_t REC_N_FIELDS_TWO_BYTES_FLAG
Number of fields flag which means it occupies two bytes.
Definition: rec.h:235
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:286
constexpr uint32_t REC_N_OWNED_MASK
Definition: rec.h:116
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:922
constexpr uint32_t REC_OFFS_EXTERNAL
Definition: rec.h:74
constexpr uint32_t REC_OFFS_HEADER_SIZE
Definition: rec.h:200
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:859
constexpr uint32_t REC_OFFS_DEFAULT
Definition: rec.h:76
constexpr uint32_t REC_NEW_HEAP_NO
Definition: rec.h:83
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.cc:529
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:688
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:1024
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:672
constexpr uint32_t REC_NEXT
Definition: rec.h:91
constexpr uint32_t REC_N_OLD_EXTRA_BYTES
Definition: rec.h:155
constexpr uint32_t REC_STATUS_SUPREMUM
Definition: rec.h:181
constexpr uint32_t REC_NODE_PTR_SIZE
Definition: rec.h:187
constexpr uint32_t REC_INFO_BITS_SHIFT
Definition: rec.h:123
constexpr uint32_t REC_OFFS_DROP
Definition: rec.h:78
constexpr uint32_t REC_INFO_MIN_REC_FLAG
Definition: rec.h:143
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:327
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:347
constexpr uint32_t REC_NEW_INFO_BITS
Definition: rec.h:120
constexpr uint32_t REC_OLD_INFO_BITS
Definition: rec.h:119
constexpr uint32_t REC_OFFS_MASK
Definition: rec.h:80
constexpr uint32_t REC_OLD_SHORT_MASK
Definition: rec.h:96
constexpr uint32_t REC_OLD_SHORT_SHIFT
Definition: rec.h:97
Rec_instant_state
Instant state of a record.
Definition: rec.h:213
constexpr uint32_t REC_INFO_BITS_MASK
Definition: rec.h:122
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:339
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:527
static const uint8_t REC_N_FIELDS_ONE_BYTE_MAX
Max number of fields which can be stored in one byte.
Definition: rec.h:238
constexpr uint32_t REC_HEAP_NO_MASK
Definition: rec.h:108
REC_INSERT_STATE
Definition: rec.h:771
@ INSERTED_AFTER_UPGRADE_BEFORE_INSTANT_ADD_NEW_IMPLEMENTATION
Definition: rec.h:780
@ INSERTED_AFTER_INSTANT_ADD_OLD_IMPLEMENTATION
Definition: rec.h:777
@ INSERTED_AFTER_INSTANT_ADD_NEW_IMPLEMENTATION
Definition: rec.h:786
@ INSERTED_BEFORE_INSTANT_ADD_NEW_IMPLEMENTATION
Definition: rec.h:783
@ INSERTED_INTO_TABLE_WITH_NO_INSTANT_NO_VERSION
Definition: rec.h:788
@ NONE
Definition: rec.h:789
@ INSERTED_BEFORE_INSTANT_ADD_OLD_IMPLEMENTATION
Definition: rec.h:774
constexpr uint32_t REC_TMP_INFO_BITS
Definition: rec.h:121
constexpr uint32_t REC_HEAP_NO_SHIFT
Definition: rec.h:86
constexpr uint32_t REC_STATUS_ORDINARY
Definition: rec.h:178
static enum REC_INSERT_STATE get_rec_insert_state(const dict_index_t *index, const rec_t *rec, bool temp)
Definition: rec.h:792
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:470
constexpr uint32_t REC_STATUS_INFIMUM
Definition: rec.h:180
constexpr uint32_t REC_NEW_STATUS
Definition: rec.h:103
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:630
static bool rec_new_is_versioned(const rec_t *rec)
The following function tells if a new-style record is versioned.
Definition: rec.h:705
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:146
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:372
constexpr uint32_t REC_1BYTE_SQL_NULL_MASK
SQL null flag in a 1-byte offset of ROW_FORMAT=REDUNDANT records.
Definition: rec.h:190
constexpr uint32_t REC_OLD_N_FIELDS
Definition: rec.h:99
constexpr auto MAX_REC_PER_PAGE
Maximum number of records in a page.
Definition: rec.h:166
constexpr uint32_t REC_OFFS_COMPACT
NOTE: The functions in this file should only use functions from other files in library.
Definition: rec.h:70
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:483
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:567
static bool rec_new_temp_is_versioned(const rec_t *rec)
The following function tells if a temporary record is versioned.
Definition: rec.h:721
constexpr uint32_t REC_NEW_STATUS_MASK
Definition: rec.h:104
constexpr uint32_t REC_OFFS_SQL_NULL
Definition: rec.h:72
constexpr uint32_t REC_N_TMP_EXTRA_BYTES
Definition: rec.h:162
constexpr uint32_t REC_OLD_N_OWNED
Definition: rec.h:114
static ulint rec_offs_n_fields(const ulint *offsets)
The following function returns the number of fields in a record.
Definition: rec.h:509
static const ulint * rec_offs_base(const ulint *offsets)
Definition: rec.h:226
constexpr int32_t REC_N_NEW_EXTRA_BYTES
Definition: rec.h:158
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:349
constexpr uint32_t REC_NEXT_MASK
Definition: rec.h:92
constexpr uint32_t REC_2BYTE_SQL_NULL_MASK
SQL null flag in a 2-byte offset of ROW_FORMAT=REDUNDANT records.
Definition: rec.h:192
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:358
constexpr uint32_t REC_INFO_VERSION_FLAG
Definition: rec.h:148
constexpr uint32_t REC_NEW_N_OWNED
Definition: rec.h:115
constexpr uint32_t REC_OLD_N_FIELDS_SHIFT
Definition: rec.h:101
constexpr uint32_t REC_OLD_HEAP_NO
Definition: rec.h:107
static bool rec_old_is_versioned(const rec_t *rec)
The following function tells if an old-style record is versioned.
Definition: rec.h:713
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:1116
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:415
constexpr uint32_t REC_N_OWNED_SHIFT
Definition: rec.h:117
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:732
constexpr uint32_t REC_STATUS_NODE_PTR
Definition: rec.h:179
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:458
constexpr uint32_t REC_OLD_SHORT
Definition: rec.h:95
constexpr uint32_t REC_NEXT_SHIFT
Definition: rec.h:93
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:495
constexpr uint32_t REC_OFFS_NORMAL_SIZE
Definition: rec.h:208
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:274
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:196
constexpr uint32_t REC_NEW_STATUS_SHIFT
Definition: rec.h:105
bool rec_offs_cmp(ulint *offsets1, ulint *offsets2)
Check if the given two record offsets are identical.
Definition: rec.cc:714
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:428
std::ostream & rec_offs_print(std::ostream &out, const ulint *offsets)
Print the record offsets.
Definition: rec.cc:746
static ulint rec_get_status(const rec_t *rec)
The following function retrieves the status bits of a new-style record.
Definition: rec.h:299
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:664
constexpr uint32_t REC_OLD_N_FIELDS_MASK
Definition: rec.h:100
constexpr uint32_t REC_OFFS_SMALL_SIZE
Definition: rec.h:209
byte rec_t
Definition: rem0types.h:40
constexpr uint32_t REC_MAX_N_FIELDS
Definition: rem0types.h:43
required uint64 version
Definition: replication_group_member_actions.proto:40
Definition: completion_hash.h:34
std::atomic< uint16_t > n_pointers
Used in debugging.
Definition: buf0buf.h:1833
unsigned fixed_len
0 or the fixed length of the column if smaller than DICT_ANTELOPE_MAX_INDEX_COL_LEN
Definition: dict0mem.h:907
Data structure for an index.
Definition: dict0mem.h:1045
uint32_t get_n_nullable_before(uint32_t nth) const
Returns the number of nullable fields before specified nth field.
Definition: dict0mem.h:1367
const char * table_name
table name
Definition: dict0mem.h:1056
id_name_t name
index name
Definition: dict0mem.h:1053
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:1574
bool has_instant_cols_or_row_versions() const
check if either instant or versioned.
Definition: dict0mem.h:1351
uint32_t get_instant_fields() const
Returns the number of fields before first instant ADD COLUMN.
Definition: dict0mem.ic:91
dict_field_t * get_field(ulint pos) const
Gets the nth field of an index.
Definition: dict0mem.h:1501
uint16_t get_nullable_before_instant_add_drop() const
Get the nullable fields before any INSTANT ADD/DROP.
Definition: dict0mem.h:1255
size_t calculate_n_instant_nullable(size_t _n_fields) const
Definition: dict0mem.h:1394
unsigned n_def
number of fields defined so far
Definition: dict0mem.h:1102
unsigned n_nullable
number of nullable fields
Definition: dict0mem.h:1111
rec_cache_t rec_cache
cache the field that needs to be re-computed on each insert.
Definition: dict0mem.h:1224
bool has_row_versions() const
Check whether index belongs to a table having row versions.
Definition: dict0mem.h:1347
bool is_clustered() const
Definition: dict0mem.h:1310
bool has_instant_cols() const
Check whether index has any instantly added columns.
Definition: dict0mem.h:1343
dict_table_t * table
back pointer to table
Definition: dict0mem.h:1059
uint32_t get_nullable_in_version(uint8_t version) const
Return nullable in a specific row version.
Definition: dict0mem.h:1435
bool has_instant_cols() const
Definition: dict0mem.h:2493
bool has_row_versions() const
Definition: dict0mem.h:2478
unsigned n_cols
Number of non-virtual columns.
Definition: dict0mem.h:2050
unsigned n_instant_cols
Number of non-virtual columns before first instant ADD COLUMN, including the system columns like n_co...
Definition: dict0mem.h:2055
table_id_t id
Id of the table.
Definition: dict0mem.h:1969
bool is_upgraded_instant() const
Checks if table is upgraded table with INSTANT ADD columns in V1.
Definition: dict0mem.h:2550
Structure for an SQL data tuple of fields (logical record)
Definition: data0data.h:681
The info structure stored at the beginning of a heap block.
Definition: mem0mem.h:301
const ulint * offsets
Holds reference to cached offsets for record.
Definition: dict0mem.h:981
#define UNIV_MEM_ASSERT_W(addr, size)
Definition: univ.i:617
constexpr uint8_t UINT8_UNDEFINED
The 'undefined' value for a 8-bit unsigned integer.
Definition: univ.i:433
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:462
#define UNIV_MEM_ASSERT_AND_ALLOC(addr, size)
Definition: univ.i:629
constexpr ulint ULINT_MAX
Maximum value for a ulint.
Definition: univ.i:439
unsigned long int ulint
Definition: univ.i:405
constexpr size_t UNIV_PAGE_SIZE_MAX
Maximum page size InnoDB currently supports.
Definition: univ.i:322
#define ut_error
Abort execution.
Definition: ut0dbg.h:100
#define ut_ad(EXPR)
Debug assertion.
Definition: ut0dbg.h:104
#define ut_a(EXPR)
Abort execution if EXPR does not evaluate to nonzero.
Definition: ut0dbg.h:92
#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:197
int n
Definition: xcom_base.cc:508