1
1
/*****************************************************************************
3
Copyright (C) 1995, 2010, Innobase Oy. All Rights Reserved.
3
Copyright (c) 1995, 2010, 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
59
58
buf_page_t* bpage); /*!< in: pointer to the block in question */
60
59
/*********************************************************************//**
61
60
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
/*=========================*/
61
a margin of replaceable pages there. */
64
buf_flush_free_margin(void);
65
/*=======================*/
75
66
#endif /* !UNIV_HOTBACKUP */
76
67
/********************************************************************//**
77
68
Initializes a page for writing to the tablespace. */
84
75
ib_uint64_t newest_lsn); /*!< in: newest modification lsn
86
77
#ifndef UNIV_HOTBACKUP
87
# if defined UNIV_DEBUG || defined UNIV_IBUF_DEBUG
88
/********************************************************************//**
89
Writes a flushable page asynchronously from the buffer pool to a file.
90
NOTE: buf_pool->mutex and block->mutex must be held upon entering this
91
function, and they will be released by this function after flushing.
92
This is loosely based on buf_flush_batch() and buf_flush_page().
93
@return TRUE if the page was flushed and the mutexes released */
98
buf_pool_t* buf_pool, /*!< in/out: buffer pool instance */
99
buf_block_t* block) /*!< in/out: buffer control block */
100
__attribute__((nonnull, warn_unused_result));
101
# endif /* UNIV_DEBUG || UNIV_IBUF_DEBUG */
102
/*******************************************************************//**
103
This utility flushes dirty blocks from the end of the LRU list.
104
NOTE: The calling thread may own latches to pages: to avoid deadlocks,
105
this function must be written so that it cannot end up waiting for these
107
@return number of blocks for which the write request was queued;
108
ULINT_UNDEFINED if there was a flush of the same type already running */
113
buf_pool_t* buf_pool, /*!< in: buffer pool instance */
114
ulint min_n); /*!< in: wished minimum mumber of blocks
115
flushed (it is not guaranteed that the
116
actual number is that big, though) */
117
/*******************************************************************//**
118
This utility flushes dirty blocks from the end of the flush_list of
119
all buffer pool instances.
120
NOTE: The calling thread is not allowed to own any latches on pages!
121
@return number of blocks for which the write request was queued;
122
ULINT_UNDEFINED if there was a flush of the same type already running */
78
/*******************************************************************//**
79
This utility flushes dirty blocks from the end of the LRU list or flush_list.
80
NOTE 1: in the case of an LRU flush the calling thread may own latches to
81
pages: to avoid deadlocks, this function must be written so that it cannot
82
end up waiting for these latches! NOTE 2: in the case of a flush list flush,
83
the calling thread is not allowed to own any latches on pages!
84
@return number of blocks for which the write request was queued;
85
ULINT_UNDEFINED if there was a flush of the same type already running */
90
enum buf_flush flush_type, /*!< in: BUF_FLUSH_LRU or
91
BUF_FLUSH_LIST; if BUF_FLUSH_LIST,
92
then the caller must not own any
127
94
ulint min_n, /*!< in: wished minimum mumber of blocks
128
95
flushed (it is not guaranteed that the
129
96
actual number is that big, though) */
139
106
buf_flush_wait_batch_end(
140
107
/*=====================*/
141
buf_pool_t* buf_pool, /*!< buffer pool instance */
142
enum buf_flush type); /*!< in: BUF_FLUSH_LRU
108
enum buf_flush type); /*!< in: BUF_FLUSH_LRU or BUF_FLUSH_LIST */
144
109
/********************************************************************//**
145
110
This function should be called at a mini-transaction commit, if a page was
146
111
modified in it. Puts the block to the list of modified blocks, if it not
216
181
@return TRUE if ok */
221
buf_pool_t* buf_pool);
184
buf_flush_validate(void);
185
/*====================*/
222
186
#endif /* UNIV_DEBUG || UNIV_BUF_DEBUG */
224
/********************************************************************//**
188
/******************************************************************//**
225
189
Initialize the red-black tree to speed up insertions into the flush_list
226
190
during recovery process. Should be called at the start of recovery
227
191
process before any page has been read/written. */
241
205
available to replacement in the free list and at the end of the LRU list (to
242
206
make sure that a read-ahead batch can be read efficiently in a single
244
#define BUF_FLUSH_FREE_BLOCK_MARGIN(b) (5 + BUF_READ_AHEAD_AREA(b))
208
#define BUF_FLUSH_FREE_BLOCK_MARGIN (5 + BUF_READ_AHEAD_AREA)
245
209
/** Extra margin to apply above BUF_FLUSH_FREE_BLOCK_MARGIN */
246
#define BUF_FLUSH_EXTRA_MARGIN(b) ((BUF_FLUSH_FREE_BLOCK_MARGIN(b) / 4 \
247
+ 100) / srv_buf_pool_instances)
210
#define BUF_FLUSH_EXTRA_MARGIN (BUF_FLUSH_FREE_BLOCK_MARGIN / 4 + 100)
248
211
#endif /* !UNIV_HOTBACKUP */
250
213
#ifndef UNIV_NONINL