MySQL 8.4.2
Source Code Documentation
buf0checksum.h File Reference

Buffer pool checksum functions, also linked from /extra/innochecksum.cc. More...

#include "buf0types.h"
#include "page0size.h"
#include "univ.i"

Go to the source code of this file.

Classes

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

Functions

uint32_t buf_calc_page_crc32 (const byte *page, bool use_legacy_big_endian=false)
 Calculates the CRC32 checksum of a page. More...
 
uint32_t buf_calc_page_new_checksum (const byte *page)
 Calculates a page checksum which is stored to the page when it is written to a file. More...
 
uint32_t buf_calc_page_old_checksum (const byte *page)
 In versions < 4.0.14 and < 4.1.1 there was a bug that the checksum only looked at the first few bytes of the page. More...
 
const char * buf_checksum_algorithm_name (srv_checksum_algorithm_t algo)
 Return a printable string describing the checksum algorithm. More...
 

Variables

ulong srv_checksum_algorithm
 the macro MYSQL_SYSVAR_ENUM() requires "long unsigned int" and if we use srv_checksum_algorithm_t here then we get a compiler error: ha_innodb.cc:12251: error: cannot convert 'srv_checksum_algorithm_t*' to 'long unsigned int*' in initialization More...
 

Detailed Description

Buffer pool checksum functions, also linked from /extra/innochecksum.cc.

Created Aug 11, 2011 Vasil Dimov

Function Documentation

◆ buf_calc_page_crc32()

uint32_t buf_calc_page_crc32 ( const byte page,
bool  use_legacy_big_endian 
)

Calculates the CRC32 checksum of a page.

The value is stored to the page when it is written to a file and also checked for a match when reading from the file. When reading we allow both normal CRC32 and CRC-legacy-big-endian variants. Note that we must be careful to calculate the same value on 32-bit and 64-bit architectures.

Parameters
[in]pagebuffer page (UNIV_PAGE_SIZE bytes)
[in]use_legacy_big_endianif true then use big endian byteorder when converting byte strings to integers
Returns
checksum

◆ buf_calc_page_new_checksum()

uint32_t buf_calc_page_new_checksum ( const byte page)

Calculates a page checksum which is stored to the page when it is written to a file.

Note that we must be careful to calculate the same value on 32-bit and 64-bit architectures.

Returns
checksum in: buffer page

Note that we must be careful to calculate the same value on 32-bit and 64-bit architectures.

Returns
checksum
Parameters
pagein: buffer page

◆ buf_calc_page_old_checksum()

uint32_t buf_calc_page_old_checksum ( const byte page)

In versions < 4.0.14 and < 4.1.1 there was a bug that the checksum only looked at the first few bytes of the page.

This calculates that old checksum. NOTE: we must first store the new formula checksum to FIL_PAGE_SPACE_OR_CHKSUM before calculating and storing this old checksum because this takes that field as an input!

Returns
checksum in: buffer page

This calculates that old checksum. NOTE: we must first store the new formula checksum to FIL_PAGE_SPACE_OR_CHKSUM before calculating and storing this old checksum because this takes that field as an input!

Returns
checksum
Parameters
pagein: buffer page

◆ buf_checksum_algorithm_name()

const char * buf_checksum_algorithm_name ( srv_checksum_algorithm_t  algo)

Return a printable string describing the checksum algorithm.

Returns
algorithm name in: algorithm
algorithm name
Parameters
algoin: algorithm

Variable Documentation

◆ srv_checksum_algorithm

ulong srv_checksum_algorithm
extern

the macro MYSQL_SYSVAR_ENUM() requires "long unsigned int" and if we use srv_checksum_algorithm_t here then we get a compiler error: ha_innodb.cc:12251: error: cannot convert 'srv_checksum_algorithm_t*' to 'long unsigned int*' in initialization