1
1
/*****************************************************************************
3
Copyright (c) 1995, 2010, Innobase Oy. All Rights Reserved.
3
Copyright (c) 1995, 2009, Innobase Oy. All Rights Reserved.
5
5
This program is free software; you can redistribute it and/or modify it under
6
6
the terms of the GNU General Public License as published by the Free Software
42
41
buf_page_t* bpage); /*!< in: pointer to the block in question */
43
/*******************************************************************//**
44
Relocates a buffer control block on the flush_list.
45
Note that it is assumed that the contents of bpage has already been
49
buf_flush_relocate_on_flush_list(
50
/*=============================*/
51
buf_page_t* bpage, /*!< in/out: control block being moved */
52
buf_page_t* dpage); /*!< in/out: destination block */
53
42
/********************************************************************//**
54
43
Updates the flush system data structures when a write is completed. */
59
48
buf_page_t* bpage); /*!< in: pointer to the block in question */
60
49
/*********************************************************************//**
61
50
Flushes pages from the end of the LRU list if there is too small
62
a margin of replaceable pages there. If buffer pool is NULL it
63
means flush free margin on all buffer pool instances. */
66
buf_flush_free_margin(
67
/*==================*/
68
buf_pool_t* buf_pool);
69
/*********************************************************************//**
70
Flushes pages from the end of all the LRU lists. */
73
buf_flush_free_margins(void);
74
/*=========================*/
51
a margin of replaceable pages there. */
54
buf_flush_free_margin(void);
55
/*=======================*/
75
56
#endif /* !UNIV_HOTBACKUP */
76
57
/********************************************************************//**
77
58
Initializes a page for writing to the tablespace. */
86
67
#ifndef UNIV_HOTBACKUP
87
68
/*******************************************************************//**
88
This utility flushes dirty blocks from the end of the LRU list.
89
NOTE: The calling thread may own latches to pages: to avoid deadlocks,
90
this function must be written so that it cannot end up waiting for these
92
@return number of blocks for which the write request was queued;
93
ULINT_UNDEFINED if there was a flush of the same type already running */
98
buf_pool_t* buf_pool, /*!< in: buffer pool instance */
99
ulint min_n); /*!< in: wished minimum mumber of blocks
100
flushed (it is not guaranteed that the
101
actual number is that big, though) */
102
/*******************************************************************//**
103
This utility flushes dirty blocks from the end of the flush_list of
104
all buffer pool instances.
105
NOTE: The calling thread is not allowed to own any latches on pages!
106
@return number of blocks for which the write request was queued;
107
ULINT_UNDEFINED if there was a flush of the same type already running */
69
This utility flushes dirty blocks from the end of the LRU list or flush_list.
70
NOTE 1: in the case of an LRU flush the calling thread may own latches to
71
pages: to avoid deadlocks, this function must be written so that it cannot
72
end up waiting for these latches! NOTE 2: in the case of a flush list flush,
73
the calling thread is not allowed to own any latches on pages!
74
@return number of blocks for which the write request was queued;
75
ULINT_UNDEFINED if there was a flush of the same type already running */
80
enum buf_flush flush_type, /*!< in: BUF_FLUSH_LRU or
81
BUF_FLUSH_LIST; if BUF_FLUSH_LIST,
82
then the caller must not own any
112
84
ulint min_n, /*!< in: wished minimum mumber of blocks
113
85
flushed (it is not guaranteed that the
114
86
actual number is that big, though) */
124
96
buf_flush_wait_batch_end(
125
97
/*=====================*/
126
buf_pool_t* buf_pool, /*!< buffer pool instance */
127
enum buf_flush type); /*!< in: BUF_FLUSH_LRU
98
enum buf_flush type); /*!< in: BUF_FLUSH_LRU or BUF_FLUSH_LIST */
129
99
/********************************************************************//**
130
100
This function should be called at a mini-transaction commit, if a page was
131
101
modified in it. Puts the block to the list of modified blocks, if it not
201
171
@return TRUE if ok */
206
buf_pool_t* buf_pool);
174
buf_flush_validate(void);
175
/*====================*/
207
176
#endif /* UNIV_DEBUG || UNIV_BUF_DEBUG */
209
/********************************************************************//**
210
Initialize the red-black tree to speed up insertions into the flush_list
211
during recovery process. Should be called at the start of recovery
212
process before any page has been read/written. */
215
buf_flush_init_flush_rbt(void);
216
/*==========================*/
218
/********************************************************************//**
219
Frees up the red-black tree. */
222
buf_flush_free_flush_rbt(void);
223
/*==========================*/
225
178
/** When buf_flush_free_margin is called, it tries to make this many blocks
226
179
available to replacement in the free list and at the end of the LRU list (to
227
180
make sure that a read-ahead batch can be read efficiently in a single
229
#define BUF_FLUSH_FREE_BLOCK_MARGIN(b) (5 + BUF_READ_AHEAD_AREA(b))
182
#define BUF_FLUSH_FREE_BLOCK_MARGIN (5 + BUF_READ_AHEAD_AREA)
230
183
/** Extra margin to apply above BUF_FLUSH_FREE_BLOCK_MARGIN */
231
#define BUF_FLUSH_EXTRA_MARGIN(b) ((BUF_FLUSH_FREE_BLOCK_MARGIN(b) / 4 \
232
+ 100) / srv_buf_pool_instances)
184
#define BUF_FLUSH_EXTRA_MARGIN (BUF_FLUSH_FREE_BLOCK_MARGIN / 4 + 100)
233
185
#endif /* !UNIV_HOTBACKUP */
235
187
#ifndef UNIV_NONINL