2001-02-17 13:19:19 +01:00
|
|
|
/******************************************************
|
|
|
|
The database buffer pool flush algorithm
|
|
|
|
|
|
|
|
(c) 1995 Innobase Oy
|
|
|
|
|
|
|
|
Created 11/5/1995 Heikki Tuuri
|
|
|
|
*******************************************************/
|
|
|
|
|
|
|
|
#ifndef buf0flu_h
|
|
|
|
#define buf0flu_h
|
|
|
|
|
|
|
|
#include "univ.i"
|
|
|
|
#include "buf0types.h"
|
|
|
|
#include "ut0byte.h"
|
|
|
|
#include "mtr0types.h"
|
|
|
|
|
|
|
|
/************************************************************************
|
|
|
|
Updates the flush system data structures when a write is completed. */
|
|
|
|
|
|
|
|
void
|
|
|
|
buf_flush_write_complete(
|
|
|
|
/*=====================*/
|
|
|
|
buf_block_t* block); /* in: pointer to the block in question */
|
|
|
|
/*************************************************************************
|
|
|
|
Flushes pages from the end of the LRU list if there is too small
|
|
|
|
a margin of replaceable pages there. */
|
|
|
|
|
|
|
|
void
|
|
|
|
buf_flush_free_margin(void);
|
|
|
|
/*=======================*/
|
2002-03-21 17:03:09 +01:00
|
|
|
/************************************************************************
|
|
|
|
Initializes a page for writing to the tablespace. */
|
|
|
|
|
|
|
|
void
|
|
|
|
buf_flush_init_for_writing(
|
|
|
|
/*=======================*/
|
|
|
|
byte* page, /* in: page */
|
|
|
|
dulint newest_lsn, /* in: newest modification lsn to the page */
|
|
|
|
ulint space, /* in: space id */
|
|
|
|
ulint page_no); /* in: page number */
|
2001-02-17 13:19:19 +01:00
|
|
|
/***********************************************************************
|
|
|
|
This utility flushes dirty blocks from the end of the LRU list or flush_list.
|
|
|
|
NOTE 1: in the case of an LRU flush the calling thread may own latches to
|
|
|
|
pages: to avoid deadlocks, this function must be written so that it cannot
|
|
|
|
end up waiting for these latches! NOTE 2: in the case of a flush list flush,
|
|
|
|
the calling thread is not allowed to own any latches on pages! */
|
|
|
|
|
|
|
|
ulint
|
|
|
|
buf_flush_batch(
|
|
|
|
/*============*/
|
|
|
|
/* out: number of blocks for which the write
|
|
|
|
request was queued */
|
|
|
|
ulint flush_type, /* in: BUF_FLUSH_LRU or BUF_FLUSH_LIST; if
|
|
|
|
BUF_FLUSH_LIST, then the caller must not own
|
|
|
|
any latches on pages */
|
|
|
|
ulint min_n, /* in: wished minimum mumber of blocks flushed
|
|
|
|
(it is not guaranteed that the actual number
|
|
|
|
is that big, though) */
|
|
|
|
dulint lsn_limit); /* in the case BUF_FLUSH_LIST all blocks whose
|
|
|
|
oldest_modification is smaller than this
|
|
|
|
should be flushed (if their number does not
|
|
|
|
exceed min_n), otherwise ignored */
|
|
|
|
/**********************************************************************
|
|
|
|
Waits until a flush batch of the given type ends */
|
|
|
|
|
|
|
|
void
|
|
|
|
buf_flush_wait_batch_end(
|
|
|
|
/*=====================*/
|
|
|
|
ulint type); /* in: BUF_FLUSH_LRU or BUF_FLUSH_LIST */
|
|
|
|
/************************************************************************
|
|
|
|
This function should be called at a mini-transaction commit, if a page was
|
|
|
|
modified in it. Puts the block to the list of modified blocks, if it not
|
|
|
|
already in it. */
|
|
|
|
UNIV_INLINE
|
|
|
|
void
|
|
|
|
buf_flush_note_modification(
|
|
|
|
/*========================*/
|
|
|
|
buf_block_t* block, /* in: block which is modified */
|
|
|
|
mtr_t* mtr); /* in: mtr */
|
|
|
|
/************************************************************************
|
|
|
|
This function should be called when recovery has modified a buffer page. */
|
|
|
|
UNIV_INLINE
|
|
|
|
void
|
|
|
|
buf_flush_recv_note_modification(
|
|
|
|
/*=============================*/
|
|
|
|
buf_block_t* block, /* in: block which is modified */
|
|
|
|
dulint start_lsn, /* in: start lsn of the first mtr in a
|
|
|
|
set of mtr's */
|
|
|
|
dulint end_lsn); /* in: end lsn of the last mtr in the
|
|
|
|
set of mtr's */
|
|
|
|
/************************************************************************
|
|
|
|
Returns TRUE if the file page block is immediately suitable for replacement,
|
|
|
|
i.e., transition FILE_PAGE => NOT_USED allowed. */
|
|
|
|
ibool
|
|
|
|
buf_flush_ready_for_replace(
|
|
|
|
/*========================*/
|
|
|
|
/* out: TRUE if can replace immediately */
|
|
|
|
buf_block_t* block); /* in: buffer control block, must be in state
|
|
|
|
BUF_BLOCK_FILE_PAGE and in the LRU list */
|
|
|
|
/**********************************************************************
|
|
|
|
Validates the flush list. */
|
|
|
|
|
|
|
|
ibool
|
|
|
|
buf_flush_validate(void);
|
|
|
|
/*====================*/
|
|
|
|
/* out: TRUE if ok */
|
|
|
|
|
|
|
|
/* When buf_flush_free_margin is called, it tries to make this many blocks
|
|
|
|
available to replacement in the free list and at the end of the LRU list (to
|
|
|
|
make sure that a read-ahead batch can be read efficiently in a single
|
|
|
|
sweep). */
|
|
|
|
|
|
|
|
#define BUF_FLUSH_FREE_BLOCK_MARGIN (5 + BUF_READ_AHEAD_AREA)
|
srv0srv.h Support raw disk partitions as data files
srv0start.c Support raw disk partitions as data files
srv0srv.c Support raw disk partitions as data files
row0purge.c < 4 GB rows, doublewrite, hang fixes
row0row.c < 4 GB rows, doublewrite, hang fixes
row0sel.c < 4 GB rows, doublewrite, hang fixes
row0uins.c < 4 GB rows, doublewrite, hang fixes
row0umod.c < 4 GB rows, doublewrite, hang fixes
row0undo.c < 4 GB rows, doublewrite, hang fixes
row0upd.c < 4 GB rows, doublewrite, hang fixes
srv0srv.c < 4 GB rows, doublewrite, hang fixes
srv0start.c < 4 GB rows, doublewrite, hang fixes
sync0rw.c < 4 GB rows, doublewrite, hang fixes
sync0sync.c < 4 GB rows, doublewrite, hang fixes
trx0purge.c < 4 GB rows, doublewrite, hang fixes
trx0rec.c < 4 GB rows, doublewrite, hang fixes
trx0sys.c < 4 GB rows, doublewrite, hang fixes
btr0btr.c < 4 GB rows, doublewrite, hang fixes
btr0cur.c < 4 GB rows, doublewrite, hang fixes
buf0buf.c < 4 GB rows, doublewrite, hang fixes
buf0flu.c < 4 GB rows, doublewrite, hang fixes
buf0rea.c < 4 GB rows, doublewrite, hang fixes
data0data.c < 4 GB rows, doublewrite, hang fixes
fil0fil.c < 4 GB rows, doublewrite, hang fixes
fsp0fsp.c < 4 GB rows, doublewrite, hang fixes
ibuf0ibuf.c < 4 GB rows, doublewrite, hang fixes
lock0lock.c < 4 GB rows, doublewrite, hang fixes
log0log.c < 4 GB rows, doublewrite, hang fixes
log0recv.c < 4 GB rows, doublewrite, hang fixes
os0file.c < 4 GB rows, doublewrite, hang fixes
page0cur.c < 4 GB rows, doublewrite, hang fixes
pars0pars.c < 4 GB rows, doublewrite, hang fixes
rem0cmp.c < 4 GB rows, doublewrite, hang fixes
rem0rec.c < 4 GB rows, doublewrite, hang fixes
row0ins.c < 4 GB rows, doublewrite, hang fixes
row0mysql.c < 4 GB rows, doublewrite, hang fixes
univ.i < 4 GB rows, doublewrite, hang fixes
data0data.ic < 4 GB rows, doublewrite, hang fixes
mach0data.ic < 4 GB rows, doublewrite, hang fixes
rem0rec.ic < 4 GB rows, doublewrite, hang fixes
row0upd.ic < 4 GB rows, doublewrite, hang fixes
trx0rec.ic < 4 GB rows, doublewrite, hang fixes
rem0cmp.h < 4 GB rows, doublewrite, hang fixes
rem0rec.h < 4 GB rows, doublewrite, hang fixes
row0ins.h < 4 GB rows, doublewrite, hang fixes
row0mysql.h < 4 GB rows, doublewrite, hang fixes
row0row.h < 4 GB rows, doublewrite, hang fixes
row0upd.h < 4 GB rows, doublewrite, hang fixes
srv0srv.h < 4 GB rows, doublewrite, hang fixes
sync0sync.h < 4 GB rows, doublewrite, hang fixes
trx0rec.h < 4 GB rows, doublewrite, hang fixes
trx0sys.h < 4 GB rows, doublewrite, hang fixes
trx0types.h < 4 GB rows, doublewrite, hang fixes
trx0undo.h < 4 GB rows, doublewrite, hang fixes
ut0dbg.h < 4 GB rows, doublewrite, hang fixes
ut0ut.h < 4 GB rows, doublewrite, hang fixes
btr0btr.h < 4 GB rows, doublewrite, hang fixes
btr0cur.h < 4 GB rows, doublewrite, hang fixes
buf0buf.h < 4 GB rows, doublewrite, hang fixes
buf0flu.h < 4 GB rows, doublewrite, hang fixes
data0data.h < 4 GB rows, doublewrite, hang fixes
dict0mem.h < 4 GB rows, doublewrite, hang fixes
fil0fil.h < 4 GB rows, doublewrite, hang fixes
fsp0fsp.h < 4 GB rows, doublewrite, hang fixes
os0file.h < 4 GB rows, doublewrite, hang fixes
innobase/include/btr0btr.h:
< 4 GB rows, doublewrite, hang fixes
innobase/include/btr0cur.h:
< 4 GB rows, doublewrite, hang fixes
innobase/include/buf0buf.h:
< 4 GB rows, doublewrite, hang fixes
innobase/include/buf0flu.h:
< 4 GB rows, doublewrite, hang fixes
innobase/include/data0data.h:
< 4 GB rows, doublewrite, hang fixes
innobase/include/dict0mem.h:
< 4 GB rows, doublewrite, hang fixes
innobase/include/fil0fil.h:
< 4 GB rows, doublewrite, hang fixes
innobase/include/fsp0fsp.h:
< 4 GB rows, doublewrite, hang fixes
innobase/include/os0file.h:
< 4 GB rows, doublewrite, hang fixes
innobase/include/rem0cmp.h:
< 4 GB rows, doublewrite, hang fixes
innobase/include/rem0rec.h:
< 4 GB rows, doublewrite, hang fixes
innobase/include/row0ins.h:
< 4 GB rows, doublewrite, hang fixes
innobase/include/row0mysql.h:
< 4 GB rows, doublewrite, hang fixes
innobase/include/row0row.h:
< 4 GB rows, doublewrite, hang fixes
innobase/include/row0upd.h:
< 4 GB rows, doublewrite, hang fixes
innobase/include/sync0sync.h:
< 4 GB rows, doublewrite, hang fixes
innobase/include/trx0rec.h:
< 4 GB rows, doublewrite, hang fixes
innobase/include/trx0sys.h:
< 4 GB rows, doublewrite, hang fixes
innobase/include/trx0types.h:
< 4 GB rows, doublewrite, hang fixes
innobase/include/trx0undo.h:
< 4 GB rows, doublewrite, hang fixes
innobase/include/ut0dbg.h:
< 4 GB rows, doublewrite, hang fixes
innobase/include/ut0ut.h:
< 4 GB rows, doublewrite, hang fixes
innobase/include/data0data.ic:
< 4 GB rows, doublewrite, hang fixes
innobase/include/mach0data.ic:
< 4 GB rows, doublewrite, hang fixes
innobase/include/rem0rec.ic:
< 4 GB rows, doublewrite, hang fixes
innobase/include/row0upd.ic:
< 4 GB rows, doublewrite, hang fixes
innobase/include/trx0rec.ic:
< 4 GB rows, doublewrite, hang fixes
innobase/include/univ.i:
< 4 GB rows, doublewrite, hang fixes
innobase/btr/btr0btr.c:
< 4 GB rows, doublewrite, hang fixes
innobase/btr/btr0cur.c:
< 4 GB rows, doublewrite, hang fixes
innobase/buf/buf0buf.c:
< 4 GB rows, doublewrite, hang fixes
innobase/buf/buf0flu.c:
< 4 GB rows, doublewrite, hang fixes
innobase/buf/buf0rea.c:
< 4 GB rows, doublewrite, hang fixes
innobase/data/data0data.c:
< 4 GB rows, doublewrite, hang fixes
innobase/fil/fil0fil.c:
< 4 GB rows, doublewrite, hang fixes
innobase/fsp/fsp0fsp.c:
< 4 GB rows, doublewrite, hang fixes
innobase/ibuf/ibuf0ibuf.c:
< 4 GB rows, doublewrite, hang fixes
innobase/lock/lock0lock.c:
< 4 GB rows, doublewrite, hang fixes
innobase/log/log0log.c:
< 4 GB rows, doublewrite, hang fixes
innobase/log/log0recv.c:
< 4 GB rows, doublewrite, hang fixes
innobase/os/os0file.c:
< 4 GB rows, doublewrite, hang fixes
innobase/page/page0cur.c:
< 4 GB rows, doublewrite, hang fixes
innobase/pars/pars0pars.c:
< 4 GB rows, doublewrite, hang fixes
innobase/rem/rem0cmp.c:
< 4 GB rows, doublewrite, hang fixes
innobase/rem/rem0rec.c:
< 4 GB rows, doublewrite, hang fixes
innobase/row/row0ins.c:
< 4 GB rows, doublewrite, hang fixes
innobase/row/row0mysql.c:
< 4 GB rows, doublewrite, hang fixes
innobase/row/row0purge.c:
< 4 GB rows, doublewrite, hang fixes
innobase/row/row0row.c:
< 4 GB rows, doublewrite, hang fixes
innobase/row/row0sel.c:
< 4 GB rows, doublewrite, hang fixes
innobase/row/row0uins.c:
< 4 GB rows, doublewrite, hang fixes
innobase/row/row0umod.c:
< 4 GB rows, doublewrite, hang fixes
innobase/row/row0undo.c:
< 4 GB rows, doublewrite, hang fixes
innobase/row/row0upd.c:
< 4 GB rows, doublewrite, hang fixes
innobase/sync/sync0rw.c:
< 4 GB rows, doublewrite, hang fixes
innobase/sync/sync0sync.c:
< 4 GB rows, doublewrite, hang fixes
innobase/trx/trx0purge.c:
< 4 GB rows, doublewrite, hang fixes
innobase/trx/trx0rec.c:
< 4 GB rows, doublewrite, hang fixes
innobase/trx/trx0sys.c:
< 4 GB rows, doublewrite, hang fixes
innobase/srv/srv0srv.c:
Support raw disk partitions as data files
innobase/srv/srv0start.c:
Support raw disk partitions as data files
innobase/include/srv0srv.h:
Support raw disk partitions as data files
2001-08-04 18:36:14 +02:00
|
|
|
#define BUF_FLUSH_EXTRA_MARGIN (BUF_FLUSH_FREE_BLOCK_MARGIN / 4 + 100)
|
2001-02-17 13:19:19 +01:00
|
|
|
|
|
|
|
#ifndef UNIV_NONINL
|
|
|
|
#include "buf0flu.ic"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif
|