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