MySQL 8.0.31
Source Code Documentation
row0ext.h
Go to the documentation of this file.
1/*****************************************************************************
2
3Copyright (c) 2006, 2022, 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 also distributed with certain software (including but not
10limited to OpenSSL) that is licensed under separate terms, as designated in a
11particular file or component or in included license documentation. The authors
12of MySQL hereby grant you an additional permission to link the program and
13your derivative works with the separately licensed software that they have
14included with MySQL.
15
16This program is distributed in the hope that it will be useful, but WITHOUT
17ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
18FOR A PARTICULAR PURPOSE. See the GNU General Public License, version 2.0,
19for more details.
20
21You should have received a copy of the GNU General Public License along with
22this program; if not, write to the Free Software Foundation, Inc.,
2351 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
24
25*****************************************************************************/
26
27/** @file include/row0ext.h
28 Caching of externally stored column prefixes
29
30 Created September 2006 Marko Makela
31 *******************************************************/
32
33#ifndef row0ext_h
34#define row0ext_h
35
36#include "data0types.h"
37#include "dict0types.h"
38#include "mem0mem.h"
39#include "page0size.h"
40#include "row0types.h"
41#include "univ.i"
42
43/** Creates a cache of column prefixes of externally stored columns.
44@param[in] index the index to which LOB belongs.
45@param[in] n_ext number of externally stored columns
46@param[in] ext col_no's of externally stored columns in the InnoDB
47table object, as reported by dict_col_get_no(); NOT relative to the records
48in the clustered index
49@param[in] flags table->flags
50@param[in] tuple data tuple containing the field references of the
51externally stored columns; must be indexed by col_no; the clustered index record
52must be covered by a lock or a page latch to prevent deletion (rollback
53or purge)
54@param[in] is_sdi true for SDI Indexes
55@param[in,out] heap heap where created
56@return own: column prefix cache */
58 const ulint *ext, uint32_t flags,
59 const dtuple_t *tuple,
60 IF_DEBUG(bool is_sdi, ) mem_heap_t *heap);
61
62static inline row_ext_t *row_ext_create(const dict_index_t *index, ulint n_ext,
63 const ulint *ext, uint32_t flags,
64 const dtuple_t *tuple,
65 bool is_sdi [[maybe_unused]],
66 mem_heap_t *heap) {
67 return row_ext_create_func(index, n_ext, ext, flags, tuple,
68 IF_DEBUG(is_sdi, ) heap);
69}
70
71/** Looks up a column prefix of an externally stored column.
72@param[in,out] ext column prefix cache
73@param[in] i index of ext->ext[]
74@param[out] len length of prefix, in bytes, at most the length
75 determined by DICT_MAX_FIELD_LEN_BY_FORMAT()
76@return column prefix, or NULL if the column is not stored externally,
77or pointer to field_ref_zero if the BLOB pointer is unset */
78static inline const byte *row_ext_lookup_ith(const row_ext_t *ext, ulint i,
79 ulint *len);
80
81/** Looks up a column prefix of an externally stored column.
82@param[in] ext column prefix cache
83@param[in] col column number in the InnoDB table object, as reported
84 by dict_col_get_no(); NOT relative to the records in
85 the clustered index
86@param[out] len length of prefix, in bytes, at most the length
87 determined by DICT_MAX_FIELD_LEN_BY_FORMAT()
88@return column prefix, or NULL if the column is not stored externally,
89or pointer to field_ref_zero if the BLOB pointer is unset */
90static inline const byte *row_ext_lookup(const row_ext_t *ext, ulint col,
91 ulint *len);
92
93/** Prefixes of externally stored columns */
94struct row_ext_t {
95 /** The clustered index from where LOB is fetched. */
97
98 ulint n_ext; /*!< number of externally stored columns which are part of
99 index */
100 const ulint *ext; /*!< col_no's of externally stored columns */
101 byte *buf; /*!< backing store of the column prefix cache */
102 ulint max_len; /*!< maximum prefix length, it could be
103 REC_ANTELOPE_MAX_INDEX_COL_LEN or
104 REC_VERSION_56_MAX_INDEX_COL_LEN depending
105 on row format */
107 /*!< page size of the externally stored
108 columns */
109 ulint len[1]; /*!< prefix lengths; 0 if not cached */
110
111 /* NOTE: Do NOT add new members here. */
112
113 std::ostream &print(std::ostream &out) const {
114 out << "[row_ext_t:";
115 for (ulint i = 0; i < n_ext; i++) {
116 if (len[i] > 0) {
117 byte *ptr = (buf + i * max_len);
118 ut_print_buf(out, ptr, len[i]);
119 }
120 }
121 out << "]" << std::endl;
122 return (out);
123 }
124};
125
126inline std::ostream &operator<<(std::ostream &out, const row_ext_t &obj) {
127 return (obj.print(out));
128}
129
130#include "row0ext.ic"
131
132#endif
Page size descriptor.
Definition: page0size.h:49
Some type definitions.
Data dictionary global types.
static int flags[50]
Definition: hp_test1.cc:39
The memory management.
Definition: buf0block_hint.cc:29
Json_data_extension ext
Definition: backend.cc:50
A class describing a page size.
row_ext_t * row_ext_create_func(const dict_index_t *index, ulint n_ext, const ulint *ext, uint32_t flags, const dtuple_t *tuple, bool is_sdi, mem_heap_t *heap)
Creates a cache of column prefixes of externally stored columns.
Definition: row0ext.cc:106
std::ostream & operator<<(std::ostream &out, const row_ext_t &obj)
Definition: row0ext.h:126
static const byte * row_ext_lookup(const row_ext_t *ext, ulint col, ulint *len)
Looks up a column prefix of an externally stored column.
Definition: row0ext.ic:53
static const byte * row_ext_lookup_ith(const row_ext_t *ext, ulint i, ulint *len)
Looks up a column prefix of an externally stored column.
Definition: row0ext.ic:36
static row_ext_t * row_ext_create(const dict_index_t *index, ulint n_ext, const ulint *ext, uint32_t flags, const dtuple_t *tuple, bool is_sdi, mem_heap_t *heap)
Definition: row0ext.h:62
Caching of externally stored column prefixes.
Row operation global types.
Data structure for an index.
Definition: dict0mem.h:1021
Structure for an SQL data tuple of fields (logical record)
Definition: data0data.h:681
The info structure stored at the beginning of a heap block.
Definition: mem0mem.h:299
Prefixes of externally stored columns.
Definition: row0ext.h:94
ulint n_ext
number of externally stored columns which are part of index
Definition: row0ext.h:98
byte * buf
backing store of the column prefix cache
Definition: row0ext.h:101
const dict_index_t * index
The clustered index from where LOB is fetched.
Definition: row0ext.h:96
page_size_t page_size
page size of the externally stored columns
Definition: row0ext.h:106
ulint max_len
maximum prefix length, it could be REC_ANTELOPE_MAX_INDEX_COL_LEN or REC_VERSION_56_MAX_INDEX_COL_LEN...
Definition: row0ext.h:102
std::ostream & print(std::ostream &out) const
Definition: row0ext.h:113
const ulint * ext
col_no's of externally stored columns
Definition: row0ext.h:100
ulint len[1]
prefix lengths; 0 if not cached
Definition: row0ext.h:109
Version control for database, common definitions, and include files.
#define IF_DEBUG(...)
Definition: univ.i:675
unsigned long int ulint
Definition: univ.i:407
void ut_print_buf(FILE *file, const void *buf, ulint len)
NOTE: The functions in this file should only use functions from other files in library.
Definition: ut.cc:46