MySQL 5.6.14 Source Code Document
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
buf0dblwr.h File Reference
#include "univ.i"
#include "ut0byte.h"
#include "log0log.h"
Include dependency graph for buf0dblwr.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  buf_dblwr_t

Functions

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 ibool buf_dblwr_page_inside (ulint page_no)
UNIV_INTERN void buf_dblwr_add_to_batch (buf_page_t *bpage)
UNIV_INTERN void buf_dblwr_flush_buffered_writes (void)
UNIV_INTERN void buf_dblwr_write_single_page (buf_page_t *bpage, bool sync)

Variables

buf_dblwr_tbuf_dblwr
ibool buf_dblwr_being_created

Detailed Description

Doublewrite buffer module

Created 2011/12/19 Inaam Rana

Definition in file buf0dblwr.h.

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. in: buffer block to write

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.

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_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. in: TRUE=restore 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 in: page number

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_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. in: 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. in: true if sync IO requested

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

buf_dblwr_t* buf_dblwr

Doublewrite system

The doublewrite buffer

Definition at line 47 of file buf0dblwr.cc.

ibool buf_dblwr_being_created

Set to TRUE when the doublewrite buffer is being created

Definition at line 50 of file buf0dblwr.cc.