1
1
/*****************************************************************************
3
Copyright (c) 1995, 2010, Innobase Oy. All Rights Reserved.
3
Copyright (c) 1995, 2011, Oracle and/or its affiliates. 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
120
120
/*===============*/
122
122
/********************************************************************//**
123
Drops the adaptive hash index. To prevent a livelock, this function
124
is only to be called while holding btr_search_latch and while
125
btr_search_enabled == FALSE. */
123
Clears the adaptive hash index on all pages in the buffer pool. */
128
buf_pool_drop_hash_index(void);
129
/*==========================*/
126
buf_pool_clear_hash_index(void);
127
/*===========================*/
131
129
/********************************************************************//**
132
130
Relocate a buffer control block. Relocates the block on the LRU list
141
139
BUF_BLOCK_ZIP_DIRTY or BUF_BLOCK_ZIP_PAGE */
142
140
buf_page_t* dpage) /*!< in/out: destination control block */
143
141
__attribute__((nonnull));
144
/********************************************************************//**
145
Resizes the buffer pool. */
148
buf_pool_resize(void);
149
/*=================*/
150
142
/*********************************************************************//**
151
143
Gets the current size of buffer buf_pool in bytes.
152
144
@return size in bytes */
163
155
buf_pool_get_oldest_modification(void);
164
156
/*==================================*/
165
157
/********************************************************************//**
158
Allocates a buf_page_t descriptor. This function must succeed. In case
159
of failure we assert in this function. */
162
buf_page_alloc_descriptor(void)
163
/*===========================*/
164
__attribute__((malloc));
165
/********************************************************************//**
166
Free a buf_page_t descriptor. */
169
buf_page_free_descriptor(
170
/*=====================*/
171
buf_page_t* bpage) /*!< in: bpage descriptor to free. */
172
__attribute__((nonnull));
174
/********************************************************************//**
166
175
Allocates a buffer block.
167
176
@return own: the allocated block, in state BUF_BLOCK_MEMORY */
362
371
ulint space, /*!< in: space id */
363
372
ulint offset);/*!< in: page number */
364
/********************************************************************//**
365
Resets the check_index_page_at_flush field of a page if found in the buffer
369
buf_reset_check_index_page_at_flush(
370
/*================================*/
371
ulint space, /*!< in: space id */
372
ulint offset);/*!< in: page number */
373
373
#if defined UNIV_DEBUG_FILE_ACCESSES || defined UNIV_DEBUG
374
374
/********************************************************************//**
375
375
Sets file_page_was_freed TRUE if the page is found in the buffer pool.
416
416
__attribute__((pure));
418
418
/********************************************************************//**
419
Tells if a block is still close enough to the MRU end of the LRU list
420
meaning that it is not in danger of getting evicted and also implying
421
that it has been accessed recently.
422
Note that this is for heuristics only and does not reserve buffer pool
424
@return TRUE if block is close to MRU end of LRU */
427
buf_page_peek_if_young(
428
/*===================*/
429
const buf_page_t* bpage); /*!< in: block */
430
/********************************************************************//**
419
431
Recommends a move of a block to the start of the LRU list if there is danger
420
432
of dropping from the buffer pool. NOTE: does not reserve the buffer pool
426
438
/*=====================*/
427
439
const buf_page_t* bpage); /*!< in: block to make younger */
428
440
/********************************************************************//**
429
Returns the current state of is_hashed of a page. FALSE if the page is
430
not in the pool. NOTE that this operation does not fix the page in the
431
pool if it is found there.
432
@return TRUE if page hash index is built in search system */
435
buf_page_peek_if_search_hashed(
436
/*===========================*/
437
ulint space, /*!< in: space id */
438
ulint offset);/*!< in: page number */
439
/********************************************************************//**
440
441
Gets the youngest modification log sequence number for a frame.
441
442
Returns zero if not file page or no modification occurred yet.
442
443
@return newest modification to page */
1230
1231
/** @name Hash search fields
1231
These 6 fields may only be modified when we have
1232
These 5 fields may only be modified when we have
1232
1233
an x-latch on btr_search_latch AND
1233
1234
- we are holding an s-latch or x-latch on buf_block_struct::lock or
1234
1235
- we know that buf_block_struct::buf_fix_count == 0.
1236
1237
An exception to this is when we init or create a page
1237
in the buffer pool in buf0buf.c. */
1238
in the buffer pool in buf0buf.c.
1240
Another exception is that assigning block->index = NULL
1241
is allowed whenever holding an x-latch on btr_search_latch. */
1243
1247
pointers in the adaptive hash index
1244
1248
pointing to this frame */
1245
1249
#endif /* UNIV_AHI_DEBUG || UNIV_DEBUG */
1246
unsigned is_hashed:1; /*!< TRUE if hash index has
1247
already been built on this
1248
page; note that it does not
1249
guarantee that the index is
1250
complete, though: there may
1251
have been hash collisions,
1252
record deletions, etc. */
1253
1250
unsigned curr_n_fields:10;/*!< prefix length for hash indexing:
1254
1251
number of full fields */
1255
1252
unsigned curr_n_bytes:15;/*!< number of bytes in hash
1257
1254
unsigned curr_left_side:1;/*!< TRUE or FALSE in hash indexing */
1258
dict_index_t* index; /*!< Index for which the adaptive
1259
hash index has been created. */
1255
dict_index_t* index; /*!< Index for which the
1256
adaptive hash index has been
1257
created, or NULL if the page
1258
does not exist in the
1259
index. Note that it does not
1260
guarantee that the index is
1261
complete, though: there may
1262
have been hash collisions,
1263
record deletions, etc. */
1261
1265
# ifdef UNIV_SYNC_DEBUG
1262
1266
/** @name Debug fields */
1298
1302
ulint n_pages_written;/*!< number write operations */
1299
1303
ulint n_pages_created;/*!< number of pages created
1300
1304
in the pool with no read */
1305
ulint n_ra_pages_read_rnd;/*!< number of pages read in
1306
as part of random read ahead */
1301
1307
ulint n_ra_pages_read;/*!< number of pages read in
1302
1308
as part of read ahead */
1303
1309
ulint n_ra_pages_evicted;/*!< number of read ahead
1421
1427
frames and buf_page_t descriptors of blocks that exist
1422
1428
in the buffer pool only in compressed form. */
1430
#if defined UNIV_DEBUG || defined UNIV_BUF_DEBUG
1424
1431
UT_LIST_BASE_NODE_T(buf_page_t) zip_clean;
1425
1432
/*!< unmodified compressed pages */
1433
#endif /* UNIV_DEBUG || UNIV_BUF_DEBUG */
1426
1434
UT_LIST_BASE_NODE_T(buf_page_t) zip_free[BUF_BUDDY_SIZES];
1427
1435
/*!< buddy free lists */
1428
1436
#if BUF_BUDDY_HIGH != UNIV_PAGE_SIZE