InnoDB Plugin  1.0
Data Structures | Functions | Variables
buf0dblwr.h File Reference
#include "univ.i"
#include "ut0byte.h"
#include "log0log.h"
#include "log0recv.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.

Data Structures

struct  buf_dblwr_t


UNIV_INTERN void buf_dblwr_create (void)
void buf_dblwr_init_or_load_pages (os_file_t file, char *path, bool load_corrupt_pages)
void buf_dblwr_process (void)
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)


ibool buf_dblwr_being_created

Detailed Description

Doublewrite buffer module

Created 2011/12/19 Inaam Rana

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

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.

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.

UNIV_INTERN void buf_dblwr_free ( void  )

frees doublewrite buffer.

void buf_dblwr_init_or_load_pages ( os_file_t  file,
char *  path,
bool  load_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 loads the pages from double write buffer into memory.

UNIV_INTERN ibool buf_dblwr_page_inside ( ulint  page_no)

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

TRUE if the location is inside the two blocks of the doublewrite buffer in: page number
void buf_dblwr_process ( void  )

Process the double write buffer pages.

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

bpagein: buffer block descriptor
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

bpagein: buffer block to write

Variable Documentation

buf_dblwr_t* buf_dblwr

Doublewrite system

ibool buf_dblwr_being_created

Set to TRUE when the doublewrite buffer is being created