MySQL 8.4.2
Source Code Documentation
Log_test Class Reference

It is a environment for tests of redo log. More...

#include <log0test.h>

Classes

struct  Page
 
class  Sync_point
 

Public Types

enum class  Options { VALIDATE_RECENT_CLOSED = 1 , VALIDATE_RECENT_WRITTEN = 2 }
 
typedef page_no_t Key
 
typedef int64_t Value
 
typedef std::map< Key, PagePages
 
typedef std::map< std::string, std::unique_ptr< Sync_point > > Sync_points
 

Public Member Functions

lsn_t oldest_modification_approx () const
 Calculates oldest_modification of the earliest added dirty page during the test in log0log-t. More...
 
void add_dirty_page (const Page &page)
 
void fsync_written_pages ()
 
void purge (lsn_t max_dirty_page_age)
 
const byteparse_mlog_rec (const byte *begin, const byte *end)
 
const Pagesflushed () const
 
const Pagesrecovered () const
 
void sync_point (const std::string &sync_point_name)
 
void register_sync_point_handler (const std::string &sync_point_name, std::unique_ptr< Sync_point > &&sync_point_handler)
 
bool enabled (Options option) const
 
void set_enabled (Options option, bool enabled)
 
int flush_every () const
 
void set_flush_every (int flush_every)
 
int verbosity () const
 
void set_verbosity (int level)
 

Static Public Member Functions

static bytecreate_mlog_rec (byte *rec, Key key, Value value, size_t payload)
 
static bytecreate_mlog_rec (byte *rec, Key key, Value value)
 
static const byteparse_mlog_rec (const byte *begin, const byte *end, Key &key, Value &value, lsn_t &start_lsn, lsn_t &end_lsn)
 

Private Member Functions

void recovered_reset (Key key, lsn_t oldest_modification, lsn_t newest_modification)
 
void recovered_add (Key key, Value value, lsn_t oldest_modification, lsn_t newest_modification)
 

Private Attributes

std::mutex m_mutex
 
std::mutex m_purge_mutex
 
std::map< lsn_t, Pagem_buf
 
Pages m_written
 
Pages m_flushed
 
Pages m_recovered
 
Sync_points m_sync_points
 
uint64_t m_options_enabled = 0
 
int m_verbosity = 0
 
int m_flush_every = 10
 

Detailed Description

It is a environment for tests of redo log.

It contains a mock, which replaces real buffer pool during the test.

Member Typedef Documentation

◆ Key

◆ Pages

typedef std::map<Key, Page> Log_test::Pages

◆ Sync_points

typedef std::map<std::string, std::unique_ptr<Sync_point> > Log_test::Sync_points

◆ Value

typedef int64_t Log_test::Value

Member Enumeration Documentation

◆ Options

enum class Log_test::Options
strong
Enumerator
VALIDATE_RECENT_CLOSED 
VALIDATE_RECENT_WRITTEN 

Member Function Documentation

◆ add_dirty_page()

void Log_test::add_dirty_page ( const Page page)

◆ create_mlog_rec() [1/2]

byte * Log_test::create_mlog_rec ( byte rec,
Key  key,
Value  value 
)
static

◆ create_mlog_rec() [2/2]

byte * Log_test::create_mlog_rec ( byte rec,
Key  key,
Value  value,
size_t  payload 
)
static

◆ enabled()

bool Log_test::enabled ( Options  option) const

◆ flush_every()

int Log_test::flush_every ( ) const

◆ flushed()

const Log_test::Pages & Log_test::flushed ( ) const

◆ fsync_written_pages()

void Log_test::fsync_written_pages ( )

◆ oldest_modification_approx()

lsn_t Log_test::oldest_modification_approx ( ) const

Calculates oldest_modification of the earliest added dirty page during the test in log0log-t.

It is basically a replacement for the log_buf_get_oldest_modification_approx() during the test.

Returns
oldest_modification lsn

◆ parse_mlog_rec() [1/2]

const byte * Log_test::parse_mlog_rec ( const byte begin,
const byte end 
)

◆ parse_mlog_rec() [2/2]

const byte * Log_test::parse_mlog_rec ( const byte begin,
const byte end,
Key key,
Value value,
lsn_t start_lsn,
lsn_t end_lsn 
)
static

◆ purge()

void Log_test::purge ( lsn_t  max_dirty_page_age)

◆ recovered()

const Log_test::Pages & Log_test::recovered ( ) const

◆ recovered_add()

void Log_test::recovered_add ( Key  key,
Value  value,
lsn_t  oldest_modification,
lsn_t  newest_modification 
)
private

◆ recovered_reset()

void Log_test::recovered_reset ( Key  key,
lsn_t  oldest_modification,
lsn_t  newest_modification 
)
private

◆ register_sync_point_handler()

void Log_test::register_sync_point_handler ( const std::string &  sync_point_name,
std::unique_ptr< Sync_point > &&  sync_point_handler 
)

◆ set_enabled()

void Log_test::set_enabled ( Options  option,
bool  enabled 
)

◆ set_flush_every()

void Log_test::set_flush_every ( int  flush_every)

◆ set_verbosity()

void Log_test::set_verbosity ( int  level)

◆ sync_point()

void Log_test::sync_point ( const std::string &  sync_point_name)

◆ verbosity()

int Log_test::verbosity ( ) const

Member Data Documentation

◆ m_buf

std::map<lsn_t, Page> Log_test::m_buf
private

◆ m_flush_every

int Log_test::m_flush_every = 10
private

◆ m_flushed

Pages Log_test::m_flushed
private

◆ m_mutex

std::mutex Log_test::m_mutex
mutableprivate

◆ m_options_enabled

uint64_t Log_test::m_options_enabled = 0
private

◆ m_purge_mutex

std::mutex Log_test::m_purge_mutex
mutableprivate

◆ m_recovered

Pages Log_test::m_recovered
private

◆ m_sync_points

Sync_points Log_test::m_sync_points
private

◆ m_verbosity

int Log_test::m_verbosity = 0
private

◆ m_written

Pages Log_test::m_written
private

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