1
1
/*****************************************************************************
3
Copyright (c) 1995, 2009, Innobase Oy. All Rights Reserved.
3
Copyright (C) 1995, 2009, 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
56
buf_LRU_try_free_flushed_blocks(void);
57
/*==================================*/
56
buf_LRU_try_free_flushed_blocks(
57
/*============================*/
58
buf_pool_t* buf_pool); /*!< in: buffer pool instance */
58
59
/******************************************************************//**
59
60
Returns TRUE if less than 25 % of the buffer pool is available. This can be
60
61
used in heuristics to prevent huge transactions eating up the whole buffer
73
74
#define BUF_LRU_OLD_MIN_LEN 512 /* 8 megabytes of 16k pages */
75
76
/** Maximum LRU list search length in buf_flush_LRU_recommendation() */
76
#define BUF_LRU_FREE_SEARCH_LEN (5 + 2 * BUF_READ_AHEAD_AREA)
77
#define BUF_LRU_FREE_SEARCH_LEN(b) (5 + 2 * BUF_READ_AHEAD_AREA(b))
78
79
/******************************************************************//**
79
80
Invalidates all pages belonging to a given tablespace when we are deleting
98
99
page, the descriptor object will be freed as well.
100
101
NOTE: If this function returns BUF_LRU_FREED, it will temporarily
101
release buf_pool_mutex. Furthermore, the page frame will no longer be
102
release buf_pool->mutex. Furthermore, the page frame will no longer be
102
103
accessible via bpage.
104
The caller must hold buf_pool_mutex and buf_page_get_mutex(bpage) and
105
The caller must hold buf_pool->mutex and buf_page_get_mutex(bpage) and
105
106
release these two mutexes after the call. No other
106
107
buf_page_get_mutex() may be held when calling this function.
107
108
@return BUF_LRU_FREED if freed, BUF_LRU_CANNOT_RELOCATE or
115
116
compressed page of an uncompressed page */
116
117
ibool* buf_pool_mutex_released);
117
118
/*!< in: pointer to a variable that will
118
be assigned TRUE if buf_pool_mutex
119
be assigned TRUE if buf_pool->mutex
119
120
was temporarily released, or NULL */
120
121
/******************************************************************//**
121
122
Try to free a replaceable block.
125
126
buf_LRU_search_and_free_block(
126
127
/*==========================*/
127
ulint n_iterations); /*!< in: how many times this has been called
128
repeatedly without result: a high value means
129
that we should search farther; if
130
n_iterations < 10, then we search
131
n_iterations / 10 * buf_pool->curr_size
132
pages from the end of the LRU list; if
133
n_iterations < 5, then we will also search
134
n_iterations / 5 of the unzip_LRU list. */
128
buf_pool_t* buf_pool, /*!< in: buffer pool instance */
129
ulint n_iterations); /*!< in: how many times this has
130
been called repeatedly without
131
result: a high value means that
132
we should search farther; if
133
n_iterations < 10, then we search
134
n_iterations / 10 * buf_pool->curr_size
135
pages from the end of the LRU list; if
136
n_iterations < 5, then we will
137
also search n_iterations / 5
138
of the unzip_LRU list. */
135
139
/******************************************************************//**
136
140
Returns a free block from the buf_pool. The block is taken off the
137
141
free list. If it is empty, returns NULL.
138
142
@return a free control block, or NULL if the buf_block->free list is empty */
141
buf_LRU_get_free_only(void);
142
/*=======================*/
145
buf_LRU_get_free_only(
146
/*==================*/
147
buf_pool_t* buf_pool); /*!< buffer pool instance */
143
148
/******************************************************************//**
144
149
Returns a free block from the buf_pool. The block is taken off the
145
150
free list. If it is empty, blocks are moved from the end of the
150
155
buf_LRU_get_free_block(
151
156
/*===================*/
152
ulint zip_size); /*!< in: compressed page size in bytes,
153
or 0 if uncompressed tablespace */
157
buf_pool_t* buf_pool, /*!< in: preferred buffer pool */
158
ulint zip_size); /*!< in: compressed page size in bytes,
159
or 0 if uncompressed tablespace */
155
161
/******************************************************************//**
156
162
Puts a block back to the free list. */
197
203
Updates buf_LRU_old_ratio.
198
204
@return updated old_pct */
201
207
buf_LRU_old_ratio_update(
202
208
/*=====================*/
203
209
uint old_pct,/*!< in: Reserve this percentage of
234
240
/** @name Heuristics for detecting index scan @{ */
235
241
/** Reserve this much/BUF_LRU_OLD_RATIO_DIV of the buffer pool for
236
"old" blocks. Protected by buf_pool_mutex. */
242
"old" blocks. Protected by buf_pool->mutex. */
237
243
extern uint buf_LRU_old_ratio;
238
244
/** The denominator of buf_LRU_old_ratio. */
239
245
#define BUF_LRU_OLD_RATIO_DIV 1024
279
285
extern buf_LRU_stat_t buf_LRU_stat_cur;
281
287
/** Running sum of past values of buf_LRU_stat_cur.
282
Updated by buf_LRU_stat_update(). Protected by buf_pool_mutex. */
288
Updated by buf_LRU_stat_update(). Protected by buf_pool->mutex. */
283
289
extern buf_LRU_stat_t buf_LRU_stat_sum;
285
291
/********************************************************************//**