MySQL 9.1.0
Source Code Documentation
data0data.h
Go to the documentation of this file.
1/*****************************************************************************
2
3Copyright (c) 1994, 2024, 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);
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.
348@param[out] o output stream
349@param[in] tuple data tuple */
350inline std::ostream &operator<<(std::ostream &o, const dtuple_t &tuple) {
351 dtuple_print(o, &tuple);
352 return (o);
353}
354
355/** Moves parts of long fields in entry to the big record vector so that
356the size of tuple drops below the maximum record size allowed in the
357database. Moves data only from those fields which are not necessary
358to determine uniquely the insertion place of the tuple in the index.
359@param[in,out] index Index that owns the record.
360@param[in,out] upd Update vector.
361@param[in,out] entry Index entry.
362@return own: created big record vector, NULL if we are not able to
363shorten the entry enough, i.e., if there are too many fixed-length or
364short fields in entry or the index is clustered */
365[[nodiscard]] big_rec_t *dtuple_convert_big_rec(dict_index_t *index, upd_t *upd,
367 MY_ATTRIBUTE((malloc));
368
369/** Puts back to entry the data stored in vector. Note that to ensure the
370fields in entry can accommodate the data, vector must have been created
371from entry with dtuple_convert_big_rec.
372@param[in] entry Entry whose data was put to vector.
373@param[in] vector Big rec vector; it is freed in this function*/
375
376/** Frees the memory in a big rec vector. */
377static inline void dtuple_big_rec_free(
378 big_rec_t *vector); /*!< in, own: big rec vector; it is
379 freed in this function */
380
381/*######################################################################*/
382
383/** Structure to hold number of multiple values */
385 public:
386 /** points to different value */
387 const void **datap;
388
389 /** each individual value length */
390 uint32_t *data_len;
391
392 /** convert buffer if the data is an integer */
393 uint64_t *conv_buf;
394
395 /** number of values */
396 uint32_t num_v;
397
398 /** number of pointers allocated */
399 uint32_t num_alc;
400
401 /** Bitset to indicate which data should be handled for current data
402 array. This is mainly used for UPDATE case. UPDATE may not need
403 to delete all old values and insert all new values because there could
404 be some same values in both old and new data array.
405 If current data array is for INSERT and DELETE, this can(should) be
406 nullptr since all values in current array should be handled in these
407 two cases. */
409
410#ifdef UNIV_DEBUG
411 /** The size of bitmap buffer in bytes. The bitset might point into
412 some prefix of it, and be later made shorter or longer, but not longer
413 than this length of underlying buffer. */
414 size_t bitmap_bytes{};
415#endif
416
417 /** Allocate specified number of elements for all arrays and initialize
418 the structure accordingly
419 @param[in] num number of elements to allocate
420 @param[in] bitset true if memory for bitset should be
421 allocated too
422 @param[in,out] heap memory heap */
423 void alloc(uint32_t num, bool bitset, mem_heap_t *heap);
424
425 /** Allocate the bitset for current data array
426 @param[in,out] heap memory heap
427 @param[in] size size of the bitset, if 0 or default,
428 the size would be num_v */
429 void alloc_bitset(mem_heap_t *heap, uint32_t size = 0);
430
431 /** Check if two multi_value_data are equal or not, regardless of bitset
432 @param[in] multi_value Another multi-value data to be compared
433 @return true if two data structures are equal, otherwise false */
434 bool equal(const multi_value_data *multi_value) const {
435 if (num_v != multi_value->num_v) {
436 return (false);
437 }
438
439 for (uint32_t i = 0; i < num_v; ++i) {
440 if (data_len[i] != multi_value->data_len[i] ||
441 memcmp(datap[i], multi_value->datap[i], data_len[i]) != 0) {
442 return (false);
443 }
444 }
445
446 return (true);
447 }
448
449 /** Copy a multi_value_data structure
450 @param[in] multi_value multi_value structure to copy from
451 @param[in,out] heap memory heap */
452 void copy(const multi_value_data *multi_value, mem_heap_t *heap) {
453 if (num_alc < multi_value->num_v) {
454 alloc(multi_value->num_v, (multi_value->bitset != nullptr), heap);
455 }
456
457 copy_low(multi_value, heap);
458 }
459
460 /** Compare and check if one value from dfield_t is in current data set.
461 Any caller calls this function to check if one field from clustered index
462 is equal to a record on multi-value index should understand that this
463 function can only be used for equality comparison, rather than order
464 comparison
465 @param[in] type type of the data
466 @param[in] data data value to compare
467 @param[in] len length of data
468 @return true if the value exists in current data set, otherwise false */
469 bool has(const dtype_t *type, const byte *data, uint64_t len) const;
470
471 /** Compare and check if one value from dfield_t is in current data set.
472 Any caller calls this function to check if one field from clustered index
473 is equal to a record on multi-value index should understand that this
474 function can only be used for equality comparison, rather than order
475 comparison
476 @param[in] mtype mtype of data
477 @param[in] prtype prtype of data
478 @param[in] data data value to compare
479 @param[in] len length of data
480 @return true if the value exists in current data set, otherwise false */
481 bool has(ulint mtype, ulint prtype, const byte *data, uint64_t len) const;
482
483#ifdef UNIV_DEBUG
484 /* Check if there is any duplicate data in this array.
485 It is safe to assume all the data has been sorted.
486 @return true if duplicate data found, otherwise false */
487 bool duplicate() const {
488 /* Since the array is guaranteed to be sorted, so it is fine to
489 scan it sequentially and only compare current one with previous one
490 if exists. */
491 if (num_v > 1) {
492 for (uint32_t i = 1; i < num_v; ++i) {
493 if (data_len[i] == data_len[i - 1] &&
494 memcmp(datap[i], datap[i - 1], data_len[i]) == 0) {
495 return (true);
496 }
497 }
498 }
499 return (false);
500 }
501#endif /* UNIV_DEBUG */
502
503 private:
504 /** Copy a multi_value_data structure, current one should be bigger
505 or equal to the one to be copied
506 @param[in] multi_value multi_value structure to copy from
507 @param[in,out] heap memory heap */
508 void copy_low(const multi_value_data *multi_value, mem_heap_t *heap) {
509 ut_ad(num_alc >= multi_value->num_v);
510 for (uint32_t i = 0; i < multi_value->num_v; ++i) {
511 datap[i] =
512 mem_heap_dup(heap, multi_value->datap[i], multi_value->data_len[i]);
513 }
514 memcpy(data_len, multi_value->data_len,
515 sizeof(*data_len) * multi_value->num_v);
516 memcpy(conv_buf, multi_value->conv_buf,
517 sizeof(*conv_buf) * multi_value->num_v);
518 if (multi_value->bitset != nullptr) {
519 ut_ad(bitset != nullptr);
520 ut_ad_le(multi_value->bitset->size_bytes(), bitmap_bytes);
521 /* adjust the size to match that of multi_value, but keep pointing to the
522 old buffer */
523 *bitset = Bitset<>(bitset->data(), multi_value->bitset->size_bytes());
524 /* copy the actual data into the buffer from multi_value's buffer */
525 bitset->copy_from(multi_value->bitset->data());
526 }
527 num_v = multi_value->num_v;
528 }
529
530 public:
531 /** default number of multiple values */
532 static constexpr uint32_t s_default_allocate_num = 24;
533};
534
535/** Class to log the multi-value data and read it from the log */
537 public:
538 /** Constructor
539 @param[in] mv_data multi-value data structure to log
540 @param[in] field_len multi-value data field length */
541 Multi_value_logger(const multi_value_data *mv_data, uint32_t field_len)
542 : m_mv_data(mv_data), m_field_len(field_len) {}
543
544 /** Get the log length for the multi-value data
545 @param[in] precise true if precise length is needed, false if rough
546 estimation is OK
547 @return the total log length for the multi-value data */
548 uint32_t get_log_len(bool precise) const;
549
550 /** Log the multi-value data to specified memory
551 @param[in,out] ptr the memory to write
552 @return next to the end of the multi-value data log */
553 byte *log(byte **ptr);
554
555 /** Read the log length for the multi-value data log starting from ptr
556 @param[in] ptr log starting from here
557 @return the length of this log */
558 static uint32_t read_log_len(const byte *ptr);
559
560 /** Read the multi-value data from the ptr
561 @param[in] ptr log starting from here
562 @param[in,out] field multi-value data field to store the array
563 @param[in,out] heap memory heap
564 @return next to the end of the multi-value data log */
565 static const byte *read(const byte *ptr, dfield_t *field, mem_heap_t *heap);
566
567 /** Estimate how many multi-value keys at most can be accommodated into the
568 log of specified size.
569 @param[in] log_size max log size
570 @param[in] key_length max multi-value key length, charset considered
571 @param[out] num_keys max possible number of multi-value keys
572 @return the total size of the keys, let's assume all keys are concatenated
573 one by one compactly */
574 static uint32_t get_keys_capacity(uint32_t log_size, uint32_t key_length,
575 uint32_t *num_keys);
576
577 /** Determine if the log starting from ptr is for multi-value data
578 @return true if it is for multi-value data, otherwise false */
579 static bool is_multi_value_log(const byte *ptr) {
581 }
582
583 private:
584 /** Multi-value data */
586
587 /** Multi-value field length */
588 uint32_t m_field_len;
589
590 /** Length of log for NULL value or no indexed value cases */
591 static constexpr uint32_t s_log_length_for_null_or_empty = 2;
592
593 /** Multi-value virtual column length marker. With this length marker,
594 a multi-value virtual column undo log can be identified. Meanwhile, this
595 marker should/will not conflict with any normal compressed written length
596 leading byte */
597 static constexpr uint8_t s_multi_value_virtual_col_length_marker = 0xFF;
598
599 /** Multi-value virtual column length, which indicates that there is
600 no value on the multi-value index. It's mapped to UNIV_NO_INDEX_VALUE */
601 static constexpr uint16_t s_multi_value_no_index_value = 0x0;
602
603 /** Multi-value virtual column length, which indicates that the field
604 is NULL. It's mapped to UNIV_SQL_NULL. Since any not NULL and not no value
605 multi-value data must be longer than 1 byte, so this is safe for this
606 special meaning */
607 static constexpr uint16_t s_multi_value_null = 0x1;
608
609 /** The compressed length for multi-value key length logging.
610 This would not be longer than 2 bytes for now, while 2 bytes can
611 actually support key length of 16384 bytes. And the actual key
612 length would never be longer than this */
613 static constexpr uint8_t s_max_compressed_mv_key_length_size = 2;
614};
615
616/** Structure for an SQL data field */
617struct dfield_t {
618 void *data; /*!< pointer to data */
619 bool ext; /*!< true=externally stored, false=local */
620 unsigned spatial_status : 2;
621 /*!< spatial status of externally stored field
622 in undo log for purge */
623 unsigned len; /*!< data length; UNIV_SQL_NULL if SQL null */
624 dtype_t type; /*!< type of data */
625
626 bool is_ext() const { return ext; }
627
628 bool is_virtual() const { return (type.is_virtual()); }
629
630 void reset() {
631 data = nullptr;
632 ext = false;
634 }
635
636 /** Create a deep copy of this object
637 @param[in] heap the memory heap in which the clone will be
638 created.
639 @return the cloned object. */
640 dfield_t *clone(mem_heap_t *heap);
641
642 byte *blobref() const;
643
644 /** Obtain the LOB version number, if this is an externally
645 stored field. */
646 uint32_t lob_version() const;
647
649 : data(nullptr), ext(0), spatial_status(0), len(0), type({0, 0, 0, 0}) {}
650
651 /** Print the dfield_t object into the given output stream.
652 @param[in] out the output stream.
653 @return the output stream. */
654 std::ostream &print(std::ostream &out) const;
655
656 /** Adjust and(or) set virtual column value which is read from undo
657 or online DDL log
658 @param[in] vcol virtual column definition
659 @param[in] comp true if compact format
660 @param[in] field virtual column value
661 @param[in] len value length
662 @param[in,out] heap memory heap to keep value when necessary */
663 void adjust_v_data_mysql(const dict_v_col_t *vcol, bool comp,
664 const byte *field, ulint len, mem_heap_t *heap);
665};
666
667/** Compare a multi-value clustered index field with a secondary index
668field, to see if they are equal. If the clustered index field is the
669array, then equal means it contains the secondary index field
670@param[in] clust_field clustered index field
671@param[in] clust_len clustered index field length
672@param[in] sec_field secondary index field
673@param[in] sec_len secondary index field length
674@param[in] col the column tied to this field
675@return true if they are equal, otherwise false */
676bool is_multi_value_clust_and_sec_equal(const byte *clust_field,
677 uint64_t clust_len,
678 const byte *sec_field, uint64_t sec_len,
679 const dict_col_t *col);
680
681/** Overloading the global output operator to easily print the given dfield_t
682object into the given output stream.
683@param[in] out the output stream
684@param[in] obj the given object to print.
685@return the output stream. */
686inline std::ostream &operator<<(std::ostream &out, const dfield_t &obj) {
687 return (obj.print(out));
688}
689
690#ifdef UNIV_DEBUG
691/** Value of dtuple_t::magic_n */
692constexpr uint32_t DATA_TUPLE_MAGIC_N = 65478679;
693#endif
694
695/** Structure for an SQL data tuple of fields (logical record) */
696struct dtuple_t {
697 /** info bits of an index record: the default is 0; this field is used if an
698 index record is built from a data tuple */
699 uint16_t info_bits;
700
701 /** Number of fields in dtuple */
702 uint16_t n_fields;
703
704 /** number of fields which should be used in comparison services of rem0cmp.*;
705 the index search is performed by comparing only these fields, others are
706 ignored; the default value in dtuple creation is the same value as n_fields */
707 uint16_t n_fields_cmp;
708
709 /** Fields. */
711
712 /** Number of virtual fields. */
713 uint16_t n_v_fields;
714
715 /** Fields on virtual column */
717
718 /** Data tuples can be linked into a list using this field */
720
721#ifdef UNIV_DEBUG
722 /** Memory heap where this tuple is allocated. */
724
725 /** Value of dtuple_t::magic_n */
726 static constexpr size_t MAGIC_N = 614679;
727
728 /** Magic number, used in debug assertions */
730#endif /* UNIV_DEBUG */
731
732 /** Print the tuple to the output stream.
733 @param[in,out] out Stream to output to.
734 @return stream */
735 std::ostream &print(std::ostream &out) const {
736 dtuple_print(out, this);
737 return out;
738 }
739
740 /** Read the trx id from the tuple (DB_TRX_ID)
741 @return transaction id of the tuple. */
742 trx_id_t get_trx_id() const;
743
744 /** Ignore at most n trailing default fields if this is a tuple
745 from instant index
746 @param[in] index clustered index object for this tuple */
747 void ignore_trailing_default(const dict_index_t *index);
748
749 /** Compare a data tuple to a physical record.
750 @param[in] rec record
751 @param[in] index index
752 @param[in] offsets rec_get_offsets(rec)
753 @param[in,out] matched_fields number of completely matched fields
754 @return the comparison result of dtuple and rec
755 @retval 0 if dtuple is equal to rec
756 @retval negative if dtuple is less than rec
757 @retval positive if dtuple is greater than rec */
758 int compare(const rec_t *rec, const dict_index_t *index, const ulint *offsets,
759 ulint *matched_fields) const;
760
761 /** Compare a data tuple to a physical record.
762 @param[in] rec record
763 @param[in] index index
764 @param[in] offsets rec_get_offsets(rec)
765 @return the comparison result of dtuple and rec
766 @retval 0 if dtuple is equal to rec
767 @retval negative if dtuple is less than rec
768 @retval positive if dtuple is greater than rec */
769 inline int compare(const rec_t *rec, const dict_index_t *index,
770 const ulint *offsets) const {
771 ulint matched_fields{};
772
773 return (compare(rec, index, offsets, &matched_fields));
774 }
775
776 /** Get number of externally stored fields.
777 @retval number of externally stored fields. */
778 inline size_t get_n_ext() const {
779 size_t n_ext = 0;
780 for (uint32_t i = 0; i < n_fields; ++i) {
781 if (dfield_is_ext(&fields[i])) {
782 ++n_ext;
783 }
784 }
785 return n_ext;
786 }
787
788 /** Set the flag REC_INFO_MIN_REC_FLAG in the info bits. */
789 void set_min_rec_flag();
790
791 /** Unset the flag REC_INFO_MIN_REC_FLAG in the info bits. */
792 void unset_min_rec_flag();
793
794 /** Does tuple has externally stored fields.
795 @retval true if there is externally stored fields. */
796 inline bool has_ext() const {
797 for (uint32_t i = 0; i < n_fields; ++i) {
798 if (dfield_is_ext(&fields[i])) {
799 return true;
800 }
801 }
802 return false;
803 }
804
805 dtuple_t *deep_copy(mem_heap_t *heap) const;
806};
807
808/** A slot for a field in a big rec vector */
810 /** Constructor.
811 @param[in] field_no_ the field number
812 @param[in] len_ the data length
813 @param[in] data_ the data */
814 big_rec_field_t(ulint field_no_, ulint len_, void *data_)
815 : field_no(field_no_),
816 len(len_),
817 data(data_),
818 ext_in_old(false),
819 ext_in_new(false) {}
820
821 byte *ptr() const { return (static_cast<byte *>(data)); }
822
823 ulint field_no; /*!< field number in record */
824 ulint len; /*!< stored data length, in bytes */
825 void *data; /*!< stored data */
826
827 /** If true, this field was stored externally in the old row.
828 If false, this field was stored inline in the old row.*/
830
831 /** If true, this field is stored externally in the new row.
832 If false, this field is stored inline in the new row.*/
834
835 /** Print the big_rec_field_t object into the given output stream.
836 @param[in] out the output stream.
837 @return the output stream. */
838 std::ostream &print(std::ostream &out) const;
839};
840
841/** Overloading the global output operator to easily print the given
842big_rec_field_t object into the given output stream.
843@param[in] out the output stream
844@param[in] obj the given object to print.
845@return the output stream. */
846inline std::ostream &operator<<(std::ostream &out, const big_rec_field_t &obj) {
847 return (obj.print(out));
848}
849
850/** Storage format for overflow data in a big record, that is, a
851clustered index record which needs external storage of data fields */
852struct big_rec_t {
853 mem_heap_t *heap; /*!< memory heap from which
854 allocated */
855 const ulint capacity; /*!< fields array size */
856 ulint n_fields; /*!< number of stored fields */
857 big_rec_field_t *fields; /*!< stored fields */
858
859 /** Constructor.
860 @param[in] max the capacity of the array of fields. */
861 explicit big_rec_t(const ulint max)
862 : heap(nullptr), capacity(max), n_fields(0), fields(nullptr) {}
863
864 /** Append one big_rec_field_t object to the end of array of fields */
865 void append(const big_rec_field_t &field) {
867 fields[n_fields] = field;
868 n_fields++;
869 }
870
871 /** Allocate a big_rec_t object in the given memory heap, and for
872 storing n_fld number of fields.
873 @param[in] heap memory heap in which this object is allocated
874 @param[in] n_fld maximum number of fields that can be stored in
875 this object
876 @return the allocated object */
877 static big_rec_t *alloc(mem_heap_t *heap, ulint n_fld);
878
879 /** Print the current object into the given output stream.
880 @param[in] out the output stream.
881 @return the output stream. */
882 std::ostream &print(std::ostream &out) const;
883};
884
885/** Overloading the global output operator to easily print the given
886big_rec_t object into the given output stream.
887@param[in] out the output stream
888@param[in] obj the given object to print.
889@return the output stream. */
890inline std::ostream &operator<<(std::ostream &out, const big_rec_t &obj) {
891 return (obj.print(out));
892}
893
894#include "data0data.ic"
895
896#endif
Kerberos Client Authentication nullptr
Definition: auth_kerberos_client_plugin.cc:251
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:536
Multi_value_logger(const multi_value_data *mv_data, uint32_t field_len)
Constructor.
Definition: data0data.h:541
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:987
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:601
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:591
static bool is_multi_value_log(const byte *ptr)
Determine if the log starting from ptr is for multi-value data.
Definition: data0data.h:579
const multi_value_data * m_mv_data
Multi-value data.
Definition: data0data.h:585
static constexpr uint16_t s_multi_value_null
Multi-value virtual column length, which indicates that the field is NULL.
Definition: data0data.h:607
uint32_t m_field_len
Multi-value field length.
Definition: data0data.h:588
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:1049
byte * log(byte **ptr)
Log the multi-value data to specified memory.
Definition: data0data.cc:942
uint32_t get_log_len(bool precise) const
Get the log length for the multi-value data.
Definition: data0data.cc:906
static constexpr uint8_t s_multi_value_virtual_col_length_marker
Multi-value virtual column length marker.
Definition: data0data.h:597
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:1000
static constexpr uint8_t s_max_compressed_mv_key_length_size
The compressed length for multi-value key length logging.
Definition: data0data.h:613
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.
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: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.
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:828
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:692
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: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:622
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:346
@ SPATIAL_UNKNOWN
Definition: dict0types.h:348
#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")
size_t size(const char *const c)
Definition: base64.h:46
std::vector< T, ut::allocator< T > > vector
Specialization of vector which uses allocator.
Definition: ut0new.h:2876
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:809
void * data
stored data
Definition: data0data.h:825
bool ext_in_new
If true, this field is stored externally in the new row.
Definition: data0data.h:833
ulint field_no
field number in record
Definition: data0data.h:823
bool ext_in_old
If true, this field was stored externally in the old row.
Definition: data0data.h:829
big_rec_field_t(ulint field_no_, ulint len_, void *data_)
Constructor.
Definition: data0data.h:814
std::ostream & print(std::ostream &out) const
Print the big_rec_field_t object into the given output stream.
Definition: data0data.cc:765
ulint len
stored data length, in bytes
Definition: data0data.h:824
byte * ptr() const
Definition: data0data.h:821
Storage format for overflow data in a big record, that is, a clustered index record which needs exter...
Definition: data0data.h:852
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:865
const ulint capacity
fields array size
Definition: data0data.h:855
big_rec_field_t * fields
stored fields
Definition: data0data.h:857
big_rec_t(const ulint max)
Constructor.
Definition: data0data.h:861
ulint n_fields
number of stored fields
Definition: data0data.h:856
mem_heap_t * heap
memory heap from which allocated
Definition: data0data.h:853
std::ostream & print(std::ostream &out) const
Print the current object into the given output stream.
Definition: data0data.cc:772
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:649
Structure for an SQL data field.
Definition: data0data.h:617
std::ostream & print(std::ostream &out) const
Print the dfield_t object into the given output stream.
Definition: data0data.cc:749
uint32_t lob_version() const
Obtain the LOB version number, if this is an externally stored field.
Definition: data0data.cc:689
dtype_t type
type of data
Definition: data0data.h:624
unsigned spatial_status
spatial status of externally stored field in undo log for purge
Definition: data0data.h:620
void reset()
Definition: data0data.h:630
byte * blobref() const
Definition: data0data.cc:683
bool ext
true=externally stored, false=local
Definition: data0data.h:619
dfield_t()
Definition: data0data.h:648
bool is_ext() const
Definition: data0data.h:626
unsigned len
data length; UNIV_SQL_NULL if SQL null
Definition: data0data.h:623
dfield_t * clone(mem_heap_t *heap)
Create a deep copy of this object.
Definition: data0data.cc:663
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:697
bool is_virtual() const
Definition: data0data.h:628
void * data
pointer to data
Definition: data0data.h:618
Data structure for a column in a table.
Definition: dict0mem.h:484
Data structure for an index.
Definition: dict0mem.h:1041
Data structure for a virtual column in a table.
Definition: dict0mem.h:810
Structure for an SQL data tuple of fields (logical record)
Definition: data0data.h:696
size_t get_n_ext() const
Get number of externally stored fields.
Definition: data0data.h:778
void set_min_rec_flag()
Set the flag REC_INFO_MIN_REC_FLAG in the info bits.
Definition: data0data.cc:864
dtuple_t * deep_copy(mem_heap_t *heap) const
Definition: data0data.cc:1076
mem_heap_t * m_heap
Memory heap where this tuple is allocated.
Definition: data0data.h:723
uint16_t n_fields
Number of fields in dtuple.
Definition: data0data.h:702
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:769
static constexpr size_t MAGIC_N
Value of dtuple_t::magic_n.
Definition: data0data.h:726
trx_id_t get_trx_id() const
Read the trx id from the tuple (DB_TRX_ID)
Definition: data0data.cc:783
uint16_t n_fields_cmp
number of fields which should be used in comparison services of rem0cmp.
Definition: data0data.h:707
bool has_ext() const
Does tuple has externally stored fields.
Definition: data0data.h:796
dfield_t * fields
Fields.
Definition: data0data.h:710
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:713
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:735
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:797
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:699
dfield_t * v_fields
Fields on virtual column.
Definition: data0data.h:716
size_t magic_n
Magic number, used in debug assertions.
Definition: data0data.h:729
void unset_min_rec_flag()
Unset the flag REC_INFO_MIN_REC_FLAG in the info bits.
Definition: data0data.cc:865
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:532
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:508
bool duplicate() const
Definition: data0data.h:487
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:886
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:869
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:846
void copy(const multi_value_data *multi_value, mem_heap_t *heap)
Copy a multi_value_data structure.
Definition: data0data.h:452
Bitset * bitset
Bitset to indicate which data should be handled for current data array.
Definition: data0data.h:408
size_t bitmap_bytes
The size of bitmap buffer in bytes.
Definition: data0data.h:414
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:434
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:105
#define ut_ad_le(LHS, RHS)
Debug-only assertion that LHS <= RHS.
Definition: ut0dbg.h:113
int n
Definition: xcom_base.cc:509