MySQL 26.7.0
Source Code Documentation
data0data.h
Go to the documentation of this file.
1/*****************************************************************************
2
3Copyright (c) 1994, 2026, Oracle and/or its affiliates.
4
5This program is free software; you can redistribute it and/or modify it under
6the terms of the GNU General Public License, version 2.0, as published by the
7Free Software Foundation.
8
9This program is designed to work with certain software (including
10but not limited to OpenSSL) that is licensed under separate terms,
11as designated in a particular file or component or in included license
12documentation. The authors of MySQL hereby grant you an additional
13permission to link the program and your derivative works with the
14separately licensed software that they have either included with
15the program or referenced in the documentation.
16
17This program is distributed in the hope that it will be useful, but WITHOUT
18ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
19FOR A PARTICULAR PURPOSE. See the GNU General Public License, version 2.0,
20for more details.
21
22You should have received a copy of the GNU General Public License along with
23this program; if not, write to the Free Software Foundation, Inc.,
2451 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
25
26*****************************************************************************/
27
28/** @file include/data0data.h
29 SQL data field and tuple
30
31 Created 5/30/1994 Heikki Tuuri
32 *************************************************************************/
33
34#ifndef data0data_h
35#define data0data_h
36
37#include "univ.i"
38
39#include "data0type.h"
40#include "data0types.h"
41#include "dict0types.h"
42#include "mem0mem.h"
43#include "trx0types.h"
44#include "ut0bitset.h"
45
46#include <ostream>
47
48/** Storage for overflow data in a big record, that is, a clustered
49index record which needs external storage of data fields */
50struct big_rec_t;
51struct upd_t;
52
53#ifdef UNIV_DEBUG
54/** Gets pointer to the type struct of SQL data field.
55 @return pointer to the type struct */
56[[nodiscard]] static inline dtype_t *dfield_get_type(
57 const dfield_t *field); /*!< in: SQL data field */
58/** Gets pointer to the data in a field.
59 @return pointer to data */
60[[nodiscard]] static inline void *dfield_get_data(
61 const dfield_t *field); /*!< in: field */
62#else /* UNIV_DEBUG */
63#define dfield_get_type(field) (&(field)->type)
64#define dfield_get_data(field) ((field)->data)
65#endif /* UNIV_DEBUG */
66
67/** Sets the type struct of SQL data field.
68@param[in] field SQL data field
69@param[in] type pointer to data type struct */
70static inline void dfield_set_type(dfield_t *field, const dtype_t *type);
71
72/** Gets length of field data.
73 @return length of data; UNIV_SQL_NULL if SQL null data */
74[[nodiscard]] static inline uint32_t dfield_get_len(
75 const dfield_t *field); /*!< in: field */
76
77/** Sets length in a field.
78@param[in] field field
79@param[in] len length or UNIV_SQL_NULL */
80static inline void dfield_set_len(dfield_t *field, ulint len);
81
82/** Determines if a field is SQL NULL
83 @return nonzero if SQL null data */
84[[nodiscard]] static inline ulint dfield_is_null(
85 const dfield_t *field); /*!< in: field */
86/** Determines if a field is externally stored
87 @return nonzero if externally stored */
88[[nodiscard]] static inline bool dfield_is_ext(
89 const dfield_t *field); /*!< in: field */
90/** Sets the "external storage" flag */
91static inline void dfield_set_ext(dfield_t *field); /*!< in/out: field */
92
93/** Gets spatial status for "external storage"
94@param[in,out] field field */
96
97/** Sets spatial status for "external storage"
98@param[in,out] field field
99@param[in] spatial_status spatial status */
100static inline void dfield_set_spatial_status(dfield_t *field,
101 spatial_status_t spatial_status);
102
103/** Sets pointer to the data and length in a field.
104@param[in] field field
105@param[in] data data
106@param[in] len length or UNIV_SQL_NULL */
107static inline void dfield_set_data(dfield_t *field, const void *data,
108 ulint len);
109
110/** Sets pointer to the data and length in a field.
111@param[in] field field
112@param[in] mbr data */
113static inline void dfield_write_mbr(dfield_t *field, const double *mbr);
114
115/** Sets a data field to SQL NULL. */
116static inline void dfield_set_null(dfield_t *field); /*!< in/out: field */
117
118/** Writes an SQL null field full of zeros.
119@param[in] data pointer to a buffer of size len
120@param[in] len SQL null size in bytes */
121static inline void data_write_sql_null(byte *data, ulint len);
122
123/** Copies the data and len fields.
124@param[out] field1 field to copy to
125@param[in] field2 field to copy from */
126static inline void dfield_copy_data(dfield_t *field1, const dfield_t *field2);
127
128/** Copies a data field to another.
129@param[out] field1 field to copy to
130@param[in] field2 field to copy from */
131static inline void dfield_copy(dfield_t *field1, const dfield_t *field2);
132
133/** Copies the data pointed to by a data field.
134@param[in,out] field data field
135@param[in] heap memory heap where allocated */
136static inline void dfield_dup(dfield_t *field, mem_heap_t *heap);
137
138/** Copies the data pointed to by a data field.
139This function works for multi-value fields only.
140@param[in,out] field data field
141@param[in] heap memory heap where allocated */
142static inline void dfield_multi_value_dup(dfield_t *field, mem_heap_t *heap);
143
144/** Determine if a field is of multi-value type
145@param[in] field data field
146@return true if multi-value type field, otherwise false */
147static inline bool dfield_is_multi_value(const dfield_t *field);
148
149/** Tests if two data fields are equal.
150If len==0, tests the data length and content for equality.
151If len>0, tests the first len bytes of the content for equality.
152@param[in] field1 first field to compare
153@param[in] field2 second field to compare
154@param[in] len maximum prefix to compare,
155 or 0 to compare the whole field length.
156 This works only if !multi_val
157@return true if both fields are NULL or if they are equal */
158[[nodiscard]] inline bool dfield_datas_are_binary_equal(const dfield_t *field1,
159 const dfield_t *field2,
160 ulint len = 0);
161/** Tests if dfield data length and content is equal to the given.
162@param[in] field Field
163@param[in] len Data length or UNIV_SQL_NULL
164@param[in] data Data
165@return true if equal */
166[[nodiscard]] static inline bool dfield_data_is_binary_equal(
167 const dfield_t *field, ulint len, const byte *data);
168/** Gets number of fields in a data tuple.
169 @return number of fields */
170[[nodiscard]] static inline ulint dtuple_get_n_fields(
171 const dtuple_t *tuple); /*!< in: tuple */
172
173/** Gets number of virtual fields in a data tuple.
174@param[in] tuple dtuple to check
175@return number of fields */
176static inline ulint dtuple_get_n_v_fields(const dtuple_t *tuple);
177
178#ifdef UNIV_DEBUG
179/** Gets nth field of a tuple.
180@param[in] tuple tuple
181@param[in] n index of field
182@return nth field */
183static inline dfield_t *dtuple_get_nth_field(const dtuple_t *tuple, ulint n);
184
185/** Gets nth virtual field of a tuple.
186@param[in] tuple tuple
187@param[in] n the nth field to get
188@return nth field */
189static inline dfield_t *dtuple_get_nth_v_field(const dtuple_t *tuple, ulint n);
190
191#else /* UNIV_DEBUG */
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))
195#endif /* UNIV_DEBUG */
196/** Gets info bits in a data tuple.
197 @return info bits */
198[[nodiscard]] static inline ulint dtuple_get_info_bits(
199 const dtuple_t *tuple); /*!< in: tuple */
200
201/** Sets info bits in a data tuple.
202@param[in] tuple tuple
203@param[in] info_bits info bits */
204static inline void dtuple_set_info_bits(dtuple_t *tuple, ulint info_bits);
205
206/** Gets number of fields used in record comparisons.
207 @return number of fields used in comparisons in rem0cmp.* */
208[[nodiscard]] static inline ulint dtuple_get_n_fields_cmp(
209 const dtuple_t *tuple); /*!< in: tuple */
210
211/** Gets number of fields used in record comparisons.
212@param[in] tuple tuple
213@param[in] n_fields_cmp number of fields used in comparisons in
214 rem0cmp */
215static inline void dtuple_set_n_fields_cmp(dtuple_t *tuple, ulint n_fields_cmp);
216
217/* Estimate the number of bytes that are going to be allocated when
218creating a new dtuple_t object */
219#define DTUPLE_EST_ALLOC(n_fields) \
220 (sizeof(dtuple_t) + (n_fields) * sizeof(dfield_t))
221
222/** Creates a data tuple from an already allocated chunk of memory.
223 The size of the chunk must be at least DTUPLE_EST_ALLOC(n_fields).
224 The default value for number of fields used in record comparisons
225 for this tuple is n_fields.
226 @param[in,out] buf buffer to use
227 @param[in] buf_size buffer size
228 @param[in] n_fields number of field
229 @param[in] n_v_fields number of fields on virtual columns
230 @return created tuple (inside buf) */
231[[nodiscard]] static inline dtuple_t *dtuple_create_from_mem(void *buf,
234 ulint n_v_fields);
235/** Creates a data tuple to a memory heap. The default value for number
236 of fields used in record comparisons for this tuple is n_fields.
237 @return own: created tuple */
238static inline dtuple_t *dtuple_create(
239 mem_heap_t *heap, /*!< in: memory heap where the tuple
240 is created, DTUPLE_EST_ALLOC(n_fields)
241 bytes will be allocated from this heap */
242 ulint n_fields) /*!< in: number of fields */
243 MY_ATTRIBUTE((malloc));
244
245/** Initialize the virtual field data in a dtuple_t
246@param[in,out] vrow dtuple contains the virtual fields */
247static inline void dtuple_init_v_fld(const dtuple_t *vrow);
248
249/** Duplicate the virtual field data in a dtuple_t
250@param[in,out] vrow dtuple contains the virtual fields
251@param[in] heap heap memory to use */
252static inline void dtuple_dup_v_fld(const dtuple_t *vrow, mem_heap_t *heap);
253
254/** Creates a data tuple with possible virtual columns to a memory heap.
255@param[in] heap memory heap where the tuple is created
256@param[in] n_fields number of fields
257@param[in] n_v_fields number of fields on virtual col
258@return own: created tuple */
261 ulint n_v_fields);
262/** Sets number of fields used in a tuple. Normally this is set in
263dtuple_create, but if you want later to set it smaller, you can use this.
264@param[in] tuple Tuple.
265@param[in] n_fields Number of fields. */
267
268/** Copies a data tuple's virtual fields to another. This is a shallow copy;
269@param[in,out] d_tuple destination tuple
270@param[in] s_tuple source tuple */
271static inline void dtuple_copy_v_fields(dtuple_t *d_tuple,
272 const dtuple_t *s_tuple);
273/** Copies a data tuple to another. This is a shallow copy; if a deep copy
274 is desired, dfield_dup() will have to be invoked on each field.
275 @return own: copy of tuple */
276static inline dtuple_t *dtuple_copy(
277 const dtuple_t *tuple, /*!< in: tuple to copy from */
278 mem_heap_t *heap) /*!< in: memory heap
279 where the tuple is created */
280 MY_ATTRIBUTE((malloc));
281
282/** The following function returns the sum of data lengths of a tuple. The space
283occupied by the field structs or the tuple struct is not counted.
284@param[in] tuple typed data tuple
285@param[in] comp nonzero=ROW_FORMAT=COMPACT
286@return sum of data lens */
287static inline ulint dtuple_get_data_size(const dtuple_t *tuple, ulint comp);
288/** Compare two data tuples.
289@param[in] tuple1 first data tuple
290@param[in] tuple2 second data tuple
291@return whether tuple1==tuple2 */
292[[nodiscard]] bool dtuple_coll_eq(const dtuple_t *tuple1,
293 const dtuple_t *tuple2);
294
295/** Compute a hash value of a prefix of an index record.
296@param[in] tuple index record
297@param[in] n_fields number of fields to include
298@param[in] n_bytes number of bytes to hash in the last field
299@param[in] hash_value hash value of the index identifier
300@return the hashed value */
301[[nodiscard]] static inline uint64_t dtuple_hash(const dtuple_t *tuple,
302 ulint n_fields, ulint n_bytes,
303 uint64_t hash_value);
304
305/** Sets types of fields binary in a tuple.
306@param[in] tuple data tuple
307@param[in] n number of fields to set */
308static inline void dtuple_set_types_binary(dtuple_t *tuple, ulint n);
309
310/** Checks if a dtuple contains an SQL null value.
311 @return true if some field is SQL null */
312[[nodiscard]] static inline bool dtuple_contains_null(
313 const dtuple_t *tuple); /*!< in: dtuple */
314/** Checks that a data field is typed. Asserts an error if not.
315 @return true if ok */
316[[nodiscard]] bool dfield_check_typed(
317 const dfield_t *field); /*!< in: data field */
318/** Checks that a data tuple is typed. Asserts an error if not.
319 @return true if ok */
320[[nodiscard]] bool dtuple_check_typed(const dtuple_t *tuple); /*!< in: tuple */
321#ifdef UNIV_DEBUG
322/** Validates the consistency of a tuple which must be complete, i.e,
323 all fields must have been set.
324 @return true if ok */
325[[nodiscard]] bool dtuple_validate(const dtuple_t *tuple); /*!< in: tuple */
326#endif /* UNIV_DEBUG */
327/** Pretty prints a dfield value according to its data type. Also the hex string
328 is printed if a string contains non-printable characters. */
329void dfield_print_also_hex(const dfield_t *dfield); /*!< in: dfield */
330
331/** The following function prints the contents of a tuple.
332@param[in,out] f Output stream.
333@param[in] tuple Tuple to print. */
334void dtuple_print(FILE *f, const dtuple_t *tuple);
335
336/** Print the contents of a tuple.
337@param[out] o output stream
338@param[in] field array of data fields
339@param[in] n number of data fields */
340void dfield_print(std::ostream &o, const dfield_t *field, ulint n);
341
342/** Print the contents of a tuple.
343@param[out] o output stream
344@param[in] tuple data tuple */
345void dtuple_print(std::ostream &o, const dtuple_t *tuple);
346
347/** Print the contents of a tuple, followed by a newline.
348@param[out] o output stream
349@param[in] tuple data tuple */
350inline void dtuple_println(std::ostream &o, const dtuple_t *tuple) {
351 dtuple_print(o, tuple);
352 o << std::endl;
353}
354
355/** Print the contents of a tuple.
356@param[out] o output stream
357@param[in] tuple data tuple */
358inline std::ostream &operator<<(std::ostream &o, const dtuple_t &tuple) {
359 dtuple_print(o, &tuple);
360 return (o);
361}
362
363/** Moves parts of long fields in entry to the big record vector so that
364the size of tuple drops below the maximum record size allowed in the
365database. Moves data only from those fields which are not necessary
366to determine uniquely the insertion place of the tuple in the index.
367@param[in,out] index Index that owns the record.
368@param[in,out] upd Update vector.
369@param[in,out] entry Index entry.
370@return own: created big record vector, NULL if we are not able to
371shorten the entry enough, i.e., if there are too many fixed-length or
372short fields in entry or the index is clustered */
375 MY_ATTRIBUTE((malloc));
376
377/** Puts back to entry the data stored in vector. Note that to ensure the
378fields in entry can accommodate the data, vector must have been created
379from entry with dtuple_convert_big_rec.
380@param[in] entry Entry whose data was put to vector.
381@param[in] vector Big rec vector; it is freed in this function*/
383
384/** Frees the memory in a big rec vector. */
385static inline void dtuple_big_rec_free(
386 big_rec_t *vector); /*!< in, own: big rec vector; it is
387 freed in this function */
388
389/*######################################################################*/
390
391/** Structure to hold number of multiple values */
393 public:
394 /** points to different value */
395 const void **datap;
396
397 /** each individual value length */
398 uint32_t *data_len;
399
400 /** convert buffer if the data is an integer */
401 uint64_t *conv_buf;
402
403 /** number of values */
404 uint32_t num_v;
405
406 /** number of pointers allocated */
407 uint32_t num_alc;
408
409 /** Bitset to indicate which data should be handled for current data
410 array. This is mainly used for UPDATE case. UPDATE may not need
411 to delete all old values and insert all new values because there could
412 be some same values in both old and new data array.
413 If current data array is for INSERT and DELETE, this can(should) be
414 nullptr since all values in current array should be handled in these
415 two cases. */
417
418#ifdef UNIV_DEBUG
419 /** The size of bitmap buffer in bytes. The bitset might point into
420 some prefix of it, and be later made shorter or longer, but not longer
421 than this length of underlying buffer. */
422 size_t bitmap_bytes{};
423#endif
424
425 /** Allocate specified number of elements for all arrays and initialize
426 the structure accordingly
427 @param[in] num number of elements to allocate
428 @param[in] bitset true if memory for bitset should be
429 allocated too
430 @param[in,out] heap memory heap */
431 void alloc(uint32_t num, bool bitset, mem_heap_t *heap);
432
433 /** Allocate the bitset for current data array
434 @param[in,out] heap memory heap
435 @param[in] size size of the bitset, if 0 or default,
436 the size would be num_v */
437 void alloc_bitset(mem_heap_t *heap, uint32_t size = 0);
438
439 /** Check if two multi_value_data are equal or not, regardless of bitset
440 @param[in] multi_value Another multi-value data to be compared
441 @return true if two data structures are equal, otherwise false */
442 bool equal(const multi_value_data *multi_value) const {
443 if (num_v != multi_value->num_v) {
444 return (false);
445 }
446
447 for (uint32_t i = 0; i < num_v; ++i) {
448 if (data_len[i] != multi_value->data_len[i] ||
449 memcmp(datap[i], multi_value->datap[i], data_len[i]) != 0) {
450 return (false);
451 }
452 }
453
454 return (true);
455 }
456
457 /** Copy a multi_value_data structure
458 @param[in] multi_value multi_value structure to copy from
459 @param[in,out] heap memory heap */
460 void copy(const multi_value_data *multi_value, mem_heap_t *heap) {
461 if (num_alc < multi_value->num_v) {
462 alloc(multi_value->num_v, (multi_value->bitset != nullptr), heap);
463 }
464
465 copy_low(multi_value, heap);
466 }
467
468 /** Compare and check if one value from dfield_t is in current data set.
469 Any caller calls this function to check if one field from clustered index
470 is equal to a record on multi-value index should understand that this
471 function can only be used for equality comparison, rather than order
472 comparison
473 @param[in] type type of the data
474 @param[in] data data value to compare
475 @param[in] len length of data
476 @return true if the value exists in current data set, otherwise false */
477 bool has(const dtype_t *type, const byte *data, uint64_t len) const;
478
479 /** Compare and check if one value from dfield_t is in current data set.
480 Any caller calls this function to check if one field from clustered index
481 is equal to a record on multi-value index should understand that this
482 function can only be used for equality comparison, rather than order
483 comparison
484 @param[in] mtype mtype of data
485 @param[in] prtype prtype of data
486 @param[in] data data value to compare
487 @param[in] len length of data
488 @return true if the value exists in current data set, otherwise false */
489 bool has(ulint mtype, ulint prtype, const byte *data, uint64_t len) const;
490
491#ifdef UNIV_DEBUG
492 /* Check if there is any duplicate data in this array.
493 It is safe to assume all the data has been sorted.
494 @return true if duplicate data found, otherwise false */
495 bool duplicate() const {
496 /* Since the array is guaranteed to be sorted, so it is fine to
497 scan it sequentially and only compare current one with previous one
498 if exists. */
499 if (num_v > 1) {
500 for (uint32_t i = 1; i < num_v; ++i) {
501 if (data_len[i] == data_len[i - 1] &&
502 memcmp(datap[i], datap[i - 1], data_len[i]) == 0) {
503 return (true);
504 }
505 }
506 }
507 return (false);
508 }
509#endif /* UNIV_DEBUG */
510
511 private:
512 /** Copy a multi_value_data structure, current one should be bigger
513 or equal to the one to be copied
514 @param[in] multi_value multi_value structure to copy from
515 @param[in,out] heap memory heap */
516 void copy_low(const multi_value_data *multi_value, mem_heap_t *heap) {
517 ut_ad(num_alc >= multi_value->num_v);
518 for (uint32_t i = 0; i < multi_value->num_v; ++i) {
519 datap[i] =
520 mem_heap_dup(heap, multi_value->datap[i], multi_value->data_len[i]);
521 }
522 memcpy(data_len, multi_value->data_len,
523 sizeof(*data_len) * multi_value->num_v);
524 memcpy(conv_buf, multi_value->conv_buf,
525 sizeof(*conv_buf) * multi_value->num_v);
526 if (multi_value->bitset != nullptr) {
527 ut_ad(bitset != nullptr);
528 ut_ad_le(multi_value->bitset->size_bytes(), bitmap_bytes);
529 /* adjust the size to match that of multi_value, but keep pointing to the
530 old buffer */
531 *bitset = Bitset<>(bitset->data(), multi_value->bitset->size_bytes());
532 /* copy the actual data into the buffer from multi_value's buffer */
533 bitset->copy_from(multi_value->bitset->data());
534 }
535 num_v = multi_value->num_v;
536 }
537
538 public:
539 /** default number of multiple values */
540 static constexpr uint32_t s_default_allocate_num = 24;
541};
542
543/** Class to log the multi-value data and read it from the log */
545 public:
546 /** Constructor
547 @param[in] mv_data multi-value data structure to log
548 @param[in] field_len multi-value data field length */
549 Multi_value_logger(const multi_value_data *mv_data, uint32_t field_len)
550 : m_mv_data(mv_data), m_field_len(field_len) {}
551
552 /** Get the log length for the multi-value data
553 @param[in] precise true if precise length is needed, false if rough
554 estimation is OK
555 @return the total log length for the multi-value data */
556 uint32_t get_log_len(bool precise) const;
557
558 /** Log the multi-value data to specified memory
559 @param[in,out] ptr the memory to write
560 @return next to the end of the multi-value data log */
561 byte *log(byte **ptr);
562
563 /** Read the log length for the multi-value data log starting from ptr
564 @param[in] ptr log starting from here
565 @return the length of this log */
566 static uint32_t read_log_len(const byte *ptr);
567
568 /** Read the multi-value data from the ptr
569 @param[in] ptr log starting from here
570 @param[in,out] field multi-value data field to store the array
571 @param[in,out] heap memory heap
572 @return next to the end of the multi-value data log */
573 static const byte *read(const byte *ptr, dfield_t *field, mem_heap_t *heap);
574
575 /** Estimate how many multi-value keys at most can be accommodated into the
576 log of specified size.
577 @param[in] log_size max log size
578 @param[in] key_length max multi-value key length, charset considered
579 @param[out] num_keys max possible number of multi-value keys
580 @return the total size of the keys, let's assume all keys are concatenated
581 one by one compactly */
582 static uint32_t get_keys_capacity(uint32_t log_size, uint32_t key_length,
583 uint32_t *num_keys);
584
585 /** Determine if the log starting from ptr is for multi-value data
586 @return true if it is for multi-value data, otherwise false */
587 static bool is_multi_value_log(const byte *ptr) {
589 }
590
591 private:
592 /** Multi-value data */
594
595 /** Multi-value field length */
596 uint32_t m_field_len;
597
598 /** Length of log for NULL value or no indexed value cases */
599 static constexpr uint32_t s_log_length_for_null_or_empty = 2;
600
601 /** Multi-value virtual column length marker. With this length marker,
602 a multi-value virtual column undo log can be identified. Meanwhile, this
603 marker should/will not conflict with any normal compressed written length
604 leading byte */
605 static constexpr uint8_t s_multi_value_virtual_col_length_marker = 0xFF;
606
607 /** Multi-value virtual column length, which indicates that there is
608 no value on the multi-value index. It's mapped to UNIV_NO_INDEX_VALUE */
609 static constexpr uint16_t s_multi_value_no_index_value = 0x0;
610
611 /** Multi-value virtual column length, which indicates that the field
612 is NULL. It's mapped to UNIV_SQL_NULL. Since any not NULL and not no value
613 multi-value data must be longer than 1 byte, so this is safe for this
614 special meaning */
615 static constexpr uint16_t s_multi_value_null = 0x1;
616
617 /** The compressed length for multi-value key length logging.
618 This would not be longer than 2 bytes for now, while 2 bytes can
619 actually support key length of 16384 bytes. And the actual key
620 length would never be longer than this */
621 static constexpr uint8_t s_max_compressed_mv_key_length_size = 2;
622};
623
624/** Structure for an SQL data field */
625struct dfield_t {
626 void *data; /*!< pointer to data */
627 bool ext; /*!< true=externally stored, false=local */
628 unsigned spatial_status : 2;
629 /*!< spatial status of externally stored field
630 in undo log for purge */
631 unsigned len; /*!< data length; UNIV_SQL_NULL if SQL null */
632 dtype_t type; /*!< type of data */
633
634 bool is_ext() const { return ext; }
635
636 bool is_virtual() const { return (type.is_virtual()); }
637
638 void reset() {
639 data = nullptr;
640 ext = false;
642 }
643
644 /** Create a deep copy of this object
645 @param[in] heap the memory heap in which the clone will be
646 created.
647 @return the cloned object. */
648 dfield_t *clone(mem_heap_t *heap);
649
650 byte *blobref() const;
651
653 : data(nullptr), ext(0), spatial_status(0), len(0), type({0, 0, 0, 0}) {}
654
655 /** Print the dfield_t object into the given output stream.
656 @param[in] out the output stream.
657 @return the output stream. */
658 std::ostream &print(std::ostream &out) const;
659
660 /** Adjust and(or) set virtual column value which is read from undo
661 or online DDL log
662 @param[in] vcol virtual column definition
663 @param[in] comp true if compact format
664 @param[in] field virtual column value
665 @param[in] len value length
666 @param[in,out] heap memory heap to keep value when necessary */
667 void adjust_v_data_mysql(const dict_v_col_t *vcol, bool comp,
668 const byte *field, ulint len, mem_heap_t *heap);
669
670 std::string to_string() const {
672 print(sout);
673 return sout.str();
674 }
675};
676
677/** Compare a multi-value clustered index field with a secondary index
678field, to see if they are equal. If the clustered index field is the
679array, then equal means it contains the secondary index field
680@param[in] clust_field clustered index field
681@param[in] clust_len clustered index field length
682@param[in] sec_field secondary index field
683@param[in] sec_len secondary index field length
684@param[in] col the column tied to this field
685@return true if they are equal, otherwise false */
686bool is_multi_value_clust_and_sec_equal(const byte *clust_field,
687 uint64_t clust_len,
688 const byte *sec_field, uint64_t sec_len,
689 const dict_col_t *col);
690
691/** Overloading the global output operator to easily print the given dfield_t
692object into the given output stream.
693@param[in] out the output stream
694@param[in] obj the given object to print.
695@return the output stream. */
696inline std::ostream &operator<<(std::ostream &out, const dfield_t &obj) {
697 return (obj.print(out));
698}
699
700#ifdef UNIV_DEBUG
701/** Value of dtuple_t::magic_n */
702constexpr uint32_t DATA_TUPLE_MAGIC_N = 65478679;
703#endif
704
705/** Structure for an SQL data tuple of fields (logical record) */
706struct dtuple_t {
707 /** info bits of an index record: the default is 0; this field is used if an
708 index record is built from a data tuple */
709 uint16_t info_bits;
710
711 /** Number of fields in dtuple */
712 uint16_t n_fields;
713
714 /** number of fields which should be used in comparison services of rem0cmp.*;
715 the index search is performed by comparing only these fields, others are
716 ignored; the default value in dtuple creation is the same value as n_fields */
717 uint16_t n_fields_cmp;
718
719 /** Fields. */
721
722 /** Number of virtual fields. */
723 uint16_t n_v_fields;
724
725 /** Fields on virtual column */
727
728 /** Data tuples can be linked into a list using this field */
730
731#ifdef UNIV_DEBUG
732 /** Memory heap where this tuple is allocated. */
734
735 /** Value of dtuple_t::magic_n */
736 static constexpr size_t MAGIC_N = 614679;
737
738 /** Magic number, used in debug assertions */
740#endif /* UNIV_DEBUG */
741
742 /** Print the tuple to the output stream.
743 @param[in,out] out Stream to output to.
744 @return stream */
745 std::ostream &print(std::ostream &out) const {
746 dtuple_print(out, this);
747 return out;
748 }
749
750 /** Ignore at most n trailing default fields if this is a tuple
751 from instant index
752 @param[in] index clustered index object for this tuple */
754
755 /** Compare a data tuple to a physical record.
756 @param[in] rec record
757 @param[in] index index
758 @param[in] offsets rec_get_offsets(rec)
759 @param[in,out] matched_fields number of completely matched fields
760 @return the comparison result of dtuple and rec
761 @retval 0 if dtuple is equal to rec
762 @retval negative if dtuple is less than rec
763 @retval positive if dtuple is greater than rec */
764 int compare(const rec_t *rec, const dict_index_t *index, const ulint *offsets,
765 ulint *matched_fields) const;
766
767 /** Compare a data tuple to a physical record.
768 @param[in] rec record
769 @param[in] index index
770 @param[in] offsets rec_get_offsets(rec)
771 @return the comparison result of dtuple and rec
772 @retval 0 if dtuple is equal to rec
773 @retval negative if dtuple is less than rec
774 @retval positive if dtuple is greater than rec */
775 inline int compare(const rec_t *rec, const dict_index_t *index,
776 const ulint *offsets) const {
777 ulint matched_fields{};
778
779 return (compare(rec, index, offsets, &matched_fields));
780 }
781
782 /** Get number of externally stored fields.
783 @retval number of externally stored fields. */
784 inline size_t get_n_ext() const {
785 size_t n_ext = 0;
786 for (uint32_t i = 0; i < n_fields; ++i) {
787 if (dfield_is_ext(&fields[i])) {
788 ++n_ext;
789 }
790 }
791 return n_ext;
792 }
793
794 /** Set the flag REC_INFO_MIN_REC_FLAG in the info bits. */
795 void set_min_rec_flag();
796
797 /** Unset the flag REC_INFO_MIN_REC_FLAG in the info bits. */
798 void unset_min_rec_flag();
799
800 /** Does tuple has externally stored fields.
801 @retval true if there is externally stored fields. */
802 inline bool has_ext() const {
803 for (uint32_t i = 0; i < n_fields; ++i) {
804 if (dfield_is_ext(&fields[i])) {
805 return true;
806 }
807 }
808 return false;
809 }
810
811 /** Choose a field suitable for storing externally. */
813 dtuple_t *deep_copy(mem_heap_t *heap) const;
814
815#ifdef UNIV_DEBUG
816 void validate() const;
817 void validate_for_index(const dict_index_t *index) const;
818#endif /* UNIV_DEBUG */
819};
820
821/** A slot for a field in a big rec vector */
823 /** Constructor.
824 @param[in] field_no_ the field number
825 @param[in] len_ the data length
826 @param[in] data_ the data */
827 big_rec_field_t(ulint field_no_, ulint len_, void *data_)
828 : field_no(field_no_),
829 len(len_),
830 data(data_),
831 ext_in_old(false),
832 ext_in_new(false) {}
833
834 byte *ptr() const { return (static_cast<byte *>(data)); }
835
836 ulint field_no; /*!< field number in record */
837 ulint len; /*!< stored data length, in bytes */
838 void *data; /*!< stored data */
839
840 /** If true, this field was stored externally in the old row.
841 If false, this field was stored inline in the old row.*/
843
844 /** If true, this field is stored externally in the new row.
845 If false, this field is stored inline in the new row.*/
847
848 /** Print the big_rec_field_t object into the given output stream.
849 @param[in] out the output stream.
850 @return the output stream. */
851 std::ostream &print(std::ostream &out) const;
852};
853
854/** Overloading the global output operator to easily print the given
855big_rec_field_t object into the given output stream.
856@param[in] out the output stream
857@param[in] obj the given object to print.
858@return the output stream. */
859inline std::ostream &operator<<(std::ostream &out, const big_rec_field_t &obj) {
860 return (obj.print(out));
861}
862
863/** Storage format for overflow data in a big record, that is, a
864clustered index record which needs external storage of data fields */
865struct big_rec_t {
866 mem_heap_t *heap; /*!< memory heap from which
867 allocated */
868 const ulint capacity; /*!< fields array size */
869 ulint n_fields; /*!< number of stored fields */
870 big_rec_field_t *fields; /*!< stored fields */
871
872 /** Constructor.
873 @param[in] max the capacity of the array of fields. */
874 explicit big_rec_t(const ulint max)
876
877 /** Append one big_rec_field_t object to the end of array of fields */
878 void append(const big_rec_field_t &field) {
880 fields[n_fields] = field;
881 n_fields++;
882 }
883
884 /** Allocate a big_rec_t object in the given memory heap, and for
885 storing n_fld number of fields.
886 @param[in] heap memory heap in which this object is allocated
887 @param[in] n_fld maximum number of fields that can be stored in
888 this object
889 @return the allocated object */
890 static big_rec_t *alloc(mem_heap_t *heap, ulint n_fld);
891
892 /** Print the current object into the given output stream.
893 @param[in] out the output stream.
894 @return the output stream. */
895 std::ostream &print(std::ostream &out) const;
896};
897
898/** Overloading the global output operator to easily print the given
899big_rec_t object into the given output stream.
900@param[in] out the output stream
901@param[in] obj the given object to print.
902@return the output stream. */
903inline std::ostream &operator<<(std::ostream &out, const big_rec_t &obj) {
904 return (obj.print(out));
905}
906
907#include "data0data.ic"
908
909#endif
Kerberos Client Authentication nullptr
Definition: auth_kerberos_client_plugin.cc:247
A simple bitset wrapper class, which lets you access an existing range of bytes (not owned by it!...
Definition: ut0bitset.h:55
size_t size_bytes() const
Get the size of current bitset in bytes.
Definition: ut0bitset.h:204
B * data() const
Get the bitset's bytes buffer.
Definition: ut0bitset.h:208
void copy_from(const byte *bitset) const
Copy a bits from other buffer into this one.
Definition: ut0bitset.h:84
Class to log the multi-value data and read it from the log.
Definition: data0data.h:544
Multi_value_logger(const multi_value_data *mv_data, uint32_t field_len)
Constructor.
Definition: data0data.h:549
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:992
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:609
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:599
static bool is_multi_value_log(const byte *ptr)
Determine if the log starting from ptr is for multi-value data.
Definition: data0data.h:587
const multi_value_data * m_mv_data
Multi-value data.
Definition: data0data.h:593
static constexpr uint16_t s_multi_value_null
Multi-value virtual column length, which indicates that the field is NULL.
Definition: data0data.h:615
uint32_t m_field_len
Multi-value field length.
Definition: data0data.h:596
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:1054
byte * log(byte **ptr)
Log the multi-value data to specified memory.
Definition: data0data.cc:947
uint32_t get_log_len(bool precise) const
Get the log length for the multi-value data.
Definition: data0data.cc:911
static constexpr uint8_t s_multi_value_virtual_col_length_marker
Multi-value virtual column length marker.
Definition: data0data.h:605
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:1005
static constexpr uint8_t s_max_compressed_mv_key_length_size
The compressed length for multi-value key length logging.
Definition: data0data.h:621
constexpr DWORD buf_size
Definition: create_def.cc:229
static void dtuple_init_v_fld(const dtuple_t *vrow)
Initialize the virtual field data in a dtuple_t.
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:369
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:423
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:148
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:62
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:205
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.
bool dfield_datas_are_binary_equal(const dfield_t *field1, const dfield_t *field2, ulint len=0)
Tests if two data fields are equal.
Definition: data0data.ic:249
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:833
static dfield_t * dtuple_get_nth_field(const dtuple_t *tuple, ulint n)
Gets nth field of a tuple.
void dtuple_println(std::ostream &o, const dtuple_t *tuple)
Print the contents of a tuple, followed by a newline.
Definition: data0data.h:350
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:702
std::ostream & operator<<(std::ostream &o, const dtuple_t &tuple)
Print the contents of a tuple.
Definition: data0data.h:358
bool dtuple_check_typed(const dtuple_t *tuple)
Checks that a data tuple is typed.
Definition: data0data.cc:159
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:623
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:172
void dfield_print(std::ostream &o, const dfield_t *field, ulint n)
Print the contents of a tuple.
Definition: data0data.cc:386
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:97
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 types.
Some type definitions.
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:330
@ SPATIAL_UNKNOWN
Definition: dict0types.h:332
#define malloc(A)
Definition: lexyy.cc:914
The memory management.
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")
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
size_t size(const char *const c)
Definition: base64.h:46
std::basic_ostringstream< char, std::char_traits< char >, ut::allocator< char > > ostringstream
Specialization of basic_ostringstream which uses ut::allocator.
Definition: ut0new.h:2720
std::vector< T, ut::allocator< T > > vector
Specialization of vector which uses allocator.
Definition: ut0new.h:2724
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:822
void * data
stored data
Definition: data0data.h:838
bool ext_in_new
If true, this field is stored externally in the new row.
Definition: data0data.h:846
ulint field_no
field number in record
Definition: data0data.h:836
bool ext_in_old
If true, this field was stored externally in the old row.
Definition: data0data.h:842
big_rec_field_t(ulint field_no_, ulint len_, void *data_)
Constructor.
Definition: data0data.h:827
std::ostream & print(std::ostream &out) const
Print the big_rec_field_t object into the given output stream.
Definition: data0data.cc:758
ulint len
stored data length, in bytes
Definition: data0data.h:837
byte * ptr() const
Definition: data0data.h:834
Storage format for overflow data in a big record, that is, a clustered index record which needs exter...
Definition: data0data.h:865
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:878
const ulint capacity
fields array size
Definition: data0data.h:868
big_rec_field_t * fields
stored fields
Definition: data0data.h:870
big_rec_t(const ulint max)
Constructor.
Definition: data0data.h:874
ulint n_fields
number of stored fields
Definition: data0data.h:869
mem_heap_t * heap
memory heap from which allocated
Definition: data0data.h:866
std::ostream & print(std::ostream &out) const
Print the current object into the given output stream.
Definition: data0data.cc:765
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:650
Structure for an SQL data field.
Definition: data0data.h:625
std::ostream & print(std::ostream &out) const
Print the dfield_t object into the given output stream.
Definition: data0data.cc:742
dtype_t type
type of data
Definition: data0data.h:632
unsigned spatial_status
spatial status of externally stored field in undo log for purge
Definition: data0data.h:628
void reset()
Definition: data0data.h:638
byte * blobref() const
Definition: data0data.cc:684
bool ext
true=externally stored, false=local
Definition: data0data.h:627
dfield_t()
Definition: data0data.h:652
bool is_ext() const
Definition: data0data.h:634
unsigned len
data length; UNIV_SQL_NULL if SQL null
Definition: data0data.h:631
std::string to_string() const
Definition: data0data.h:670
dfield_t * clone(mem_heap_t *heap)
Create a deep copy of this object.
Definition: data0data.cc:664
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:690
bool is_virtual() const
Definition: data0data.h:636
void * data
pointer to data
Definition: data0data.h:626
Data structure for a column in a table.
Definition: dict0mem.h:485
Data structure for an index.
Definition: dict0mem.h:1069
Data structure for a virtual column in a table.
Definition: dict0mem.h:811
Structure for an SQL data tuple of fields (logical record)
Definition: data0data.h:706
size_t get_n_ext() const
Get number of externally stored fields.
Definition: data0data.h:784
void validate_for_index(const dict_index_t *index) const
Definition: data0data.cc:791
void set_min_rec_flag()
Set the flag REC_INFO_MIN_REC_FLAG in the info bits.
Definition: data0data.cc:869
dtuple_t * deep_copy(mem_heap_t *heap) const
Definition: data0data.cc:1081
mem_heap_t * m_heap
Memory heap where this tuple is allocated.
Definition: data0data.h:733
dfield_t * choose_ext(dict_index_t *index)
Choose a field suitable for storing externally.
Definition: data0data.cc:1090
uint16_t n_fields
Number of fields in dtuple.
Definition: data0data.h:712
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:775
static constexpr size_t MAGIC_N
Value of dtuple_t::magic_n.
Definition: data0data.h:736
uint16_t n_fields_cmp
number of fields which should be used in comparison services of rem0cmp.
Definition: data0data.h:717
bool has_ext() const
Does tuple has externally stored fields.
Definition: data0data.h:802
dfield_t * fields
Fields.
Definition: data0data.h:720
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:1125
uint16_t n_v_fields
Number of virtual fields.
Definition: data0data.h:723
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:745
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:802
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:709
void validate() const
Definition: data0data.cc:775
dfield_t * v_fields
Fields on virtual column.
Definition: data0data.h:726
size_t magic_n
Magic number, used in debug assertions.
Definition: data0data.h:739
void unset_min_rec_flag()
Unset the flag REC_INFO_MIN_REC_FLAG in the info bits.
Definition: data0data.cc:870
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:295
Structure to hold number of multiple values.
Definition: data0data.h:392
const void ** datap
points to different value
Definition: data0data.h:395
static constexpr uint32_t s_default_allocate_num
default number of multiple values
Definition: data0data.h:540
uint64_t * conv_buf
convert buffer if the data is an integer
Definition: data0data.h:401
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:516
bool duplicate() const
Definition: data0data.h:495
uint32_t num_alc
number of pointers allocated
Definition: data0data.h:407
uint32_t num_v
number of values
Definition: data0data.h:404
void alloc_bitset(mem_heap_t *heap, uint32_t size=0)
Allocate the bitset for current data array.
Definition: data0data.cc:891
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:874
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:851
void copy(const multi_value_data *multi_value, mem_heap_t *heap)
Copy a multi_value_data structure.
Definition: data0data.h:460
Bitset * bitset
Bitset to indicate which data should be handled for current data array.
Definition: data0data.h:416
size_t bitmap_bytes
The size of bitmap buffer in bytes.
Definition: data0data.h:422
uint32_t * data_len
each individual value length
Definition: data0data.h:398
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:442
Definition: row0upd.h:571
mem_heap_t * heap
Heap from which memory allocated.
Definition: row0upd.h:575
ulint info_bits
New value of info bits to record; default is 0.
Definition: row0upd.h:583
ulint n_fields
Number of update fields.
Definition: row0upd.h:595
Transaction system global type definitions.
Version control for database, common definitions, and include files.
unsigned long int ulint
Definition: univ.i:403
Utilities for bitset operations.
#define ut_ad(EXPR)
Debug assertion.
Definition: ut0dbg.h:109
#define ut_ad_le(LHS, RHS)
Debug-only assertion that LHS <= RHS.
Definition: ut0dbg.h:117
int n
Definition: xcom_base.cc:509