62#define dfield_get_type(field) (&(field)->type)
63#define dfield_get_data(field) ((field)->data)
191#define dtuple_get_nth_field(tuple, n) ((tuple)->fields + (n))
192#define dtuple_get_nth_v_field(tuple, n) \
193 ((tuple)->fields + (tuple)->n_fields + (n))
218#define DTUPLE_EST_ALLOC(n_fields) \
219 (sizeof(dtuple_t) + (n_fields) * sizeof(dfield_t))
302 uint64_t hash_value);
431 for (uint32_t i = 0; i <
num_v; ++i) {
445 if (num_alc < multi_value->
num_v) {
461 bool has(
const dtype_t *
type,
const byte *data, uint64_t len)
const;
473 bool has(
ulint mtype,
ulint prtype,
const byte *data, uint64_t len)
const;
484 for (uint32_t i = 1; i <
num_v; ++i) {
502 for (uint32_t i = 0; i < multi_value->
num_v; ++i) {
510 if (multi_value->
bitset !=
nullptr) {
540 byte *
log(
byte **ptr);
639 std::ostream &
print(std::ostream &out)
const;
663 const byte *sec_field, uint64_t sec_len,
672 return (obj.
print(out));
720 std::ostream &
print(std::ostream &out)
const {
744 ulint *matched_fields)
const;
755 const ulint *offsets)
const {
756 ulint matched_fields{};
758 return (
compare(rec, index, offsets, &matched_fields));
765 for (uint32_t i = 0; i <
n_fields; ++i) {
776 for (uint32_t i = 0; i <
n_fields; ++i) {
798 byte *
ptr()
const {
return (
static_cast<byte *
>(
data)); }
815 std::ostream &
print(std::ostream &out)
const;
824 return (obj.
print(out));
859 std::ostream &
print(std::ostream &out)
const;
868 return (obj.
print(out));
A simple bitset wrapper class, whose size can be specified after the object has been defined.
Definition: ut0bitset.h:38
Class to log the multi-value data and read it from the log.
Definition: data0data.h:523
Multi_value_logger(const multi_value_data *mv_data, uint32_t field_len)
Constructor.
Definition: data0data.h:528
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:968
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:588
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:578
static bool is_multi_value_log(const byte *ptr)
Determine if the log starting from ptr is for multi-value data.
Definition: data0data.h:566
const multi_value_data * m_mv_data
Multi-value data.
Definition: data0data.h:572
static constexpr uint16_t s_multi_value_null
Multi-value virtual column length, which indicates that the field is NULL.
Definition: data0data.h:594
uint32_t m_field_len
Multi-value field length.
Definition: data0data.h:575
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:1027
byte * log(byte **ptr)
Log the multi-value data to specified memory.
Definition: data0data.cc:928
uint32_t get_log_len(bool precise) const
Get the log length for the multi-value data.
Definition: data0data.cc:892
static constexpr uint8_t s_multi_value_virtual_col_length_marker
Multi-value virtual column length marker.
Definition: data0data.h:584
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:981
static constexpr uint8_t s_max_compressed_mv_key_length_size
The compressed length for multi-value key length logging.
Definition: data0data.h:600
constexpr DWORD buf_size
Definition: create_def.cc:227
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:248
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:367
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:421
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:146
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:60
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:203
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:650
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:826
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:677
std::ostream & operator<<(std::ostream &o, const dtuple_t &tuple)
Print the contents of a tuple.
Definition: data0data.h:349
bool dtuple_check_typed(const dtuple_t *tuple)
Checks that a data tuple is typed.
Definition: data0data.cc:157
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:620
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:170
void dfield_print(std::ostream &o, const dfield_t *field, ulint n)
Print the contents of a tuple.
Definition: data0data.cc:384
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:95
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:331
@ SPATIAL_UNKNOWN
Definition: dict0types.h:333
Fido Client Authentication nullptr
Definition: fido_client_plugin.cc:221
#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:56
Definition: buf0block_hint.cc:29
const std::string FILE("FILE")
std::vector< T, ut::allocator< T > > vector
Specialization of vector which uses allocator.
Definition: ut0new.h:2873
byte rec_t
Definition: rem0types.h:40
required string type
Definition: replication_group_member_actions.proto:33
Definition: completion_hash.h:34
A slot for a field in a big rec vector.
Definition: data0data.h:786
void * data
stored data
Definition: data0data.h:802
bool ext_in_new
If true, this field is stored externally in the new row.
Definition: data0data.h:810
ulint field_no
field number in record
Definition: data0data.h:800
bool ext_in_old
If true, this field was stored externally in the old row.
Definition: data0data.h:806
big_rec_field_t(ulint field_no_, ulint len_, void *data_)
Constructor.
Definition: data0data.h:791
std::ostream & print(std::ostream &out) const
Print the big_rec_field_t object into the given output stream.
Definition: data0data.cc:763
ulint len
stored data length, in bytes
Definition: data0data.h:801
byte * ptr() const
Definition: data0data.h:798
Storage format for overflow data in a big record, that is, a clustered index record which needs exter...
Definition: data0data.h:829
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:842
const ulint capacity
fields array size
Definition: data0data.h:832
big_rec_field_t * fields
stored fields
Definition: data0data.h:834
big_rec_t(const ulint max)
Constructor.
Definition: data0data.h:838
ulint n_fields
number of stored fields
Definition: data0data.h:833
mem_heap_t * heap
memory heap from which allocated
Definition: data0data.h:830
std::ostream & print(std::ostream &out) const
Print the current object into the given output stream.
Definition: data0data.cc:770
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:647
Structure for an SQL data field.
Definition: data0data.h:604
std::ostream & print(std::ostream &out) const
Print the dfield_t object into the given output stream.
Definition: data0data.cc:747
uint32_t lob_version() const
Obtain the LOB version number, if this is an externally stored field.
Definition: data0data.cc:687
dtype_t type
type of data
Definition: data0data.h:611
unsigned spatial_status
spatial status of externally stored field in undo log for purge
Definition: data0data.h:607
void reset()
Definition: data0data.h:615
byte * blobref() const
Definition: data0data.cc:681
bool ext
true=externally stored, false=local
Definition: data0data.h:606
dfield_t()
Definition: data0data.h:633
unsigned len
data length; UNIV_SQL_NULL if SQL null
Definition: data0data.h:610
dfield_t * clone(mem_heap_t *heap)
Create a deep copy of this object.
Definition: data0data.cc:661
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:695
bool is_virtual() const
Definition: data0data.h:613
void * data
pointer to data
Definition: data0data.h:605
Data structure for a column in a table.
Definition: dict0mem.h:488
Data structure for an index.
Definition: dict0mem.h:1045
Data structure for a virtual column in a table.
Definition: dict0mem.h:814
Structure for an SQL data tuple of fields (logical record)
Definition: data0data.h:681
size_t get_n_ext() const
Get number of externally stored fields.
Definition: data0data.h:763
mem_heap_t * m_heap
Memory heap where this tuple is allocated.
Definition: data0data.h:708
uint16_t n_fields
Number of fields in dtuple.
Definition: data0data.h:687
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:754
static constexpr size_t MAGIC_N
Value of dtuple_t::magic_n.
Definition: data0data.h:711
trx_id_t get_trx_id() const
Read the trx id from the tuple (DB_TRX_ID)
Definition: data0data.cc:781
uint16_t n_fields_cmp
number of fields which should be used in comparison services of rem0cmp.
Definition: data0data.h:692
bool has_ext() const
Does tuple has externally stored fields.
Definition: data0data.h:775
dfield_t * fields
Fields.
Definition: data0data.h:695
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:698
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:720
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:795
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:684
dfield_t * v_fields
Fields on virtual column.
Definition: data0data.h:701
size_t magic_n
Magic number, used in debug assertions.
Definition: data0data.h:714
Definition: data0type.h:497
bool is_virtual() const
Definition: data0type.h:523
The info structure stored at the beginning of a heap block.
Definition: mem0mem.h:301
Structure to hold number of multiple values.
Definition: data0data.h:383
const void ** datap
points to different value
Definition: data0data.h:386
static constexpr uint32_t s_default_allocate_num
default number of multiple values
Definition: data0data.h:519
uint64_t * conv_buf
convert buffer if the data is an integer
Definition: data0data.h:392
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:500
bool duplicate() const
Definition: data0data.h:479
uint32_t num_alc
number of pointers allocated
Definition: data0data.h:398
uint32_t num_v
number of values
Definition: data0data.h:395
void alloc_bitset(mem_heap_t *heap, uint32_t size=0)
Allocate the bitset for current data array.
Definition: data0data.cc:881
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:864
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:844
void copy(const multi_value_data *multi_value, mem_heap_t *heap)
Copy a multi_value_data structure.
Definition: data0data.h:444
Bitset * bitset
Bitset to indicate which data should be handled for current data array.
Definition: data0data.h:407
uint32_t * data_len
each individual value length
Definition: data0data.h:389
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:426
Definition: row0upd.h:564
mem_heap_t * heap
Heap from which memory allocated.
Definition: row0upd.h:568
ulint info_bits
New value of info bits to record; default is 0.
Definition: row0upd.h:576
ulint n_fields
Number of update fields.
Definition: row0upd.h:588
Transaction system global type definitions.
ib_id_t trx_id_t
Transaction identifier (DB_TRX_ID, DATA_TRX_ID)
Definition: trx0types.h:137
Version control for database, common definitions, and include files.
unsigned long int ulint
Definition: univ.i:405
Utilities for bitset operations.
#define ut_ad(EXPR)
Debug assertion.
Definition: ut0dbg.h:68
int n
Definition: xcom_base.cc:508