MySQL 9.0.0
Source Code Documentation
row0ext.h
Go to the documentation of this file.
1/*****************************************************************************
2
3Copyright (c) 2006, 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/row0ext.h
29 Caching of externally stored column prefixes
30
31 Created September 2006 Marko Makela
32 *******************************************************/
33
34#ifndef row0ext_h
35#define row0ext_h
36
37#include "data0types.h"
38#include "dict0types.h"
39#include "mem0mem.h"
40#include "page0size.h"
41#include "row0types.h"
42#include "univ.i"
43
44/** Creates a cache of column prefixes of externally stored columns.
45@param[in] index the index to which LOB belongs.
46@param[in] n_ext number of externally stored columns
47@param[in] ext col_no's of externally stored columns in the InnoDB
48table object, as reported by dict_col_get_no(); NOT relative to the records
49in the clustered index
50@param[in] flags table->flags
51@param[in] tuple data tuple containing the field references of the
52externally stored columns; must be indexed by col_no; the clustered index record
53must be covered by a lock or a page latch to prevent deletion (rollback
54or purge)
55@param[in] is_sdi true for SDI Indexes
56@param[in,out] heap heap where created
57@return own: column prefix cache */
59 const ulint *ext, uint32_t flags,
60 const dtuple_t *tuple,
61 IF_DEBUG(bool is_sdi, ) mem_heap_t *heap);
62
63static inline row_ext_t *row_ext_create(const dict_index_t *index, ulint n_ext,
64 const ulint *ext, uint32_t flags,
65 const dtuple_t *tuple,
66 bool is_sdi [[maybe_unused]],
67 mem_heap_t *heap) {
68 return row_ext_create_func(index, n_ext, ext, flags, tuple,
69 IF_DEBUG(is_sdi, ) heap);
70}
71
72/** Looks up a column prefix of an externally stored column.
73@param[in,out] ext column prefix cache
74@param[in] i index of ext->ext[]
75@param[out] len length of prefix, in bytes, at most the length
76 determined by DICT_MAX_FIELD_LEN_BY_FORMAT()
77@return column prefix, or NULL if the column is not stored externally,
78or pointer to field_ref_zero if the BLOB pointer is unset */
79static inline const byte *row_ext_lookup_ith(const row_ext_t *ext, ulint i,
80 ulint *len);
81
82/** Looks up a column prefix of an externally stored column.
83@param[in] ext column prefix cache
84@param[in] col column number in the InnoDB table object, as reported
85 by dict_col_get_no(); NOT relative to the records in
86 the clustered index
87@param[out] len length of prefix, in bytes, at most the length
88 determined by DICT_MAX_FIELD_LEN_BY_FORMAT()
89@return column prefix, or NULL if the column is not stored externally,
90or pointer to field_ref_zero if the BLOB pointer is unset */
91static inline const byte *row_ext_lookup(const row_ext_t *ext, ulint col,
92 ulint *len);
93
94/** Prefixes of externally stored columns */
95struct row_ext_t {
96 /** The clustered index from where LOB is fetched. */
98
99 ulint n_ext; /*!< number of externally stored columns which are part of
100 index */
101 const ulint *ext; /*!< col_no's of externally stored columns */
102 byte *buf; /*!< backing store of the column prefix cache */
103 ulint max_len; /*!< maximum prefix length, it could be
104 REC_ANTELOPE_MAX_INDEX_COL_LEN or
105 REC_VERSION_56_MAX_INDEX_COL_LEN depending
106 on row format */
108 /*!< page size of the externally stored
109 columns */
110 ulint len[1]; /*!< prefix lengths; 0 if not cached */
111
112 /* NOTE: Do NOT add new members here. */
113
114 std::ostream &print(std::ostream &out) const {
115 out << "[row_ext_t:";
116 for (ulint i = 0; i < n_ext; i++) {
117 if (len[i] > 0) {
118 byte *ptr = (buf + i * max_len);
119 ut_print_buf(out, ptr, len[i]);
120 }
121 }
122 out << "]" << std::endl;
123 return (out);
124 }
125};
126
127inline std::ostream &operator<<(std::ostream &out, const row_ext_t &obj) {
128 return (obj.print(out));
129}
130
131#include "row0ext.ic"
132
133#endif
Page size descriptor.
Definition: page0size.h:50
Some type definitions.
Data dictionary global types.
static int flags[50]
Definition: hp_test1.cc:40
The memory management.
Definition: buf0block_hint.cc:30
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:107
std::ostream & operator<<(std::ostream &out, const row_ext_t &obj)
Definition: row0ext.h:127
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:54
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:37
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:63
Caching of externally stored column prefixes.
Row operation global types.
Data structure for an index.
Definition: dict0mem.h:1046
Structure for an SQL data tuple of fields (logical record)
Definition: data0data.h:684
The info structure stored at the beginning of a heap block.
Definition: mem0mem.h:302
Prefixes of externally stored columns.
Definition: row0ext.h:95
ulint n_ext
number of externally stored columns which are part of index
Definition: row0ext.h:99
byte * buf
backing store of the column prefix cache
Definition: row0ext.h:102
const dict_index_t * index
The clustered index from where LOB is fetched.
Definition: row0ext.h:97
page_size_t page_size
page size of the externally stored columns
Definition: row0ext.h:107
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:103
std::ostream & print(std::ostream &out) const
Definition: row0ext.h:114
const ulint * ext
col_no's of externally stored columns
Definition: row0ext.h:101
ulint len[1]
prefix lengths; 0 if not cached
Definition: row0ext.h:110
Version control for database, common definitions, and include files.
#define IF_DEBUG(...)
Definition: univ.i:674
unsigned long int ulint
Definition: univ.i:406
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:47