MySQL 8.0.31
Source Code Documentation
lob0del.h
Go to the documentation of this file.
1/*****************************************************************************
2
3Copyright (c) 2015, 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 lob0del_h
27#define lob0del_h
28
29#include "lob0lob.h"
30
31namespace lob {
32
33/* Delete a LOB */
34class Deleter {
35 public:
36 /** Constructor */
38 ut_ad(ctx.index()->is_clustered());
42 ctx.table()->is_intrinsic());
47 }
48
49 /** Free the LOB object.
50 @return DB_SUCCESS on success. */
52
53 /** Free the first page of the BLOB and update the BLOB reference
54 in the clustered index.
55 @return DB_SUCCESS on pass, error code on failure. */
57
58 private:
59 /** Obtain an x-latch on the clustered index record page.*/
60 void x_latch_rec_page();
61
62 /** Validate the page type of the given page frame.
63 @param[in] page the page frame.
64 @return true if valid, false otherwise. */
65 bool validate_page_type(const page_t *page) const {
68 }
69
70 /** Check if the page type is set correctly.
71 @param[in] page the page frame.
72 @return true if page type is correct. */
75 switch (pt) {
79 break;
80 default:
82 }
83 return (true);
84 }
85
86 /** Check if the page type is set correctly.
87 @param[in] page the page frame.
88 @return true if page type is correct. */
89 bool validate_blob_page_type(const page_t *page) const {
91
92 switch (type) {
95 break;
96 default:
97#ifndef UNIV_DEBUG /* Improve debug test coverage */
98 if (!m_ctx.has_atomic_blobs()) {
99 /* Old versions of InnoDB did not initialize
100 FIL_PAGE_TYPE on BLOB pages. Do not print
101 anything about the type mismatch when reading
102 a BLOB page that may be from old versions. */
103 return (true);
104 }
105#endif /* !UNIV_DEBUG */
106 ut_error;
107 }
108 return (true);
109 }
110
111 /** Check if the BLOB can be freed. If the clustered index record
112 is not the owner of the LOB, then it cannot be freed. Also, during
113 rollback, if inherited flag is set, then LOB will not be freed.
114 @return true if the BLOB can be freed, false otherwise. */
115 bool can_free() const;
116
119};
120
121} // namespace lob
122
123#endif // lob0del_h
mtr_t * get_mtr()
Get the associated mini-transaction.
Definition: lob0lob.h:1040
dict_table_t * table() const
Get the table object.
Definition: lob0lob.h:977
dict_index_t * index() const
Get the index object.
Definition: lob0lob.h:973
bool rec_offs_validate() const
Validate the record offsets array.
Definition: lob0lob.h:1031
Definition: lob0del.h:34
bool validate_zblob_page_type(const page_t *page) const
Check if the page type is set correctly.
Definition: lob0del.h:73
void x_latch_rec_page()
Obtain an x-latch on the clustered index record page.
Definition: lob0del.cc:32
mtr_t m_mtr
Definition: lob0del.h:118
bool can_free() const
Check if the BLOB can be freed.
Definition: lob0del.cc:138
bool validate_page_type(const page_t *page) const
Validate the page type of the given page frame.
Definition: lob0del.h:65
dberr_t free_first_page()
Free the first page of the BLOB and update the BLOB reference in the clustered index.
Definition: lob0del.cc:56
dberr_t destroy()
Free the LOB object.
Definition: lob0del.cc:106
DeleteContext & m_ctx
Definition: lob0del.h:117
bool validate_blob_page_type(const page_t *page) const
Check if the page type is set correctly.
Definition: lob0del.h:89
Deleter(DeleteContext &ctx)
Constructor.
Definition: lob0del.h:37
int page
Definition: ctype-mb.cc:1235
dberr_t
Definition: db0err.h:38
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:1231
uint16_t page_type_t
Definition: fil0fil.h:1184
constexpr page_type_t FIL_PAGE_TYPE_ZBLOB2
Subsequent compressed BLOB page.
Definition: fil0fil.h:1234
constexpr page_type_t FIL_PAGE_SDI_ZBLOB
Compressed SDI BLOB page.
Definition: fil0fil.h:1256
page_type_t fil_page_get_type(const byte *page)
Get the file page type.
Definition: fil0fil.h:1798
constexpr page_type_t FIL_PAGE_SDI_BLOB
Uncompressed SDI BLOB page.
Definition: fil0fil.h:1253
constexpr page_type_t FIL_PAGE_TYPE_BLOB
Uncompressed BLOB page.
Definition: fil0fil.h:1228
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:101
#define mtr_memo_contains_flagged(m, p, l)
Definition: mtr0mtr.h:136
@ MTR_MEMO_X_LOCK
Definition: mtr0types.h:284
@ MTR_MEMO_PAGE_X_FIX
Definition: mtr0types.h:272
@ MTR_MEMO_SX_LOCK
Definition: mtr0types.h:286
Provides the large objects (LOB) module.
Definition: lob0del.h:31
byte page_t
Type of the index page.
Definition: page0types.h:151
required string type
Definition: replication_group_member_actions.proto:33
bool is_clustered() const
Definition: dict0mem.h:1286
bool is_intrinsic() const
Determine whether the table is intrinsic.
Definition: dict0mem.h:2667
The context information when the delete operation on LOB is taking place.
Definition: lob0lob.h:1379
bool is_compressed() const
Determine if it is compressed page format.
Definition: lob0lob.h:1406
bool validate_blobref() const
Validate the LOB reference object.
Definition: lob0lob.h:1427
bool has_atomic_blobs() const
Check if tablespace supports atomic blobs.
Definition: lob0lob.h:1410
ref_t m_blobref
the BLOB reference or external field reference.
Definition: lob0lob.h:1445
page_t * page_align() const
Get the start of a page containing this blob reference.
Definition: lob0lob.h:462
Mini-transaction handle and buffer.
Definition: mtr0mtr.h:181
#define ut_error
Abort execution.
Definition: ut0dbg.h:64
#define ut_ad(EXPR)
Debug assertion.
Definition: ut0dbg.h:68