63#define dfield_get_type(field) (&(field)->type)
64#define dfield_get_data(field) ((field)->data)
192#define dtuple_get_nth_field(tuple, n) ((tuple)->fields + (n))
193#define dtuple_get_nth_v_field(tuple, n) \
194 ((tuple)->fields + (tuple)->n_fields + (n))
219#define DTUPLE_EST_ALLOC(n_fields) \
220 (sizeof(dtuple_t) + (n_fields) * sizeof(dfield_t))
303 uint64_t hash_value);
432 for (uint32_t i = 0; i <
num_v; ++i) {
446 if (num_alc < multi_value->
num_v) {
462 bool has(
const dtype_t *
type,
const byte *data, uint64_t len)
const;
474 bool has(
ulint mtype,
ulint prtype,
const byte *data, uint64_t len)
const;
485 for (uint32_t i = 1; i <
num_v; ++i) {
503 for (uint32_t i = 0; i < multi_value->
num_v; ++i) {
511 if (multi_value->
bitset !=
nullptr) {
541 byte *
log(
byte **ptr);
640 std::ostream &
print(std::ostream &out)
const;
664 const byte *sec_field, uint64_t sec_len,
673 return (obj.
print(out));
721 std::ostream &
print(std::ostream &out)
const {
745 ulint *matched_fields)
const;
756 const ulint *offsets)
const {
757 ulint matched_fields{};
759 return (
compare(rec, index, offsets, &matched_fields));
766 for (uint32_t i = 0; i <
n_fields; ++i) {
777 for (uint32_t i = 0; i <
n_fields; ++i) {
799 byte *
ptr()
const {
return (
static_cast<byte *
>(
data)); }
816 std::ostream &
print(std::ostream &out)
const;
825 return (obj.
print(out));
860 std::ostream &
print(std::ostream &out)
const;
869 return (obj.
print(out));
A simple bitset wrapper class, whose size can be specified after the object has been defined.
Definition: ut0bitset.h:39
Class to log the multi-value data and read it from the log.
Definition: data0data.h:524
Multi_value_logger(const multi_value_data *mv_data, uint32_t field_len)
Constructor.
Definition: data0data.h:529
static uint32_t read_log_len(const byte *ptr)
Read the log length for the multi-value data log starting from ptr.
Definition: data0data.cc:969
static constexpr uint16_t s_multi_value_no_index_value
Multi-value virtual column length, which indicates that there is no value on the multi-value index.
Definition: data0data.h:589
static constexpr uint32_t s_log_length_for_null_or_empty
Length of log for NULL value or no indexed value cases.
Definition: data0data.h:579
static bool is_multi_value_log(const byte *ptr)
Determine if the log starting from ptr is for multi-value data.
Definition: data0data.h:567
const multi_value_data * m_mv_data
Multi-value data.
Definition: data0data.h:573
static constexpr uint16_t s_multi_value_null
Multi-value virtual column length, which indicates that the field is NULL.
Definition: data0data.h:595
uint32_t m_field_len
Multi-value field length.
Definition: data0data.h:576
static uint32_t get_keys_capacity(uint32_t log_size, uint32_t key_length, uint32_t *num_keys)
Estimate how many multi-value keys at most can be accommodated into the log of specified size.
Definition: data0data.cc:1028
byte * log(byte **ptr)
Log the multi-value data to specified memory.
Definition: data0data.cc:929
uint32_t get_log_len(bool precise) const
Get the log length for the multi-value data.
Definition: data0data.cc:893
static constexpr uint8_t s_multi_value_virtual_col_length_marker
Multi-value virtual column length marker.
Definition: data0data.h:585
static const byte * read(const byte *ptr, dfield_t *field, mem_heap_t *heap)
Read the multi-value data from the ptr.
Definition: data0data.cc:982
static constexpr uint8_t s_max_compressed_mv_key_length_size
The compressed length for multi-value key length logging.
Definition: data0data.h:601
constexpr DWORD buf_size
Definition: create_def.cc:228
static void dtuple_init_v_fld(const dtuple_t *vrow)
Initialize the virtual field data in a dtuple_t.
bool dfield_datas_are_binary_equal(const dfield_t *field1, const dfield_t *field2, ulint len)
Tests if two data fields are equal.
Definition: data0data.ic:249
static spatial_status_t dfield_get_spatial_status(const dfield_t *field)
Gets spatial status for "external storage".
static uint64_t dtuple_hash(const dtuple_t *tuple, ulint n_fields, ulint n_bytes, uint64_t hash_value)
Compute a hash value of a prefix of an index record.
static void dfield_set_data(dfield_t *field, const void *data, ulint len)
Sets pointer to the data and length in a field.
static void dfield_set_ext(dfield_t *field)
Sets the "external storage" flag.
static void dtuple_set_info_bits(dtuple_t *tuple, ulint info_bits)
Sets info bits in a data tuple.
static void dfield_copy(dfield_t *field1, const dfield_t *field2)
Copies a data field to another.
static ulint dtuple_get_n_fields_cmp(const dtuple_t *tuple)
Gets number of fields used in record comparisons.
void dtuple_print(FILE *f, const dtuple_t *tuple)
The following function prints the contents of a tuple.
Definition: data0data.cc:368
static dtuple_t * dtuple_create(mem_heap_t *heap, ulint n_fields)
Creates a data tuple to a memory heap.
big_rec_t * dtuple_convert_big_rec(dict_index_t *index, upd_t *upd, dtuple_t *entry)
Moves parts of long fields in entry to the big record vector so that the size of tuple drops below th...
Definition: data0data.cc:422
static ulint dtuple_get_data_size(const dtuple_t *tuple, ulint comp)
The following function returns the sum of data lengths of a tuple.
static void dtuple_set_n_fields_cmp(dtuple_t *tuple, ulint n_fields_cmp)
Gets number of fields used in record comparisons.
static void dtuple_dup_v_fld(const dtuple_t *vrow, mem_heap_t *heap)
Duplicate the virtual field data in a dtuple_t.
static void dfield_set_len(dfield_t *field, ulint len)
Sets length in a field.
static void dfield_dup(dfield_t *field, mem_heap_t *heap)
Copies the data pointed to by a data field.
static void dfield_set_type(dfield_t *field, const dtype_t *type)
Sets the type struct of SQL data field.
static void dfield_multi_value_dup(dfield_t *field, mem_heap_t *heap)
Copies the data pointed to by a data field.
static void data_write_sql_null(byte *data, ulint len)
Writes an SQL null field full of zeros.
static void dfield_write_mbr(dfield_t *field, const double *mbr)
Sets pointer to the data and length in a field.
bool dfield_check_typed(const dfield_t *field)
Checks that a data field is typed.
Definition: data0data.cc:147
static dfield_t * dtuple_get_nth_v_field(const dtuple_t *tuple, ulint n)
Gets nth virtual field of a tuple.
bool dtuple_coll_eq(const dtuple_t *tuple1, const dtuple_t *tuple2)
Compare two data tuples.
Definition: data0data.cc:61
static uint32_t dfield_get_len(const dfield_t *field)
Gets length of field data.
void dfield_print_also_hex(const dfield_t *dfield)
Pretty prints a dfield value according to its data type.
Definition: data0data.cc:204
static bool dfield_is_ext(const dfield_t *field)
Determines if a field is externally stored.
static dtuple_t * dtuple_create_with_vcol(mem_heap_t *heap, ulint n_fields, ulint n_v_fields)
Creates a data tuple with possible virtual columns to a memory heap.
static dtuple_t * dtuple_create_from_mem(void *buf, ulint buf_size, ulint n_fields, ulint n_v_fields)
Creates a data tuple from an already allocated chunk of memory.
static void dtuple_big_rec_free(big_rec_t *vector)
Frees the memory in a big rec vector.
Definition: data0data.ic:651
static dtype_t * dfield_get_type(const dfield_t *field)
Gets pointer to the type struct of SQL data field.
static void dfield_set_spatial_status(dfield_t *field, spatial_status_t spatial_status)
Sets spatial status for "external storage".
static void dtuple_set_types_binary(dtuple_t *tuple, ulint n)
Sets types of fields binary in a tuple.
bool is_multi_value_clust_and_sec_equal(const byte *clust_field, uint64_t clust_len, const byte *sec_field, uint64_t sec_len, const dict_col_t *col)
Compare a multi-value clustered index field with a secondary index field, to see if they are equal.
Definition: data0data.cc:827
static dfield_t * dtuple_get_nth_field(const dtuple_t *tuple, ulint n)
Gets nth field of a tuple.
static bool dtuple_contains_null(const dtuple_t *tuple)
Checks if a dtuple contains an SQL null value.
constexpr uint32_t DATA_TUPLE_MAGIC_N
Value of dtuple_t::magic_n.
Definition: data0data.h:678
std::ostream & operator<<(std::ostream &o, const dtuple_t &tuple)
Print the contents of a tuple.
Definition: data0data.h:350
bool dtuple_check_typed(const dtuple_t *tuple)
Checks that a data tuple is typed.
Definition: data0data.cc:158
void dtuple_convert_back_big_rec(dtuple_t *entry, big_rec_t *vector)
Puts back to entry the data stored in vector.
Definition: data0data.cc:621
static bool dfield_is_multi_value(const dfield_t *field)
Determine if a field is of multi-value type.
static void dfield_copy_data(dfield_t *field1, const dfield_t *field2)
Copies the data and len fields.
static ulint dtuple_get_n_fields(const dtuple_t *tuple)
Gets number of fields in a data tuple.
static void dtuple_copy_v_fields(dtuple_t *d_tuple, const dtuple_t *s_tuple)
Copies a data tuple's virtual fields to another.
static dtuple_t * dtuple_copy(const dtuple_t *tuple, mem_heap_t *heap)
Copies a data tuple to another.
bool dtuple_validate(const dtuple_t *tuple)
Validates the consistency of a tuple which must be complete, i.e, all fields must have been set.
Definition: data0data.cc:171
void dfield_print(std::ostream &o, const dfield_t *field, ulint n)
Print the contents of a tuple.
Definition: data0data.cc:385
static ulint dtuple_get_n_v_fields(const dtuple_t *tuple)
Gets number of virtual fields in a data tuple.
void dtuple_set_n_fields(dtuple_t *tuple, ulint n_fields)
Sets number of fields used in a tuple.
Definition: data0data.cc:96
static void * dfield_get_data(const dfield_t *field)
Gets pointer to the data in a field.
static ulint dtuple_get_info_bits(const dtuple_t *tuple)
Gets info bits in a data tuple.
static bool dfield_data_is_binary_equal(const dfield_t *field, ulint len, const byte *data)
Tests if dfield data length and content is equal to the given.
static void dfield_set_null(dfield_t *field)
Sets a data field to SQL NULL.
static ulint dfield_is_null(const dfield_t *field)
Determines if a field is SQL NULL.
SQL data field and tuple.
Data dictionary global types.
spatial_status_t
whether a col is used in spatial index or regular index Note: the spatial status is part of persisten...
Definition: dict0types.h:346
@ SPATIAL_UNKNOWN
Definition: dict0types.h:348
Fido Client Authentication nullptr
Definition: fido_client_plugin.cc:222
#define malloc(A)
Definition: lexyy.cc:914
void * mem_heap_dup(mem_heap_t *heap, const void *data, ulint len)
Duplicate a block of data, allocated from a memory heap.
Definition: memory.cc:57
Definition: buf0block_hint.cc:30
const std::string FILE("FILE")
std::vector< T, ut::allocator< T > > vector
Specialization of vector which uses allocator.
Definition: ut0new.h:2874
byte rec_t
Definition: rem0types.h:41
required string type
Definition: replication_group_member_actions.proto:34
Definition: completion_hash.h:35
A slot for a field in a big rec vector.
Definition: data0data.h:787
void * data
stored data
Definition: data0data.h:803
bool ext_in_new
If true, this field is stored externally in the new row.
Definition: data0data.h:811
ulint field_no
field number in record
Definition: data0data.h:801
bool ext_in_old
If true, this field was stored externally in the old row.
Definition: data0data.h:807
big_rec_field_t(ulint field_no_, ulint len_, void *data_)
Constructor.
Definition: data0data.h:792
std::ostream & print(std::ostream &out) const
Print the big_rec_field_t object into the given output stream.
Definition: data0data.cc:764
ulint len
stored data length, in bytes
Definition: data0data.h:802
byte * ptr() const
Definition: data0data.h:799
Storage format for overflow data in a big record, that is, a clustered index record which needs exter...
Definition: data0data.h:830
void append(const big_rec_field_t &field)
Append one big_rec_field_t object to the end of array of fields.
Definition: data0data.h:843
const ulint capacity
fields array size
Definition: data0data.h:833
big_rec_field_t * fields
stored fields
Definition: data0data.h:835
big_rec_t(const ulint max)
Constructor.
Definition: data0data.h:839
ulint n_fields
number of stored fields
Definition: data0data.h:834
mem_heap_t * heap
memory heap from which allocated
Definition: data0data.h:831
std::ostream & print(std::ostream &out) const
Print the current object into the given output stream.
Definition: data0data.cc:771
static big_rec_t * alloc(mem_heap_t *heap, ulint n_fld)
Allocate a big_rec_t object in the given memory heap, and for storing n_fld number of fields.
Definition: data0data.cc:648
Structure for an SQL data field.
Definition: data0data.h:605
std::ostream & print(std::ostream &out) const
Print the dfield_t object into the given output stream.
Definition: data0data.cc:748
uint32_t lob_version() const
Obtain the LOB version number, if this is an externally stored field.
Definition: data0data.cc:688
dtype_t type
type of data
Definition: data0data.h:612
unsigned spatial_status
spatial status of externally stored field in undo log for purge
Definition: data0data.h:608
void reset()
Definition: data0data.h:616
byte * blobref() const
Definition: data0data.cc:682
bool ext
true=externally stored, false=local
Definition: data0data.h:607
dfield_t()
Definition: data0data.h:634
unsigned len
data length; UNIV_SQL_NULL if SQL null
Definition: data0data.h:611
dfield_t * clone(mem_heap_t *heap)
Create a deep copy of this object.
Definition: data0data.cc:662
void adjust_v_data_mysql(const dict_v_col_t *vcol, bool comp, const byte *field, ulint len, mem_heap_t *heap)
Adjust and(or) set virtual column value which is read from undo or online DDL log.
Definition: data0data.cc:696
bool is_virtual() const
Definition: data0data.h:614
void * data
pointer to data
Definition: data0data.h:606
Data structure for a column in a table.
Definition: dict0mem.h:489
Data structure for an index.
Definition: dict0mem.h:1046
Data structure for a virtual column in a table.
Definition: dict0mem.h:815
Structure for an SQL data tuple of fields (logical record)
Definition: data0data.h:682
size_t get_n_ext() const
Get number of externally stored fields.
Definition: data0data.h:764
mem_heap_t * m_heap
Memory heap where this tuple is allocated.
Definition: data0data.h:709
uint16_t n_fields
Number of fields in dtuple.
Definition: data0data.h:688
int compare(const rec_t *rec, const dict_index_t *index, const ulint *offsets) const
Compare a data tuple to a physical record.
Definition: data0data.h:755
static constexpr size_t MAGIC_N
Value of dtuple_t::magic_n.
Definition: data0data.h:712
trx_id_t get_trx_id() const
Read the trx id from the tuple (DB_TRX_ID)
Definition: data0data.cc:782
uint16_t n_fields_cmp
number of fields which should be used in comparison services of rem0cmp.
Definition: data0data.h:693
bool has_ext() const
Does tuple has externally stored fields.
Definition: data0data.h:776
dfield_t * fields
Fields.
Definition: data0data.h:696
int compare(const rec_t *rec, const dict_index_t *index, const ulint *offsets, ulint *matched_fields) const
Compare a data tuple to a physical record.
Definition: rem0cmp.cc:1123
uint16_t n_v_fields
Number of virtual fields.
Definition: data0data.h:699
UT_LIST_NODE_T(dtuple_t) tuple_list
Data tuples can be linked into a list using this field.
std::ostream & print(std::ostream &out) const
Print the tuple to the output stream.
Definition: data0data.h:721
void ignore_trailing_default(const dict_index_t *index)
Ignore at most n trailing default fields if this is a tuple from instant index.
Definition: data0data.cc:796
uint16_t info_bits
info bits of an index record: the default is 0; this field is used if an index record is built from a...
Definition: data0data.h:685
dfield_t * v_fields
Fields on virtual column.
Definition: data0data.h:702
size_t magic_n
Magic number, used in debug assertions.
Definition: data0data.h:715
Definition: data0type.h:498
bool is_virtual() const
Definition: data0type.h:524
The info structure stored at the beginning of a heap block.
Definition: mem0mem.h:302
Structure to hold number of multiple values.
Definition: data0data.h:384
const void ** datap
points to different value
Definition: data0data.h:387
static constexpr uint32_t s_default_allocate_num
default number of multiple values
Definition: data0data.h:520
uint64_t * conv_buf
convert buffer if the data is an integer
Definition: data0data.h:393
void copy_low(const multi_value_data *multi_value, mem_heap_t *heap)
Copy a multi_value_data structure, current one should be bigger or equal to the one to be copied.
Definition: data0data.h:501
bool duplicate() const
Definition: data0data.h:480
uint32_t num_alc
number of pointers allocated
Definition: data0data.h:399
uint32_t num_v
number of values
Definition: data0data.h:396
void alloc_bitset(mem_heap_t *heap, uint32_t size=0)
Allocate the bitset for current data array.
Definition: data0data.cc:882
void alloc(uint32_t num, bool bitset, mem_heap_t *heap)
Allocate specified number of elements for all arrays and initialize the structure accordingly.
Definition: data0data.cc:865
bool has(const dtype_t *type, const byte *data, uint64_t len) const
Compare and check if one value from dfield_t is in current data set.
Definition: data0data.cc:845
void copy(const multi_value_data *multi_value, mem_heap_t *heap)
Copy a multi_value_data structure.
Definition: data0data.h:445
Bitset * bitset
Bitset to indicate which data should be handled for current data array.
Definition: data0data.h:408
uint32_t * data_len
each individual value length
Definition: data0data.h:390
bool equal(const multi_value_data *multi_value) const
Check if two multi_value_data are equal or not, regardless of bitset.
Definition: data0data.h:427
Definition: row0upd.h:565
mem_heap_t * heap
Heap from which memory allocated.
Definition: row0upd.h:569
ulint info_bits
New value of info bits to record; default is 0.
Definition: row0upd.h:577
ulint n_fields
Number of update fields.
Definition: row0upd.h:589
Transaction system global type definitions.
ib_id_t trx_id_t
Transaction identifier (DB_TRX_ID, DATA_TRX_ID)
Definition: trx0types.h:138
Version control for database, common definitions, and include files.
unsigned long int ulint
Definition: univ.i:406
Utilities for bitset operations.
#define ut_ad(EXPR)
Debug assertion.
Definition: ut0dbg.h:69
int n
Definition: xcom_base.cc:509