MySQL 9.1.0
Source Code Documentation
Arch_Block Class Reference

In memory data block in Page ID archiving system. More...

#include <arch0arch.h>

Public Member Functions

 Arch_Block (byte *blk_buf, uint size, Arch_Blk_Type type)
 Constructor: Initialize elements. More...
 
void copy_data (const Arch_Block *block)
 Do a deep copy of the members of the block passed as the parameter. More...
 
void begin_write (Arch_Page_Pos pos)
 Set the block ready to begin writing page ID. More...
 
void end_write ()
 End writing to a block. More...
 
bool is_init () const
 Check if block is initialised or not. More...
 
bool is_active () const
 
bool is_flushable () const
 Check if the block can be flushed or not. More...
 
void set_flushed ()
 Set current block flushed. More...
 
bool add_page (buf_page_t *page, Arch_Page_Pos *pos)
 Add page ID to current block. More...
 
void add_reset (lsn_t reset_lsn, Arch_Page_Pos reset_pos)
 
bool get_data (Arch_Page_Pos *read_pos, uint read_len, byte *read_buff)
 Copy page Ids from this block at read position to a buffer. More...
 
bool set_data (uint read_len, byte *read_buff, uint read_offset)
 Copy page Ids from a buffer to this block. More...
 
dberr_t flush (Arch_Group *file_group, Arch_Blk_Flush_Type type)
 Flush this block to the file group. More...
 
void update_block_header (lsn_t stop_lsn, lsn_t reset_lsn)
 
uint get_data_len () const
 
void set_data_len (uint data_len)
 Set the data length of the block. More...
 
void set_reset_lsn (lsn_t reset_lsn)
 Set the reset length of the block. More...
 
uint64_t get_number () const
 
lsn_t get_stop_lsn () const
 
lsn_t get_oldest_lsn () const
 Get oldest LSN among the pages that are added to this block. More...
 
Arch_Blk_State get_state () const
 Get current state of the block. More...
 

Static Public Member Functions

static bool validate (byte *block)
 Check if the block data is valid. More...
 
static uint get_file_index (uint64_t block_num, Arch_Blk_Type type)
 Get file index of the file the block belongs to. More...
 
static Arch_Blk_Type get_type (byte *block)
 Get block type from the block header. More...
 
static uint get_data_len (byte *block)
 Get block data length from the block header. More...
 
static lsn_t get_stop_lsn (byte *block)
 Get the stop lsn stored in the block header. More...
 
static uint64_t get_block_number (byte *block)
 Get the block number from the block header. More...
 
static lsn_t get_reset_lsn (byte *block)
 Get the reset lsn stored in the block header. More...
 
static uint32_t get_checksum (byte *block)
 Get the checksum stored in the block header. More...
 
static uint64_t get_file_offset (uint64_t block_num, Arch_Blk_Type type)
 Fetch the offset for a block in the archive file. More...
 

Private Attributes

bytem_data
 Block data buffer. More...
 
uint m_data_len {}
 Block data length in bytes. More...
 
uint m_size
 Total block size in bytes. More...
 
Arch_Blk_State m_state {ARCH_BLOCK_INIT}
 State of the block. More...
 
uint64_t m_number {}
 Unique block number. More...
 
Arch_Blk_Type m_type
 Type of block. More...
 
lsn_t m_stop_lsn {LSN_MAX}
 Checkpoint lsn at the time the last page ID was added to the block. More...
 
lsn_t m_oldest_lsn {LSN_MAX}
 Oldest LSN of all the page IDs added to the block since the last checkpoint. More...
 
lsn_t m_reset_lsn {LSN_MAX}
 Start LSN or the last reset LSN of the group. More...
 

Detailed Description

In memory data block in Page ID archiving system.

Constructor & Destructor Documentation

◆ Arch_Block()

Arch_Block::Arch_Block ( byte blk_buf,
uint  size,
Arch_Blk_Type  type 
)
inline

Constructor: Initialize elements.

Parameters
[in]blk_bufbuffer for data block
[in]sizebuffer size
[in]typeblock type

Member Function Documentation

◆ add_page()

bool Arch_Block::add_page ( buf_page_t page,
Arch_Page_Pos pos 
)

Add page ID to current block.

Parameters
[in]pagepage from buffer pool
[in]posArchiver current position
Returns
true, if successful false, if no more space in current block

◆ add_reset()

void Arch_Block::add_reset ( lsn_t  reset_lsn,
Arch_Page_Pos  reset_pos 
)

◆ begin_write()

void Arch_Block::begin_write ( Arch_Page_Pos  pos)

Set the block ready to begin writing page ID.

Parameters
[in]posposition to initiate block number

◆ copy_data()

void Arch_Block::copy_data ( const Arch_Block block)

Do a deep copy of the members of the block passed as the parameter.

Note
This member needs to be updated whenever a new data member is added to this class.

◆ end_write()

void Arch_Block::end_write ( )

End writing to a block.

Change state to ARCH_BLOCK_READY_TO_FLUSH

◆ flush()

dberr_t Arch_Block::flush ( Arch_Group file_group,
Arch_Blk_Flush_Type  type 
)

Flush this block to the file group.

Parameters
[in]file_groupcurrent archive group
[in]typeflush type
Returns
error code.

◆ get_block_number()

uint64_t Arch_Block::get_block_number ( byte block)
static

Get the block number from the block header.

Parameters
[in]blockblock from where to fetch the block number
Returns
block number

◆ get_checksum()

uint32_t Arch_Block::get_checksum ( byte block)
static

Get the checksum stored in the block header.

Parameters
[in]blockblock from where to fetch the checksum
Returns
checksum

◆ get_data()

bool Arch_Block::get_data ( Arch_Page_Pos read_pos,
uint  read_len,
byte read_buff 
)

Copy page Ids from this block at read position to a buffer.

Parameters
[in]read_poscurrent read position
[in]read_lenlength of data to copy
[out]read_buffbuffer to copy page IDs. Caller must allocate the buffer.
Returns
true, if successful false, if block is already overwritten

◆ get_data_len() [1/2]

uint Arch_Block::get_data_len ( ) const
inline
Returns
data length of the block.

◆ get_data_len() [2/2]

uint Arch_Block::get_data_len ( byte block)
static

Get block data length from the block header.

Parameters
[in]blockblock from where to get the data length
Returns
block data length

◆ get_file_index()

uint Arch_Block::get_file_index ( uint64_t  block_num,
Arch_Blk_Type  type 
)
static

Get file index of the file the block belongs to.

Returns
file index

◆ get_file_offset()

uint64_t Arch_Block::get_file_offset ( uint64_t  block_num,
Arch_Blk_Type  type 
)
static

Fetch the offset for a block in the archive file.

Parameters
[in]block_numblock number
[in]typetype of block
Returns
file offset of the block

◆ get_number()

uint64_t Arch_Block::get_number ( ) const
inline
Returns
block number of the block.

◆ get_oldest_lsn()

lsn_t Arch_Block::get_oldest_lsn ( ) const
inline

Get oldest LSN among the pages that are added to this block.

Returns
oldest LSN in block pages

◆ get_reset_lsn()

lsn_t Arch_Block::get_reset_lsn ( byte block)
static

Get the reset lsn stored in the block header.

Parameters
[in]blockblock from where to fetch the reset lsn
Returns
reset lsn

◆ get_state()

Arch_Blk_State Arch_Block::get_state ( ) const
inline

Get current state of the block.

Returns
block state

◆ get_stop_lsn() [1/2]

lsn_t Arch_Block::get_stop_lsn ( ) const
inline
Returns
stop lsn

◆ get_stop_lsn() [2/2]

lsn_t Arch_Block::get_stop_lsn ( byte block)
static

Get the stop lsn stored in the block header.

Parameters
[in]blockblock from where to fetch the stop lsn
Returns
stop lsn

◆ get_type()

Arch_Blk_Type Arch_Block::get_type ( byte block)
static

Get block type from the block header.

Parameters
[in]blockblock from where to get the type
Returns
block type

◆ is_active()

bool Arch_Block::is_active ( ) const
inline

◆ is_flushable()

bool Arch_Block::is_flushable ( ) const
inline

Check if the block can be flushed or not.

Returns
true, if the block cannot be flushed

◆ is_init()

bool Arch_Block::is_init ( ) const
inline

Check if block is initialised or not.

Returns
true if it has been initialised, else false

◆ set_data()

bool Arch_Block::set_data ( uint  read_len,
byte read_buff,
uint  read_offset 
)

Copy page Ids from a buffer to this block.

Parameters
[in]read_lenlength of data to copy
[in]read_buffbuffer to copy page IDs from
[in]read_offsetoffset from where to write
Returns
true if successful

◆ set_data_len()

void Arch_Block::set_data_len ( uint  data_len)
inline

Set the data length of the block.

Parameters
[in]data_lendata length

◆ set_flushed()

void Arch_Block::set_flushed ( )
inline

Set current block flushed.

Must hold page archiver sys operation mutex.

◆ set_reset_lsn()

void Arch_Block::set_reset_lsn ( lsn_t  reset_lsn)
inline

Set the reset length of the block.

Parameters
[in]reset_lsnreset lsn

◆ update_block_header()

void Arch_Block::update_block_header ( lsn_t  stop_lsn,
lsn_t  reset_lsn 
)

◆ validate()

bool Arch_Block::validate ( byte block)
static

Check if the block data is valid.

Parameters
[in]blockblock to be validated
Returns
true if it's a valid block, else false

Member Data Documentation

◆ m_data

byte* Arch_Block::m_data
private

Block data buffer.

◆ m_data_len

uint Arch_Block::m_data_len {}
private

Block data length in bytes.

◆ m_number

uint64_t Arch_Block::m_number {}
private

Unique block number.

◆ m_oldest_lsn

lsn_t Arch_Block::m_oldest_lsn {LSN_MAX}
private

Oldest LSN of all the page IDs added to the block since the last checkpoint.

◆ m_reset_lsn

lsn_t Arch_Block::m_reset_lsn {LSN_MAX}
private

Start LSN or the last reset LSN of the group.

◆ m_size

uint Arch_Block::m_size
private

Total block size in bytes.

◆ m_state

Arch_Blk_State Arch_Block::m_state {ARCH_BLOCK_INIT}
private

State of the block.

◆ m_stop_lsn

lsn_t Arch_Block::m_stop_lsn {LSN_MAX}
private

Checkpoint lsn at the time the last page ID was added to the block.

◆ m_type

Arch_Blk_Type Arch_Block::m_type
private

Type of block.


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