MySQL 8.4.2
Source Code Documentation
lob::first_page_t Struct Reference

The first page of an uncompressed LOB. More...

#include <lob0first.h>

Inheritance diagram for lob::first_page_t:
[legend]

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_talloc (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_tload_s (page_id_t page_id, page_size_t page_size)
 Load the first page of LOB with s-latch. More...
 
buf_block_tload_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_tload_x (mtr_t *mtr) const
 Load the first page of LOB with x-latch in the given mtr context. More...
 
buf_block_tload_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_tget_block ()
 Get the buffer block of the LOB first page. More...
 
flst_node_taddr2ptr_x (const fil_addr_t &addr, mtr_t *mtr) const
 Load the file list node from the given location. More...
 
flst_node_taddr2ptr_x (fil_addr_t &addr) const
 Load the file list node from the given location. More...
 
flst_node_taddr2ptr (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_taddr2ptr_s (fil_addr_t &addr)
 Load the file list node from the given location. More...
 
flst_node_taddr2ptr_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_talloc_index_entry (bool bulk)
 Allocate one index entry. More...
 
bytenodes_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_treplace (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_tindex_list () const
 
flst_base_node_tfree_list () const
 
std::ostream & print_index_entries (std::ostream &out) const
 
std::ostream & print_index_entries_cache_s (std::ostream &out, BlockCache &cache) const
 
bytedata_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
 
byteframe () const
 
flst_node_tget_flst_node (const fil_addr_t &addr)
 
ulint max_space_available ()
 
buf_block_tget_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_tm_block
 
mtr_tm_mtr
 
dict_index_tm_index
 

Detailed Description

The first page of an uncompressed LOB.

Constructor & Destructor Documentation

◆ first_page_t() [1/5]

lob::first_page_t::first_page_t ( )
default

The default constructor.

◆ first_page_t() [2/5]

lob::first_page_t::first_page_t ( buf_block_t block,
mtr_t mtr 
)
inline

Constructor.

Parameters
[in]blockBuffer block of the first page.
[in]mtrMini-transaction context.

◆ first_page_t() [3/5]

lob::first_page_t::first_page_t ( buf_block_t block)
inline

Constructor.

Parameters
[in]blockthe buffer block of the first page.

◆ first_page_t() [4/5]

lob::first_page_t::first_page_t ( buf_block_t block,
mtr_t mtr,
dict_index_t index 
)
inline

Constructor.

Parameters
[in]blockBuffer block of the first page.
[in]mtrMini-transaction context.
[in]indexClustered index containing the LOB.

◆ first_page_t() [5/5]

lob::first_page_t::first_page_t ( mtr_t mtr,
dict_index_t index 
)
inline

Constructor.

Parameters
[in]mtrMini-transaction context.
[in]indexClustered index containing the LOB.

Member Function Documentation

◆ addr2ptr()

flst_node_t * lob::first_page_t::addr2ptr ( const fil_addr_t addr)
inline

Load the file list node from the given location, assuming that it exists in the first page itself.

Parameters
[in]addrthe location of file list node.
Returns
the file list node.

◆ addr2ptr_s()

flst_node_t * lob::first_page_t::addr2ptr_s ( fil_addr_t addr)
inline

Load the file list node from the given location.

An s-latch is taken on the page containing the file list node.

Parameters
[in]addrthe location of file list node.
Returns
the file list node.

◆ addr2ptr_s_cache()

flst_node_t * lob::first_page_t::addr2ptr_s_cache ( std::map< page_no_t, buf_block_t * > &  cache,
fil_addr_t addr 
) const
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.

Parameters
[in]cachecache of loaded buffer blocks.
[in]addrthe location of file list node.
Returns
the file list node.

◆ addr2ptr_x() [1/2]

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.

Parameters
[in]addrLocation of file list node.
[in]mtrMini-transaction context to be used.
Returns
the file list node.

◆ addr2ptr_x() [2/2]

flst_node_t * lob::first_page_t::addr2ptr_x ( fil_addr_t addr) const
inline

Load the file list node from the given location.

An x-latch is taken on the page containing the file list node.

Parameters
[in]addrthe location of file list node.
Returns
the file list node.

◆ alloc()

buf_block_t * lob::first_page_t::alloc ( mtr_t alloc_mtr,
bool  is_bulk 
)

Allocate the first page for uncompressed LOB.

Parameters
[in,out]alloc_mtrthe allocation mtr.
[in]is_bulktrue if it is bulk operation. (OPCODE_INSERT_BULK) return the allocated buffer block.

◆ alloc_index_entry()

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.

Parameters
[in]bulktrue if it is a bulk operation (OPCODE_INSERT_BULK), false otherwise.
Returns
the file list node of the index entry.

◆ append()

ulint lob::first_page_t::append ( trx_id_t  trxid,
byte *&  data,
ulint len 
)

Append data into a LOB first page.

◆ can_be_partially_updated()

bool lob::first_page_t::can_be_partially_updated ( )
inline

When the bit is set, the LOB is not partially updatable anymore.

Returns
true, if partially updatable.
false, if partially NOT updatable.

◆ data_begin()

byte * lob::first_page_t::data_begin ( ) const
inline

Obtain the location where the data begins.

Returns
pointer to location within page where data begins.

◆ dealloc()

void lob::first_page_t::dealloc ( )

Free the first page.

This is done when all other LOB pages have been freed.

◆ destroy()

void lob::first_page_t::destroy ( )

Free all the pages associated with this LOB.

◆ free_all_data_pages()

void lob::first_page_t::free_all_data_pages ( )

Free all the data pages.

The data pages can be accessed through index entry.

◆ free_all_index_pages()

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.

◆ free_list()

flst_base_node_t * lob::first_page_t::free_list ( ) const
inline

◆ get_block()

buf_block_t * lob::first_page_t::get_block ( )
inline

Get the buffer block of the LOB first page.

Returns
the buffer block.

◆ get_data_len()

ulint lob::first_page_t::get_data_len ( ) const
inline

◆ get_flags()

uint8_t lob::first_page_t::get_flags ( )
inline

Obtain the flags value.

This has 8 bits of which only the first bit is used.

Returns
one byte flag

◆ get_last_trx_id()

trx_id_t lob::first_page_t::get_last_trx_id ( ) const
inline

Get the last transaction identifier.

Returns
the transaction identifier.

◆ get_last_trx_undo_no()

undo_no_t lob::first_page_t::get_last_trx_undo_no ( ) const
inline

Get the last transaction undo number.

Returns
the transaction undo number.

◆ get_lob_version()

uint32_t lob::first_page_t::get_lob_version ( )
inline

Get the lob version number.

Returns
the lob version.

◆ get_page_type() [1/2]

page_type_t lob::first_page_t::get_page_type ( )
inline

◆ get_page_type() [2/2]

static page_type_t lob::first_page_t::get_page_type ( dict_index_t index,
const page_id_t page_id,
const page_size_t page_size 
)
inlinestatic

◆ import()

void lob::first_page_t::import ( trx_id_t  trx_id)

Do tablespace import.

◆ incr_lob_version()

uint32_t lob::first_page_t::incr_lob_version ( )

Increment the lob version by 1.

Increment the lob version number by 1.

◆ index_list()

flst_base_node_t * lob::first_page_t::index_list ( ) const
inline

◆ init_lob_version()

void lob::first_page_t::init_lob_version ( )
inline

Initialize the LOB version to 1.

◆ is_empty()

bool lob::first_page_t::is_empty ( void  ) const
inline

Check if the index list is empty or not.

Returns
true if empty, false otherwise.

◆ load_s()

buf_block_t * lob::first_page_t::load_s ( page_id_t  page_id,
page_size_t  page_size 
)
inline

Load the first page of LOB with s-latch.

Parameters
[in]page_idthe page identifier of the first page.
[in]page_sizethe page size information.
Returns
the buffer block of the first page.

◆ load_x() [1/3]

buf_block_t * lob::first_page_t::load_x ( const page_id_t page_id,
const page_size_t page_size 
)
inline

Load the first page of LOB with x-latch.

Parameters
[in]page_idthe page identifier of the first page.
[in]page_sizethe page size information.
Returns
the buffer block of the first page.

◆ load_x() [2/3]

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.

Parameters
[in]page_idPage identifier of the first page.
[in]page_sizePage size information.
[in]mtrMini-transaction context for latch.
Returns
the buffer block of the first page.

◆ load_x() [3/3]

buf_block_t * lob::first_page_t::load_x ( mtr_t mtr) const
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.

Parameters
[in]mtrMini-transaction context for latch.
Returns
the buffer block of the first page.

◆ make_empty()

void lob::first_page_t::make_empty ( )

Free all the pages associated with this LOB, except the first page.

◆ mark_cannot_be_partially_updated()

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.

Parameters
[in]trxthe current transaction.

Enable the bit.

◆ max_space_available()

static ulint lob::first_page_t::max_space_available ( )
inlinestatic

Get the number of bytes used to store LOB data in the first page of uncompressed LOB.

Returns
Number of bytes available for LOB data.

◆ node_count()

constexpr static ulint lob::first_page_t::node_count ( )
inlinestaticconstexpr

Get the number of index entries this page can hold.

Returns
Number of index entries this page can hold.

◆ nodes_begin()

byte * lob::first_page_t::nodes_begin ( ) const
inline

Get a pointer to the beginning of the index entry nodes in the first part of the page.

Returns
the first index entry node.

◆ payload()

static ulint lob::first_page_t::payload ( )
inlinestatic

Calculate and return the payload.

Returns
the payload possible in this page.

◆ print_index_entries()

std::ostream & lob::first_page_t::print_index_entries ( std::ostream &  out) const

◆ print_index_entries_cache_s()

std::ostream & lob::first_page_t::print_index_entries_cache_s ( std::ostream &  out,
BlockCache cache 
) const

◆ read()

ulint lob::first_page_t::read ( ulint  offset,
byte ptr,
ulint  want 
)

Read data from the first page.

Parameters
[in]offsetthe offset from where read starts.
[out]ptrthe output buffer
[in]wantnumber of bytes to read.
Returns
number of bytes read.

◆ replace()

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.

Parameters
[in]trxCurrent transaction.
[in]offsetLocation where replace operation starts.
[in,out]ptrBuffer containing new data. after the call it will point to remaining data.
[in,out]wantRequested amount of data to be replaced. After the call it will contain amount of data yet to be replaced.
[in]mtrMini-transaction context.
Returns
the newly allocated buffer block.
nullptr if new page could not be allocated (DB_OUT_OF_FILE_SPACE).

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.

◆ replace_inline()

void lob::first_page_t::replace_inline ( ulint  offset,
const byte *&  ptr,
ulint want,
mtr_t mtr 
)

Replace data in the page inline.

Parameters
[in]offsetLocation where replace operation starts.
[in,out]ptrBuffer containing new data. after the call it will point to remaining data.
[in,out]wantRequested amount of data to be replaced. after the call it will contain amount of data yet to be replaced.
[in]mtrMini-transaction context.

◆ restart_mtr()

void lob::first_page_t::restart_mtr ( mtr_t mtr)
inline

Restart the given mtr.

The first page must already be x-latched by the m_mtr.

Parameters
[in]mtrMini-transaction context which is to be restarted.

◆ set_data_len()

void lob::first_page_t::set_data_len ( ulint  len)
inline

Set the length of data stored in bytes.

Parameters
[in]lenamount of data stored in bytes.

◆ set_last_trx_id()

void lob::first_page_t::set_last_trx_id ( trx_id_t  id)
inline

Set the last transaction identifier.

Parameters
[in]idthe trx identifier.

◆ set_last_trx_id_no_redo()

void lob::first_page_t::set_last_trx_id_no_redo ( trx_id_t  id)
inline

Set the last transaction identifier, without generating redo log records.

Parameters
[in]idthe trx identifier.

◆ set_last_trx_undo_no()

void lob::first_page_t::set_last_trx_undo_no ( undo_no_t  undo_no)
inline

Set the last transaction undo number.

Parameters
[in]undo_nothe trx undo number.

◆ set_page_type()

void lob::first_page_t::set_page_type ( )
inline

◆ set_trx_id()

void lob::first_page_t::set_trx_id ( trx_id_t  id)
inline

Set the transaction identifier in the first page header.

Parameters
[in]idthe transaction identifier.

◆ set_trx_id_no_redo()

void lob::first_page_t::set_trx_id_no_redo ( trx_id_t  id)
inline

Set the transaction identifier in the first page header without generating redo logs.

Parameters
[in]idthe transaction identifier.

◆ set_version_0()

void lob::first_page_t::set_version_0 ( )
inline

Set the LOB format version number to 0.

◆ validate()

bool lob::first_page_t::validate ( ) const

Validate the first page.

◆ write()

ulint lob::first_page_t::write ( trx_id_t  trxid,
const byte *&  data,
ulint len 
)

Write as much as possible of the given data into the page.

Parameters
[in]trxidthe current transaction.
[in]datathe data to be written.
[in]lenthe length of the given data.
Returns
number of bytes actually written.

Member Data Documentation

◆ LOB_PAGE_DATA

const ulint lob::first_page_t::LOB_PAGE_DATA
static
Initial value:
=
constexpr ulint FLST_BASE_NODE_SIZE
Definition: fut0lst.h:50
static const ulint OFFSET_INDEX_FREE_NODES
The offset where the list base node is located.
Definition: lob0first.h:72

The offset where the contents of the first page begins.

◆ LOB_PAGE_TRAILER_LEN

const ulint lob::first_page_t::LOB_PAGE_TRAILER_LEN = FIL_PAGE_DATA_END
static

◆ OFFSET_DATA_LEN

const ulint lob::first_page_t::OFFSET_DATA_LEN = OFFSET_LAST_UNDO_NO + 4
static

Length of data stored in this page.

4 bytes.

◆ OFFSET_FLAGS

const ulint lob::first_page_t::OFFSET_FLAGS = FIL_PAGE_DATA + 1
static

One byte of flag bits.

Currently only one bit (the least significant bit) is used, other 7 bits are available for future use.

◆ OFFSET_INDEX_FREE_NODES

const ulint lob::first_page_t::OFFSET_INDEX_FREE_NODES
static
Initial value:
=
static const ulint OFFSET_INDEX_LIST
The offset where the list base node is located.
Definition: lob0first.h:68

The offset where the list base node is located.

This is the list of free nodes.

◆ OFFSET_INDEX_LIST

const ulint lob::first_page_t::OFFSET_INDEX_LIST = OFFSET_TRX_ID + 6
static

The offset where the list base node is located.

This is the list of LOB pages.

◆ OFFSET_LAST_TRX_ID

const ulint lob::first_page_t::OFFSET_LAST_TRX_ID = OFFSET_LOB_VERSION + 4
static

The latest transaction that modified this LOB.

◆ OFFSET_LAST_UNDO_NO

const ulint lob::first_page_t::OFFSET_LAST_UNDO_NO = OFFSET_LAST_TRX_ID + 6
static

The latest transaction undo_no that modified this LOB.

◆ OFFSET_LOB_VERSION

const uint32_t lob::first_page_t::OFFSET_LOB_VERSION = OFFSET_FLAGS + 1
static

LOB version.

4 bytes.

◆ OFFSET_TRX_ID

const ulint lob::first_page_t::OFFSET_TRX_ID = OFFSET_DATA_LEN + 4
static

The trx that created the data stored in this page.

◆ OFFSET_VERSION

const ulint lob::first_page_t::OFFSET_VERSION = FIL_PAGE_DATA
static

Version information.

One byte.


The documentation for this struct was generated from the following files: