MySQL 8.3.0
Source Code Documentation
BlockReporter Class Reference

Class to print checksums to log file. More...

#include <buf0checksum.h>

Public Member Functions

 BlockReporter (bool check_lsn, const byte *read_buf, const page_size_t &page_size, bool skip_checksum)
 Constructor. More...
 
virtual ~BlockReporter ()=default
 
 BlockReporter (const BlockReporter &)=default
 
bool is_corrupted () const
 Checks if a page is corrupt. More...
 
bool is_encrypted () const noexcept
 Checks if a page is encrypted. More...
 
virtual void report_empty_page (bool empty) const
 Print message if page is empty. More...
 
virtual void print_strict_crc32 (uint32_t checksum_field1, uint32_t checksum_field2, uint32_t crc32, srv_checksum_algorithm_t algo) const
 Print crc32 checksum and the checksum fields in page. More...
 
virtual void print_strict_innodb (uint32_t checksum_field1, uint32_t checksum_field2) const
 Print innodb checksum and the checksum fields in page. More...
 
virtual void print_strict_none (uint32_t checksum_field1, uint32_t checksum_field2, srv_checksum_algorithm_t algo) const
 Print none checksum and the checksum fields in page. More...
 
virtual void print_innodb_checksum (uint32_t old_checksum, uint32_t new_checksum, uint32_t checksum_field1, uint32_t checksum_field2, srv_checksum_algorithm_t algo) const
 Print innodb checksum value stored in page trailer. More...
 
virtual void print_innodb_fail () const
 Print the message that checksum mismatch happened in page header. More...
 
virtual void print_crc32_checksum (uint32_t checksum_field1, uint32_t checksum_field2) const
 Print both new-style, old-style & crc32 checksum values. More...
 
virtual void print_crc32_fail () const
 Print a message that crc32 check failed. More...
 
virtual void print_none_fail () const
 Print a message that none check failed. More...
 
virtual void print_compressed_checksum (uint32_t calc, uint32_t stored) const
 Print checksum values on a compressed page. More...
 
bool verify_zip_checksum () const
 Verify a compressed page's checksum. More...
 
uint32_t calc_zip_checksum (const byte *read_buf, ulint phys_page_size, srv_checksum_algorithm_t algo) const
 Calculate the compressed page checksum. More...
 
uint32_t calc_zip_checksum (srv_checksum_algorithm_t algo) const
 Calculate the compressed page checksum. More...
 

Static Public Member Functions

static bool is_lsn_valid (const byte *frame, uint32_t page_size) noexcept
 

Protected Attributes

bool m_check_lsn
 If true, do a LSN check during innodb recovery. More...
 
const bytem_read_buf
 Buffer holding the page. More...
 
const page_size_tm_page_size
 Page size. More...
 
bool m_skip_checksum
 Skip checksum verification but compare only data. More...
 

Private Member Functions

bool is_checksum_valid_innodb (uint32_t checksum_field1, uint32_t checksum_field2, const srv_checksum_algorithm_t algo) const
 Checks if the page is in innodb checksum format. More...
 
bool is_checksum_valid_none (uint32_t checksum_field1, uint32_t checksum_field2, const srv_checksum_algorithm_t algo) const
 Checks if the page is in none checksum format. More...
 
bool is_checksum_valid_crc32 (uint32_t checksum_field1, uint32_t checksum_field2, const srv_checksum_algorithm_t algo, bool use_legacy_big_endian) const
 Checks if the page is in crc32 checksum format. More...
 
void page_warn_strict_checksum (srv_checksum_algorithm_t curr_algo, srv_checksum_algorithm_t page_checksum, const page_id_t &page_id) const
 Issue a warning when the checksum that is stored in the page is valid, but different than the global setting innodb_checksum_algorithm. More...
 
space_id_t space_id () const noexcept
 
page_no_t page_no () const noexcept
 

Detailed Description

Class to print checksums to log file.

Constructor & Destructor Documentation

◆ BlockReporter() [1/2]

BlockReporter::BlockReporter ( bool  check_lsn,
const byte read_buf,
const page_size_t page_size,
bool  skip_checksum 
)
inline

Constructor.

Parameters
[in]check_lsncheck lsn of the page with the current lsn (only in recovery)
[in]read_bufbuffer holding the page
[in]page_sizepage size
[in]skip_checksumskip checksum verification

◆ ~BlockReporter()

virtual BlockReporter::~BlockReporter ( )
virtualdefault

◆ BlockReporter() [2/2]

BlockReporter::BlockReporter ( const BlockReporter )
default

Member Function Documentation

◆ calc_zip_checksum() [1/2]

uint32_t BlockReporter::calc_zip_checksum ( const byte read_buf,
ulint  phys_page_size,
srv_checksum_algorithm_t  algo 
) const

Calculate the compressed page checksum.

This variant should be used when only the page_size_t is unknown and only physical page_size of compressed page is available.

Parameters
[in]read_bufbuffer holding the page
[in]phys_page_sizephysical page size
[in]algochecksum algorithm to use
Returns
page checksum

◆ calc_zip_checksum() [2/2]

uint32_t BlockReporter::calc_zip_checksum ( srv_checksum_algorithm_t  algo) const

Calculate the compressed page checksum.

Parameters
[in]algochecksum algorithm to use
Returns
page checksum

◆ is_checksum_valid_crc32()

bool BlockReporter::is_checksum_valid_crc32 ( uint32_t  checksum_field1,
uint32_t  checksum_field2,
const srv_checksum_algorithm_t  algo,
bool  use_legacy_big_endian 
) const
private

Checks if the page is in crc32 checksum format.

Parameters
[in]checksum_field1new checksum field
[in]checksum_field2old checksum field
[in]algocurrent checksum algorithm
[in]use_legacy_big_endianbig endian algorithm
Returns
true if the page is in crc32 checksum format.

◆ is_checksum_valid_innodb()

bool BlockReporter::is_checksum_valid_innodb ( uint32_t  checksum_field1,
uint32_t  checksum_field2,
const srv_checksum_algorithm_t  algo 
) const
private

Checks if the page is in innodb checksum format.

Parameters
[in]checksum_field1new checksum field
[in]checksum_field2old checksum field
[in]algocurrent checksum algorithm
Returns
true if the page is in innodb checksum format.

◆ is_checksum_valid_none()

bool BlockReporter::is_checksum_valid_none ( uint32_t  checksum_field1,
uint32_t  checksum_field2,
const srv_checksum_algorithm_t  algo 
) const
private

Checks if the page is in none checksum format.

Parameters
[in]checksum_field1new checksum field
[in]checksum_field2old checksum field
[in]algocurrent checksum algorithm
Returns
true if the page is in none checksum format.

◆ is_corrupted()

bool BlockReporter::is_corrupted ( ) const

Checks if a page is corrupt.

Return values
trueif page is corrupt
falseif page is not corrupt

◆ is_encrypted()

bool BlockReporter::is_encrypted ( ) const
noexcept

Checks if a page is encrypted.

Return values
trueif page is encrypted
falseif page is not encrypted

◆ is_lsn_valid()

bool BlockReporter::is_lsn_valid ( const byte frame,
uint32_t  page_size 
)
staticnoexcept

◆ page_no()

page_no_t BlockReporter::page_no ( ) const
privatenoexcept

◆ page_warn_strict_checksum()

void BlockReporter::page_warn_strict_checksum ( srv_checksum_algorithm_t  curr_algo,
srv_checksum_algorithm_t  page_checksum,
const page_id_t page_id 
) const
private

Issue a warning when the checksum that is stored in the page is valid, but different than the global setting innodb_checksum_algorithm.

Parameters
[in]curr_algocurrent checksum algorithm
[in]page_checksumpage valid checksum
[in]page_idpage identifier

◆ print_compressed_checksum()

virtual void BlockReporter::print_compressed_checksum ( uint32_t  calc,
uint32_t  stored 
) const
inlinevirtual

Print checksum values on a compressed page.

Parameters
[in]calcthe calculated checksum value
[in]storedthe stored checksum in header.

◆ print_crc32_checksum()

virtual void BlockReporter::print_crc32_checksum ( uint32_t  checksum_field1,
uint32_t  checksum_field2 
) const
inlinevirtual

Print both new-style, old-style & crc32 checksum values.

Parameters
[in]checksum_field1Checksum in page header
[in]checksum_field2Checksum in page trailer

◆ print_crc32_fail()

virtual void BlockReporter::print_crc32_fail ( ) const
inlinevirtual

Print a message that crc32 check failed.

◆ print_innodb_checksum()

virtual void BlockReporter::print_innodb_checksum ( uint32_t  old_checksum,
uint32_t  new_checksum,
uint32_t  checksum_field1,
uint32_t  checksum_field2,
srv_checksum_algorithm_t  algo 
) const
inlinevirtual

Print innodb checksum value stored in page trailer.

Parameters
[in]old_checksumchecksum value according to old style
[in]new_checksumchecksum value according to new style
[in]checksum_field1Checksum in page header
[in]checksum_field2Checksum in page trailer
[in]algocurrent checksum algorithm

◆ print_innodb_fail()

virtual void BlockReporter::print_innodb_fail ( ) const
inlinevirtual

Print the message that checksum mismatch happened in page header.

◆ print_none_fail()

virtual void BlockReporter::print_none_fail ( ) const
inlinevirtual

Print a message that none check failed.

◆ print_strict_crc32()

virtual void BlockReporter::print_strict_crc32 ( uint32_t  checksum_field1,
uint32_t  checksum_field2,
uint32_t  crc32,
srv_checksum_algorithm_t  algo 
) const
inlinevirtual

Print crc32 checksum and the checksum fields in page.

Parameters
[in]checksum_field1Checksum in page header
[in]checksum_field2Checksum in page trailer
[in]crc32Calculated crc32 checksum
[in]algoCurrent checksum algorithm

◆ print_strict_innodb()

virtual void BlockReporter::print_strict_innodb ( uint32_t  checksum_field1,
uint32_t  checksum_field2 
) const
inlinevirtual

Print innodb checksum and the checksum fields in page.

Parameters
[in]checksum_field1Checksum in page header
[in]checksum_field2Checksum in page trailer

◆ print_strict_none()

virtual void BlockReporter::print_strict_none ( uint32_t  checksum_field1,
uint32_t  checksum_field2,
srv_checksum_algorithm_t  algo 
) const
inlinevirtual

Print none checksum and the checksum fields in page.

Parameters
[in]checksum_field1Checksum in page header
[in]checksum_field2Checksum in page trailer
[in]algoCurrent checksum algorithm

◆ report_empty_page()

virtual void BlockReporter::report_empty_page ( bool  empty) const
inlinevirtual

Print message if page is empty.

Parameters
[in]emptytrue if page is empty

◆ space_id()

space_id_t BlockReporter::space_id ( ) const
privatenoexcept

◆ verify_zip_checksum()

bool BlockReporter::verify_zip_checksum ( ) const

Verify a compressed page's checksum.

Return values
trueif stored checksum is valid according to the value of srv_checksum_algorithm
falseif stored checksum is not valid according to the value of srv_checksum_algorithm

Member Data Documentation

◆ m_check_lsn

bool BlockReporter::m_check_lsn
protected

If true, do a LSN check during innodb recovery.

◆ m_page_size

const page_size_t& BlockReporter::m_page_size
protected

Page size.

◆ m_read_buf

const byte* BlockReporter::m_read_buf
protected

Buffer holding the page.

◆ m_skip_checksum

bool BlockReporter::m_skip_checksum
protected

Skip checksum verification but compare only data.


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