70
69
#########################################################################*/
72
71
/** Minimum LRU list length for which the LRU_old pointer is defined */
73
#define BUF_LRU_OLD_MIN_LEN 512 /* 8 megabytes of 16k pages */
72
#define BUF_LRU_OLD_MIN_LEN 80
75
74
/** Maximum LRU list search length in buf_flush_LRU_recommendation() */
76
75
#define BUF_LRU_FREE_SEARCH_LEN (5 + 2 * BUF_READ_AHEAD_AREA)
85
84
buf_LRU_invalidate_tablespace(
86
85
/*==========================*/
87
86
ulint id); /*!< in: space id */
87
/******************************************************************//**
88
Gets the minimum LRU_position field for the blocks in an initial segment
89
(determined by BUF_LRU_INITIAL_RATIO) of the LRU list. The limit is not
90
guaranteed to be precise, because the ulint_clock may wrap around.
91
@return the limit; zero if could not determine it */
94
buf_LRU_get_recent_limit(void);
95
/*==========================*/
88
96
/********************************************************************//**
89
97
Insert a compressed block into buf_pool->zip_clean in the LRU order. */
193
201
buf_LRU_make_block_old(
194
202
/*===================*/
195
203
buf_page_t* bpage); /*!< in: control block */
196
/**********************************************************************//**
197
Updates buf_LRU_old_ratio.
198
@return updated old_pct */
201
buf_LRU_old_ratio_update(
202
/*=====================*/
203
uint old_pct,/*!< in: Reserve this percentage of
204
the buffer pool for "old" blocks. */
205
ibool adjust);/*!< in: TRUE=adjust the LRU list;
206
FALSE=just assign buf_LRU_old_ratio
207
during the initialization of InnoDB */
208
204
/********************************************************************//**
209
205
Update the historical stats that we are collecting for LRU eviction
210
206
policy at the end of each interval. */
231
227
/*===============*/
232
228
#endif /* UNIV_DEBUG_PRINT || UNIV_DEBUG || UNIV_BUF_DEBUG */
234
/** @name Heuristics for detecting index scan @{ */
235
/** Reserve this much/BUF_LRU_OLD_RATIO_DIV of the buffer pool for
236
"old" blocks. Protected by buf_pool_mutex. */
237
extern uint buf_LRU_old_ratio;
238
/** The denominator of buf_LRU_old_ratio. */
239
#define BUF_LRU_OLD_RATIO_DIV 1024
240
/** Maximum value of buf_LRU_old_ratio.
241
@see buf_LRU_old_adjust_len
242
@see buf_LRU_old_ratio_update */
243
#define BUF_LRU_OLD_RATIO_MAX BUF_LRU_OLD_RATIO_DIV
244
/** Minimum value of buf_LRU_old_ratio.
245
@see buf_LRU_old_adjust_len
246
@see buf_LRU_old_ratio_update
247
The minimum must exceed
248
(BUF_LRU_OLD_TOLERANCE + 5) * BUF_LRU_OLD_RATIO_DIV / BUF_LRU_OLD_MIN_LEN. */
249
#define BUF_LRU_OLD_RATIO_MIN 51
251
#if BUF_LRU_OLD_RATIO_MIN >= BUF_LRU_OLD_RATIO_MAX
252
# error "BUF_LRU_OLD_RATIO_MIN >= BUF_LRU_OLD_RATIO_MAX"
254
#if BUF_LRU_OLD_RATIO_MAX > BUF_LRU_OLD_RATIO_DIV
255
# error "BUF_LRU_OLD_RATIO_MAX > BUF_LRU_OLD_RATIO_DIV"
258
/** Move blocks to "new" LRU list only if the first access was at
259
least this many milliseconds ago. Not protected by any mutex or latch. */
260
extern uint buf_LRU_old_threshold_ms;
263
230
/** @brief Statistics for selecting the LRU list for eviction.
265
232
These statistics are not 'of' LRU but 'for' LRU. We keep count of I/O