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