MySQL 5.6.14 Source Code Document
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
buf0dblwr.cc File Reference
#include "buf0dblwr.h"
#include "buf0buf.h"
#include "buf0checksum.h"
#include "srv0start.h"
#include "srv0srv.h"
#include "page0zip.h"
#include "trx0sys.h"
Include dependency graph for buf0dblwr.cc:

Go to the source code of this file.

Functions

UNIV_INTERN ibool buf_dblwr_page_inside (ulint page_no)
UNIV_INLINE byte * buf_dblwr_get (mtr_t *mtr)
UNIV_INLINE void buf_dblwr_sync_datafiles ()
UNIV_INTERN void buf_dblwr_create (void)
UNIV_INTERN void buf_dblwr_init_or_restore_pages (ibool restore_corrupt_pages)
UNIV_INTERN void buf_dblwr_free (void)
UNIV_INTERN void buf_dblwr_update (const buf_page_t *bpage, buf_flush_t flush_type)
UNIV_INTERN void buf_dblwr_flush_buffered_writes (void)
UNIV_INTERN void buf_dblwr_add_to_batch (buf_page_t *bpage)
UNIV_INTERN void buf_dblwr_write_single_page (buf_page_t *bpage, bool sync)

Variables

UNIV_INTERN buf_dblwr_tbuf_dblwr = NULL
UNIV_INTERN ibool buf_dblwr_being_created = FALSE

Detailed Description

Doublwrite buffer module

Created 2011/12/19

Definition in file buf0dblwr.cc.

Function Documentation

UNIV_INTERN void buf_dblwr_add_to_batch ( buf_page_t bpage)

Posts a buffer page for writing. If the doublewrite memory buffer is full, calls buf_dblwr_flush_buffered_writes and waits for for free space to appear.

Parameters
bpagein: buffer block to write

Definition at line 932 of file buf0dblwr.cc.

Here is the call graph for this function:

UNIV_INTERN void buf_dblwr_create ( void  )

Creates the doublewrite buffer to a new InnoDB installation. The header of the doublewrite buffer is placed on the trx system header page.

Definition at line 178 of file buf0dblwr.cc.

Here is the call graph for this function:

UNIV_INTERN void buf_dblwr_flush_buffered_writes ( void  )

Flushes possible buffered writes from the doublewrite memory buffer to disk, and also wakes up the aio thread if simulated aio is used. It is very important to call this function after a batch of writes has been posted, and also when we may have to wait for a page latch! Otherwise a deadlock of threads can occur.

Definition at line 789 of file buf0dblwr.cc.

Here is the call graph for this function:

Here is the caller graph for this function:

UNIV_INTERN void buf_dblwr_free ( void  )

Frees doublewrite buffer.

Definition at line 568 of file buf0dblwr.cc.

Here is the call graph for this function:

Here is the caller graph for this function:

UNIV_INLINE byte* buf_dblwr_get ( mtr_t mtr)

Calls buf_page_get() on the TRX_SYS_PAGE and returns a pointer to the doublewrite buffer within it.

Returns
pointer to the doublewrite buffer within the filespace header page.
Parameters
mtrin/out: MTR to hold the page latch

Definition at line 89 of file buf0dblwr.cc.

Here is the caller graph for this function:

UNIV_INTERN void buf_dblwr_init_or_restore_pages ( ibool  restore_corrupt_pages)

At a database startup initializes the doublewrite buffer memory structure if we already have a doublewrite buffer created in the data files. If we are upgrading to an InnoDB version which supports multiple tablespaces, then this function performs the necessary update operations. If we are in a crash recovery, this function uses a possible doublewrite buffer to restore half-written pages in the data files.

Parameters
restore_corrupt_pagesin: TRUE=restore pages

Definition at line 358 of file buf0dblwr.cc.

Here is the call graph for this function:

Here is the caller graph for this function:

UNIV_INTERN ibool buf_dblwr_page_inside ( ulint  page_no)

Determines if a page number is located inside the doublewrite buffer.

Returns
TRUE if the location is inside the two blocks of the doublewrite buffer
Parameters
page_noin: page number

Definition at line 58 of file buf0dblwr.cc.

UNIV_INLINE void buf_dblwr_sync_datafiles ( )

Flush a batch of writes to the datafiles that have already been written to the dblwr buffer on disk.

Definition at line 107 of file buf0dblwr.cc.

Here is the call graph for this function:

Here is the caller graph for this function:

UNIV_INTERN void buf_dblwr_update ( const buf_page_t bpage,
buf_flush_t  flush_type 
)

Updates the doublewrite buffer when an IO request is completed.

Parameters
bpagein: buffer block descriptor
flush_typein: flush type

Definition at line 596 of file buf0dblwr.cc.

Here is the call graph for this function:

Here is the caller graph for this function:

UNIV_INTERN void buf_dblwr_write_single_page ( buf_page_t bpage,
bool  sync 
)

Writes a page to the doublewrite buffer on disk, sync it, then write the page to the datafile and sync the datafile. This function is used for single page flushes. If all the buffers allocated for single page flushes in the doublewrite buffer are in use we wait here for one to become free. We are guaranteed that a slot will become free because any thread that is using a slot must also release the slot before leaving this function.

Parameters
bpagein: buffer block to write
syncin: true if sync IO requested

Definition at line 1019 of file buf0dblwr.cc.

Here is the call graph for this function:

Variable Documentation

UNIV_INTERN buf_dblwr_t* buf_dblwr = NULL

The doublewrite buffer

Definition at line 47 of file buf0dblwr.cc.

UNIV_INTERN ibool buf_dblwr_being_created = FALSE

Set to TRUE when the doublewrite buffer is being created

Definition at line 50 of file buf0dblwr.cc.