MySQL 8.0.39
Source Code Documentation
ib::Tester Struct Reference

This class contains implementations of the commands that can be executed at server side by passing them via the innodb_interpreter system variable. More...

#include <ut0test.h>

Public Types

enum  Ret_t { RET_PASS = 0 , RET_FAIL = 1 , RET_CMD_TBD = 2 }
 The return status code used by the various commands in this module. More...
 

Public Member Functions

 Tester () noexcept
 Default constructor. More...
 
Ret_t run (ulong cmd) noexcept
 Run the given command. More...
 
Ret_t run (const std::string &cmd) noexcept
 Run the given command. More...
 
const char * get_last_log () const noexcept
 Get the last generated output. More...
 
void update_thd_variable () noexcept
 Let the thread-variable innodb_interpreter_output point to the current output. More...
 

Private Types

using Function_executor = Ret_t(Tester::*)(std::vector< std::string > &)
 
using Pair = std::pair< const std::string, Function_executor >
 
using Allocator = ut::allocator< Pair >
 

Private Member Functions

void init () noexcept
 Initialize the internal state of the tester. More...
 
Ret_t open_table (std::vector< std::string > &tokens) noexcept
 Open the specified table. More...
 
void close_table (dict_table_t *table) noexcept
 Close the given table. More...
 
Ret_t find_space_id (std::vector< std::string > &tokens) noexcept
 Find the space_id of the given table. More...
 
Ret_t find_root_page_no (std::vector< std::string > &tokens) noexcept
 Find the root page of the given table. More...
 
Ret_t find_ondisk_page_type (std::vector< std::string > &tokens) noexcept
 Find the on-disk page type of the given page. More...
 
Ret_t find_fil_page_lsn (std::vector< std::string > &tokens) noexcept
 Find the FIL_PAGE_LSN of the given page. More...
 
Ret_t find_flush_sync_lsn (std::vector< std::string > &tokens) noexcept
 Find the flush sync lsn from the buffer pool module. More...
 
Ret_t print_dblwr_has_encrypted_pages (std::vector< std::string > &tokens) noexcept
 Print the page type of pages in dblwr file to server error log. More...
 
Ret_t find_tablespace_file_name (std::vector< std::string > &tokens) noexcept
 Obtain the file name of the given tablespace. More...
 
 DISPATCH_FUNCTION (count_page_type)
 Count various page_types for given tablespace. More...
 
 DISPATCH_FUNCTION (count_used_and_free)
 Count various page_types for given tablespace. More...
 
 DISPATCH_FUNCTION (find_tablespace_physical_page_size)
 Obtain the page size of the given tablespace. More...
 
 DISPATCH_FUNCTION (make_ondisk_root_page_zeroes)
 Fill the root page of the given table with zeroes. More...
 
 DISPATCH_FUNCTION (make_page_dirty)
 Make the page dirty. More...
 
Ret_t corrupt_ondisk_root_page (std::vector< std::string > &tokens) noexcept
 Corrupt the root page of the given table. More...
 
Ret_t corrupt_ondisk_page0 (std::vector< std::string > &tokens) noexcept
 Corrupt the first page of the given tablespace. More...
 
 DISPATCH_FUNCTION (dblwr_force_crash)
 Set the dblwr::Force_crash to the desired page. More...
 
void destroy () noexcept
 Destroy the tester object. More...
 
dict_table_tis_table_open (const std::string &table_name) const noexcept
 Check if the given table is already opened. More...
 
void set_output (const std::ostringstream &sout) noexcept
 Set the output value of the interpreter. More...
 
void set_output (const std::string &log) noexcept
 Set the output value of the interpreter to the given value. More...
 
void append_output (const std::string &log) noexcept
 Append the given string to the output value of the interpreter. More...
 
void clear_output () noexcept
 Make the output empty. More...
 
Ret_t clear_page_prefix (const space_id_t space_id, page_no_t page_no, const size_t prefix_length)
 Make the first prefix_length bytes of the given page as zeroes. More...
 

Private Attributes

std::list< dict_table_t *, ut::allocator< dict_table_t * > > m_open_tables {}
 List of open tables. More...
 
THDm_thd {}
 Current thread object. More...
 
std::string m_log {}
 The actual log data that is shared with the client via the thread-variable innodb_interpreter_output. More...
 
std::string m_command {}
 The latest command executed. More...
 
std::map< std::string, Function_executor, std::less< std::string >, Allocatorm_dispatch
 Mapping b/w the command name and the function to execute. More...
 

Detailed Description

This class contains implementations of the commands that can be executed at server side by passing them via the innodb_interpreter system variable.

Member Typedef Documentation

◆ Allocator

◆ Function_executor

using ib::Tester::Function_executor = Ret_t (Tester::*)(std::vector<std::string> &)
private

◆ Pair

using ib::Tester::Pair = std::pair<const std::string, Function_executor>
private

Member Enumeration Documentation

◆ Ret_t

The return status code used by the various commands in this module.

Enumerator
RET_PASS 
RET_FAIL 
RET_CMD_TBD 

Constructor & Destructor Documentation

◆ Tester()

ib::Tester::Tester ( )
noexcept

Default constructor.

Member Function Documentation

◆ append_output()

void ib::Tester::append_output ( const std::string &  log)
privatenoexcept

Append the given string to the output value of the interpreter.

Parameters
[in]logthe output string to be appended

◆ clear_output()

void ib::Tester::clear_output ( )
privatenoexcept

Make the output empty.

◆ clear_page_prefix()

Ret_t ib::Tester::clear_page_prefix ( const space_id_t  space_id,
page_no_t  page_no,
const size_t  prefix_length 
)
private

Make the first prefix_length bytes of the given page as zeroes.

Parameters
[in]space_idthe tablespace identifier of the page to be zeroed.
[in]page_nopage number within the given tablespace.
[in]prefix_lengththe length of the page, from beginning, to be zeroed.
Returns
RET_PASS on success, or error code on failure.

◆ close_table()

void ib::Tester::close_table ( dict_table_t table)
privatenoexcept

Close the given table.

Parameters
[in]tablethe table object

◆ corrupt_ondisk_page0()

Ret_t ib::Tester::corrupt_ondisk_page0 ( std::vector< std::string > &  tokens)
privatenoexcept

Corrupt the first page of the given tablespace.

Parameters
[in]tokensthe given command line
Returns
RET_PASS on success, or the error code.

◆ corrupt_ondisk_root_page()

Ret_t ib::Tester::corrupt_ondisk_root_page ( std::vector< std::string > &  tokens)
privatenoexcept

Corrupt the root page of the given table.

Parameters
[in]tokensthe given command line
Returns
RET_PASS on success, or the error code.

◆ destroy()

void ib::Tester::destroy ( )
privatenoexcept

Destroy the tester object.

◆ DISPATCH_FUNCTION() [1/6]

ib::Tester::DISPATCH_FUNCTION ( count_page_type  )
private

Count various page_types for given tablespace.

◆ DISPATCH_FUNCTION() [2/6]

ib::Tester::DISPATCH_FUNCTION ( count_used_and_free  )
private

Count various page_types for given tablespace.

◆ DISPATCH_FUNCTION() [3/6]

ib::Tester::DISPATCH_FUNCTION ( dblwr_force_crash  )
private

Set the dblwr::Force_crash to the desired page.

This will crash the server after flushing the page to dblwr.

Returns
RET_PASS on success, or the error code.

◆ DISPATCH_FUNCTION() [4/6]

ib::Tester::DISPATCH_FUNCTION ( find_tablespace_physical_page_size  )
private

Obtain the page size of the given tablespace.

◆ DISPATCH_FUNCTION() [5/6]

ib::Tester::DISPATCH_FUNCTION ( make_ondisk_root_page_zeroes  )
private

Fill the root page of the given table with zeroes.

◆ DISPATCH_FUNCTION() [6/6]

ib::Tester::DISPATCH_FUNCTION ( make_page_dirty  )
private

Make the page dirty.

It takes two arguments. make_page_dirty space_id page_no

◆ find_fil_page_lsn()

Ret_t ib::Tester::find_fil_page_lsn ( std::vector< std::string > &  tokens)
privatenoexcept

Find the FIL_PAGE_LSN of the given page.

Parameters
[in]tokensthe given command line
Returns
RET_PASS on success, or the error code.

◆ find_flush_sync_lsn()

Ret_t ib::Tester::find_flush_sync_lsn ( std::vector< std::string > &  tokens)
privatenoexcept

Find the flush sync lsn from the buffer pool module.

Parameters
[in]tokensthe given command line
Returns
RET_PASS on success, or the error code.

◆ find_ondisk_page_type()

Ret_t ib::Tester::find_ondisk_page_type ( std::vector< std::string > &  tokens)
privatenoexcept

Find the on-disk page type of the given page.

Parameters
[in]tokensthe given command line
Returns
RET_PASS on success, or the error code.

◆ find_root_page_no()

Ret_t ib::Tester::find_root_page_no ( std::vector< std::string > &  tokens)
privatenoexcept

Find the root page of the given table.

Parameters
[in]tokensthe given command line
Returns
RET_PASS on success, or the error code.

◆ find_space_id()

Ret_t ib::Tester::find_space_id ( std::vector< std::string > &  tokens)
privatenoexcept

Find the space_id of the given table.

Parameters
[in]tokensthe given command line
Returns
RET_PASS on success, or the error code.

◆ find_tablespace_file_name()

Ret_t ib::Tester::find_tablespace_file_name ( std::vector< std::string > &  tokens)
privatenoexcept

Obtain the file name of the given tablespace.

Parameters
[in]tokensthe given command line
Returns
RET_PASS on success, or the error code.

◆ get_last_log()

const char * ib::Tester::get_last_log ( ) const
inlinenoexcept

Get the last generated output.

Returns
the last generated output.

◆ init()

void ib::Tester::init ( void  )
privatenoexcept

Initialize the internal state of the tester.

◆ is_table_open()

dict_table_t * ib::Tester::is_table_open ( const std::string &  table_name) const
privatenoexcept

Check if the given table is already opened.

Parameters
[in]table_namename of the table to open.
Returns
if table is already open return its pointer.
if table is NOT already open return nullptr.

◆ open_table()

Ret_t ib::Tester::open_table ( std::vector< std::string > &  tokens)
privatenoexcept

Open the specified table.

Parameters
[in]tokensthe given command line
Returns
RET_PASS on success, or the error code.

◆ print_dblwr_has_encrypted_pages()

Ret_t ib::Tester::print_dblwr_has_encrypted_pages ( std::vector< std::string > &  tokens)
privatenoexcept

Print the page type of pages in dblwr file to server error log.

Parameters
[in]tokensthe given command line
Returns
RET_PASS on success, or the error code.

◆ run() [1/2]

Ret_t ib::Tester::run ( const std::string &  cmd)
noexcept

Run the given command.

Parameters
[in]cmdthe command to run.
Returns
0 on success.
error code on failure.

◆ run() [2/2]

Ret_t ib::Tester::run ( ulong  cmd)
noexcept

Run the given command.

Parameters
[in]cmdthe command to run.
Returns
0 on success.
error code on failure.

◆ set_output() [1/2]

void ib::Tester::set_output ( const std::ostringstream &  sout)
privatenoexcept

Set the output value of the interpreter.

Parameters
[in]soutthe output string stream containing the output string.

◆ set_output() [2/2]

void ib::Tester::set_output ( const std::string &  log)
privatenoexcept

Set the output value of the interpreter to the given value.

Parameters
[in]logthe output string

◆ update_thd_variable()

void ib::Tester::update_thd_variable ( )
noexcept

Let the thread-variable innodb_interpreter_output point to the current output.


Member Data Documentation

◆ m_command

std::string ib::Tester::m_command {}
private

The latest command executed.

◆ m_dispatch

std::map<std::string, Function_executor, std::less<std::string>, Allocator> ib::Tester::m_dispatch
private

Mapping b/w the command name and the function to execute.

◆ m_log

std::string ib::Tester::m_log {}
private

The actual log data that is shared with the client via the thread-variable innodb_interpreter_output.

(Search for the variable interpreter_output in the file ha_innodb.cc)

◆ m_open_tables

std::list<dict_table_t *, ut::allocator<dict_table_t *> > ib::Tester::m_open_tables {}
private

List of open tables.

◆ m_thd

THD* ib::Tester::m_thd {}
private

Current thread object.


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