MySQL 8.4.2
Source Code Documentation
|
The first page of an uncompressed LOB. More...
#include <lob0first.h>
Public Member Functions | |
first_page_t ()=default | |
The default constructor. More... | |
first_page_t (buf_block_t *block, mtr_t *mtr) | |
Constructor. More... | |
first_page_t (buf_block_t *block) | |
Constructor. More... | |
first_page_t (buf_block_t *block, mtr_t *mtr, dict_index_t *index) | |
Constructor. More... | |
first_page_t (mtr_t *mtr, dict_index_t *index) | |
Constructor. More... | |
void | set_version_0 () |
Set the LOB format version number to 0. More... | |
uint8_t | get_flags () |
Obtain the flags value. More... | |
bool | can_be_partially_updated () |
When the bit is set, the LOB is not partially updatable anymore. More... | |
void | import (trx_id_t trx_id) |
Do tablespace import. More... | |
void | mark_cannot_be_partially_updated (trx_t *trx) |
When the bit is set, the LOB is not partially updatable anymore. More... | |
buf_block_t * | alloc (mtr_t *alloc_mtr, bool is_bulk) |
Allocate the first page for uncompressed LOB. More... | |
void | free_all_index_pages () |
Free all the index pages. More... | |
void | free_all_data_pages () |
Free all the data pages. More... | |
buf_block_t * | load_s (page_id_t page_id, page_size_t page_size) |
Load the first page of LOB with s-latch. More... | |
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. More... | |
buf_block_t * | load_x (mtr_t *mtr) const |
Load the first page of LOB with x-latch in the given mtr context. More... | |
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. More... | |
buf_block_t * | get_block () |
Get the buffer block of the LOB first page. More... | |
flst_node_t * | addr2ptr_x (const fil_addr_t &addr, mtr_t *mtr) const |
Load the file list node from the given location. More... | |
flst_node_t * | addr2ptr_x (fil_addr_t &addr) const |
Load the file list node from the given location. More... | |
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. More... | |
flst_node_t * | addr2ptr_s (fil_addr_t &addr) |
Load the file list node from the given location. More... | |
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. More... | |
void | dealloc () |
Free the first page. More... | |
void | destroy () |
Free all the pages associated with this LOB. More... | |
void | make_empty () |
Free all the pages associated with this LOB, except the first page. More... | |
bool | is_empty () const |
Check if the index list is empty or not. More... | |
flst_node_t * | alloc_index_entry (bool bulk) |
Allocate one index entry. More... | |
byte * | nodes_begin () const |
Get a pointer to the beginning of the index entry nodes in the first part of the page. More... | |
void | set_trx_id_no_redo (trx_id_t id) |
Set the transaction identifier in the first page header without generating redo logs. More... | |
void | set_trx_id (trx_id_t id) |
Set the transaction identifier in the first page header. More... | |
void | init_lob_version () |
Initialize the LOB version to 1. More... | |
uint32_t | get_lob_version () |
Get the lob version number. More... | |
uint32_t | incr_lob_version () |
Increment the lob version by 1. More... | |
void | set_last_trx_id_no_redo (trx_id_t id) |
Set the last transaction identifier, without generating redo log records. More... | |
void | set_last_trx_id (trx_id_t id) |
Set the last transaction identifier. More... | |
void | set_last_trx_undo_no (undo_no_t undo_no) |
Set the last transaction undo number. More... | |
trx_id_t | get_last_trx_id () const |
Get the last transaction identifier. More... | |
undo_no_t | get_last_trx_undo_no () const |
Get the last transaction undo number. More... | |
void | set_data_len (ulint len) |
Set the length of data stored in bytes. More... | |
ulint | write (trx_id_t trxid, const byte *&data, ulint &len) |
Write as much as possible of the given data into the page. More... | |
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. More... | |
void | replace_inline (ulint offset, const byte *&ptr, ulint &want, mtr_t *mtr) |
Replace data in the page inline. More... | |
ulint | get_data_len () const |
ulint | read (ulint offset, byte *ptr, ulint want) |
Read data from the first page. More... | |
void | set_page_type () |
flst_base_node_t * | index_list () const |
flst_base_node_t * | free_list () const |
std::ostream & | print_index_entries (std::ostream &out) const |
std::ostream & | print_index_entries_cache_s (std::ostream &out, BlockCache &cache) const |
byte * | data_begin () const |
Obtain the location where the data begins. More... | |
ulint | append (trx_id_t trxid, byte *&data, ulint &len) |
Append data into a LOB first page. More... | |
bool | validate () const |
Validate the first page. More... | |
page_type_t | get_page_type () |
void | restart_mtr (mtr_t *mtr) |
Restart the given mtr. More... | |
Public Member Functions inherited from lob::basic_page_t | |
basic_page_t () | |
basic_page_t (buf_block_t *block, mtr_t *mtr) | |
basic_page_t (buf_block_t *block, mtr_t *mtr, dict_index_t *index) | |
void | set_space_id_no_redo (space_id_t space_id) |
Update the space identifier to given value without generating any redo log records. More... | |
page_no_t | get_page_no () const |
Get page number of the current page. More... | |
page_id_t | get_page_id () const |
Get the page id of the current page. More... | |
void | set_next_page (page_no_t page_no, mtr_t *mtr) |
Set the FIL_PAGE_NEXT to the given page number, using the given mini transaction context. More... | |
void | set_next_page (page_no_t page_no) |
Set the FIL_PAGE_NEXT to the given page number. More... | |
void | set_next_page_null () |
Set the FIL_PAGE_NEXT to FIL_NULL. More... | |
page_no_t | get_next_page () |
page_type_t | get_page_type () const |
byte * | frame () const |
flst_node_t * | get_flst_node (const fil_addr_t &addr) |
ulint | max_space_available () |
buf_block_t * | get_block () const noexcept |
Get the underlying buffer block. More... | |
void | set_block (buf_block_t *block) |
void | set_mtr (mtr_t *mtr) |
Static Public Member Functions | |
static ulint | payload () |
Calculate and return the payload. More... | |
static ulint | max_space_available () |
Get the number of bytes used to store LOB data in the first page of uncompressed LOB. More... | |
constexpr static ulint | node_count () |
Get the number of index entries this page can hold. More... | |
static page_type_t | get_page_type (dict_index_t *index, const page_id_t &page_id, const page_size_t &page_size) |
Static Public Member Functions inherited from lob::basic_page_t | |
static ulint | payload () |
Static Public Attributes | |
static const ulint | OFFSET_VERSION = FIL_PAGE_DATA |
Version information. More... | |
static const ulint | OFFSET_FLAGS = FIL_PAGE_DATA + 1 |
One byte of flag bits. More... | |
static const uint32_t | OFFSET_LOB_VERSION = OFFSET_FLAGS + 1 |
LOB version. More... | |
static const ulint | OFFSET_LAST_TRX_ID = OFFSET_LOB_VERSION + 4 |
The latest transaction that modified this LOB. More... | |
static const ulint | OFFSET_LAST_UNDO_NO = OFFSET_LAST_TRX_ID + 6 |
The latest transaction undo_no that modified this LOB. More... | |
static const ulint | OFFSET_DATA_LEN = OFFSET_LAST_UNDO_NO + 4 |
Length of data stored in this page. More... | |
static const ulint | OFFSET_TRX_ID = OFFSET_DATA_LEN + 4 |
The trx that created the data stored in this page. More... | |
static const ulint | OFFSET_INDEX_LIST = OFFSET_TRX_ID + 6 |
The offset where the list base node is located. More... | |
static const ulint | OFFSET_INDEX_FREE_NODES |
The offset where the list base node is located. More... | |
static const ulint | LOB_PAGE_DATA |
The offset where the contents of the first page begins. More... | |
static const ulint | LOB_PAGE_TRAILER_LEN = FIL_PAGE_DATA_END |
Additional Inherited Members | |
Protected Attributes inherited from lob::basic_page_t | |
buf_block_t * | m_block |
mtr_t * | m_mtr |
dict_index_t * | m_index |
The first page of an uncompressed LOB.
|
default |
The default constructor.
|
inline |
Constructor.
[in] | block | Buffer block of the first page. |
[in] | mtr | Mini-transaction context. |
|
inline |
Constructor.
[in] | block | the buffer block of the first page. |
|
inline |
Constructor.
[in] | block | Buffer block of the first page. |
[in] | mtr | Mini-transaction context. |
[in] | index | Clustered index containing the LOB. |
|
inline |
Constructor.
[in] | mtr | Mini-transaction context. |
[in] | index | Clustered index containing the LOB. |
|
inline |
Load the file list node from the given location, assuming that it exists in the first page itself.
[in] | addr | the location of file list node. |
|
inline |
Load the file list node from the given location.
An s-latch is taken on the page containing the file list node.
[in] | addr | the location of file list node. |
|
inline |
Load the file list node from the given location.
An s-latch is taken on the page containing the file list node. The given cache is checked to see if the page is already loaded.
[in] | cache | cache of loaded buffer blocks. |
[in] | addr | the location of file list node. |
flst_node_t * lob::first_page_t::addr2ptr_x | ( | const fil_addr_t & | addr, |
mtr_t * | mtr | ||
) | const |
Load the file list node from the given location.
An x-latch is taken on the page containing the file list node.
[in] | addr | Location of file list node. |
[in] | mtr | Mini-transaction context to be used. |
|
inline |
Load the file list node from the given location.
An x-latch is taken on the page containing the file list node.
[in] | addr | the location of file list node. |
buf_block_t * lob::first_page_t::alloc | ( | mtr_t * | alloc_mtr, |
bool | is_bulk | ||
) |
Allocate the first page for uncompressed LOB.
[in,out] | alloc_mtr | the allocation mtr. |
[in] | is_bulk | true if it is bulk operation. (OPCODE_INSERT_BULK) return the allocated buffer block. |
flst_node_t * lob::first_page_t::alloc_index_entry | ( | bool | bulk | ) |
Allocate one index entry.
If required an index page (of type FIL_PAGE_TYPE_LOB_INDEX) will be allocated.
[in] | bulk | true if it is a bulk operation (OPCODE_INSERT_BULK), false otherwise. |
Append data into a LOB first page.
|
inline |
When the bit is set, the LOB is not partially updatable anymore.
|
inline |
Obtain the location where the data begins.
void lob::first_page_t::dealloc | ( | ) |
Free the first page.
This is done when all other LOB pages have been freed.
void lob::first_page_t::destroy | ( | ) |
Free all the pages associated with this LOB.
void lob::first_page_t::free_all_data_pages | ( | ) |
Free all the data pages.
The data pages can be accessed through index entry.
void lob::first_page_t::free_all_index_pages | ( | ) |
Free all the index pages.
The list of index pages can be accessed by traversing via the FIL_PAGE_NEXT field.
|
inline |
|
inline |
Get the buffer block of the LOB first page.
|
inline |
|
inline |
Obtain the flags value.
This has 8 bits of which only the first bit is used.
|
inline |
Get the last transaction identifier.
|
inline |
Get the last transaction undo number.
|
inline |
Get the lob version number.
|
inline |
|
inlinestatic |
void lob::first_page_t::import | ( | trx_id_t | trx_id | ) |
Do tablespace import.
uint32_t lob::first_page_t::incr_lob_version | ( | ) |
Increment the lob version by 1.
Increment the lob version number by 1.
|
inline |
|
inline |
Initialize the LOB version to 1.
|
inline |
Check if the index list is empty or not.
|
inline |
Load the first page of LOB with s-latch.
[in] | page_id | the page identifier of the first page. |
[in] | page_size | the page size information. |
|
inline |
Load the first page of LOB with x-latch.
[in] | page_id | the page identifier of the first page. |
[in] | page_size | the page size information. |
buf_block_t * lob::first_page_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.
[in] | page_id | Page identifier of the first page. |
[in] | page_size | Page size information. |
[in] | mtr | Mini-transaction context for latch. |
|
inline |
Load the first page of LOB with x-latch in the given mtr context.
The first page must already be x-latched by the m_mtr.
[in] | mtr | Mini-transaction context for latch. |
void lob::first_page_t::make_empty | ( | ) |
Free all the pages associated with this LOB, except the first page.
void lob::first_page_t::mark_cannot_be_partially_updated | ( | trx_t * | trx | ) |
When the bit is set, the LOB is not partially updatable anymore.
Enable the bit.
[in] | trx | the current transaction. |
Enable the bit.
|
inlinestatic |
Get the number of bytes used to store LOB data in the first page of uncompressed LOB.
|
inlinestaticconstexpr |
Get the number of index entries this page can hold.
|
inline |
Get a pointer to the beginning of the index entry nodes in the first part of the page.
|
inlinestatic |
Calculate and return the payload.
std::ostream & lob::first_page_t::print_index_entries | ( | std::ostream & | out | ) | const |
std::ostream & lob::first_page_t::print_index_entries_cache_s | ( | std::ostream & | out, |
BlockCache & | cache | ||
) | const |
Read data from the first page.
[in] | offset | the offset from where read starts. |
[out] | ptr | the output buffer |
[in] | want | number of bytes to read. |
buf_block_t * lob::first_page_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.
[in] | trx | Current transaction. |
[in] | offset | Location where replace operation starts. |
[in,out] | ptr | Buffer containing new data. after the call it will point to remaining data. |
[in,out] | want | Requested amount of data to be replaced. After the call it will contain amount of data yet to be replaced. |
[in] | mtr | Mini-transaction context. |
Allocate a new data page.
Copy contents from old page to new page.
Copy the new data to new page.
Copy contents from old page to new page.
void lob::first_page_t::replace_inline | ( | ulint | offset, |
const byte *& | ptr, | ||
ulint & | want, | ||
mtr_t * | mtr | ||
) |
Replace data in the page inline.
[in] | offset | Location where replace operation starts. |
[in,out] | ptr | Buffer containing new data. after the call it will point to remaining data. |
[in,out] | want | Requested amount of data to be replaced. after the call it will contain amount of data yet to be replaced. |
[in] | mtr | Mini-transaction context. |
|
inline |
Restart the given mtr.
The first page must already be x-latched by the m_mtr.
[in] | mtr | Mini-transaction context which is to be restarted. |
|
inline |
Set the length of data stored in bytes.
[in] | len | amount of data stored in bytes. |
|
inline |
Set the last transaction identifier.
[in] | id | the trx identifier. |
|
inline |
Set the last transaction identifier, without generating redo log records.
[in] | id | the trx identifier. |
|
inline |
Set the last transaction undo number.
[in] | undo_no | the trx undo number. |
|
inline |
|
inline |
Set the transaction identifier in the first page header.
[in] | id | the transaction identifier. |
|
inline |
Set the transaction identifier in the first page header without generating redo logs.
[in] | id | the transaction identifier. |
|
inline |
Set the LOB format version number to 0.
bool lob::first_page_t::validate | ( | ) | const |
Validate the first page.
Write as much as possible of the given data into the page.
[in] | trxid | the current transaction. |
[in] | data | the data to be written. |
[in] | len | the length of the given data. |
|
static |
The offset where the contents of the first page begins.
|
static |
|
static |
Length of data stored in this page.
4 bytes.
|
static |
One byte of flag bits.
Currently only one bit (the least significant bit) is used, other 7 bits are available for future use.
|
static |
The offset where the list base node is located.
This is the list of free nodes.
|
static |
The offset where the list base node is located.
This is the list of LOB pages.
|
static |
The latest transaction that modified this LOB.
|
static |
The latest transaction undo_no that modified this LOB.
|
static |
LOB version.
4 bytes.
|
static |
The trx that created the data stored in this page.
|
static |
Version information.
One byte.