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_INLINE
150 void
152 /*========================*/
153  buf_block_t* block,
154  mtr_t* mtr);
155 /********************************************************************/
157 UNIV_INLINE
158 void
160 /*=============================*/
161  buf_block_t* block,
162  ib_uint64_t start_lsn,
164  ib_uint64_t end_lsn);
166 /********************************************************************/
170 UNIV_INTERN
171 ibool
172 buf_flush_ready_for_replace(
173 /*========================*/
174  buf_page_t* bpage);
187 {
188  ib_uint64_t redo;
189  ulint n_flushed;
190 };
191 
194 /*********************************************************************
195 Update the historical stats that we are collecting for flush rate
196 heuristics at the end of each interval. */
197 UNIV_INTERN
198 void
199 buf_flush_stat_update(void);
200 /*=======================*/
201 /*********************************************************************
202 Determines the fraction of dirty pages that need to be flushed based
203 on the speed at which we generate redo log. Note that if redo log
204 is generated at significant rate without a corresponding increase
205 in the number of dirty pages (for example, an in-memory workload)
206 it can cause IO bursts of flushing. This function implements heuristics
207 to avoid this burstiness.
208 @return number of dirty pages to be flushed / second */
209 UNIV_INTERN
210 ulint
211 buf_flush_get_desired_flush_rate(void);
212 /*==================================*/
213 
214 #if defined UNIV_DEBUG || defined UNIV_BUF_DEBUG
215 /******************************************************************/
218 UNIV_INTERN
219 ibool
220 buf_flush_validate(
221 /*===============*/
222  buf_pool_t* buf_pool);
223 #endif /* UNIV_DEBUG || UNIV_BUF_DEBUG */
224 
225 /********************************************************************/
229 UNIV_INTERN
230 void
231 buf_flush_init_flush_rbt(void);
232 /*==========================*/
233 
234 /********************************************************************/
236 UNIV_INTERN
237 void
238 buf_flush_free_flush_rbt(void);
239 /*==========================*/
240 
245 #define BUF_FLUSH_FREE_BLOCK_MARGIN(b) (5 + BUF_READ_AHEAD_AREA(b))
246 
247 #define BUF_FLUSH_EXTRA_MARGIN(b) ((BUF_FLUSH_FREE_BLOCK_MARGIN(b) / 4 \
248  + 100) / srv_buf_pool_instances)
249 #endif /* !UNIV_HOTBACKUP */
250 
251 #ifndef UNIV_NONINL
252 #include "buf0flu.ic"
253 #endif
254 
255 #endif