MySQL 8.0.31
Source Code Documentation
zlob0first.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 zlob0first_h
27#define zlob0first_h
28
29#include "fil0types.h"
30#include "fut0lst.h"
31#include "lob0impl.h"
32#include "univ.i"
33
34namespace lob {
35
36/** The first page of an zlob. */
38 /** Version information. One byte. */
40
41 /** One byte of flag bits. Currently only one bit (the least
42 significant bit) is used, other 7 bits are available for future use.*/
43 static const ulint OFFSET_FLAGS = FIL_PAGE_DATA + 1;
44
45 /** LOB version. 4 bytes.*/
46 static const uint32_t OFFSET_LOB_VERSION = OFFSET_FLAGS + 1;
47
48 /** The last transaction that modified this LOB. */
50
51 /** The last transaction that modified this LOB. */
53
54 /** The length of compressed data stored in this page. */
56
57 /** The transaction that created data in the data portion. */
59
60 /** The next index page. */
62
63 /** The next frag nodes page. */
65
66 /** List of free index entries. */
68
69 /** List of index entries. */
71
72 /** List of free frag entries. */
75
76 /** List of frag entries. */
77 static const ulint OFFSET_FRAG_LIST =
79
80 /** Begin of index entries. */
83
84 /** Given the page size, what is the number of index entries the
85 first page can contain. */
87
88 /** Given the page size, what is the number of frag entries the
89 first page can contain. */
91
93
96 }
97
100 }
101
104 }
105
106 bool is_empty() const {
108 return (flst_get_len(flst) == 0);
109 }
110
111 /** Get the length of the index list.
112 @return length of the index list. */
115 return (flst_get_len(flst));
116 }
117
120 }
121
122 byte *begin_data_ptr() const { return (frame() + begin_data()); }
123
124 /** Amount of zlob data that can be stored in first page (in bytes). */
127 ut_ad(begin_data() + FIL_PAGE_DATA_END < page_size.physical());
128 return (page_size.physical() - begin_data() - FIL_PAGE_DATA_END);
129 }
130
132
134 : m_block(nullptr), m_mtr(mtr), m_index(index) {}
135
137
139 : m_block(block), m_mtr(mtr), m_index(index) {}
140
141 buf_block_t *alloc(bool bulk);
142
143 void import(trx_id_t trx_id);
144
147 }
148
149 /** Load the given page number as the first page in x-latch mode.
150 @param[in] page_no the first page number.
151 @return the buffer block of the given page number. */
153 page_id_t page_id(dict_index_get_space(m_index), page_no);
155 m_block =
156 buf_page_get(page_id, page_size, RW_X_LATCH, UT_LOCATION_HERE, m_mtr);
157 return (m_block);
158 }
159
160 /** Load the first page using given mini-transaction. The first page must
161 already be x-latched by the m_mtr.
162 @param[in] mtr the mini-transaction in which first page is to be loaded.
163 @return the buffer block of first page. */
164 buf_block_t *load_x(mtr_t *mtr) const {
168 ut_ad(tmp == m_block);
169 return (tmp);
170 }
171
172 /** Load the first page of the compressed LOB with x-latch.
173 @param[in] page_id the page identifier of first page
174 @param[in] page_size the page size information of table.
175 @return buffer block of the first page. */
176 buf_block_t *load_x(const page_id_t &page_id, const page_size_t &page_size);
177
178 /** Load the given page number as the first page in s-latch mode.
179 @param[in] page_no the first page number.
180 @return the buffer block of the given page number. */
182 ut_ad(m_block == nullptr);
183
184 page_id_t page_id(dict_index_get_space(m_index), page_no);
186 m_block =
187 buf_page_get(page_id, page_size, RW_S_LATCH, UT_LOCATION_HERE, m_mtr);
188 return (m_block);
189 }
190
191 /** Deallocate the first page of a compressed LOB. */
192 void dealloc();
193
194 /** Set the FIL_PAGE_NEXT to FIL_NULL. */
196
197 /** Set the FIL_PAGE_PREV to FIL_NULL. */
199
200 /** Set the FIL_PAGE_NEXT to the given value.
201 @param[in] page_no the page number to set in FIL_PAGE_NEXT.
202 @param[in] mtr mini trx to be used for this modification. */
203 void set_next_page_no(page_no_t page_no, mtr_t *mtr) {
204 ut_ad(mtr != nullptr);
206 }
207
208 /** Set the FIL_PAGE_PREV to the given value.
209 @param[in] page_no the page number to set in FIL_PAGE_PREV.
210 @param[in] mtr mini trx to be used for this modification. */
211 void set_prev_page_no(page_no_t page_no, mtr_t *mtr) {
212 ut_ad(mtr != nullptr);
214 }
215
216 /** Write the space identifier to the page header, without generating
217 redo log records.
218 @param[in] space_id the space identifier. */
221 nullptr);
222 }
223
224 void init() {
225 ut_ad(m_mtr != nullptr);
226
229 set_data_len(0);
232 set_trx_id(0);
233 flst_base_node_t *flst = free_list();
234 flst_init(flst, m_mtr);
236 flst_init(ilst, m_mtr);
237 flst_base_node_t *free_frag_lst = free_frag_list();
238 flst_init(free_frag_lst, m_mtr);
239 flst_base_node_t *frag_lst = frag_list();
240 flst_init(frag_lst, m_mtr);
245 }
246
247 /** Get the amount of zlob data stored in this page. */
250 }
251
252 /** Get the page number. */
253 page_no_t get_page_no() const { return (m_block->page.id.page_no()); }
254
255 /** Get the page id of the first page of compressed LOB.
256 @return page id of the first page of compressed LOB. */
258 ut_ad(m_block != nullptr);
259
260 return (m_block->page.id);
261 }
262
264 page_no_t page_no = get_page_no();
265 uint32_t offset = static_cast<uint32_t>(begin_data());
266 return (fil_addr_t(page_no, offset));
267 }
268
269 /** All the index pages are singly linked with each other, and
270 the first page contains the link to one index page.
271 @param[in] page_no the page number of an index page. */
273 set_index_page_no(page_no, m_mtr);
274 }
275
276 /** All the index pages are singly linked with each other, and
277 the first page contains the link to one index page.
278 @param[in] page_no the page number of an index page.
279 @param[in] mtr use this mini transaction context for redo logs. */
280 void set_index_page_no(page_no_t page_no, mtr_t *mtr) {
281 ut_ad(m_mtr != nullptr);
283 }
284
285 /** All the index pages are singly linked with each other, and
286 the first page contains the link to one index page. Get that index
287 page number.
288 @return the index page number. */
291 }
292
293 /** All the fragment pages are doubly linked with each other, and
294 the first page contains the link to one fragment page in FIL_PAGE_PREV. Get
295 that frag page number.
296 @return the frag page number. */
298
299 /** All the fragment pages are doubly linked with each other, and
300 the first page contains the link to one fragment page in FIL_PAGE_PREV. Get
301 that frag page number.
302 @param[in] mtr Mini-transaction to use for this read operation.
303 @return the frag page number. */
305 return (mtr_read_ulint(frame() + FIL_PAGE_PREV, MLOG_4BYTES, mtr));
306 }
307
308#ifdef UNIV_DEBUG
309 /** Verify that the page number pointed to by FIL_PAGE_PREV of the first page
310 of LOB is indeed a fragment page. It uses its own mtr internally.
311 @return true if it is a fragment page, false otherwise. */
312 bool verify_frag_page_no();
313#endif /* UNIV_DEBUG */
314
315 /** All the fragment pages (@see z_frag_page_t) are doubly linked with each
316 other, and the first page contains the link to one fragment page in
317 FIL_PAGE_PREV.
318 @param[in] mtr Mini-transaction for this modification.
319 @param[in] page_no The page number of a fragment page. */
320 void set_frag_page_no(mtr_t *mtr, page_no_t page_no) {
322 set_prev_page_no(page_no, mtr);
323 }
324
325 /** All the fragment pages (@see z_frag_page_t) are doubly linked with each
326 other, and the first page contains the link to one fragment page in
327 FIL_PAGE_PREV.
328 @param[in] page_no the page number of a fragment page. */
331 set_prev_page_no(page_no, m_mtr);
332 }
333
334 /** All the frag node pages (@see z_frag_node_page_t) are singly linked with
335 each other, and the first page contains the link to the last allocated frag
336 node page. The last allocated FIL_PAGE_TYPE_ZLOB_FRAG_ENTRY page will be the
337 first in this list. This list is used to free these pages.
338 @param[in] page_no the page number of an frag node page. */
341 }
342
343 /** All the frag node pages (@see z_frag_node_page_t) are singly linked with
344 each other, and the first page contains the link to the last allocated frag
345 node page. The last allocated FIL_PAGE_TYPE_ZLOB_FRAG_ENTRY page will be the
346 first in this list. This list is used to free these pages.
347 @param[in] page_no the page number of an frag node page.
348 @param[in] mtr mini trx context to generate redo logs. */
350 ut_ad(mtr != nullptr);
352 mtr);
353 }
354
355 /** Free all the z_frag_page_t pages. All the z_frag_page_t pages are
356 singly linked to each other. The head of the list is maintained in the
357 first page.
358 @return the number of pages freed. */
360
361 /** Free all the index pages.
362 @return the number of pages freed. */
363 size_t free_all_index_pages();
364
365 /** Free all the fragment pages.
366 @return the number of pages freed. */
367 size_t free_all_frag_pages();
368
369 private:
370 /** Free all the fragment pages when the next page of the first LOB page IS
371 NOT USED to link the fragment pages.
372 @return the number of pages freed. */
374
375 /** Free all the fragment pages when the next page of the first LOB page IS
376 USED to link the fragment pages.
377 @return the number of pages freed. */
379
380 public:
381 /** Free all the data pages.
382 @return the number of pages freed. */
383 size_t free_all_data_pages();
384
385 /** All the frag node pages are singly linked with each other, and the
386 first page contains the link to one frag node page. Get that frag node
387 page number.
388 @return the index page number. */
391 }
392
393 /** Set the page type to FIL_PAGE_TYPE_UNKNOWN. This is done while
394 deallocating this page. */
396 ut_ad(m_mtr != nullptr);
399 }
400
402 ut_ad(m_mtr != nullptr);
405 }
406
407 void set_data_len(ulint len) {
408 ut_ad(m_mtr != nullptr);
410 }
411
412 /** Update the trx id in the header.
413 @param[in] tid the given transaction identifier. */
415 byte *ptr = frame() + OFFSET_TRX_ID;
416 mach_write_to_6(ptr, tid);
417 mlog_log_string(ptr, 6, m_mtr);
418 }
419
420 /** Update the trx id in the header, without generating redo
421 log records.
422 @param[in] tid the given transaction identifier. */
424 byte *ptr = frame() + OFFSET_TRX_ID;
425 mach_write_to_6(ptr, tid);
426 }
427
428 /** Initialize the LOB version to 1. */
430 ut_ad(m_mtr != nullptr);
431
433 }
434
435 /** Get the LOB version
436 @return the LOB version. */
437 uint32_t get_lob_version() {
439 }
440
441 /** Increment LOB version by 1. */
442 uint32_t incr_lob_version();
443
444 /** Get one byte of flags
445 @return one byte of flags. */
446 uint8_t get_flags() { return (mach_read_from_1(frame() + OFFSET_FLAGS)); }
447
448 /** When the bit is set, the LOB is not partially updatable anymore.
449 @return true, if partially updatable.
450 @return false, if partially NOT updatable. */
452 uint8_t flags = get_flags();
453 return (!(flags & 0x01));
454 }
455
456 /** When the bit is set, the LOB is not partially updatable anymore.
457 Enable the bit.
458 @param[in] trx the current transaction.*/
460
462 byte *ptr = frame() + OFFSET_LAST_TRX_ID;
463 mach_write_to_6(ptr, tid);
464 mlog_log_string(ptr, 6, m_mtr);
465 }
466
467 /** Update the last transaction identifier in the header, without
468 generating redo logs.
469 @param[in] tid given transaction identifier.*/
471 byte *ptr = frame() + OFFSET_LAST_TRX_ID;
472 mach_write_to_6(ptr, tid);
473 }
474
476 ut_ad(m_mtr != nullptr);
477
478 byte *ptr = frame() + OFFSET_LAST_UNDO_NO;
479 mlog_write_ulint(ptr, undo_no, MLOG_4BYTES, m_mtr);
480 }
481
483 byte *ptr = frame() + OFFSET_LAST_TRX_ID;
484 return (mach_read_from_6(ptr));
485 }
486
488 byte *ptr = frame() + OFFSET_LAST_UNDO_NO;
489 return (mach_read_from_4(ptr));
490 }
491
493
495
497 return (frame() + OFFSET_FREE_FRAG_LIST);
498 }
499
501
503 flst_base_node_t *free_frag_lst = free_frag_list();
505 for (ulint i = 0; i < n; ++i) {
507 ptr += (i * z_frag_entry_t::SIZE);
508 z_frag_entry_t frag_entry(ptr, m_mtr);
509 frag_entry.init();
510 frag_entry.push_back(free_frag_lst);
511 }
512 }
513
514 void init_index_entries();
515
516 /** Allocate a fragment of the given size. This involves finding a
517 fragment page, that has space to store len bytes of data. If necessary,
518 allocate a new fragment page.
519 @param[in] bulk true if it is bulk operation
520 (OPCODE_INSERT_BULK), false otherwise.
521 @param[in] len length of data to be stored in
522 fragment page.
523 @param[out] frag_page the fragment page with the needed
524 free space.
525 @param[out] entry fragment page entry representing frag_page.
526 @return fragment identifier within the fragment page.
527 @return FRAG_ID_NULL if fragment could not be allocated. */
528 frag_id_t alloc_fragment(bool bulk, ulint len, z_frag_page_t &frag_page,
530
531 /** Allocate one index entry. If there is no free index entry,
532 allocate an index page (a page full of z_index_entry_t objects)
533 and service the request.
534 @return the allocated index entry. */
536
537 /** Allocate one frag page entry. If there is no free frag
538 entry, allocate an frag node page (a page full of z_frag_entry_t
539 objects) and service the request.
540 @return the allocated frag entry. */
542
543 /** Print the index entries. */
544 std::ostream &print_index_entries(std::ostream &out) const;
545
546 /** Print the index entries. */
547 std::ostream &print_frag_entries(std::ostream &out) const;
548
549 /** Print the page. */
550 std::ostream &print(std::ostream &out) const;
551
552 byte *frame() const { return (buf_block_get_frame(m_block)); }
553
554 /** Load the page, in x-latch mode, containing the given file address.
555 @param[in] addr given file address
556 @return the file list node pointer. */
558 return (addr2ptr_x(addr, m_mtr));
559 }
560
561 /** Load the page, in x-latch mode, containing the given file address.
562 @param[in] addr given file address
563 @param[in] mtr the mini-transaction context to be used.
564 @return the file list node pointer. */
567 const page_size_t page_size = dict_table_page_size(m_index->table);
568 return (fut_get_ptr(space, page_size, addr, RW_X_LATCH, mtr));
569 }
570
571 /** Load the page, in s-latch mode, containing the given file address.
572 @param[in] addr given file address
573 @return the file list node pointer. */
576 const page_size_t page_size = dict_table_page_size(m_index->table);
577 return (fut_get_ptr(space, page_size, addr, RW_S_LATCH, m_mtr));
578 }
579
580 /** Load the entry available in the given file address.
581 @param[in] addr file address
582 @param[out] entry the entry to be loaded.*/
584
585 /** Load the entry available in the given file address.
586 @param[in] addr file address
587 @param[out] entry the entry to be loaded.*/
589
590 /** Free all the pages of the zlob.
591 @return the total number of pages freed. */
592 size_t destroy();
593
594 /** Free all the pages of the zlob except the first page.
595 @return the total number of pages freed. */
596 size_t make_empty();
597
598#ifdef UNIV_DEBUG
599 private:
600 /** Validate the LOB. This is a costly function. We need to avoid using
601 this directly, instead call z_first_page_t::validate().
602 @return true if valid, false otherwise. */
603 bool validate_low();
604
605 public:
606 /** Validate the LOB.
607 @return true if valid, false otherwise. */
608 bool validate() {
609 static const uint32_t FREQ = 50;
610 static std::atomic<uint32_t> n{0};
611
612 bool valid = true;
613 if (++n % FREQ == 0) {
614 valid = validate_low();
615 }
616 return (valid);
617 }
618#endif /* UNIV_DEBUG */
619
620 /** Get the buffer block of the first page of LOB.
621 @return the buffer block of the first page of LOB. */
622 buf_block_t *get_block() const { return (m_block); }
623
624 public:
625 void set_mtr(mtr_t *mtr) { m_mtr = mtr; }
626
627 /** Restart the given mtr. The first page must already be x-latched by the
628 m_mtr.
629 @param[in] mtr the mini-transaction context which is to be restarted. */
630 void restart_mtr(mtr_t *mtr) {
631 ut_ad(mtr != m_mtr);
632
633 mtr_commit(mtr);
634 mtr_start(mtr);
636 load_x(mtr);
637 }
638
639 private:
640 /** The buffer block of the first page. */
642
643 /** The mini-transaction context. */
645
646 /** The index dictionary object. */
648
649}; // struct z_first_page_t
650
651/** Overloading the global output parameter to print object of type
652z_first_page_t into the given output stream.
653@param[in,out] out output stream.
654@param[in] obj object to be printed.
655@return the output stream. */
656inline std::ostream &operator<<(std::ostream &out, const z_first_page_t &obj) {
657 return (obj.print(out));
658}
659
660} /* namespace lob */
661
662#endif /* zlob0first_h */
uint32_t space_id_t
Tablespace identifier.
Definition: api0api.h:50
uint32_t page_no_t
Page number.
Definition: api0api.h:48
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:425
page_id_t id
Page id.
Definition: buf0buf.h:1319
Page identifier.
Definition: buf0types.h:206
page_no_t page_no() const
Retrieve the page number.
Definition: buf0types.h:242
Page size descriptor.
Definition: page0size.h:49
size_t physical() const
Retrieve the physical page size (on-disk).
Definition: page0size.h:120
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.
Fido Client Authentication nullptr
Definition: fido_client_plugin.cc:221
uint16_t page_type_t
Definition: fil0fil.h:1184
constexpr page_no_t FIL_NULL
'null' (undefined) page offset in the context of file spaces
Definition: fil0fil.h:1122
constexpr page_type_t FIL_PAGE_TYPE_UNKNOWN
In old tablespaces, garbage in FIL_PAGE_TYPE is replaced with this value when flushing pages.
Definition: fil0fil.h:1238
constexpr page_type_t FIL_PAGE_TYPE_ZLOB_FIRST
The first page of a compressed LOB.
Definition: fil0fil.h:1274
The low-level file system page header & trailer offsets.
constexpr uint32_t FIL_PAGE_TYPE
file page type: FIL_PAGE_INDEX,..., 2 bytes.
Definition: fil0types.h:75
constexpr uint32_t FIL_PAGE_DATA
start of the data on the page
Definition: fil0types.h:110
constexpr uint32_t FIL_PAGE_SPACE_ID
alias for space id
Definition: fil0types.h:107
constexpr uint32_t FIL_PAGE_NEXT
if there is a 'natural' successor of the page, its offset.
Definition: fil0types.h:60
constexpr uint32_t FIL_PAGE_PREV
if there is a 'natural' predecessor of the page, its offset.
Definition: fil0types.h:50
constexpr uint32_t FIL_PAGE_DATA_END
size of the page trailer
Definition: fil0types.h:118
static byte * fut_get_ptr(space_id_t space, const page_size_t &page_size, fil_addr_t addr, rw_lock_type_t rw_latch, mtr_t *mtr, buf_block_t **ptr_block=nullptr)
Gets a pointer to a file address and latches the page.
File-based list utilities.
constexpr ulint FLST_BASE_NODE_SIZE
Definition: fut0lst.h:49
byte flst_base_node_t
Definition: fut0lst.h:45
static ulint flst_get_len(const flst_base_node_t *base)
Get the length of a list.
static void flst_init(flst_base_node_t *base, mtr_t *mtr)
Initializes a list base node.
byte flst_node_t
Definition: fut0lst.h:46
static int flags[50]
Definition: hp_test1.cc:39
static uint16_t mach_read_from_2(const byte *b)
The following function is used to fetch data from 2 consecutive bytes.
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.
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:341
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:255
#define mtr_commit(m)
Commit a mini-transaction.
Definition: mtr0mtr.h:58
#define mtr_memo_contains(m, o, t)
Check if memo contains the given item.
Definition: mtr0mtr.h:106
#define mtr_start(m)
Start a mini-transaction.
Definition: mtr0mtr.h:49
#define mtr_read_ulint(p, t, m)
Read 1 - 4 bytes from a file page buffered in the buffer pool.
Definition: mtr0mtr.h:86
@ MLOG_4BYTES
4 bytes ...
Definition: mtr0types.h:75
@ MLOG_1BYTE
one byte is written
Definition: mtr0types.h:69
@ MLOG_2BYTES
2 bytes ...
Definition: mtr0types.h:72
@ MTR_MEMO_PAGE_X_FIX
Definition: mtr0types.h:272
Provides the large objects (LOB) module.
Definition: lob0del.h:31
ulint frag_id_t
Definition: lob0impl.h:488
std::ostream & operator<<(std::ostream &out, const plist_node_t &obj)
Definition: lob0impl.h:238
Definition: completion_hash.h:34
The buffer control block structure.
Definition: buf0buf.h:1664
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:1670
page_no_t get_prev_page_no() const
Get the prev page number of the current buffer block.
Definition: buf0buf.h:1844
Data structure for an index.
Definition: dict0mem.h:1021
dict_table_t * table
back pointer to table
Definition: dict0mem.h:1035
page_size_t get_page_size() const
Get the page size of the tablespace to which this index belongs.
Definition: dict0mem.cc:894
File space address.
Definition: fil0fil.h:1139
The first page of an zlob.
Definition: zlob0first.h:37
std::ostream & print_frag_entries(std::ostream &out) const
Print the index entries.
Definition: zlob0first.cc:144
void restart_mtr(mtr_t *mtr)
Restart the given mtr.
Definition: zlob0first.h:630
void set_page_type_unknown()
Set the page type to FIL_PAGE_TYPE_UNKNOWN.
Definition: zlob0first.h:395
void init_lob_version()
Initialize the LOB version to 1.
Definition: zlob0first.h:429
uint32_t incr_lob_version()
Increment LOB version by 1.
Definition: zlob0first.cc:454
void set_data_len(ulint len)
Definition: zlob0first.h:407
void set_frag_node_page_no(page_no_t page_no)
All the frag node pages (.
Definition: zlob0first.h:339
ulint get_n_frag_entries() const
Given the page size, what is the number of frag entries the first page can contain.
Definition: zlob0first.cc:64
static const ulint OFFSET_INDEX_PAGE_NO
The next index page.
Definition: zlob0first.h:61
buf_block_t * get_block() const
Get the buffer block of the first page of LOB.
Definition: zlob0first.h:622
size_t free_all_frag_pages()
Free all the fragment pages.
Definition: zlob0first.cc:644
static const ulint OFFSET_LAST_UNDO_NO
The last transaction that modified this LOB.
Definition: zlob0first.h:52
z_first_page_t(buf_block_t *block)
Definition: zlob0first.h:136
page_no_t get_index_page_no() const
All the index pages are singly linked with each other, and the first page contains the link to one in...
Definition: zlob0first.h:289
void init_frag_entries()
Definition: zlob0first.h:502
size_t free_all_frag_pages_old()
Free all the fragment pages when the next page of the first LOB page IS NOT USED to link the fragment...
Definition: zlob0first.cc:589
size_t make_empty()
Free all the pages of the zlob except the first page.
Definition: zlob0first.cc:687
void set_prev_page_no(page_no_t page_no, mtr_t *mtr)
Set the FIL_PAGE_PREV to the given value.
Definition: zlob0first.h:211
static const ulint OFFSET_INDEX_BEGIN
Begin of index entries.
Definition: zlob0first.h:81
static const ulint OFFSET_DATA_LEN
The length of compressed data stored in this page.
Definition: zlob0first.h:55
flst_node_t * addr2ptr_s(fil_addr_t &addr)
Load the page, in s-latch mode, containing the given file address.
Definition: zlob0first.h:574
size_t free_all_frag_node_pages()
Free all the z_frag_page_t pages.
Definition: zlob0first.cc:336
ulint size_of_index_entries() const
Definition: zlob0first.cc:398
void init()
Definition: zlob0first.h:224
uint32_t get_lob_version()
Get the LOB version.
Definition: zlob0first.h:437
bool validate()
Validate the LOB.
Definition: zlob0first.h:608
bool is_empty() const
Definition: zlob0first.h:106
size_t free_all_index_pages()
Free all the index pages.
Definition: zlob0first.cc:369
void dealloc()
Deallocate the first page of a compressed LOB.
Definition: zlob0first.cc:423
void set_last_trx_id_no_redo(trx_id_t tid)
Update the last transaction identifier in the header, without generating redo logs.
Definition: zlob0first.h:470
buf_block_t * m_block
The buffer block of the first page.
Definition: zlob0first.h:641
void set_prev_page_null()
Set the FIL_PAGE_PREV to FIL_NULL.
Definition: zlob0first.h:198
bool verify_frag_page_no()
Verify that the page number pointed to by FIL_PAGE_PREV of the first page of LOB is indeed a fragment...
Definition: zlob0first.cc:697
page_no_t get_frag_node_page_no()
All the frag node pages are singly linked with each other, and the first page contains the link to on...
Definition: zlob0first.h:389
buf_block_t * alloc(bool bulk)
Definition: zlob0first.cc:89
void set_mtr(mtr_t *mtr)
Definition: zlob0first.h:625
flst_node_t * addr2ptr_x(fil_addr_t &addr) const
Load the page, in x-latch mode, containing the given file address.
Definition: zlob0first.h:557
static const ulint OFFSET_FRAG_LIST
List of frag entries.
Definition: zlob0first.h:77
void set_next_page_null()
Set the FIL_PAGE_NEXT to FIL_NULL.
Definition: zlob0first.h:195
size_t free_all_data_pages()
Free all the data pages.
Definition: zlob0first.cc:485
z_frag_entry_t alloc_frag_entry(bool bulk)
Allocate one frag page entry.
Definition: zlob0first.cc:192
void set_next_page_no(page_no_t page_no, mtr_t *mtr)
Set the FIL_PAGE_NEXT to the given value.
Definition: zlob0first.h:203
void set_version_0()
Definition: zlob0first.h:118
void set_trx_id(trx_id_t tid)
Update the trx id in the header.
Definition: zlob0first.h:414
flst_node_t * addr2ptr_x(fil_addr_t &addr, mtr_t *mtr) const
Load the page, in x-latch mode, containing the given file address.
Definition: zlob0first.h:565
static const ulint OFFSET_FLAGS
One byte of flag bits.
Definition: zlob0first.h:43
ulint get_n_index_entries() const
Given the page size, what is the number of index entries the first page can contain.
Definition: zlob0first.cc:36
page_type_t get_page_type() const
Definition: zlob0first.h:145
page_id_t get_page_id() const
Get the page id of the first page of compressed LOB.
Definition: zlob0first.h:257
flst_base_node_t * frag_list() const
Definition: zlob0first.h:500
void set_last_trx_id(trx_id_t tid)
Definition: zlob0first.h:461
static const ulint OFFSET_TRX_ID
The transaction that created data in the data portion.
Definition: zlob0first.h:58
flst_base_node_t * free_list() const
Definition: zlob0first.h:492
ulint begin_data() const
Definition: zlob0first.h:102
bool validate_low()
Validate the LOB.
Definition: zlob0first.cc:532
static const uint32_t OFFSET_LOB_VERSION
LOB version.
Definition: zlob0first.h:46
byte * begin_data_ptr() const
Definition: zlob0first.h:122
page_no_t get_page_no() const
Get the page number.
Definition: zlob0first.h:253
void set_space_id_no_redo(space_id_t space_id)
Write the space identifier to the page header, without generating redo log records.
Definition: zlob0first.h:219
mtr_t * m_mtr
The mini-transaction context.
Definition: zlob0first.h:644
undo_no_t get_last_trx_undo_no() const
Definition: zlob0first.h:487
void set_frag_page_no(mtr_t *mtr, page_no_t page_no)
All the fragment pages (.
Definition: zlob0first.h:320
ulint get_index_list_length() const
Get the length of the index list.
Definition: zlob0first.h:113
size_t destroy()
Free all the pages of the zlob.
Definition: zlob0first.cc:680
dict_index_t * m_index
The index dictionary object.
Definition: zlob0first.h:647
z_index_entry_t alloc_index_entry(bool bulk)
Allocate one index entry.
Definition: zlob0first.cc:167
static const ulint OFFSET_FREE_LIST
List of free index entries.
Definition: zlob0first.h:67
static const ulint OFFSET_FRAG_NODES_PAGE_NO
The next frag nodes page.
Definition: zlob0first.h:64
page_no_t get_frag_page_no() const
All the fragment pages are doubly linked with each other, and the first page contains the link to one...
Definition: zlob0first.h:297
size_t free_all_frag_pages_new()
Free all the fragment pages when the next page of the first LOB page IS USED to link the fragment pag...
Definition: zlob0first.cc:654
static const ulint OFFSET_FREE_FRAG_LIST
List of free frag entries.
Definition: zlob0first.h:73
static const ulint OFFSET_INDEX_LIST
List of index entries.
Definition: zlob0first.h:70
buf_block_t * load_s(page_no_t page_no)
Load the given page number as the first page in s-latch mode.
Definition: zlob0first.h:181
z_first_page_t(mtr_t *mtr, dict_index_t *index)
Definition: zlob0first.h:133
z_first_page_t()
Definition: zlob0first.h:131
z_first_page_t(buf_block_t *block, mtr_t *mtr, dict_index_t *index)
Definition: zlob0first.h:138
void set_last_trx_undo_no(undo_no_t undo_no)
Definition: zlob0first.h:475
void set_index_page_no(page_no_t page_no)
All the index pages are singly linked with each other, and the first page contains the link to one in...
Definition: zlob0first.h:272
bool can_be_partially_updated()
When the bit is set, the LOB is not partially updatable anymore.
Definition: zlob0first.h:451
static const ulint OFFSET_LAST_TRX_ID
The last transaction that modified this LOB.
Definition: zlob0first.h:49
flst_base_node_t * index_list() const
Definition: zlob0first.h:494
uint8_t get_flags()
Get one byte of flags.
Definition: zlob0first.h:446
flst_base_node_t * free_frag_list() const
Definition: zlob0first.h:496
void set_page_type()
Definition: zlob0first.h:401
void mark_cannot_be_partially_updated(trx_t *trx)
When the bit is set, the LOB is not partially updatable anymore.
Definition: zlob0first.cc:467
fil_addr_t get_self_addr() const
Definition: zlob0first.h:263
void load_entry_s(fil_addr_t &addr, z_index_entry_t &entry)
Load the entry available in the given file address.
Definition: zlob0first.cc:414
ulint payload()
Amount of zlob data that can be stored in first page (in bytes).
Definition: zlob0first.h:125
frag_id_t alloc_fragment(bool bulk, ulint len, z_frag_page_t &frag_page, z_frag_entry_t &entry)
Allocate a fragment of the given size.
Definition: zlob0first.cc:215
void load_entry_x(fil_addr_t &addr, z_index_entry_t &entry)
Load the entry available in the given file address.
Definition: zlob0first.cc:418
void set_frag_node_page_no(page_no_t page_no, mtr_t *mtr)
All the frag node pages (.
Definition: zlob0first.h:349
std::ostream & print_index_entries(std::ostream &out) const
Print the index entries.
Definition: zlob0first.cc:106
trx_id_t get_last_trx_id() const
Definition: zlob0first.h:482
page_no_t get_frag_page_no(mtr_t *mtr) const
All the fragment pages are doubly linked with each other, and the first page contains the link to one...
Definition: zlob0first.h:304
ulint begin_frag_entries() const
Definition: zlob0first.h:98
void init_index_entries()
Definition: zlob0first.cc:402
void set_index_page_no(page_no_t page_no, mtr_t *mtr)
All the index pages are singly linked with each other, and the first page contains the link to one in...
Definition: zlob0first.h:280
void set_trx_id_no_redo(trx_id_t tid)
Update the trx id in the header, without generating redo log records.
Definition: zlob0first.h:423
byte * frame() const
Definition: zlob0first.h:552
static const ulint OFFSET_VERSION
Version information.
Definition: zlob0first.h:39
void set_frag_page_no(page_no_t page_no)
All the fragment pages (.
Definition: zlob0first.h:329
buf_block_t * load_x(mtr_t *mtr) const
Load the first page using given mini-transaction.
Definition: zlob0first.h:164
ulint get_data_len() const
Get the amount of zlob data stored in this page.
Definition: zlob0first.h:248
ulint size_of_frag_entries() const
Definition: zlob0first.h:94
std::ostream & print(std::ostream &out) const
Print the page.
Definition: zlob0first.cc:327
buf_block_t * load_x(page_no_t page_no)
Load the given page number as the first page in x-latch mode.
Definition: zlob0first.h:152
An entry representing one fragment page.
Definition: lob0impl.h:554
void init()
Initialize the fragment entry contents.
Definition: lob0impl.h:592
static const ulint SIZE
Total size of one frag entry.
Definition: lob0impl.h:578
void push_back(flst_base_node_t *bnode)
Add this node as the last node in the given list.
Definition: lob0impl.h:637
The fragment page.
Definition: lob0impl.h:1351
An index entry pointing to one zlib stream.
Definition: zlob0index.h:86
Mini-transaction handle and buffer.
Definition: mtr0mtr.h:181
mtr_log_t set_log_mode(mtr_log_t mode)
Change the logging mode.
Definition: mtr0mtr.cc:470
mtr_log_t get_log_mode() const
Get the logging mode.
Definition: mtr0mtr.ic:175
Definition: trx0trx.h:680
@ RW_X_LATCH
Definition: sync0rw.h:95
@ RW_S_LATCH
Definition: sync0rw.h:94
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
Version control for database, common definitions, and include files.
unsigned long int ulint
Definition: univ.i:407
#define UT_LOCATION_HERE
Definition: ut0core.h:46
#define ut_ad(EXPR)
Debug assertion.
Definition: ut0dbg.h:68
int n
Definition: xcom_base.cc:505