MySQL 8.4.0
Source Code Documentation
lob0del.h
Go to the documentation of this file.
1/*****************************************************************************
2
3Copyright (c) 2015, 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 lob0del_h
28#define lob0del_h
29
30#include "lob0lob.h"
31
32namespace lob {
33
34/* Delete a LOB */
35class Deleter {
36 public:
37 /** Constructor */
39 ut_ad(ctx.index()->is_clustered());
43 ctx.table()->is_intrinsic());
48 }
49
50 /** Free the LOB object.
51 @return DB_SUCCESS on success. */
53
54 /** Free the first page of the BLOB and update the BLOB reference
55 in the clustered index.
56 @return DB_SUCCESS on pass, error code on failure. */
58
59 private:
60 /** Obtain an x-latch on the clustered index record page.*/
61 void x_latch_rec_page();
62
63 /** Validate the page type of the given page frame.
64 @param[in] page the page frame.
65 @return true if valid, false otherwise. */
66 bool validate_page_type(const page_t *page) const {
69 }
70
71 /** Check if the page type is set correctly.
72 @param[in] page the page frame.
73 @return true if page type is correct. */
76 switch (pt) {
80 break;
81 default:
83 }
84 return (true);
85 }
86
87 /** Check if the page type is set correctly.
88 @param[in] page the page frame.
89 @return true if page type is correct. */
90 bool validate_blob_page_type(const page_t *page) const {
92
93 switch (type) {
96 break;
97 default:
98#ifndef UNIV_DEBUG /* Improve debug test coverage */
99 if (!m_ctx.has_atomic_blobs()) {
100 /* Old versions of InnoDB did not initialize
101 FIL_PAGE_TYPE on BLOB pages. Do not print
102 anything about the type mismatch when reading
103 a BLOB page that may be from old versions. */
104 return (true);
105 }
106#endif /* !UNIV_DEBUG */
107 ut_error;
108 }
109 return (true);
110 }
111
112 /** Check if the BLOB can be freed. If the clustered index record
113 is not the owner of the LOB, then it cannot be freed. Also, during
114 rollback, if inherited flag is set, then LOB will not be freed.
115 @return true if the BLOB can be freed, false otherwise. */
116 bool can_free() const;
117
120};
121
122} // namespace lob
123
124#endif // lob0del_h
mtr_t * get_mtr()
Get the associated mini-transaction.
Definition: lob0lob.h:1041
dict_table_t * table() const
Get the table object.
Definition: lob0lob.h:978
dict_index_t * index() const
Get the index object.
Definition: lob0lob.h:974
bool rec_offs_validate() const
Validate the record offsets array.
Definition: lob0lob.h:1032
Definition: lob0del.h:35
bool validate_zblob_page_type(const page_t *page) const
Check if the page type is set correctly.
Definition: lob0del.h:74
void x_latch_rec_page()
Obtain an x-latch on the clustered index record page.
Definition: lob0del.cc:33
mtr_t m_mtr
Definition: lob0del.h:119
bool can_free() const
Check if the BLOB can be freed.
Definition: lob0del.cc:139
bool validate_page_type(const page_t *page) const
Validate the page type of the given page frame.
Definition: lob0del.h:66
dberr_t free_first_page()
Free the first page of the BLOB and update the BLOB reference in the clustered index.
Definition: lob0del.cc:57
dberr_t destroy()
Free the LOB object.
Definition: lob0del.cc:107
DeleteContext & m_ctx
Definition: lob0del.h:118
bool validate_blob_page_type(const page_t *page) const
Check if the page type is set correctly.
Definition: lob0del.h:90
Deleter(DeleteContext &ctx)
Constructor.
Definition: lob0del.h:38
int page
Definition: ctype-mb.cc:1234
dberr_t
Definition: db0err.h:39
static rw_lock_t * dict_index_get_lock(dict_index_t *index)
Gets the read-write lock of the index tree.
constexpr page_type_t FIL_PAGE_TYPE_ZBLOB
First compressed BLOB page.
Definition: fil0fil.h:1256
uint16_t page_type_t
Definition: fil0fil.h:1209
constexpr page_type_t FIL_PAGE_TYPE_ZBLOB2
Subsequent compressed BLOB page.
Definition: fil0fil.h:1259
constexpr page_type_t FIL_PAGE_SDI_ZBLOB
Compressed SDI BLOB page.
Definition: fil0fil.h:1281
page_type_t fil_page_get_type(const byte *page)
Get the file page type.
Definition: fil0fil.h:1326
constexpr page_type_t FIL_PAGE_SDI_BLOB
Uncompressed SDI BLOB page.
Definition: fil0fil.h:1278
constexpr page_type_t FIL_PAGE_TYPE_BLOB
Uncompressed BLOB page.
Definition: fil0fil.h:1253
Implements the large objects (LOB) module.
#define mtr_is_page_fix(m, p, t, table)
Check if memo contains the given page ignore if table is intrinsic.
Definition: mtr0mtr.h:102
#define mtr_memo_contains_flagged(m, p, l)
Definition: mtr0mtr.h:137
@ MTR_MEMO_X_LOCK
Definition: mtr0types.h:285
@ MTR_MEMO_PAGE_X_FIX
Definition: mtr0types.h:273
@ MTR_MEMO_SX_LOCK
Definition: mtr0types.h:287
Provides the large objects (LOB) module.
Definition: lob0del.h:32
byte page_t
Type of the index page.
Definition: page0types.h:152
required string type
Definition: replication_group_member_actions.proto:34
bool is_clustered() const
Definition: dict0mem.h:1311
bool is_intrinsic() const
Determine whether the table is intrinsic.
Definition: dict0mem.h:2696
The context information when the delete operation on LOB is taking place.
Definition: lob0lob.h:1380
bool is_compressed() const
Determine if it is compressed page format.
Definition: lob0lob.h:1407
bool validate_blobref() const
Validate the LOB reference object.
Definition: lob0lob.h:1428
bool has_atomic_blobs() const
Check if tablespace supports atomic blobs.
Definition: lob0lob.h:1411
ref_t m_blobref
the BLOB reference or external field reference.
Definition: lob0lob.h:1446
page_t * page_align() const
Get the start of a page containing this blob reference.
Definition: lob0lob.h:463
Mini-transaction handle and buffer.
Definition: mtr0mtr.h:177
#define ut_error
Abort execution.
Definition: ut0dbg.h:101
#define ut_ad(EXPR)
Debug assertion.
Definition: ut0dbg.h:105