MySQL 5.6.14 Source Code Document
|
#include "btr0sea.h"
#include "buf0buf.h"
#include "page0page.h"
#include "page0cur.h"
#include "btr0cur.h"
#include "btr0pcur.h"
#include "btr0btr.h"
#include "ha0ha.h"
Go to the source code of this file.
Macros | |
#define | BTR_SEARCH_PAGE_BUILD_LIMIT 16 |
#define | BTR_SEARCH_BUILD_LIMIT 100 |
Variables | |
UNIV_INTERN char | btr_search_enabled = TRUE |
UNIV_INTERN ulint | btr_search_this_is_zero = 0 |
UNIV_INTERN byte | btr_sea_pad1 [64] |
UNIV_INTERN rw_lock_t * | btr_search_latch_temp |
The latch protecting the adaptive search system. | |
UNIV_INTERN byte | btr_sea_pad2 [64] |
UNIV_INTERN btr_search_sys_t * | btr_search_sys |
#define BTR_SEARCH_BUILD_LIMIT 100 |
The global limit for consecutive potentially successful hash searches,
before hash index building is started
Definition at line 94 of file btr0sea.cc.
#define BTR_SEARCH_PAGE_BUILD_LIMIT 16 |
If the number of records on the page divided by this parameter
would have been successfully accessed using a hash index, the index is then built on the page, assuming the global limit has been reached
Definition at line 90 of file btr0sea.cc.
UNIV_INTERN void btr_search_disable | ( | void | ) |
Disable the adaptive hash search system and empty the index.
Definition at line 228 of file btr0sea.cc.
UNIV_INTERN void btr_search_drop_page_hash_index | ( | buf_block_t * | block | ) |
Drops a page hash index.
block | in: block containing index page, s- or x-latched, or an index page for which we know that block->buf_fix_count == 0 or it is an index page which has already been removed from the buf_pool->page_hash i.e.: it is in state BUF_BLOCK_REMOVE_HASH |
Definition at line 1053 of file btr0sea.cc.
UNIV_INTERN void btr_search_drop_page_hash_when_freed | ( | ulint | space, |
ulint | zip_size, | ||
ulint | page_no | ||
) |
Drops a possible page hash index when a page is evicted from the buffer pool or freed in a file segment.
space | in: space id |
zip_size | in: compressed page size in bytes or 0 for uncompressed pages |
page_no | in: page number |
Definition at line 1258 of file btr0sea.cc.
UNIV_INTERN void btr_search_enable | ( | void | ) |
Enable the adaptive hash search system.
Definition at line 268 of file btr0sea.cc.
UNIV_INTERN ibool btr_search_guess_on_hash | ( | dict_index_t * | index, |
btr_search_t * | info, | ||
const dtuple_t * | tuple, | ||
ulint | mode, | ||
ulint | latch_mode, | ||
btr_cur_t * | cursor, | ||
ulint | has_search_latch, | ||
mtr_t * | mtr | ||
) |
Tries to guess the right search position based on the hash search info of the index. Note that if mode is PAGE_CUR_LE, which is used in inserts, and the function returns TRUE, then cursor->up_match and cursor->low_match both have sensible values.
index | in: index |
info | in: index search info |
tuple | in: logical record |
mode | in: PAGE_CUR_L, ... |
latch_mode | in: BTR_SEARCH_LEAF, ...; NOTE that only if has_search_latch is 0, we will have a latch set on the cursor page, otherwise we assume the caller uses his search latch to protect the record! |
cursor | out: tree cursor |
has_search_latch | in: latch mode the caller currently has on btr_search_latch: RW_S_LATCH, RW_X_LATCH, or 0 |
mtr | in: mtr |
Definition at line 847 of file btr0sea.cc.
UNIV_INTERN btr_search_t* btr_search_info_create | ( | mem_heap_t * | heap | ) |
Creates and initializes a search info struct.
heap | in: heap where created |
Definition at line 283 of file btr0sea.cc.
UNIV_INTERN ulint btr_search_info_get_ref_count | ( | btr_search_t * | info | ) |
Returns the value of ref_count. The value is protected by btr_search_latch.
info | in: search info. |
Definition at line 325 of file btr0sea.cc.
UNIV_INTERN void btr_search_info_update_slow | ( | btr_search_t * | info, |
btr_cur_t * | cursor | ||
) |
Updates the search info.
info | in/out: search info |
cursor | in: cursor which was just positioned |
Definition at line 620 of file btr0sea.cc.
UNIV_INTERN void btr_search_move_or_delete_hash_entries | ( | buf_block_t * | new_block, |
buf_block_t * | block, | ||
dict_index_t * | index | ||
) |
Moves or deletes hash entries for moved records. If new_page is already hashed, then the hash index for page, if any, is dropped. If new_page is not hashed, and page is hashed, then a new hash index is built to new_page with the same parameters as page (this often happens when a page is split).
new_block | in: records are copied to this page |
block | in: index page from which records were copied, and the copied records will be deleted from this page |
index | in: record descriptor |
Definition at line 1497 of file btr0sea.cc.
UNIV_INTERN void btr_search_sys_create | ( | ulint | hash_size | ) |
Creates and initializes the adaptive search system at a database start.
hash_size | in: hash index hash table size |
Definition at line 163 of file btr0sea.cc.
UNIV_INTERN void btr_search_sys_free | ( | void | ) |
Frees the adaptive search system at a database shutdown.
Definition at line 190 of file btr0sea.cc.
UNIV_INTERN void btr_search_update_hash_node_on_insert | ( | btr_cur_t * | cursor | ) |
Updates the page hash index when a single record is inserted on a page.
cursor | in: cursor which was positioned to the place to insert using btr_cur_search_..., and the new record has been inserted next to the cursor |
Definition at line 1624 of file btr0sea.cc.
UNIV_INTERN void btr_search_update_hash_on_delete | ( | btr_cur_t * | cursor | ) |
Updates the page hash index when a single record is deleted from a page.
cursor | in: cursor which was positioned on the record to delete using btr_cur_search_..., the record is not yet deleted |
Definition at line 1561 of file btr0sea.cc.
UNIV_INTERN void btr_search_update_hash_on_insert | ( | btr_cur_t * | cursor | ) |
Updates the page hash index when a single record is inserted on a page.
cursor | in: cursor which was positioned to the place to insert using btr_cur_search_..., and the new record has been inserted next to the cursor |
Definition at line 1689 of file btr0sea.cc.
UNIV_INTERN byte btr_sea_pad1[64] |
padding to prevent other memory update
hotspots from residing on the same memory cache line as btr_search_latch
Definition at line 63 of file btr0sea.cc.
UNIV_INTERN byte btr_sea_pad2[64] |
padding to prevent other memory update hotspots from residing on
the same memory cache line
Definition at line 77 of file btr0sea.cc.
UNIV_INTERN char btr_search_enabled = TRUE |
Flag: has the search system been enabled?
Protected by btr_search_latch.
Definition at line 48 of file btr0sea.cc.
UNIV_INTERN rw_lock_t* btr_search_latch_temp |
The latch protecting the adaptive search system.
The latch protecting the adaptive search system: this latch protects the
(1) positions of records on those pages where a hash index has been built. NOTE: It does not protect values of non-ordering fields within a record from being updated in-place! We can use fact (1) to perform unique searches to indexes.
Definition at line 73 of file btr0sea.cc.
UNIV_INTERN btr_search_sys_t* btr_search_sys |
The adaptive hash index
Definition at line 80 of file btr0sea.cc.
UNIV_INTERN ulint btr_search_this_is_zero = 0 |
A dummy variable to fool the compiler
Definition at line 51 of file btr0sea.cc.