MySQL 8.4.0
Source Code Documentation
lob::z_index_entry_t Struct Reference

An index entry pointing to one zlib stream. More...

#include <zlob0index.h>

Public Member Functions

 z_index_entry_t (flst_node_t *node, mtr_t *mtr)
 Constructor. More...
 
 z_index_entry_t (flst_node_t *node, mtr_t *mtr, dict_index_t *index)
 Constructor. More...
 
 z_index_entry_t (mtr_t *mtr, dict_index_t *index)
 Constructor. More...
 
 z_index_entry_t (flst_node_t *node)
 Constructor. More...
 
 z_index_entry_t ()
 Default constructor. More...
 
void set_index (dict_index_t *index)
 
void reset (flst_node_t *node)
 Point to another index entry. More...
 
void reset (const z_index_entry_t &entry)
 Point to another index entry. More...
 
void init ()
 Initialize an index entry to some sane value. More...
 
bool can_rollback (trx_id_t trxid, undo_no_t undo_no)
 Determine if the current index entry be rolled back. More...
 
bool can_be_purged (trx_id_t trxid, undo_no_t undo_no)
 Determine if the current index entry be purged. More...
 
fil_addr_t purge_version (dict_index_t *index, z_first_page_t &first, flst_base_node_t *lst, flst_base_node_t *free_list)
 Purge one index entry. More...
 
void purge (dict_index_t *index, z_first_page_t &first)
 Purge the current index entry. More...
 
void remove (flst_base_node_t *bnode)
 Remove this node from the given list. More...
 
void insert_after (flst_base_node_t *base, z_index_entry_t &entry)
 Insert the given index entry after the current index entry. More...
 
void insert_before (flst_base_node_t *base, z_index_entry_t &entry)
 
void push_back (flst_base_node_t *bnode)
 Add this node as the last node in the given list. More...
 
void push_front (flst_base_node_t *bnode)
 Add this node as the last node in the given list. More...
 
void set_prev_null ()
 Set the previous index entry as null. More...
 
fil_addr_t get_prev () const
 Get the location of previous index entry. More...
 
fil_addr_t get_next () const
 Get the location of next index entry. More...
 
void set_next_null ()
 Set the next index entry as null. More...
 
void set_versions_null ()
 Set the versions list as null. More...
 
flst_base_node_tget_versions_list () const
 Get the base node of the list of versions. More...
 
flst_bnode_t get_versions_mem () const
 Get the base node of the list of versions. More...
 
trx_id_t get_trx_id () const
 
trx_id_t get_trx_id_modifier () const
 
undo_no_t get_trx_undo_no () const
 Get the undo number of the creator transaction. More...
 
undo_no_t get_trx_undo_no_modifier () const
 Get the undo number of the modifier transaction. More...
 
void set_trx_id_no_redo (trx_id_t id)
 Set the trx identifier to given value, without generating redo log records. More...
 
void set_trx_id (trx_id_t id)
 Set the trx identifier to given value. More...
 
void set_trx_id_modifier (trx_id_t id)
 Set the modifier trxid to the given value. More...
 
void set_trx_id_modifier_no_redo (trx_id_t id)
 Set the modifier trxid to the given value, without generating redo log records. More...
 
void set_trx_undo_no (undo_no_t undo_no)
 Set the undo number of the creator trx. More...
 
void set_trx_undo_no_modifier (undo_no_t undo_no)
 Set the undo number of the modifier trx. More...
 
page_no_t get_z_page_no () const
 
void set_z_page_no_null (mtr_t *mtr)
 Set the page number pointed to by this index entry to FIL_NULL. More...
 
size_t free_data_pages (mtr_t *mtr)
 Free the data pages pointed to by this index entry. More...
 
void set_z_page_no (page_no_t page_no)
 Set the page number pointed to by this index entry to given value. More...
 
page_no_t get_z_frag_id () const
 
void set_z_frag_id (frag_id_t id)
 
ulint get_data_len () const
 Get the uncompressed data length in bytes. More...
 
void set_data_len (ulint len)
 Set the uncompressed data length in bytes. More...
 
ulint get_zdata_len () const
 Get the compressed data length in bytes. More...
 
void set_zdata_len (ulint len)
 Set the compressed data length in bytes. More...
 
uint32_t get_lob_version () const
 Get the LOB version. More...
 
void set_lob_version (ulint version)
 Set the LOB version . More...
 
void set_old_version (z_index_entry_t &entry)
 
fil_addr_t make_old_version_current (dict_index_t *index, z_first_page_t &first)
 The current index entry points to a latest LOB page. More...
 
flst_node_tget_node ()
 
bool is_null () const
 
std::ostream & print (std::ostream &out) const
 
std::ostream & print_pages (std::ostream &out) const
 
buf_block_tload_s ()
 Load the page (in shared mode) whose number was cached. More...
 
void load_s (fil_addr_t &addr)
 Load the given file address in s mode. More...
 
void load_x (fil_addr_t &addr)
 Load the given file address in x mode. More...
 
void read (z_index_entry_mem_t &entry_mem) const
 Read the given LOB index entry. More...
 
void read_and_commit (z_index_entry_mem_t &entry_mem)
 Read the given LOB index entry and then commit the mtr. More...
 
fil_addr_t get_self () const
 Get the location of the current index entry. More...
 

Static Public Attributes

static const ulint OFFSET_PREV = 0
 Offset with index entry pointing to the prev index entry. More...
 
static const ulint OFFSET_NEXT = OFFSET_PREV + FIL_ADDR_SIZE
 Offset with index entry pointing to the next index entry. More...
 
static const ulint OFFSET_VERSIONS = OFFSET_NEXT + FIL_ADDR_SIZE
 Offset within index entry pointing to base node of list of versions. More...
 
static const ulint OFFSET_TRXID = OFFSET_VERSIONS + FLST_BASE_NODE_SIZE
 Offset within index entry pointing to creator trxid. More...
 
static const ulint OFFSET_TRXID_MODIFIER = OFFSET_TRXID + 6
 The modifier trx id. More...
 
static const ulint OFFSET_TRX_UNDO_NO = OFFSET_TRXID_MODIFIER + 6
 Offset within index entry pointing to trx undo no. More...
 
static const ulint OFFSET_TRX_UNDO_NO_MODIFIER = OFFSET_TRX_UNDO_NO + 4
 Offset within index entry pointing to modifier trx undo no. More...
 
static const ulint OFFSET_Z_PAGE_NO = OFFSET_TRX_UNDO_NO_MODIFIER + 4
 Offset within index entry pointing to page number where zlib stream starts. More...
 
static const ulint OFFSET_Z_FRAG_ID = OFFSET_Z_PAGE_NO + 4
 Offset within index entry pointing to location of zlib stream. More...
 
static const ulint OFFSET_DATA_LEN = OFFSET_Z_FRAG_ID + 2
 Offset within index entry pointing to uncompressed data len (bytes). More...
 
static const ulint OFFSET_ZDATA_LEN = OFFSET_DATA_LEN + 4
 Offset within index entry pointing to compressed data len (bytes). More...
 
static const ulint OFFSET_LOB_VERSION = OFFSET_ZDATA_LEN + 4
 LOB version. More...
 
static const ulint SIZE = OFFSET_LOB_VERSION + 4
 Total size of one index entry. More...
 

Private Member Functions

void move_version_base_node (z_index_entry_t &entry)
 Move the version base node from current entry to the given entry. More...
 

Private Attributes

flst_node_tm_node
 The file list node in a db page. More...
 
mtr_tm_mtr
 A mini-transaction. More...
 
dict_index_tm_index
 The index containing the LOB. More...
 
buf_block_tm_block
 The buffer block in which this entry exists. More...
 
page_no_t m_page_no
 The page number in which this entry is available. More...
 

Detailed Description

An index entry pointing to one zlib stream.

Constructor & Destructor Documentation

◆ z_index_entry_t() [1/5]

lob::z_index_entry_t::z_index_entry_t ( flst_node_t node,
mtr_t mtr 
)
inline

Constructor.

◆ z_index_entry_t() [2/5]

lob::z_index_entry_t::z_index_entry_t ( flst_node_t node,
mtr_t mtr,
dict_index_t index 
)
inline

Constructor.

◆ z_index_entry_t() [3/5]

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

Constructor.

Parameters
[in]mtrthe mini-transaction
[in]indexthe clustered index to which LOB belongs.

◆ z_index_entry_t() [4/5]

lob::z_index_entry_t::z_index_entry_t ( flst_node_t node)
inline

Constructor.

Parameters
[in]nodethe location where index entry starts.

◆ z_index_entry_t() [5/5]

lob::z_index_entry_t::z_index_entry_t ( )
inline

Default constructor.

Member Function Documentation

◆ can_be_purged()

bool lob::z_index_entry_t::can_be_purged ( trx_id_t  trxid,
undo_no_t  undo_no 
)
inline

Determine if the current index entry be purged.

Parameters
[in]trxidthe transaction that is being purged.
[in]undo_nothe undo number of trx.
Returns
true if this entry can be purged, false otherwise.

◆ can_rollback()

bool lob::z_index_entry_t::can_rollback ( trx_id_t  trxid,
undo_no_t  undo_no 
)
inline

Determine if the current index entry be rolled back.

Parameters
[in]trxidthe transaction that is being rolled back.
[in]undo_nothe savepoint undo number of trx, up to which rollback happens.
Returns
true if this entry can be rolled back, false otherwise.

◆ free_data_pages()

size_t lob::z_index_entry_t::free_data_pages ( mtr_t mtr)

Free the data pages pointed to by this index entry.

Parameters
[in]mtrthe mini-transaction used to free the pages.
Returns
the number of pages freed.

◆ get_data_len()

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

Get the uncompressed data length in bytes.

◆ get_lob_version()

uint32_t lob::z_index_entry_t::get_lob_version ( ) const
inline

Get the LOB version.

◆ get_next()

fil_addr_t lob::z_index_entry_t::get_next ( ) const
inline

Get the location of next index entry.

Returns
the file address of the next index entry.

◆ get_node()

flst_node_t * lob::z_index_entry_t::get_node ( )
inline

◆ get_prev()

fil_addr_t lob::z_index_entry_t::get_prev ( ) const
inline

Get the location of previous index entry.

◆ get_self()

fil_addr_t lob::z_index_entry_t::get_self ( ) const

Get the location of the current index entry.

◆ get_trx_id()

trx_id_t lob::z_index_entry_t::get_trx_id ( ) const
inline

◆ get_trx_id_modifier()

trx_id_t lob::z_index_entry_t::get_trx_id_modifier ( ) const
inline

◆ get_trx_undo_no()

undo_no_t lob::z_index_entry_t::get_trx_undo_no ( ) const
inline

Get the undo number of the creator transaction.

This is used for rollback purposes.

Returns
the undo number of creator trx.

◆ get_trx_undo_no_modifier()

undo_no_t lob::z_index_entry_t::get_trx_undo_no_modifier ( ) const
inline

Get the undo number of the modifier transaction.

This is used for purging purposes.

Returns
the undo number of modifier trx.

◆ get_versions_list()

flst_base_node_t * lob::z_index_entry_t::get_versions_list ( ) const
inline

Get the base node of the list of versions.

◆ get_versions_mem()

flst_bnode_t lob::z_index_entry_t::get_versions_mem ( ) const
inline

Get the base node of the list of versions.

◆ get_z_frag_id()

page_no_t lob::z_index_entry_t::get_z_frag_id ( ) const
inline

◆ get_z_page_no()

page_no_t lob::z_index_entry_t::get_z_page_no ( ) const
inline

◆ get_zdata_len()

ulint lob::z_index_entry_t::get_zdata_len ( ) const
inline

Get the compressed data length in bytes.

◆ init()

void lob::z_index_entry_t::init ( void  )
inline

Initialize an index entry to some sane value.

◆ insert_after()

void lob::z_index_entry_t::insert_after ( flst_base_node_t base,
z_index_entry_t entry 
)
inline

Insert the given index entry after the current index entry.

Parameters
[in]basethe base node of the file based list.
[in]entrythe new node to be inserted.

◆ insert_before()

void lob::z_index_entry_t::insert_before ( flst_base_node_t base,
z_index_entry_t entry 
)
inline

◆ is_null()

bool lob::z_index_entry_t::is_null ( ) const
inline

◆ load_s() [1/2]

buf_block_t * lob::z_index_entry_t::load_s ( )
inline

Load the page (in shared mode) whose number was cached.

Returns
the buffer block of the page loaded.

◆ load_s() [2/2]

void lob::z_index_entry_t::load_s ( fil_addr_t addr)
inline

Load the given file address in s mode.

Parameters
[in]addrthe file address of the required node.

◆ load_x()

void lob::z_index_entry_t::load_x ( fil_addr_t addr)
inline

Load the given file address in x mode.

Parameters
[in]addrthe file address of the required node.

◆ make_old_version_current()

fil_addr_t lob::z_index_entry_t::make_old_version_current ( dict_index_t index,
z_first_page_t first 
)

The current index entry points to a latest LOB page.

It may or may not have older versions. If older version is there, bring it back to the index list from the versions list. Then remove the current entry from the index list. Move the versions list from current entry to older entry.

Parameters
[in]indexthe index in which LOB exists.
[in]firstThe first lob page containing index list and free list.

◆ move_version_base_node()

void lob::z_index_entry_t::move_version_base_node ( z_index_entry_t entry)
private

Move the version base node from current entry to the given entry.

Parameters
[in]entryThe index entry to which the version base node is moved to.

◆ print()

std::ostream & lob::z_index_entry_t::print ( std::ostream &  out) const

◆ print_pages()

std::ostream & lob::z_index_entry_t::print_pages ( std::ostream &  out) const

◆ purge()

void lob::z_index_entry_t::purge ( dict_index_t index,
z_first_page_t first 
)

Purge the current index entry.

An index entry points to either a FIRST page or DATA page. That LOB page will be freed if it is DATA page. A FIRST page should not be freed.

◆ purge_version()

fil_addr_t lob::z_index_entry_t::purge_version ( dict_index_t index,
z_first_page_t first,
flst_base_node_t lst,
flst_base_node_t free_list 
)

Purge one index entry.

Parameters
[in]indexindex to which LOB belongs.
[in]firstfirst page of LOB.
[in,out]lstlist from which this entry will be removed.
[in,out]free_listlist to which this entry will be added.

◆ push_back()

void lob::z_index_entry_t::push_back ( flst_base_node_t bnode)
inline

Add this node as the last node in the given list.

Parameters
[in]bnodethe base node of the file list.

◆ push_front()

void lob::z_index_entry_t::push_front ( flst_base_node_t bnode)
inline

Add this node as the last node in the given list.

Parameters
[in]bnodethe base node of the file list.

◆ read()

void lob::z_index_entry_t::read ( z_index_entry_mem_t entry_mem) const

Read the given LOB index entry.

Parameters
[in]entry_memthe LOB index entry.

◆ read_and_commit()

void lob::z_index_entry_t::read_and_commit ( z_index_entry_mem_t entry_mem)
inline

Read the given LOB index entry and then commit the mtr.

Parameters
[in]entry_memthe LOB index entry.

◆ remove()

void lob::z_index_entry_t::remove ( flst_base_node_t bnode)
inline

Remove this node from the given list.

Parameters
[in]bnodethe base node of the list from which to remove current node.

◆ reset() [1/2]

void lob::z_index_entry_t::reset ( const z_index_entry_t entry)
inline

Point to another index entry.

Parameters
[in]entryanother index entry.

◆ reset() [2/2]

void lob::z_index_entry_t::reset ( flst_node_t node)
inline

Point to another index entry.

Parameters
[in]nodepoint to this file list node.

◆ set_data_len()

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

Set the uncompressed data length in bytes.

Parameters
[in]lenthe uncompressed data length in bytes

◆ set_index()

void lob::z_index_entry_t::set_index ( dict_index_t index)
inline

◆ set_lob_version()

void lob::z_index_entry_t::set_lob_version ( ulint  version)
inline

Set the LOB version .

Parameters
[in]versionthe lob version.

◆ set_next_null()

void lob::z_index_entry_t::set_next_null ( )
inline

Set the next index entry as null.

◆ set_old_version()

void lob::z_index_entry_t::set_old_version ( z_index_entry_t entry)

◆ set_prev_null()

void lob::z_index_entry_t::set_prev_null ( )
inline

Set the previous index entry as null.

◆ set_trx_id()

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

Set the trx identifier to given value.

Parameters
[in]idthe given trx identifier.

◆ set_trx_id_modifier()

void lob::z_index_entry_t::set_trx_id_modifier ( trx_id_t  id)
inline

Set the modifier trxid to the given value.

Parameters
[in]idthe modifier trxid.

◆ set_trx_id_modifier_no_redo()

void lob::z_index_entry_t::set_trx_id_modifier_no_redo ( trx_id_t  id)
inline

Set the modifier trxid to the given value, without generating redo log records.

Parameters
[in]idthe modifier trxid.

◆ set_trx_id_no_redo()

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

Set the trx identifier to given value, without generating redo log records.

Parameters
[in]idthe given trx identifier.

◆ set_trx_undo_no()

void lob::z_index_entry_t::set_trx_undo_no ( undo_no_t  undo_no)
inline

Set the undo number of the creator trx.

Parameters
[in]undo_nothe undo number value.

◆ set_trx_undo_no_modifier()

void lob::z_index_entry_t::set_trx_undo_no_modifier ( undo_no_t  undo_no)
inline

Set the undo number of the modifier trx.

Parameters
[in]undo_nothe undo number value.

◆ set_versions_null()

void lob::z_index_entry_t::set_versions_null ( )
inline

Set the versions list as null.

◆ set_z_frag_id()

void lob::z_index_entry_t::set_z_frag_id ( frag_id_t  id)
inline

◆ set_z_page_no()

void lob::z_index_entry_t::set_z_page_no ( page_no_t  page_no)
inline

Set the page number pointed to by this index entry to given value.

Parameters
[in]page_noPage number to be put in index entry.

◆ set_z_page_no_null()

void lob::z_index_entry_t::set_z_page_no_null ( mtr_t mtr)
inline

Set the page number pointed to by this index entry to FIL_NULL.

Parameters
[in]mtrThe mini-transaction used for this modification.

◆ set_zdata_len()

void lob::z_index_entry_t::set_zdata_len ( ulint  len)
inline

Set the compressed data length in bytes.

Parameters
[in]lenthe compressed data length in bytes

Member Data Documentation

◆ m_block

buf_block_t* lob::z_index_entry_t::m_block
private

The buffer block in which this entry exists.

While reading data from m_node, appropriate latches must be held on this block.

◆ m_index

dict_index_t* lob::z_index_entry_t::m_index
private

The index containing the LOB.

◆ m_mtr

mtr_t* lob::z_index_entry_t::m_mtr
private

A mini-transaction.

◆ m_node

flst_node_t* lob::z_index_entry_t::m_node
private

The file list node in a db page.

This node is persisted.

◆ m_page_no

page_no_t lob::z_index_entry_t::m_page_no
private

The page number in which this entry is available.

This information will be cached and can be used to reload the page conveniently.

◆ OFFSET_DATA_LEN

const ulint lob::z_index_entry_t::OFFSET_DATA_LEN = OFFSET_Z_FRAG_ID + 2
static

Offset within index entry pointing to uncompressed data len (bytes).

◆ OFFSET_LOB_VERSION

const ulint lob::z_index_entry_t::OFFSET_LOB_VERSION = OFFSET_ZDATA_LEN + 4
static

LOB version.

◆ OFFSET_NEXT

const ulint lob::z_index_entry_t::OFFSET_NEXT = OFFSET_PREV + FIL_ADDR_SIZE
static

Offset with index entry pointing to the next index entry.

◆ OFFSET_PREV

const ulint lob::z_index_entry_t::OFFSET_PREV = 0
static

Offset with index entry pointing to the prev index entry.

◆ OFFSET_TRX_UNDO_NO

const ulint lob::z_index_entry_t::OFFSET_TRX_UNDO_NO = OFFSET_TRXID_MODIFIER + 6
static

Offset within index entry pointing to trx undo no.

◆ OFFSET_TRX_UNDO_NO_MODIFIER

const ulint lob::z_index_entry_t::OFFSET_TRX_UNDO_NO_MODIFIER = OFFSET_TRX_UNDO_NO + 4
static

Offset within index entry pointing to modifier trx undo no.

◆ OFFSET_TRXID

const ulint lob::z_index_entry_t::OFFSET_TRXID = OFFSET_VERSIONS + FLST_BASE_NODE_SIZE
static

Offset within index entry pointing to creator trxid.

◆ OFFSET_TRXID_MODIFIER

const ulint lob::z_index_entry_t::OFFSET_TRXID_MODIFIER = OFFSET_TRXID + 6
static

The modifier trx id.

◆ OFFSET_VERSIONS

const ulint lob::z_index_entry_t::OFFSET_VERSIONS = OFFSET_NEXT + FIL_ADDR_SIZE
static

Offset within index entry pointing to base node of list of versions.

◆ OFFSET_Z_FRAG_ID

const ulint lob::z_index_entry_t::OFFSET_Z_FRAG_ID = OFFSET_Z_PAGE_NO + 4
static

Offset within index entry pointing to location of zlib stream.

◆ OFFSET_Z_PAGE_NO

const ulint lob::z_index_entry_t::OFFSET_Z_PAGE_NO = OFFSET_TRX_UNDO_NO_MODIFIER + 4
static

Offset within index entry pointing to page number where zlib stream starts.

This could be a data page or a fragment page.

◆ OFFSET_ZDATA_LEN

const ulint lob::z_index_entry_t::OFFSET_ZDATA_LEN = OFFSET_DATA_LEN + 4
static

Offset within index entry pointing to compressed data len (bytes).

◆ SIZE

const ulint lob::z_index_entry_t::SIZE = OFFSET_LOB_VERSION + 4
static

Total size of one index entry.


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