MySQL 8.0.41
Source Code Documentation
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
dblwr Namespace Reference

Namespaces

namespace  recv
 
namespace  v1
 

Classes

struct  Buffer
 IO buffer in UNIV_PAGE_SIZE units and aligned on UNIV_PAGE_SIZE. More...
 
struct  File
 
struct  Mode
 
struct  Reduced_entry
 When –innodb-doublewrite=DETECT_ONLY, page contents are not written to the dblwr buffer. More...
 

Functions

bool is_odd (uint32_t val)
 
std::ostream & operator<< (std::ostream &out, const File &obj) noexcept
 Overload the global output operator to work with dblwr::File type. More...
 
static bool is_encrypted_page (const byte *page) noexcept
 
bool has_encrypted_pages () noexcept
 Check if the dblwr files contain encrypted pages. More...
 
dberr_t open () noexcept
 Startup the background thread(s) and create the instance. More...
 
dberr_t enable_reduced () noexcept
 Enable the doublewrite reduced mode by creating the necessary dblwr files and in-memory structures. More...
 
dberr_t reduced_open () noexcept
 Check and open the reduced doublewrite files if necessary. More...
 
void close () noexcept
 Shutdown the background thread and destroy the instance. More...
 
void force_flush (buf_flush_t flush_type, uint32_t buf_pool_index) noexcept
 Force a write of all pages in the queue. More...
 
void force_flush_all () noexcept
 Force a write of all pages in all dblwr segments (reduced or regular) This is used only when switching the doublewrite mode dynamically. More...
 
dberr_t write (buf_flush_t flush_type, buf_page_t *bpage, bool sync) noexcept
 Writes a page to the doublewrite buffer on disk, syncs it, then writes the page to the datafile. More...
 
file::Blockget_encrypted_frame (buf_page_t *bpage) noexcept
 Obtain the encrypted frame and store it in bpage->m_io_frame. More...
 
void write_complete (buf_page_t *bpage, buf_flush_t flush_type) noexcept
 Updates the double write buffer when a write request is completed. More...
 
void reset_files () noexcept
 Delete or adjust the dblwr file size if required. More...
 
bool is_enabled ()
 Check if doublewrite is enabled. More...
 
bool is_reduced ()
 Check if the doublewrite mode is detect-only (aka reduced). More...
 
bool is_disabled ()
 Check if the doublewrite mode is disabled. More...
 
const char * to_string (ulong mode)
 
void set ()
 Toggle the doublewrite buffer. More...
 

Variables

std::string dir {"."}
 Double write files location. More...
 
ulong n_files {1}
 Number of files to use for the double write buffer. More...
 
ulong batch_size {}
 Maximum number of pages to write in one batch. More...
 
ulong n_pages {64}
 Number of pages per doublewrite thread/segment. More...
 
ulong g_mode {Mode::ON}
 DBLWR mode. More...
 
bool is_reduced_inited = false
 true if DETECT_ONLY (aka reduced) mode is inited More...
 
static page_no_t LEGACY_PAGE1
 Legacy dblwr buffer first segment page number. More...
 
static page_no_t LEGACY_PAGE2
 Legacy dblwr buffer second segment page number. More...
 
page_id_t Force_crash {UINT32_UNDEFINED, UINT32_UNDEFINED}
 Crash the server after writing this page to the data file. More...
 
const uint32_t REDUCED_BATCH_PAGE_SIZE = 8192
 
const uint32_t RB_BATCH_ID_SIZE = 4
 
const uint32_t RB_CHECKSUM_SIZE = 4
 
const uint32_t RB_DATA_LEN_SIZE = 2
 
const uint32_t RB_BATCH_TYPE_SIZE = 1
 
const uint32_t RB_UNUSED_BYTES_SIZE = 9
 
constexpr const uint32_t RB_OFF_BATCH_ID = 0
 
constexpr const uint32_t RB_OFF_CHECKSUM = RB_OFF_BATCH_ID + RB_BATCH_ID_SIZE
 
constexpr const uint32_t RB_OFF_DATA_LEN = RB_OFF_CHECKSUM + RB_CHECKSUM_SIZE
 
constexpr const uint32_t RB_OFF_BATCH_TYPE = RB_OFF_DATA_LEN + RB_DATA_LEN_SIZE
 
constexpr const uint32_t RB_OFF_UNUSED = RB_OFF_BATCH_TYPE + RB_BATCH_TYPE_SIZE
 
constexpr const uint32_t REDUCED_HEADER_SIZE
 
constexpr const uint32_t REDUCED_ENTRY_SIZE
 
constexpr const uint32_t REDUCED_DATA_SIZE
 
constexpr const uint32_t REDUCED_MAX_ENTRIES
 

Function Documentation

◆ close()

void dblwr::close ( )
noexcept

Shutdown the background thread and destroy the instance.

◆ enable_reduced()

dberr_t dblwr::enable_reduced ( )
noexcept

Enable the doublewrite reduced mode by creating the necessary dblwr files and in-memory structures.

Returns
DB_SUCCESS or error code

◆ force_flush()

void dblwr::force_flush ( buf_flush_t  flush_type,
uint32_t  buf_pool_index 
)
noexcept

Force a write of all pages in the queue.

Parameters
[in]flush_typeFLUSH LIST or LRU_LIST flush request.
[in]buf_pool_indexBuffer pool instance for which called.

◆ force_flush_all()

void dblwr::force_flush_all ( )
noexcept

Force a write of all pages in all dblwr segments (reduced or regular) This is used only when switching the doublewrite mode dynamically.

◆ get_encrypted_frame()

file::Block * dblwr::get_encrypted_frame ( buf_page_t bpage)
noexcept

Obtain the encrypted frame and store it in bpage->m_io_frame.

Parameters
[in,out]bpagethe buffer page containing the unencrypted frame.
Returns
the memory block containing the compressed + encrypted frame.

◆ has_encrypted_pages()

bool dblwr::has_encrypted_pages ( )
noexcept

Check if the dblwr files contain encrypted pages.

Returns
true if dblwr file contains any encrypted pages, false if dblwr file contains no encrypted pages.

◆ is_disabled()

bool dblwr::is_disabled ( )
inline

Check if the doublewrite mode is disabled.

Returns
true if dblwr mode is OFF.

◆ is_enabled()

bool dblwr::is_enabled ( )
inline

Check if doublewrite is enabled.

Returns
true if dblwr mode is ON, DETECT_ONLY, DETECT_AND_RECOVER
false if dblwr mode is OFF.

◆ is_encrypted_page()

static bool dblwr::is_encrypted_page ( const byte page)
staticnoexcept

◆ is_odd()

bool dblwr::is_odd ( uint32_t  val)
inline

◆ is_reduced()

bool dblwr::is_reduced ( )
inline

Check if the doublewrite mode is detect-only (aka reduced).

Returns
true if dblwr mode is DETECT_ONLY.

◆ open()

dberr_t dblwr::open ( )
noexcept

Startup the background thread(s) and create the instance.

Returns
DB_SUCCESS or error code

◆ operator<<()

std::ostream & dblwr::operator<< ( std::ostream &  out,
const File obj 
)
inlinenoexcept

Overload the global output operator to work with dblwr::File type.

Parameters
[in]outoutput stream into which the object is printed.
[in]objAn object to type dblwr::File.
Returns
the output stream.

◆ reduced_open()

dberr_t dblwr::reduced_open ( )
noexcept

Check and open the reduced doublewrite files if necessary.

Returns
DB_SUCCESS or error code

◆ reset_files()

void dblwr::reset_files ( )
noexcept

Delete or adjust the dblwr file size if required.

◆ set()

void dblwr::set ( )

Toggle the doublewrite buffer.

◆ to_string()

const char * dblwr::to_string ( ulong  mode)
Returns
string version of dblwr numeric values
Parameters
[in]modedblwr ENUM

◆ write()

dberr_t dblwr::write ( buf_flush_t  flush_type,
buf_page_t bpage,
bool  sync 
)
noexcept

Writes a page to the doublewrite buffer on disk, syncs it, then writes the page to the datafile.

Parameters
[in]flush_typeFlush type
[in]bpageBuffer block to write
[in]syncTrue if sync IO requested
Returns
DB_SUCCESS or error code

◆ write_complete()

void dblwr::write_complete ( buf_page_t bpage,
buf_flush_t  flush_type 
)
noexcept

Updates the double write buffer when a write request is completed.

Parameters
[in]bpageBlock that has just been writtent to disk.
[in]flush_typeFlush type that triggered the write.

Variable Documentation

◆ batch_size

ulong dblwr::batch_size {}

Maximum number of pages to write in one batch.

◆ dir

std::string dblwr::dir {"."}

Double write files location.

◆ Force_crash

Crash the server after writing this page to the data file.

◆ g_mode

ulong dblwr::g_mode {Mode::ON}

DBLWR mode.

◆ is_reduced_inited

bool dblwr::is_reduced_inited = false

true if DETECT_ONLY (aka reduced) mode is inited

◆ LEGACY_PAGE1

page_no_t dblwr::LEGACY_PAGE1
static

Legacy dblwr buffer first segment page number.

◆ LEGACY_PAGE2

page_no_t dblwr::LEGACY_PAGE2
static

Legacy dblwr buffer second segment page number.

◆ n_files

ulong dblwr::n_files {1}

Number of files to use for the double write buffer.

It must be <= than the number of buffer pool instances.

◆ n_pages

ulong dblwr::n_pages {64}

Number of pages per doublewrite thread/segment.

◆ RB_BATCH_ID_SIZE

const uint32_t dblwr::RB_BATCH_ID_SIZE = 4

◆ RB_BATCH_TYPE_SIZE

const uint32_t dblwr::RB_BATCH_TYPE_SIZE = 1

◆ RB_CHECKSUM_SIZE

const uint32_t dblwr::RB_CHECKSUM_SIZE = 4

◆ RB_DATA_LEN_SIZE

const uint32_t dblwr::RB_DATA_LEN_SIZE = 2

◆ RB_OFF_BATCH_ID

constexpr const uint32_t dblwr::RB_OFF_BATCH_ID = 0
constexpr

◆ RB_OFF_BATCH_TYPE

constexpr const uint32_t dblwr::RB_OFF_BATCH_TYPE = RB_OFF_DATA_LEN + RB_DATA_LEN_SIZE
constexpr

◆ RB_OFF_CHECKSUM

constexpr const uint32_t dblwr::RB_OFF_CHECKSUM = RB_OFF_BATCH_ID + RB_BATCH_ID_SIZE
constexpr

◆ RB_OFF_DATA_LEN

constexpr const uint32_t dblwr::RB_OFF_DATA_LEN = RB_OFF_CHECKSUM + RB_CHECKSUM_SIZE
constexpr

◆ RB_OFF_UNUSED

constexpr const uint32_t dblwr::RB_OFF_UNUSED = RB_OFF_BATCH_TYPE + RB_BATCH_TYPE_SIZE
constexpr

◆ RB_UNUSED_BYTES_SIZE

const uint32_t dblwr::RB_UNUSED_BYTES_SIZE = 9

◆ REDUCED_BATCH_PAGE_SIZE

const uint32_t dblwr::REDUCED_BATCH_PAGE_SIZE = 8192

◆ REDUCED_DATA_SIZE

constexpr const uint32_t dblwr::REDUCED_DATA_SIZE
constexpr
Initial value:
=
const uint32_t REDUCED_BATCH_PAGE_SIZE
Definition: buf0dblwr.h:231
constexpr const uint32_t REDUCED_HEADER_SIZE
Definition: buf0dblwr.h:250

◆ REDUCED_ENTRY_SIZE

constexpr const uint32_t dblwr::REDUCED_ENTRY_SIZE
constexpr
Initial value:
=
sizeof(space_id_t) + sizeof(page_no_t) + sizeof(lsn_t)
uint32_t space_id_t
Tablespace identifier.
Definition: api0api.h:52
uint32_t page_no_t
Page number.
Definition: api0api.h:50
uint64_t lsn_t
Type used for all log sequence number storage and arithmetic.
Definition: log0types.h:63

◆ REDUCED_HEADER_SIZE

constexpr const uint32_t dblwr::REDUCED_HEADER_SIZE
constexpr
Initial value:
=
+ 9
const uint32_t RB_BATCH_TYPE_SIZE
Definition: buf0dblwr.h:240
const uint32_t RB_BATCH_ID_SIZE
Definition: buf0dblwr.h:237
const uint32_t RB_DATA_LEN_SIZE
Definition: buf0dblwr.h:239
const uint32_t RB_CHECKSUM_SIZE
Definition: buf0dblwr.h:238

◆ REDUCED_MAX_ENTRIES

constexpr const uint32_t dblwr::REDUCED_MAX_ENTRIES
constexpr
Initial value:
=
constexpr const uint32_t REDUCED_DATA_SIZE
Definition: buf0dblwr.h:260
constexpr const uint32_t REDUCED_ENTRY_SIZE
Definition: buf0dblwr.h:257