MySQL 8.0.31
Source Code Documentation
buf0dblwr.h File Reference

Doublewrite buffer module. More...

#include "buf0types.h"
#include "fil0fil.h"
#include "log0recv.h"
#include "ut0byte.h"

Go to the source code of this file.

Classes

struct  dblwr::Buffer
 IO buffer in UNIV_PAGE_SIZE units and aligned on UNIV_PAGE_SIZE. More...
 
struct  dblwr::Reduced_entry
 When –innodb-doublewrite=DETECT_ONLY, page contents are not written to the dblwr buffer. More...
 
struct  dblwr::Mode
 
class  dblwr::recv::DBLWR
 Redo recovery configuration. More...
 

Namespaces

namespace  dblwr
 
namespace  dblwr::v1
 
namespace  dblwr::recv
 

Macros

#define DBLWR_V1_EXTENT_SIZE   FSP_EXTENT_SIZE
 Size of the doublewrite block in pages. More...
 
#define TRX_SYS_DBLWR_V1   (UNIV_PAGE_SIZE - 200)
 Offset of the doublewrite buffer header on the trx system header page. More...
 

Functions

dberr_t dblwr::open () noexcept
 Startup the background thread(s) and create the instance. More...
 
dberr_t dblwr::enable_reduced () noexcept
 Enable the doublewrite reduced mode by creating the necessary dblwr files and in-memory structures. More...
 
dberr_t dblwr::reduced_open () noexcept
 Check and open the reduced doublewrite files if necessary. More...
 
void dblwr::close () noexcept
 Shutdown the background thread and destroy the instance. More...
 
void dblwr::force_flush (buf_flush_t flush_type, uint32_t buf_pool_index) noexcept
 Force a write of all pages in the queue. More...
 
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. More...
 
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. More...
 
file::Blockdblwr::get_encrypted_frame (buf_page_t *bpage) noexcept
 Obtain the encrypted frame and store it in bpage->m_io_frame. More...
 
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. More...
 
void dblwr::reset_files () noexcept
 Delete or adjust the dblwr file size if required. More...
 
dberr_t dblwr::v1::init () noexcept
 Read the boundaries of the legacy dblwr buffer extents. More...
 
dberr_t dblwr::v1::create () noexcept
 Create the dblwr data structures in the system tablespace. More...
 
bool dblwr::v1::is_inside (page_no_t page_no) noexcept
 Check if the read is of a page inside the legacy dblwr buffer. More...
 
bool dblwr::is_enabled ()
 Check if doublewrite is enabled. More...
 
bool dblwr::is_reduced ()
 Check if the doublewrite mode is detect-only (aka reduced). More...
 
bool dblwr::is_disabled ()
 Check if the doublewrite mode is disabled. More...
 
const char * dblwr::to_string (ulong mode)
 
void dblwr::set ()
 Toggle the doublewrite buffer. More...
 
void dblwr::recv::create (Pages *&pages) noexcept
 Create the recovery dblwr data structures. More...
 
dberr_t dblwr::recv::load (Pages *pages) noexcept
 Load the doublewrite buffer pages. More...
 
dberr_t dblwr::recv::reduced_load (Pages *pages) noexcept
 Load the doublewrite buffer pages. More...
 
dberr_t dblwr::recv::recover (Pages *pages, fil_space_t *space) noexcept
 Restore pages from the double write buffer to the tablespace. More...
 
const bytedblwr::recv::find (const Pages *pages, const page_id_t &page_id) noexcept
 Find a doublewrite copy of a page. More...
 
std::tuple< bool, lsn_tdblwr::recv::find_entry (const Pages *pages, const page_id_t &page_id) noexcept
 Find the LSN of the given page id in the dblwr. More...
 
void dblwr::recv::check_missing_tablespaces (const Pages *pages) noexcept
 Check if some pages from the double write buffer could not be restored because of the missing tablespace IDs. More...
 
void dblwr::recv::destroy (Pages *&pages) noexcept
 Free the recovery dblwr data structures. More...
 
bool dblwr::has_encrypted_pages () noexcept
 Check if the dblwr files contain encrypted pages. More...
 

Variables

constexpr ulint DBLWR_VER = FSEG_HEADER_SIZE
 4-byte ver number which shows if we have created the doublewrite buffer. More...
 
constexpr ulint DBLWR_V1_BLOCK1 = (4 + FSEG_HEADER_SIZE)
 Page number of the first page in the first sequence of 64 (= FSP_EXTENT_SIZE) consecutive pages in the doublewrite buffer. More...
 
constexpr ulint DBLWR_V1_BLOCK2 = (8 + FSEG_HEADER_SIZE)
 Page number of the first page in the second sequence of 64 consecutive pages in the doublewrite buffer. More...
 
const uint32_t dblwr::REDUCED_BATCH_PAGE_SIZE = 8192
 
const uint32_t dblwr::RB_BATCH_ID_SIZE = 4
 
const uint32_t dblwr::RB_CHECKSUM_SIZE = 4
 
const uint32_t dblwr::RB_DATA_LEN_SIZE = 2
 
const uint32_t dblwr::RB_BATCH_TYPE_SIZE = 1
 
const uint32_t dblwr::RB_UNUSED_BYTES_SIZE = 9
 
constexpr const uint32_t dblwr::RB_OFF_BATCH_ID = 0
 
constexpr const uint32_t dblwr::RB_OFF_CHECKSUM = RB_OFF_BATCH_ID + RB_BATCH_ID_SIZE
 
constexpr const uint32_t dblwr::RB_OFF_DATA_LEN = RB_OFF_CHECKSUM + RB_CHECKSUM_SIZE
 
constexpr const uint32_t dblwr::RB_OFF_BATCH_TYPE = RB_OFF_DATA_LEN + RB_DATA_LEN_SIZE
 
constexpr const uint32_t dblwr::RB_OFF_UNUSED = RB_OFF_BATCH_TYPE + RB_BATCH_TYPE_SIZE
 
constexpr const uint32_t dblwr::REDUCED_HEADER_SIZE
 
constexpr const uint32_t dblwr::REDUCED_ENTRY_SIZE
 
constexpr const uint32_t dblwr::REDUCED_DATA_SIZE
 
constexpr const uint32_t dblwr::REDUCED_MAX_ENTRIES
 

Detailed Description

Doublewrite buffer module.

Created 2011/12/19 Inaam Rana

Macro Definition Documentation

◆ DBLWR_V1_EXTENT_SIZE

#define DBLWR_V1_EXTENT_SIZE   FSP_EXTENT_SIZE

Size of the doublewrite block in pages.

◆ TRX_SYS_DBLWR_V1

#define TRX_SYS_DBLWR_V1   (UNIV_PAGE_SIZE - 200)

Offset of the doublewrite buffer header on the trx system header page.


Variable Documentation

◆ DBLWR_V1_BLOCK1

constexpr ulint DBLWR_V1_BLOCK1 = (4 + FSEG_HEADER_SIZE)
constexpr

Page number of the first page in the first sequence of 64 (= FSP_EXTENT_SIZE) consecutive pages in the doublewrite buffer.

◆ DBLWR_V1_BLOCK2

constexpr ulint DBLWR_V1_BLOCK2 = (8 + FSEG_HEADER_SIZE)
constexpr

Page number of the first page in the second sequence of 64 consecutive pages in the doublewrite buffer.

◆ DBLWR_VER

constexpr ulint DBLWR_VER = FSEG_HEADER_SIZE
constexpr

4-byte ver number which shows if we have created the doublewrite buffer.