drizzle
C++ MySQL-protocol-compatible database server
Loading...
Searching...
No Matches
buf0lru.h
Go to the documentation of this file.
1/*****************************************************************************
2
3Copyright (C) 1995, 2009, Innobase Oy. All Rights Reserved.
4
5This program is free software; you can redistribute it and/or modify it under
6the terms of the GNU General Public License as published by the Free Software
7Foundation; version 2 of the License.
8
9This program is distributed in the hope that it will be useful, but WITHOUT
10ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
12
13You should have received a copy of the GNU General Public License along with
14this program; if not, write to the Free Software Foundation, Inc., 51 Franklin
15St, Fifth Floor, Boston, MA 02110-1301 USA
16
17*****************************************************************************/
18
19/**************************************************/
25
26#pragma once
27#ifndef buf0lru_h
28#define buf0lru_h
29
30#include <sys/types.h>
31#include "univ.i"
32#include "ut0byte.h"
33#include "buf0types.h"
34
46
47/******************************************************************/
55UNIV_INTERN
56void
58/*============================*/
59 buf_pool_t* buf_pool);
60/******************************************************************/
65UNIV_INTERN
66ibool
68/*==============================*/
69
70/*#######################################################################
71These are low-level functions
72#########################################################################*/
73
75#define BUF_LRU_OLD_MIN_LEN 512 /* 8 megabytes of 16k pages */
76
78#define BUF_LRU_FREE_SEARCH_LEN(b) (5 + 2 * BUF_READ_AHEAD_AREA(b))
79
80/******************************************************************/
85UNIV_INTERN
86void
88/*==========================*/
89 ulint id);
90/********************************************************************/
92UNIV_INTERN
93void
95/*=====================*/
96 buf_page_t* bpage);
97
98/******************************************************************/
111UNIV_INTERN
114/*===============*/
115 buf_page_t* bpage,
116 ibool zip)
118 __attribute__((nonnull));
119/******************************************************************/
122UNIV_INTERN
123ibool
125/*==========================*/
126 buf_pool_t* buf_pool,
127 ulint n_iterations);
137/******************************************************************/
141UNIV_INTERN
144/*==================*/
145 buf_pool_t* buf_pool);
146/******************************************************************/
151UNIV_INTERN
154/*===================*/
155 buf_pool_t* buf_pool)
156 __attribute__((nonnull,warn_unused_result));
157
158/******************************************************************/
160UNIV_INTERN
161void
163/*=============================*/
164 buf_block_t* block);
165/******************************************************************/
167UNIV_INTERN
168void
170/*==============*/
171 buf_page_t* bpage,
172 ibool old);
176/******************************************************************/
178UNIV_INTERN
179void
181/*====================*/
182 buf_block_t* block,
183 ibool old);
185/******************************************************************/
187UNIV_INTERN
188void
190/*=====================*/
191 buf_page_t* bpage);
192/******************************************************************/
194UNIV_INTERN
195void
197/*===================*/
198 buf_page_t* bpage);
199/**********************************************************************/
202UNIV_INTERN
203ulint
205/*=====================*/
206 uint old_pct,
208 ibool adjust);
211/********************************************************************/
214UNIV_INTERN
215void
217/*=====================*/
218
219/********************************************************************/
221UNIV_INTERN
222bool
224/*===================*/
225
226/********************************************************************/
228UNIV_INTERN
229bool
231/*======================*/
232
233#if defined UNIV_DEBUG || defined UNIV_BUF_DEBUG
234/**********************************************************************/
237UNIV_INTERN
238ibool
239buf_LRU_validate(void);
240/*==================*/
241#endif /* UNIV_DEBUG || UNIV_BUF_DEBUG */
242#if defined UNIV_DEBUG_PRINT || defined UNIV_DEBUG || defined UNIV_BUF_DEBUG
243/**********************************************************************/
245UNIV_INTERN
246void
247buf_LRU_print(void);
248/*===============*/
249#endif /* UNIV_DEBUG_PRINT || UNIV_DEBUG || UNIV_BUF_DEBUG */
250
254extern uint buf_LRU_old_ratio;
256#define BUF_LRU_OLD_RATIO_DIV 1024
260#define BUF_LRU_OLD_RATIO_MAX BUF_LRU_OLD_RATIO_DIV
266#define BUF_LRU_OLD_RATIO_MIN 51
267
268#if BUF_LRU_OLD_RATIO_MIN >= BUF_LRU_OLD_RATIO_MAX
269# error "BUF_LRU_OLD_RATIO_MIN >= BUF_LRU_OLD_RATIO_MAX"
270#endif
271#if BUF_LRU_OLD_RATIO_MAX > BUF_LRU_OLD_RATIO_DIV
272# error "BUF_LRU_OLD_RATIO_MAX > BUF_LRU_OLD_RATIO_DIV"
273#endif
274
277extern uint buf_LRU_old_threshold_ms;
278/* @} */
279
286{
287 ulint io;
288 ulint unzip;
289};
290
293
296extern buf_LRU_stat_t buf_LRU_stat_cur;
297
300extern buf_LRU_stat_t buf_LRU_stat_sum;
301
302/********************************************************************/
304#define buf_LRU_stat_inc_io() buf_LRU_stat_cur.io++
305/********************************************************************/
307#define buf_LRU_stat_inc_unzip() buf_LRU_stat_cur.unzip++
308
309#ifndef UNIV_NONINL
310#include "buf0lru.ic"
311#endif
312
313#endif
UNIV_INTERN bool buf_LRU_file_restore(void)
Definition buf0lru.cc:2231
UNIV_INTERN void buf_LRU_insert_zip_clean(buf_page_t *bpage)
Definition buf0lru.cc:533
UNIV_INTERN buf_block_t * buf_LRU_get_free_block(buf_pool_t *buf_pool) __attribute__((nonnull
UNIV_INTERN enum buf_lru_free_block_status buf_LRU_free_block(buf_page_t *bpage, ibool zip) __attribute__((nonnull))
Definition buf0lru.cc:1437
UNIV_INTERN void buf_LRU_block_free_non_file_page(buf_block_t *block)
Definition buf0lru.cc:1676
UNIV_INTERN ibool buf_LRU_buf_pool_running_out(void)
Definition buf0lru.cc:792
UNIV_INTERN void buf_LRU_make_block_young(buf_page_t *bpage)
Definition buf0lru.cc:1394
UNIV_INTERN void buf_LRU_make_block_old(buf_page_t *bpage)
Definition buf0lru.cc:1414
UNIV_INTERN void buf_LRU_stat_update(void)
Definition buf0lru.cc:2046
UNIV_INTERN buf_block_t * buf_LRU_get_free_only(buf_pool_t *buf_pool)
Definition buf0lru.cc:825
UNIV_INTERN ulint buf_LRU_old_ratio_update(uint old_pct, ibool adjust)
Definition buf0lru.cc:2018
UNIV_INTERN void buf_LRU_try_free_flushed_blocks(buf_pool_t *buf_pool)
Definition buf0lru.cc:757
UNIV_INTERN void buf_LRU_invalidate_tablespace(ulint id)
Definition buf0lru.cc:508
buf_lru_free_block_status
Definition buf0lru.h:36
@ BUF_LRU_FREED
Definition buf0lru.h:38
@ BUF_LRU_CANNOT_RELOCATE
Definition buf0lru.h:42
@ BUF_LRU_NOT_FREED
Definition buf0lru.h:44
UNIV_INTERN bool buf_LRU_file_dump(void)
Definition buf0lru.cc:2100
UNIV_INTERN ibool buf_LRU_search_and_free_block(buf_pool_t *buf_pool, ulint n_iterations)
Definition buf0lru.cc:711
uint buf_LRU_old_ratio
UNIV_INTERN void buf_unzip_LRU_add_block(buf_block_t *block, ibool old)
Definition buf0lru.cc:1234
UNIV_INTERN void buf_LRU_add_block(buf_page_t *bpage, ibool old)
Definition buf0lru.cc:1378
struct buf_LRU_stat_struct buf_LRU_stat_t
Definition buf0lru.h:292
struct buf_pool_struct buf_pool_t
Definition buf0types.h:37
struct buf_page_struct buf_page_t
Definition buf0types.h:31
struct buf_block_struct buf_block_t
Definition buf0types.h:33
Statistics for selecting the LRU list for eviction.
Definition buf0lru.h:286