InnoDB Plugin  1.0
buf0lru.h
Go to the documentation of this file.
1 /*****************************************************************************
2 
3 Copyright (c) 1995, 2013, Oracle and/or its affiliates. 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.,
15 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA
16 
17 *****************************************************************************/
18 
19 /**************************************************/
26 #ifndef buf0lru_h
27 #define buf0lru_h
28 
29 #include "univ.i"
30 #ifndef UNIV_HOTBACKUP
31 #include "ut0byte.h"
32 #include "buf0types.h"
33 
34 // Forward declaration
35 struct trx_t;
36 
37 /******************************************************************/
42 UNIV_INTERN
43 ibool
45 /*==============================*/
46 
47 /*#######################################################################
48 These are low-level functions
49 #########################################################################*/
50 
52 #define BUF_LRU_OLD_MIN_LEN 512 /* 8 megabytes of 16k pages */
53 
54 /******************************************************************/
59 UNIV_INTERN
60 void
62 /*==========================*/
63  ulint id,
64  buf_remove_t buf_remove,
65  const trx_t* trx);
68 #if defined UNIV_DEBUG || defined UNIV_BUF_DEBUG
69 /********************************************************************/
71 UNIV_INTERN
72 void
74 /*=====================*/
75  buf_page_t* bpage);
76 #endif /* UNIV_DEBUG || UNIV_BUF_DEBUG */
77 
78 /******************************************************************/
89 UNIV_INTERN
90 bool
92 /*==============*/
93  buf_page_t* bpage,
94  bool zip)
96  __attribute__((nonnull));
97 /******************************************************************/
100 UNIV_INTERN
101 ibool
103 /*========================*/
104  buf_pool_t* buf_pool,
105  ibool scan_all)
108  __attribute__((nonnull,warn_unused_result));
109 /******************************************************************/
113 UNIV_INTERN
116 /*==================*/
117  buf_pool_t* buf_pool);
118 /******************************************************************/
144 UNIV_INTERN
147 /*===================*/
148  buf_pool_t* buf_pool)
149  __attribute__((nonnull,warn_unused_result));
150 /******************************************************************/
154 UNIV_INTERN
155 ibool
157 /*=========================*/
158  buf_pool_t* buf_pool);
159 /******************************************************************/
161 UNIV_INTERN
162 void
164 /*=============================*/
165  buf_block_t* block);
166 /******************************************************************/
171 UNIV_INTERN
172 void
174 /*==============*/
175  buf_page_t* bpage,
176  ibool old);
180 /******************************************************************/
182 UNIV_INTERN
183 void
185 /*====================*/
186  buf_block_t* block,
187  ibool old);
189 /******************************************************************/
191 UNIV_INTERN
192 void
194 /*=====================*/
195  buf_page_t* bpage);
196 /******************************************************************/
198 UNIV_INTERN
199 void
201 /*===================*/
202  buf_page_t* bpage);
203 /**********************************************************************/
206 UNIV_INTERN
207 ulint
209 /*=====================*/
210  uint old_pct,
212  ibool adjust);
215 /********************************************************************/
218 UNIV_INTERN
219 void
220 buf_LRU_stat_update(void);
221 /*=====================*/
222 
223 /******************************************************************/
225 UNIV_INTERN
226 void
228 /*==================*/
229  buf_page_t* bpage)
232  __attribute__((nonnull));
233 
234 #if defined UNIV_DEBUG || defined UNIV_BUF_DEBUG
235 /**********************************************************************/
238 UNIV_INTERN
239 ibool
240 buf_LRU_validate(void);
241 /*==================*/
242 #endif /* UNIV_DEBUG || UNIV_BUF_DEBUG */
243 #if defined UNIV_DEBUG_PRINT || defined UNIV_DEBUG || defined UNIV_BUF_DEBUG
244 /**********************************************************************/
246 UNIV_INTERN
247 void
248 buf_LRU_print(void);
249 /*===============*/
250 #endif /* UNIV_DEBUG_PRINT || UNIV_DEBUG || UNIV_BUF_DEBUG */
251 
254 #define BUF_LRU_OLD_RATIO_DIV 1024
255 
258 #define BUF_LRU_OLD_RATIO_MAX BUF_LRU_OLD_RATIO_DIV
259 
264 #define BUF_LRU_OLD_RATIO_MIN 51
265 
266 #if BUF_LRU_OLD_RATIO_MIN >= BUF_LRU_OLD_RATIO_MAX
267 # error "BUF_LRU_OLD_RATIO_MIN >= BUF_LRU_OLD_RATIO_MAX"
268 #endif
269 #if BUF_LRU_OLD_RATIO_MAX > BUF_LRU_OLD_RATIO_DIV
270 # error "BUF_LRU_OLD_RATIO_MAX > BUF_LRU_OLD_RATIO_DIV"
271 #endif
272 
275 extern uint buf_LRU_old_threshold_ms;
276 /* @} */
277 
284 {
285  ulint io;
286  ulint unzip;
287 };
288 
292 
296 
297 /********************************************************************/
299 #define buf_LRU_stat_inc_io() buf_LRU_stat_cur.io++
300 /********************************************************************/
302 #define buf_LRU_stat_inc_unzip() buf_LRU_stat_cur.unzip++
303 
304 #ifndef UNIV_NONINL
305 #include "buf0lru.ic"
306 #endif
307 
308 #endif /* !UNIV_HOTBACKUP */
309 
310 #endif