MySQL 8.4.0
Source Code Documentation
lob::frag_node_t Struct Reference

The fragment node represents one fragment. More...

#include <lob0impl.h>

Public Member Functions

 frag_node_t (const plist_node_t &node, mtr_t *mtr)
 Constructor. More...
 
 frag_node_t (byte *frame, byte *ptr)
 
 frag_node_t (byte *frame, byte *ptr, mtr_t *mtr)
 Constructor. More...
 
 frag_node_t (byte *frame, byte *ptr, ulint len, mtr_t *mtr)
 Constructor. More...
 
bytefrag_begin () const
 
bytedata_begin () const
 
void set_total_len (ulint len)
 
void incr_length_by_2 ()
 Increment the total length of this fragment by 2 bytes. More...
 
void decr_length_by_2 ()
 Decrement the total length of this fragment by 2 bytes. More...
 
bool is_before (const frag_node_t &frag) const
 
void set_frag_id_null ()
 
void set_frag_id (ulint id)
 
ulint get_frag_id () const
 
ulint payload () const
 Get the space available in this fragment for storing data. More...
 
ulint get_total_len () const
 Get the total length of this fragment, including its metadata. More...
 
paddr_t addr () const
 Get the offset of the current fragment within page. More...
 
byteptr () const
 Gets the pointer to the beginning of the current fragment. More...
 
byteend_ptr () const
 Gets the pointer just after the current fragment. More...
 
byteframe () const
 Get the page frame. More...
 
std::ostream & print (std::ostream &out) const
 
frag_node_t get_next_frag ()
 
frag_node_t get_next_node ()
 
frag_node_t get_prev_node ()
 
frag_node_t get_prev_frag ()
 
bool merge (frag_node_t &next)
 Merge the current fragment node with the given next fragment node. More...
 
bool is_null () const
 
bool is_equal (const frag_node_t &that) const
 
bool is_equal (const plist_node_t &node) const
 

Static Public Member Functions

static ulint overhead ()
 Amount of space that will be used up by meta data. More...
 
static ulint header_size ()
 Only the header size. More...
 

Public Attributes

plist_node_t m_node
 The page list node. More...
 

Static Public Attributes

static const ulint OFFSET_LEN = plist_node_t::SIZE
 The offset where the length of fragment is stored. More...
 
static const ulint OFFSET_FRAG_ID = OFFSET_LEN + 2
 The offset where fragment id is stored. More...
 
static const ulint OFFSET_DATA = OFFSET_FRAG_ID + 2
 The offset where fragment data is stored. More...
 
static const ulint SIZE_OF_PAGE_DIR_ENTRY = 2
 The size of a page directory entry in a fragment page in bytes. More...
 

Private Attributes

mtr_tm_mtr
 The mini-transaction context. More...
 

Detailed Description

The fragment node represents one fragment.

Constructor & Destructor Documentation

◆ frag_node_t() [1/4]

lob::frag_node_t::frag_node_t ( const plist_node_t node,
mtr_t mtr 
)
inline

Constructor.

Parameters
[in]nodePage list node.
[in]mtrMini-transaction.

◆ frag_node_t() [2/4]

lob::frag_node_t::frag_node_t ( byte frame,
byte ptr 
)
inline

◆ frag_node_t() [3/4]

lob::frag_node_t::frag_node_t ( byte frame,
byte ptr,
mtr_t mtr 
)
inline

Constructor.

Parameters
[in]framePage frame where the fragment node is located.
[in]ptrLocation of fragment node within page frame.
[in]mtrMini-transaction context.

◆ frag_node_t() [4/4]

lob::frag_node_t::frag_node_t ( byte frame,
byte ptr,
ulint  len,
mtr_t mtr 
)
inline

Constructor.

Parameters
[in]framePage frame where the fragment node is located.
[in]ptrLocation of fragment node within page frame.
[in]lenLength of the fragment.
[in]mtrMini-transaction context.

Member Function Documentation

◆ addr()

paddr_t lob::frag_node_t::addr ( ) const
inline

Get the offset of the current fragment within page.

Returns
the offset of the current fragment within.

◆ data_begin()

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

◆ decr_length_by_2()

void lob::frag_node_t::decr_length_by_2 ( )
inline

Decrement the total length of this fragment by 2 bytes.

◆ end_ptr()

byte * lob::frag_node_t::end_ptr ( ) const
inline

Gets the pointer just after the current fragment.

The pointer returned does not belong to this fragment. This is used to check adjacency.

Returns
pointer to the end of the current fragment.

◆ frag_begin()

byte * lob::frag_node_t::frag_begin ( ) const
inline

◆ frame()

byte * lob::frag_node_t::frame ( ) const
inline

Get the page frame.

Returns
the page frame.

◆ get_frag_id()

ulint lob::frag_node_t::get_frag_id ( ) const
inline

◆ get_next_frag()

frag_node_t lob::frag_node_t::get_next_frag ( )
inline

◆ get_next_node()

frag_node_t lob::frag_node_t::get_next_node ( )
inline

◆ get_prev_frag()

frag_node_t lob::frag_node_t::get_prev_frag ( )
inline

◆ get_prev_node()

frag_node_t lob::frag_node_t::get_prev_node ( )
inline

◆ get_total_len()

ulint lob::frag_node_t::get_total_len ( ) const
inline

Get the total length of this fragment, including its metadata.

◆ header_size()

static ulint lob::frag_node_t::header_size ( )
inlinestatic

Only the header size.

Don't include the page dir entry size here.

◆ incr_length_by_2()

void lob::frag_node_t::incr_length_by_2 ( )
inline

Increment the total length of this fragment by 2 bytes.

◆ is_before()

bool lob::frag_node_t::is_before ( const frag_node_t frag) const
inline

◆ is_equal() [1/2]

bool lob::frag_node_t::is_equal ( const frag_node_t that) const
inline

◆ is_equal() [2/2]

bool lob::frag_node_t::is_equal ( const plist_node_t node) const
inline

◆ is_null()

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

◆ merge()

bool lob::frag_node_t::merge ( frag_node_t next)
inline

Merge the current fragment node with the given next fragment node.

This will succeed only if they are adjacent to each other. Detailed Note: There is a new page type FIL_PAGE_TYPE_ZLOB_FRAG_ENTRY

  • and we can call it the fragment pages. Each fragment page contains one or more fragments. Each fragment is represented by a frag_node_t. And each fragment can be of different size. Consider a fragment page containing 4 fragments - f1, f2, f3 and f4. Suppose we free f2 and f3, then we can merge them into one single bigger fragment which is free.
    Parameters
    [in]nextthe next fragment.
    Returns
    true if merge done, false otherwise.

◆ overhead()

static ulint lob::frag_node_t::overhead ( )
inlinestatic

Amount of space that will be used up by meta data.

When a free space is taken from the fragment page to be used as a fragment node, header and footer will be the overhead. Footer is the page dir entry. The page dir entry may not be contiguous with the fragment.

◆ payload()

ulint lob::frag_node_t::payload ( ) const
inline

Get the space available in this fragment for storing data.

◆ print()

std::ostream & lob::frag_node_t::print ( std::ostream &  out) const
inline

◆ ptr()

byte * lob::frag_node_t::ptr ( ) const
inline

Gets the pointer to the beginning of the current fragment.

Note that the beginning of the fragment contains meta data.

Returns
pointer to the beginning of the current fragment.

◆ set_frag_id()

void lob::frag_node_t::set_frag_id ( ulint  id)
inline

◆ set_frag_id_null()

void lob::frag_node_t::set_frag_id_null ( )
inline

◆ set_total_len()

void lob::frag_node_t::set_total_len ( ulint  len)
inline

Member Data Documentation

◆ m_mtr

mtr_t* lob::frag_node_t::m_mtr
private

The mini-transaction context.

It is only in-memory.

◆ m_node

plist_node_t lob::frag_node_t::m_node

The page list node.

◆ OFFSET_DATA

const ulint lob::frag_node_t::OFFSET_DATA = OFFSET_FRAG_ID + 2
static

The offset where fragment data is stored.

◆ OFFSET_FRAG_ID

const ulint lob::frag_node_t::OFFSET_FRAG_ID = OFFSET_LEN + 2
static

The offset where fragment id is stored.

◆ OFFSET_LEN

const ulint lob::frag_node_t::OFFSET_LEN = plist_node_t::SIZE
static

The offset where the length of fragment is stored.

The length includes both the payload and the meta data overhead.

◆ SIZE_OF_PAGE_DIR_ENTRY

const ulint lob::frag_node_t::SIZE_OF_PAGE_DIR_ENTRY = 2
static

The size of a page directory entry in a fragment page in bytes.

This must be equal to z_frag_page_t::SIZE_OF_PAGE_DIR_ENTRY


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