Drizzled Public API Documentation

buf0flu.h
Go to the documentation of this file.
1 /*****************************************************************************
2 
3 Copyright (C) 1995, 2010, Innobase Oy. All Rights Reserved.
4 
5 This program is free software; you can redistribute it and/or modify it under
6 the terms of the GNU General Public License as published by the Free Software
7 Foundation; version 2 of the License.
8 
9 This program is distributed in the hope that it will be useful, but WITHOUT
10 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11 FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
12 
13 You should have received a copy of the GNU General Public License along with
14 this program; if not, write to the Free Software Foundation, Inc., 51 Franklin
15 St, Fifth Floor, Boston, MA 02110-1301 USA
16 
17 *****************************************************************************/
18 
19 /**************************************************/
26 #pragma once
27 #ifndef buf0flu_h
28 #define buf0flu_h
29 
30 #include "univ.i"
31 #include "ut0byte.h"
32 #ifndef UNIV_HOTBACKUP
33 #include "mtr0types.h"
34 #include "buf0types.h"
35 #include "log0log.h"
36 
37 /********************************************************************/
39 UNIV_INTERN
40 void
41 buf_flush_remove(
42 /*=============*/
43  buf_page_t* bpage);
44 /*******************************************************************/
48 UNIV_INTERN
49 void
50 buf_flush_relocate_on_flush_list(
51 /*=============================*/
52  buf_page_t* bpage,
53  buf_page_t* dpage);
54 /********************************************************************/
56 UNIV_INTERN
57 void
58 buf_flush_write_complete(
59 /*=====================*/
60  buf_page_t* bpage);
61 /*********************************************************************/
65 UNIV_INTERN
66 void
67 buf_flush_free_margin(
68 /*==================*/
69  buf_pool_t* buf_pool);
70 /*********************************************************************/
72 UNIV_INTERN
73 void
74 buf_flush_free_margins(void);
75 /*=========================*/
76 #endif /* !UNIV_HOTBACKUP */
77 /********************************************************************/
79 UNIV_INTERN
80 void
81 buf_flush_init_for_writing(
82 /*=======================*/
83  byte* page,
84  void* page_zip_,
85  ib_uint64_t newest_lsn);
87 #ifndef UNIV_HOTBACKUP
88 # if defined UNIV_DEBUG || defined UNIV_IBUF_DEBUG
89 /********************************************************************/
95 UNIV_INTERN
96 ibool
97 buf_flush_page_try(
98 /*===============*/
99  buf_pool_t* buf_pool,
100  buf_block_t* block)
101  __attribute__((nonnull, warn_unused_result));
102 # endif /* UNIV_DEBUG || UNIV_IBUF_DEBUG */
103 /*******************************************************************/
110 UNIV_INTERN
111 ulint
112 buf_flush_LRU(
113 /*==========*/
114  buf_pool_t* buf_pool,
115  ulint min_n);
118 /*******************************************************************/
124 UNIV_INTERN
125 ulint
126 buf_flush_list(
127 /*============*/
128  ulint min_n,
131  ib_uint64_t lsn_limit);
136 /******************************************************************/
138 UNIV_INTERN
139 void
140 buf_flush_wait_batch_end(
141 /*=====================*/
142  buf_pool_t* buf_pool,
143  enum buf_flush type);
145 /******************************************************************/
149 UNIV_INTERN
150 void
152 /*===============================*/
153  buf_pool_t* buf_pool,
154  enum buf_flush type);
156 /********************************************************************/
160 UNIV_INLINE
161 void
163 /*========================*/
164  buf_block_t* block,
165  mtr_t* mtr);
166 /********************************************************************/
168 UNIV_INLINE
169 void
171 /*=============================*/
172  buf_block_t* block,
173  ib_uint64_t start_lsn,
175  ib_uint64_t end_lsn);
177 /********************************************************************/
181 UNIV_INTERN
182 ibool
183 buf_flush_ready_for_replace(
184 /*========================*/
185  buf_page_t* bpage);
198 {
199  ib_uint64_t redo;
200  ulint n_flushed;
201 };
202 
205 /*********************************************************************
206 Update the historical stats that we are collecting for flush rate
207 heuristics at the end of each interval. */
208 UNIV_INTERN
209 void
210 buf_flush_stat_update(void);
211 /*=======================*/
212 /*********************************************************************
213 Determines the fraction of dirty pages that need to be flushed based
214 on the speed at which we generate redo log. Note that if redo log
215 is generated at significant rate without a corresponding increase
216 in the number of dirty pages (for example, an in-memory workload)
217 it can cause IO bursts of flushing. This function implements heuristics
218 to avoid this burstiness.
219 @return number of dirty pages to be flushed / second */
220 UNIV_INTERN
221 ulint
222 buf_flush_get_desired_flush_rate(void);
223 /*==================================*/
224 
225 #if defined UNIV_DEBUG || defined UNIV_BUF_DEBUG
226 /******************************************************************/
229 UNIV_INTERN
230 ibool
231 buf_flush_validate(
232 /*===============*/
233  buf_pool_t* buf_pool);
234 #endif /* UNIV_DEBUG || UNIV_BUF_DEBUG */
235 
236 /********************************************************************/
240 UNIV_INTERN
241 void
242 buf_flush_init_flush_rbt(void);
243 /*==========================*/
244 
245 /********************************************************************/
247 UNIV_INTERN
248 void
249 buf_flush_free_flush_rbt(void);
250 /*==========================*/
251 
256 #define BUF_FLUSH_FREE_BLOCK_MARGIN(b) (5 + BUF_READ_AHEAD_AREA(b))
257 
258 #define BUF_FLUSH_EXTRA_MARGIN(b) ((BUF_FLUSH_FREE_BLOCK_MARGIN(b) / 4 \
259  + 100) / srv_buf_pool_instances)
260 #endif /* !UNIV_HOTBACKUP */
261 
262 #ifndef UNIV_NONINL
263 #include "buf0flu.ic"
264 #endif
265 
266 #endif