MySQL 9.0.0
Source Code Documentation
lob0first.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
28#ifndef lob0first_h
29#define lob0first_h
30
31#include "btr0btr.h"
32#include "buf0buf.h"
33#include "dict0dict.h"
34#include "fut0lst.h"
35#include "lob0index.h"
36#include "lob0lob.h"
37#include "lob0util.h"
38#include "mtr0log.h"
39
40namespace lob {
41
42/** The first page of an uncompressed LOB. */
43struct first_page_t : public basic_page_t {
44 /** Version information. One byte. */
46
47 /** One byte of flag bits. Currently only one bit (the least
48 significant bit) is used, other 7 bits are available for future use.*/
49 static const ulint OFFSET_FLAGS = FIL_PAGE_DATA + 1;
50
51 /** LOB version. 4 bytes.*/
52 static const uint32_t OFFSET_LOB_VERSION = OFFSET_FLAGS + 1;
53
54 /** The latest transaction that modified this LOB. */
56
57 /** The latest transaction undo_no that modified this LOB. */
59
60 /** Length of data stored in this page. 4 bytes. */
62
63 /** The trx that created the data stored in this page. */
65
66 /** The offset where the list base node is located. This is the list
67 of LOB pages. */
69
70 /** The offset where the list base node is located. This is the list
71 of free nodes. */
74
75 /** The offset where the contents of the first page begins. */
76 static const ulint LOB_PAGE_DATA =
78
80
81 /** The default constructor. */
82 first_page_t() = default;
83
84 /** Constructor.
85 @param[in] block Buffer block of the first page.
86 @param[in] mtr Mini-transaction context. */
87 first_page_t(buf_block_t *block, mtr_t *mtr) : basic_page_t(block, mtr) {}
88
89 /** Constructor.
90 @param[in] block the buffer block of the first page.*/
92
93 /** Constructor.
94 @param[in] block Buffer block of the first page.
95 @param[in] mtr Mini-transaction context.
96 @param[in] index Clustered index containing the LOB. */
98 : basic_page_t(block, mtr, index) {}
99
100 /** Constructor.
101 @param[in] mtr Mini-transaction context.
102 @param[in] index Clustered index containing the LOB. */
104 : basic_page_t(nullptr, mtr, index) {}
105
106 /** Set the LOB format version number to 0. */
109 }
110
111 /** Obtain the flags value. This has 8 bits of which only the first
112 bit is used.
113 @return one byte flag */
114 uint8_t get_flags() { return (mach_read_from_1(frame() + OFFSET_FLAGS)); }
115
116 /** When the bit is set, the LOB is not partially updatable anymore.
117 @return true, if partially updatable.
118 @return false, if partially NOT updatable. */
120 uint8_t flags = get_flags();
121 return (!(flags & 0x01));
122 }
123
124 /** Do tablespace import. */
125 void import(trx_id_t trx_id);
126
127 /** When the bit is set, the LOB is not partially updatable anymore.
128 Enable the bit.
129 @param[in] trx the current transaction. */
131
132 /** Allocate the first page for uncompressed LOB.
133 @param[in,out] alloc_mtr the allocation mtr.
134 @param[in] is_bulk true if it is bulk operation.
135 (OPCODE_INSERT_BULK)
136 return the allocated buffer block.*/
137 buf_block_t *alloc(mtr_t *alloc_mtr, bool is_bulk);
138
139 /** Free all the index pages. The list of index pages can be accessed
140 by traversing via the FIL_PAGE_NEXT field.*/
142
143 /** Free all the data pages. The data pages can be accessed through
144 index entry. */
145 void free_all_data_pages();
146
147 /** Load the first page of LOB with s-latch.
148 @param[in] page_id the page identifier of the first page.
149 @param[in] page_size the page size information.
150 @return the buffer block of the first page. */
152 m_block =
153 buf_page_get(page_id, page_size, RW_S_LATCH, UT_LOCATION_HERE, m_mtr);
154 return (m_block);
155 }
156
157 /** Load the first page of LOB with x-latch.
158 @param[in] page_id Page identifier of the first page.
159 @param[in] page_size Page size information.
160 @param[in] mtr Mini-transaction context for latch.
161 @return the buffer block of the first page. */
162 buf_block_t *load_x(const page_id_t &page_id, const page_size_t &page_size,
163 mtr_t *mtr);
164
165 /** Load the first page of LOB with x-latch in the given mtr context.
166 The first page must already be x-latched by the m_mtr.
167 @param[in] mtr Mini-transaction context for latch.
168 @return the buffer block of the first page. */
169 buf_block_t *load_x(mtr_t *mtr) const {
173 ut_ad(tmp == m_block);
174 return (tmp);
175 }
176
177 /** Load the first page of LOB with x-latch.
178 @param[in] page_id the page identifier of the first page.
179 @param[in] page_size the page size information.
180 @return the buffer block of the first page. */
181 buf_block_t *load_x(const page_id_t &page_id, const page_size_t &page_size) {
182 return (load_x(page_id, page_size, m_mtr));
183 }
184
185 /** Get the buffer block of the LOB first page.
186 @return the buffer block. */
188
189 /** Load the file list node from the given location. An x-latch is taken
190 on the page containing the file list node.
191 @param[in] addr Location of file list node.
192 @param[in] mtr Mini-transaction context to be used.
193 @return the file list node.*/
194 flst_node_t *addr2ptr_x(const fil_addr_t &addr, mtr_t *mtr) const;
195
196 /** Load the file list node from the given location. An x-latch is taken
197 on the page containing the file list node.
198 @param[in] addr the location of file list node.
199 @return the file list node.*/
201 return (addr2ptr_x(addr, m_mtr));
202 }
203
204 /** Load the file list node from the given location, assuming that it
205 exists in the first page itself.
206 @param[in] addr the location of file list node.
207 @return the file list node.*/
209 ut_ad(m_block->page.id.page_no() == addr.page);
210 return (buf_block_get_frame(m_block) + addr.boffset);
211 }
212
213 /** Load the file list node from the given location. An s-latch is taken
214 on the page containing the file list node.
215 @param[in] addr the location of file list node.
216 @return the file list node.*/
219 const page_size_t page_size = dict_table_page_size(m_index->table);
220 return (fut_get_ptr(space, page_size, addr, RW_S_LATCH, m_mtr));
221 }
222
223 /** Load the file list node from the given location. An s-latch is taken
224 on the page containing the file list node. The given cache is checked to
225 see if the page is already loaded.
226 @param[in] cache cache of loaded buffer blocks.
227 @param[in] addr the location of file list node.
228 @return the file list node.*/
229 flst_node_t *addr2ptr_s_cache(std::map<page_no_t, buf_block_t *> &cache,
230 fil_addr_t &addr) const {
231 byte *result;
233 const page_size_t page_size = dict_table_page_size(m_index->table);
234
235 auto iter = cache.find(addr.page);
236
237 if (iter == cache.end()) {
238 /* Not there in cached blocks. Add the loaded block to cache. */
239 buf_block_t *block = nullptr;
240 result = fut_get_ptr(space, page_size, addr, RW_S_LATCH, m_mtr, &block);
241#ifdef UNIV_DEBUG
242 const page_type_t type = block->get_page_type();
244#endif /* UNIV_DEBUG */
245 cache.insert(std::make_pair(addr.page, block));
246 } else {
247 buf_block_t *block = iter->second;
248#ifdef UNIV_DEBUG
249 const page_type_t type = block->get_page_type();
251 ut_ad(block->page.id.page_no() == addr.page);
252#endif /* UNIV_DEBUG */
253 result = buf_block_get_frame(block) + addr.boffset;
254 }
255 return (result);
256 }
257
258 /** Free the first page. This is done when all other LOB pages have
259 been freed. */
260 void dealloc();
261
262 /** Free all the pages associated with this LOB. */
263 void destroy();
264
265 /** Free all the pages associated with this LOB, except the first page. */
266 void make_empty();
267
268 /** Check if the index list is empty or not.
269 @return true if empty, false otherwise. */
270 bool is_empty() const {
272 ut_ad(base != nullptr);
273 return (flst_get_len(base) == 0);
274 }
275
276 /** Allocate one index entry. If required an index page (of type
277 FIL_PAGE_TYPE_LOB_INDEX) will be allocated.
278 @param[in] bulk true if it is a bulk operation
279 (OPCODE_INSERT_BULK), false otherwise.
280 @return the file list node of the index entry. */
282
283 /** Get a pointer to the beginning of the index entry nodes in the
284 first part of the page.
285 @return the first index entry node. */
286 byte *nodes_begin() const { return (frame() + LOB_PAGE_DATA); }
287
288 /** Calculate and return the payload.
289 @return the payload possible in this page. */
290 static ulint payload() {
292 }
293
294 /** Set the transaction identifier in the first page header without
295 generating redo logs.
296 @param[in] id the transaction identifier. */
298 byte *ptr = frame() + OFFSET_TRX_ID;
299 mach_write_to_6(ptr, id);
300 }
301
302 /** Set the transaction identifier in the first page header.
303 @param[in] id the transaction identifier. */
305 byte *ptr = frame() + OFFSET_TRX_ID;
306 mach_write_to_6(ptr, id);
307 mlog_log_string(ptr, 6, m_mtr);
308 }
309
310 /** Initialize the LOB version to 1. */
312 ut_ad(m_mtr != nullptr);
313
315 }
316
317 /** Get the lob version number.
318 @return the lob version. */
319 uint32_t get_lob_version() {
321 }
322
323 /** Increment the lob version by 1. */
324 uint32_t incr_lob_version();
325
326 /** Set the last transaction identifier, without generating redo log
327 records.
328 @param[in] id the trx identifier. */
330 byte *ptr = frame() + OFFSET_LAST_TRX_ID;
331 mach_write_to_6(ptr, id);
332 }
333
334 /** Set the last transaction identifier.
335 @param[in] id the trx identifier. */
337 byte *ptr = frame() + OFFSET_LAST_TRX_ID;
338 mach_write_to_6(ptr, id);
339 mlog_log_string(ptr, 6, m_mtr);
340 }
341
342 /** Set the last transaction undo number.
343 @param[in] undo_no the trx undo number. */
345 ut_ad(m_mtr != nullptr);
346
347 byte *ptr = frame() + OFFSET_LAST_UNDO_NO;
348 mlog_write_ulint(ptr, undo_no, MLOG_4BYTES, m_mtr);
349 }
350
351 /** Get the last transaction identifier.
352 @return the transaction identifier. */
354 byte *ptr = frame() + OFFSET_LAST_TRX_ID;
355 return (mach_read_from_6(ptr));
356 }
357
358 /** Get the last transaction undo number.
359 @return the transaction undo number. */
361 byte *ptr = frame() + OFFSET_LAST_UNDO_NO;
362 return (mach_read_from_4(ptr));
363 }
364
365 /** Set the length of data stored in bytes.
366 @param[in] len amount of data stored in bytes. */
367 void set_data_len(ulint len) {
368 ut_ad(m_mtr != nullptr);
369
371 }
372
373 /** Write as much as possible of the given data into the page.
374 @param[in] trxid the current transaction.
375 @param[in] data the data to be written.
376 @param[in] len the length of the given data.
377 @return number of bytes actually written. */
378 ulint write(trx_id_t trxid, const byte *&data, ulint &len);
379
380 /** Replace data in the page by making a copy-on-write.
381 @param[in] trx Current transaction.
382 @param[in] offset Location where replace operation starts.
383 @param[in,out] ptr Buffer containing new data. after the call it will
384 point to remaining data.
385 @param[in,out] want Requested amount of data to be replaced. After the
386 call it will contain amount of data yet to be replaced.
387 @param[in] mtr Mini-transaction context.
388 @return the newly allocated buffer block.
389 @return nullptr if new page could not be allocated
390 (DB_OUT_OF_FILE_SPACE). */
391 buf_block_t *replace(trx_t *trx, ulint offset, const byte *&ptr, ulint &want,
392 mtr_t *mtr);
393
394 /** Replace data in the page inline.
395 @param[in] offset Location where replace operation starts.
396 @param[in,out] ptr Buffer containing new data. after the
397 call it will point to remaining data.
398 @param[in,out] want Requested amount of data to be replaced.
399 after the call it will contain amount of
400 data yet to be replaced.
401 @param[in] mtr Mini-transaction context.*/
402 void replace_inline(ulint offset, const byte *&ptr, ulint &want, mtr_t *mtr);
403
406 }
407
408 /** Read data from the first page.
409 @param[in] offset the offset from where read starts.
410 @param[out] ptr the output buffer
411 @param[in] want number of bytes to read.
412 @return number of bytes read. */
413 ulint read(ulint offset, byte *ptr, ulint want);
414
416 ut_ad(m_mtr != nullptr);
417
420 }
421
423
425 return (frame() + OFFSET_INDEX_FREE_NODES);
426 }
427
428 /** Get the number of bytes used to store LOB data in the first page
429 of uncompressed LOB.
430 @return Number of bytes available for LOB data. */
432 const ulint index_array_size = node_count() * index_entry_t::SIZE;
433
434 return (payload() - index_array_size);
435 }
436
437 /** Get the number of index entries this page can hold.
438 @return Number of index entries this page can hold. */
439 constexpr static ulint node_count() {
440 /* Each index entry is of size 60 bytes. We store only 10
441 index entries in the first page of the LOB. This means that
442 only 600 bytes are used for index data in the first page of
443 LOB. This will help to reserve more space in the first page
444 for the LOB data.*/
445 return (10);
446 }
447
448 std::ostream &print_index_entries(std::ostream &out) const;
449
450 std::ostream &print_index_entries_cache_s(std::ostream &out,
451 BlockCache &cache) const;
452
453 /** Obtain the location where the data begins.
454 @return pointer to location within page where data begins. */
455 byte *data_begin() const {
457
458 constexpr ulint index_array_size = node_count() * index_entry_t::SIZE;
459
460 return (frame() + LOB_PAGE_DATA + index_array_size);
461 }
462
463 /** Append data into a LOB first page. */
464 ulint append(trx_id_t trxid, byte *&data, ulint &len);
465
466#ifdef UNIV_DEBUG
467 /** Validate the first page. */
468 bool validate() const;
469#endif /* UNIV_DEBUG */
470
472
474 const page_id_t &page_id,
475 const page_size_t &page_size) {
476 mtr_t local_mtr;
477 mtr_start(&local_mtr);
478 first_page_t first(&local_mtr, index);
479 first.load_x(page_id, page_size);
480 page_type_t page_type = first.get_page_type();
481 mtr_commit(&local_mtr);
482 return (page_type);
483 }
484
485 public:
486 /** Restart the given mtr. The first page must already be x-latched by
487 the m_mtr.
488 @param[in] mtr Mini-transaction context which is to be restarted. */
489 void restart_mtr(mtr_t *mtr) {
490 ut_ad(mtr != m_mtr);
491 mtr_commit(mtr);
492 mtr_start(mtr);
494 load_x(mtr);
495 }
496};
497
498} /* namespace lob */
499
500#endif /* lob0first_h */
uint32_t space_id_t
Tablespace identifier.
Definition: api0api.h:47
Kerberos Client Authentication nullptr
Definition: auth_kerberos_client_plugin.cc:251
The B-tree.
The database buffer pool high-level routines.
static buf_frame_t * buf_block_get_frame(const buf_block_t *block)
Gets a pointer to the memory frame of a block.
buf_block_t * buf_page_get(const page_id_t &id, const page_size_t &size, ulint latch, ut::Location location, mtr_t *mtr)
NOTE! The following macros should be used instead of buf_page_get_gen, to improve debugging.
Definition: buf0buf.h:441
page_zip_des_t * buf_block_get_page_zip(buf_block_t *block) noexcept
Gets the compressed page descriptor corresponding to an uncompressed page if applicable.
Definition: buf0buf.h:2762
page_id_t id
Page id.
Definition: buf0buf.h:1376
Page identifier.
Definition: buf0types.h:207
page_no_t page_no() const
Retrieve the page number.
Definition: buf0types.h:243
Page size descriptor.
Definition: page0size.h:50
Data dictionary system.
static const page_size_t dict_table_page_size(const dict_table_t *table)
Get the table page size.
static space_id_t dict_index_get_space(const dict_index_t *index)
Gets the space id of the root of the index tree.
constexpr page_type_t FIL_PAGE_TYPE_LOB_FIRST
The first page of an uncompressed LOB.
Definition: fil0fil.h:1305
constexpr page_type_t FIL_PAGE_TYPE_LOB_INDEX
Index pages of uncompressed LOB.
Definition: fil0fil.h:1299
uint16_t page_type_t
Definition: fil0fil.h:1218
constexpr uint32_t FIL_PAGE_TYPE
file page type: FIL_PAGE_INDEX,..., 2 bytes.
Definition: fil0types.h:76
constexpr uint32_t FIL_PAGE_DATA
start of the data on the page
Definition: fil0types.h:111
constexpr uint32_t FIL_PAGE_DATA_END
size of the page trailer
Definition: fil0types.h:119
File-based list utilities.
constexpr ulint FLST_BASE_NODE_SIZE
Definition: fut0lst.h:50
byte flst_base_node_t
Definition: fut0lst.h:46
static ulint flst_get_len(const flst_base_node_t *base)
Get the length of a list.
byte flst_node_t
Definition: fut0lst.h:47
static int flags[50]
Definition: hp_test1.cc:40
Implements the large objects (LOB) module.
static uint32_t mach_read_from_4(const byte *b)
The following function is used to fetch data from 4 consecutive bytes.
static uint8_t mach_read_from_1(const byte *b)
The following function is used to fetch data from one byte.
static void mach_write_to_6(byte *b, uint64_t id)
The following function is used to store data in 6 consecutive bytes.
static uint64_t mach_read_from_6(const byte *b)
The following function is used to fetch data from 6 consecutive bytes.
Mini-transaction logging routines.
void mlog_log_string(byte *ptr, ulint len, mtr_t *mtr)
Logs a write of a string to a file page buffered in the buffer pool.
Definition: mtr0log.cc:347
void mlog_write_ulint(byte *ptr, ulint val, mlog_id_t type, mtr_t *mtr)
Writes 1, 2 or 4 bytes to a file page.
Definition: mtr0log.cc:258
#define mtr_commit(m)
Commit a mini-transaction.
Definition: mtr0mtr.h:59
#define mtr_memo_contains(m, o, t)
Check if memo contains the given item.
Definition: mtr0mtr.h:107
#define mtr_start(m)
Start a mini-transaction.
Definition: mtr0mtr.h:50
@ MLOG_4BYTES
4 bytes ...
Definition: mtr0types.h:76
@ MLOG_1BYTE
one byte is written
Definition: mtr0types.h:70
@ MLOG_2BYTES
2 bytes ...
Definition: mtr0types.h:73
@ MTR_MEMO_PAGE_X_FIX
Definition: mtr0types.h:273
Used for bulk load of data.
Definition: fut0lst.cc:411
byte * fut_get_ptr(fil_addr_t addr, std::vector< buf_block_t * > &blocks)
Gets a pointer to a file address.
Definition: fut0lst.cc:499
Provides the large objects (LOB) module.
Definition: lob0bulk.h:44
std::map< page_no_t, buf_block_t * > BlockCache
Definition: lob0index.h:37
struct result result
Definition: result.h:34
required string type
Definition: replication_group_member_actions.proto:34
The buffer control block structure.
Definition: buf0buf.h:1747
page_type_t get_page_type() const
Get the page type of the current buffer block.
Definition: buf0buf.h:1951
buf_page_t page
page information; this must be the first field, so that buf_pool->page_hash can point to buf_page_t o...
Definition: buf0buf.h:1753
Data structure for an index.
Definition: dict0mem.h:1046
dict_table_t * table
back pointer to table
Definition: dict0mem.h:1060
page_size_t get_page_size() const
Get the page size of the tablespace to which this index belongs.
Definition: dict0mem.cc:895
File space address.
Definition: fil0fil.h:1173
uint32_t boffset
Byte offset within the page.
Definition: fil0fil.h:1205
page_no_t page
Page number within a space.
Definition: fil0fil.h:1202
Definition: lob0util.h:42
mtr_t * m_mtr
Definition: lob0util.h:129
dict_index_t * m_index
Definition: lob0util.h:130
page_type_t get_page_type() const
Definition: lob0util.h:95
buf_block_t * m_block
Definition: lob0util.h:128
byte * frame() const
Definition: lob0util.h:99
The first page of an uncompressed LOB.
Definition: lob0first.h:43
flst_base_node_t * index_list() const
Definition: lob0first.h:422
void set_version_0()
Set the LOB format version number to 0.
Definition: lob0first.h:107
flst_node_t * addr2ptr_x(fil_addr_t &addr) const
Load the file list node from the given location.
Definition: lob0first.h:200
byte * data_begin() const
Obtain the location where the data begins.
Definition: lob0first.h:455
buf_block_t * load_x(const page_id_t &page_id, const page_size_t &page_size, mtr_t *mtr)
Load the first page of LOB with x-latch.
Definition: lob0first.cc:361
first_page_t(mtr_t *mtr, dict_index_t *index)
Constructor.
Definition: lob0first.h:103
static const ulint OFFSET_INDEX_LIST
The offset where the list base node is located.
Definition: lob0first.h:68
undo_no_t get_last_trx_undo_no() const
Get the last transaction undo number.
Definition: lob0first.h:360
static ulint max_space_available()
Get the number of bytes used to store LOB data in the first page of uncompressed LOB.
Definition: lob0first.h:431
void set_last_trx_id(trx_id_t id)
Set the last transaction identifier.
Definition: lob0first.h:336
buf_block_t * get_block()
Get the buffer block of the LOB first page.
Definition: lob0first.h:187
std::ostream & print_index_entries(std::ostream &out) const
Definition: lob0first.cc:164
static const ulint OFFSET_LAST_TRX_ID
The latest transaction that modified this LOB.
Definition: lob0first.h:55
uint32_t incr_lob_version()
Increment the lob version by 1.
Definition: lob0first.cc:392
void set_last_trx_id_no_redo(trx_id_t id)
Set the last transaction identifier, without generating redo log records.
Definition: lob0first.h:329
void dealloc()
Free the first page.
Definition: lob0first.cc:467
bool can_be_partially_updated()
When the bit is set, the LOB is not partially updatable anymore.
Definition: lob0first.h:119
void free_all_data_pages()
Free all the data pages.
Definition: lob0first.cc:282
buf_block_t * alloc(mtr_t *alloc_mtr, bool is_bulk)
Allocate the first page for uncompressed LOB.
Definition: lob0first.cc:220
first_page_t()=default
The default constructor.
void restart_mtr(mtr_t *mtr)
Restart the given mtr.
Definition: lob0first.h:489
ulint get_data_len() const
Definition: lob0first.h:404
page_type_t get_page_type()
Definition: lob0first.h:471
std::ostream & print_index_entries_cache_s(std::ostream &out, BlockCache &cache) const
Definition: lob0first.cc:124
flst_base_node_t * free_list() const
Definition: lob0first.h:424
byte * nodes_begin() const
Get a pointer to the beginning of the index entry nodes in the first part of the page.
Definition: lob0first.h:286
bool is_empty() const
Check if the index list is empty or not.
Definition: lob0first.h:270
ulint read(ulint offset, byte *ptr, ulint want)
Read data from the first page.
Definition: lob0first.cc:420
static const ulint LOB_PAGE_TRAILER_LEN
Definition: lob0first.h:79
static const ulint OFFSET_LAST_UNDO_NO
The latest transaction undo_no that modified this LOB.
Definition: lob0first.h:58
ulint append(trx_id_t trxid, byte *&data, ulint &len)
Append data into a LOB first page.
flst_node_t * alloc_index_entry(bool bulk)
Allocate one index entry.
Definition: lob0first.cc:264
static const ulint LOB_PAGE_DATA
The offset where the contents of the first page begins.
Definition: lob0first.h:76
void free_all_index_pages()
Free all the index pages.
Definition: lob0first.cc:325
buf_block_t * load_s(page_id_t page_id, page_size_t page_size)
Load the first page of LOB with s-latch.
Definition: lob0first.h:151
flst_node_t * addr2ptr(const fil_addr_t &addr)
Load the file list node from the given location, assuming that it exists in the first page itself.
Definition: lob0first.h:208
flst_node_t * addr2ptr_s_cache(std::map< page_no_t, buf_block_t * > &cache, fil_addr_t &addr) const
Load the file list node from the given location.
Definition: lob0first.h:229
void set_trx_id(trx_id_t id)
Set the transaction identifier in the first page header.
Definition: lob0first.h:304
static const ulint OFFSET_FLAGS
One byte of flag bits.
Definition: lob0first.h:49
buf_block_t * load_x(const page_id_t &page_id, const page_size_t &page_size)
Load the first page of LOB with x-latch.
Definition: lob0first.h:181
static const uint32_t OFFSET_LOB_VERSION
LOB version.
Definition: lob0first.h:52
void destroy()
Free all the pages associated with this LOB.
Definition: lob0first.cc:475
void replace_inline(ulint offset, const byte *&ptr, ulint &want, mtr_t *mtr)
Replace data in the page inline.
Definition: lob0first.cc:36
void set_trx_id_no_redo(trx_id_t id)
Set the transaction identifier in the first page header without generating redo logs.
Definition: lob0first.h:297
void set_last_trx_undo_no(undo_no_t undo_no)
Set the last transaction undo number.
Definition: lob0first.h:344
buf_block_t * load_x(mtr_t *mtr) const
Load the first page of LOB with x-latch in the given mtr context.
Definition: lob0first.h:169
static const ulint OFFSET_INDEX_FREE_NODES
The offset where the list base node is located.
Definition: lob0first.h:72
first_page_t(buf_block_t *block, mtr_t *mtr)
Constructor.
Definition: lob0first.h:87
first_page_t(buf_block_t *block, mtr_t *mtr, dict_index_t *index)
Constructor.
Definition: lob0first.h:97
uint8_t get_flags()
Obtain the flags value.
Definition: lob0first.h:114
static page_type_t get_page_type(dict_index_t *index, const page_id_t &page_id, const page_size_t &page_size)
Definition: lob0first.h:473
constexpr static ulint node_count()
Get the number of index entries this page can hold.
Definition: lob0first.h:439
buf_block_t * replace(trx_t *trx, ulint offset, const byte *&ptr, ulint &want, mtr_t *mtr)
Replace data in the page by making a copy-on-write.
Definition: lob0first.cc:60
ulint write(trx_id_t trxid, const byte *&data, ulint &len)
Write as much as possible of the given data into the page.
Definition: lob0first.cc:435
flst_node_t * addr2ptr_s(fil_addr_t &addr)
Load the file list node from the given location.
Definition: lob0first.h:217
void set_page_type()
Definition: lob0first.h:415
static const ulint OFFSET_TRX_ID
The trx that created the data stored in this page.
Definition: lob0first.h:64
flst_node_t * addr2ptr_x(const fil_addr_t &addr, mtr_t *mtr) const
Load the file list node from the given location.
Definition: lob0first.cc:485
void set_data_len(ulint len)
Set the length of data stored in bytes.
Definition: lob0first.h:367
uint32_t get_lob_version()
Get the lob version number.
Definition: lob0first.h:319
void make_empty()
Free all the pages associated with this LOB, except the first page.
Definition: lob0first.cc:480
trx_id_t get_last_trx_id() const
Get the last transaction identifier.
Definition: lob0first.h:353
static const ulint OFFSET_DATA_LEN
Length of data stored in this page.
Definition: lob0first.h:61
first_page_t(buf_block_t *block)
Constructor.
Definition: lob0first.h:91
static ulint payload()
Calculate and return the payload.
Definition: lob0first.h:290
static const ulint OFFSET_VERSION
Version information.
Definition: lob0first.h:45
void init_lob_version()
Initialize the LOB version to 1.
Definition: lob0first.h:311
bool validate() const
Validate the first page.
Definition: lob0first.cc:208
void mark_cannot_be_partially_updated(trx_t *trx)
When the bit is set, the LOB is not partially updatable anymore.
Definition: lob0first.cc:403
static const ulint SIZE
Total length of an index node.
Definition: lob0index.h:106
Mini-transaction handle and buffer.
Definition: mtr0mtr.h:177
mtr_log_t set_log_mode(mtr_log_t mode)
Change the logging mode.
Definition: mtr0mtr.cc:468
mtr_log_t get_log_mode() const
Get the logging mode.
Definition: mtr0mtr.ic:153
Definition: result.h:30
Definition: trx0trx.h:684
@ RW_X_LATCH
Definition: sync0rw.h:99
@ RW_S_LATCH
Definition: sync0rw.h:98
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
#define UNIV_PAGE_SIZE
The universal page size of the database.
Definition: univ.i:294
unsigned long int ulint
Definition: univ.i:406
#define UT_LOCATION_HERE
Definition: ut0core.h:73
#define ut_ad(EXPR)
Debug assertion.
Definition: ut0dbg.h:105