MySQL 8.0.31
Source Code Documentation
lob0inf.h
Go to the documentation of this file.
1/*****************************************************************************
2
3Copyright (c) 2016, 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#ifndef lob0inf_h
27#define lob0inf_h
28
29#include <list>
30
31#include "fut0lst.h"
32#include "lob0index.h"
33#include "lob0lob.h"
34#include "mtr0mtr.h"
35#include "table.h"
36#include "trx0trx.h"
37
38struct lob_diff_t;
39
40namespace lob {
41
42/** Insert a large object (LOB) into the system.
43@param[in] ctx the B-tree context for this LOB operation.
44@param[in] trx transaction doing the insertion.
45@param[in,out] ref the LOB reference.
46@param[in] field the LOB field.
47@param[in] field_j the LOB field index in big rec vector.
48@return DB_SUCCESS on success, error code on failure.*/
49dberr_t insert(InsertContext *ctx, trx_t *trx, ref_t &ref,
50 big_rec_field_t *field, ulint field_j);
51
52/** Insert a compressed large object (LOB) into the system.
53@param[in] ctx the B-tree context for this LOB operation.
54@param[in] trx transaction doing the insertion.
55@param[in,out] ref the LOB reference.
56@param[in] field the LOB field.
57@param[in] field_j the LOB field index in big rec vector.
58@return DB_SUCCESS on success, error code on failure.*/
59dberr_t z_insert(InsertContext *ctx, trx_t *trx, ref_t &ref,
60 big_rec_field_t *field, ulint field_j);
61
62/** Fetch a large object (LOB) from the system.
63@param[in] ctx the read context information.
64@param[in] ref the LOB reference identifying the LOB.
65@param[in] offset read the LOB from the given offset.
66@param[in] len the length of LOB data that needs to be fetched.
67@param[out] buf the output buffer (owned by caller) of minimum len bytes.
68@return the amount of data (in bytes) that was actually read. */
69ulint read(ReadContext *ctx, ref_t ref, ulint offset, ulint len, byte *buf);
70
71/** Fetch a compressed large object (ZLOB) from the system.
72@param[in] ctx the read context information.
73@param[in] ref the LOB reference identifying the LOB.
74@param[in] offset read the LOB from the given offset.
75@param[in] len the length of LOB data that needs to be fetched.
76@param[out] buf the output buffer (owned by caller) of minimum len bytes.
77@return the amount of data (in bytes) that was actually read. */
79 byte *buf);
80
81/** Print information about the given LOB.
82@param[in] trx the current transaction.
83@param[in] index the clust index that contains the LOB.
84@param[in] out the output stream into which LOB info is printed.
85@param[in] ref the LOB reference
86@param[in] fatal if true assert at end of function. */
87void print(trx_t *trx, dict_index_t *index, std::ostream &out, ref_t ref,
88 bool fatal);
89
90/** Print information about the given compressed lob. */
92 std::ostream &out);
93
94/** Update a portion of the given LOB.
95@param[in] trx the transaction that is doing the modification.
96@param[in] index the clustered index containing the LOB.
97@param[in] upd update vector
98@param[in] field_no the LOB field number
99@return DB_SUCCESS on success, error code on failure. */
100dberr_t update(trx_t *trx, dict_index_t *index, const upd_t *upd,
101 ulint field_no);
102
103/** Update a portion of the given LOB.
104@param[in] trx the transaction that is doing the modification.
105@param[in] index the clustered index containing the LOB.
106@param[in] upd update vector
107@param[in] field_no the LOB field number
108@return DB_SUCCESS on success, error code on failure. */
109dberr_t z_update(trx_t *trx, dict_index_t *index, const upd_t *upd,
110 ulint field_no);
111
112/** Get the list of index entries affected by the given partial update
113vector.
114@param[in] ref LOB reference object.
115@param[in] index Clustered index to which LOB belongs.
116@param[in] bdiff Single partial update vector
117@param[out] entries Affected LOB index entries.
118@param[in] mtr Mini-transaction
119@return DB_SUCCESS on success, error code on failure. */
121 const Binary_diff &bdiff,
122 List_iem_t &entries, mtr_t *mtr);
123
124/** Apply the undo log on the LOB
125@param[in] mtr Mini-transaction context.
126@param[in] index Clustered index to which LOB belongs.
127@param[in] ref LOB reference object.
128@param[in] uf Update vector for LOB field.
129@return DB_SUCCESS on success, error code on failure. */
131 const upd_field_t *uf);
132
133/** Get information about the given LOB.
134@param[in] ref LOB reference.
135@param[in] index Clustered index to which LOB belongs.
136@param[out] lob_version LOB version number.
137@param[out] last_trx_id trx_id that modified the lob last.
138@param[out] last_undo_no Trx undo no that modified the lob last.
139@param[out] page_type the Page type of first lob page.
140@param[in] mtr Mini-transaction context.
141@return always returns DB_SUCCESS. */
142dberr_t get_info(ref_t &ref, dict_index_t *index, ulint &lob_version,
143 trx_id_t &last_trx_id, undo_no_t &last_undo_no,
144 page_type_t &page_type, mtr_t *mtr);
145
146/** Validate the size of the given LOB.
147@param[in] lob_size Expected size of the LOB, mostly obtained from
148 the LOB reference.
149@param[in] index Clustered index containing the LOB.
150@param[in] node_loc Location of the first LOB index entry.
151@param[in] mtr Mini-transaction context.
152@return true if size is valid, false otherwise. */
153bool validate_size(const ulint lob_size, dict_index_t *index,
154 fil_addr_t node_loc, mtr_t *mtr);
155
156} // namespace lob
157
158#endif // lob0inf_h
Class that represents a single change to a column value in partial update of a JSON column.
Definition: table.h:1313
dberr_t
Definition: db0err.h:38
uint16_t page_type_t
Definition: fil0fil.h:1184
File-based list utilities.
Implements the large objects (LOB) module.
Mini-transaction buffer.
Definition: buf0block_hint.cc:29
PT & ref(PT *tp)
Definition: tablespace_impl.cc:358
Provides the large objects (LOB) module.
Definition: lob0del.h:31
std::list< index_entry_mem_t > List_iem_t
List of index entry memory (iem) objects.
Definition: lob0index.h:67
dberr_t get_info(ref_t &ref, dict_index_t *index, ulint &lob_version, trx_id_t &last_trx_id, undo_no_t &last_undo_no, page_type_t &page_type, mtr_t *mtr)
Get information about the given LOB.
Definition: lob0util.cc:182
bool validate_size(const ulint lob_size, dict_index_t *index, fil_addr_t node_loc, mtr_t *mtr)
Validate the size of the given LOB.
Definition: lob0update.cc:173
dberr_t z_insert(InsertContext *ctx, trx_t *trx, ref_t &ref, big_rec_field_t *field, ulint field_j)
Insert a compressed large object (LOB) into the system.
Definition: lob0impl.cc:404
dberr_t z_update(trx_t *trx, dict_index_t *index, const upd_t *upd, ulint field_no)
Update a portion of the given LOB.
void print(trx_t *trx, dict_index_t *index, std::ostream &out, ref_t ref, bool fatal)
Print information about the given LOB.
Definition: lob0impl.cc:1330
dberr_t update(trx_t *trx, dict_index_t *index, const upd_t *upd, ulint field_no)
Update a portion of the given LOB.
ulint read(ReadContext *ctx, ref_t ref, ulint offset, ulint len, byte *buf)
Fetch a large object (LOB) from the system.
Definition: lob0impl.cc:1073
dberr_t z_print_info(const dict_index_t *index, const lob::ref_t &ref, std::ostream &out)
Print information about the given compressed lob.
Definition: lob0impl.cc:533
dberr_t get_affected_index_entries(const ref_t &ref, dict_index_t *index, const Binary_diff &bdiff, List_iem_t &entries, mtr_t *mtr)
Get the list of index entries affected by the given partial update vector.
Definition: lob0util.cc:89
ulint z_read(lob::ReadContext *ctx, lob::ref_t ref, ulint offset, ulint len, byte *buf)
Fetch a compressed large object (ZLOB) from the system.
Definition: zlob0read.cc:46
dberr_t insert(InsertContext *ctx, trx_t *trx, ref_t &ref, big_rec_field_t *field, ulint field_j)
Insert a large object (LOB) into the system.
Definition: lob0impl.cc:928
dberr_t apply_undolog(mtr_t *mtr, dict_index_t *index, ref_t ref, const upd_field_t *uf)
Apply the undo log on the LOB.
Definition: lob0update.cc:603
TempTable Table declarations.
A slot for a field in a big rec vector.
Definition: data0data.h:786
Data structure for an index.
Definition: dict0mem.h:1021
File space address.
Definition: fil0fil.h:1139
The context information for reading a single BLOB.
Definition: lob0lob.h:1207
The struct 'lob::ref_t' represents an external field reference.
Definition: lob0lob.h:197
Mini-transaction handle and buffer.
Definition: mtr0mtr.h:181
Definition: trx0trx.h:680
Definition: row0upd.h:466
Definition: row0upd.h:564
The transaction.
ib_id_t undo_no_t
Undo number.
Definition: trx0types.h:141
ib_id_t trx_id_t
Transaction identifier (DB_TRX_ID, DATA_TRX_ID)
Definition: trx0types.h:137
unsigned long int ulint
Definition: univ.i:407