Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00026 #pragma once
00027 #ifndef buf0lru_h
00028 #define buf0lru_h
00029
00030 #include <sys/types.h>
00031 #include "univ.i"
00032 #include "ut0byte.h"
00033 #include "buf0types.h"
00034
00036 enum buf_lru_free_block_status {
00038 BUF_LRU_FREED = 0,
00042 BUF_LRU_CANNOT_RELOCATE,
00044 BUF_LRU_NOT_FREED
00045 };
00046
00047
00055 UNIV_INTERN
00056 void
00057 buf_LRU_try_free_flushed_blocks(
00058
00059 buf_pool_t* buf_pool);
00060
00065 UNIV_INTERN
00066 ibool
00067 buf_LRU_buf_pool_running_out(void);
00068
00069
00070
00071
00072
00073
00075 #define BUF_LRU_OLD_MIN_LEN 512
00076
00078 #define BUF_LRU_FREE_SEARCH_LEN(b) (5 + 2 * BUF_READ_AHEAD_AREA(b))
00079
00080
00085 UNIV_INTERN
00086 void
00087 buf_LRU_invalidate_tablespace(
00088
00089 ulint id);
00090
00092 UNIV_INTERN
00093 void
00094 buf_LRU_insert_zip_clean(
00095
00096 buf_page_t* bpage);
00098
00111 UNIV_INTERN
00112 enum buf_lru_free_block_status
00113 buf_LRU_free_block(
00114
00115 buf_page_t* bpage,
00116 ibool zip,
00118 ibool* buf_pool_mutex_released);
00122
00125 UNIV_INTERN
00126 ibool
00127 buf_LRU_search_and_free_block(
00128
00129 buf_pool_t* buf_pool,
00130 ulint n_iterations);
00140
00144 UNIV_INTERN
00145 buf_block_t*
00146 buf_LRU_get_free_only(
00147
00148 buf_pool_t* buf_pool);
00149
00154 UNIV_INTERN
00155 buf_block_t*
00156 buf_LRU_get_free_block(
00157
00158 buf_pool_t* buf_pool,
00159 ulint zip_size);
00162
00164 UNIV_INTERN
00165 void
00166 buf_LRU_block_free_non_file_page(
00167
00168 buf_block_t* block);
00169
00171 UNIV_INTERN
00172 void
00173 buf_LRU_add_block(
00174
00175 buf_page_t* bpage,
00176 ibool old);
00180
00182 UNIV_INTERN
00183 void
00184 buf_unzip_LRU_add_block(
00185
00186 buf_block_t* block,
00187 ibool old);
00189
00191 UNIV_INTERN
00192 void
00193 buf_LRU_make_block_young(
00194
00195 buf_page_t* bpage);
00196
00198 UNIV_INTERN
00199 void
00200 buf_LRU_make_block_old(
00201
00202 buf_page_t* bpage);
00203
00206 UNIV_INTERN
00207 ulint
00208 buf_LRU_old_ratio_update(
00209
00210 uint old_pct,
00212 ibool adjust);
00215
00218 UNIV_INTERN
00219 void
00220 buf_LRU_stat_update(void);
00221
00222
00223
00225 UNIV_INTERN
00226 bool
00227 buf_LRU_file_dump(void);
00228
00229
00230
00232 UNIV_INTERN
00233 bool
00234 buf_LRU_file_restore(void);
00235
00236
00237 #if defined UNIV_DEBUG || defined UNIV_BUF_DEBUG
00238
00241 UNIV_INTERN
00242 ibool
00243 buf_LRU_validate(void);
00244
00245 #endif
00246 #if defined UNIV_DEBUG_PRINT || defined UNIV_DEBUG || defined UNIV_BUF_DEBUG
00247
00249 UNIV_INTERN
00250 void
00251 buf_LRU_print(void);
00252
00253 #endif
00254
00258 extern uint buf_LRU_old_ratio;
00260 #define BUF_LRU_OLD_RATIO_DIV 1024
00261
00264 #define BUF_LRU_OLD_RATIO_MAX BUF_LRU_OLD_RATIO_DIV
00265
00270 #define BUF_LRU_OLD_RATIO_MIN 51
00271
00272 #if BUF_LRU_OLD_RATIO_MIN >= BUF_LRU_OLD_RATIO_MAX
00273 # error "BUF_LRU_OLD_RATIO_MIN >= BUF_LRU_OLD_RATIO_MAX"
00274 #endif
00275 #if BUF_LRU_OLD_RATIO_MAX > BUF_LRU_OLD_RATIO_DIV
00276 # error "BUF_LRU_OLD_RATIO_MAX > BUF_LRU_OLD_RATIO_DIV"
00277 #endif
00278
00281 extern uint buf_LRU_old_threshold_ms;
00282
00283
00289 struct buf_LRU_stat_struct
00290 {
00291 ulint io;
00292 ulint unzip;
00293 };
00294
00296 typedef struct buf_LRU_stat_struct buf_LRU_stat_t;
00297
00300 extern buf_LRU_stat_t buf_LRU_stat_cur;
00301
00304 extern buf_LRU_stat_t buf_LRU_stat_sum;
00305
00306
00308 #define buf_LRU_stat_inc_io() buf_LRU_stat_cur.io++
00309
00311 #define buf_LRU_stat_inc_unzip() buf_LRU_stat_cur.unzip++
00312
00313 #ifndef UNIV_NONINL
00314 #include "buf0lru.ic"
00315 #endif
00316
00317 #endif