|
drizzle
C++ MySQL-protocol-compatible database server
|
#include "univ.i"#include "rem0rec.h"#include "dict0dict.h"#include "btr0types.h"#include "mtr0mtr.h"#include "ha0ha.h"Go to the source code of this file.
Classes | |
| struct | btr_search_struct |
| struct | btr_search_sys_struct |
Macros | |
| #define | btr0sea_h |
| #define | btr_search_validate() |
| #define | btr_search_latch (*btr_search_latch_temp) |
| #define | BTR_SEARCH_HASH_ANALYSIS 17 |
| #define | BTR_SEARCH_ON_PATTERN_LIMIT 3 |
| #define | BTR_SEARCH_ON_HASH_LIMIT 3 |
| #define | BTR_SEA_TIMEOUT 10000 |
Typedefs | |
| typedef struct btr_search_sys_struct | btr_search_sys_t |
Functions | |
| UNIV_INTERN void | btr_search_sys_create (ulint hash_size) |
| UNIV_INTERN void | btr_search_sys_free (void) |
| UNIV_INTERN void | btr_search_disable (void) |
| UNIV_INTERN void | btr_search_enable (void) |
| UNIV_INLINE btr_search_t * | btr_search_get_info (dict_index_t *index) |
| UNIV_INTERN btr_search_t * | btr_search_info_create (mem_heap_t *heap) |
| UNIV_INTERN ulint | btr_search_info_get_ref_count (btr_search_t *info) |
| UNIV_INLINE void | btr_search_info_update (dict_index_t *index, btr_cur_t *cursor) |
| 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) |
| UNIV_INTERN void | btr_search_move_or_delete_hash_entries (buf_block_t *new_block, buf_block_t *block, dict_index_t *index) |
| UNIV_INTERN void | btr_search_drop_page_hash_index (buf_block_t *block) |
| UNIV_INTERN void | btr_search_drop_page_hash_when_freed (ulint space, ulint zip_size, ulint page_no) |
| UNIV_INTERN void | btr_search_update_hash_node_on_insert (btr_cur_t *cursor) |
| UNIV_INTERN void | btr_search_update_hash_on_insert (btr_cur_t *cursor) |
| UNIV_INTERN void | btr_search_update_hash_on_delete (btr_cur_t *cursor) |
Variables | |
| bool | btr_search_enabled |
| ibool | btr_search_fully_disabled |
| btr_search_sys_t * | btr_search_sys |
| rw_lock_t * | btr_search_latch_temp |
| The latch protecting the adaptive search system. | |
| #define BTR_SEA_TIMEOUT 10000 |
| #define BTR_SEARCH_HASH_ANALYSIS 17 |
| #define btr_search_latch (*btr_search_latch_temp) |
| #define BTR_SEARCH_ON_HASH_LIMIT 3 |
| #define BTR_SEARCH_ON_PATTERN_LIMIT 3 |
| typedef struct btr_search_sys_struct btr_search_sys_t |
| UNIV_INTERN void btr_search_disable | ( | void | ) |
Disable the adaptive hash search system and empty the index.
Definition at line 206 of file btr0sea.cc.
| UNIV_INTERN void btr_search_drop_page_hash_index | ( | buf_block_t * | block | ) |
Drops a page hash index. in: block containing index page, s- or x-latched, or an index page for which we know that block->buf_fix_count == 0
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 |
Definition at line 1020 of file btr0sea.cc.
| UNIV_INTERN void btr_search_drop_page_hash_when_freed | ( | ulint | space, |
| ulint | zip_size, | ||
| ulint | page_no ) |
Drops a page hash index when a page is freed from a fseg to the file system. Drops possible hash index if the page happens to be in the buffer pool. in: page number
Drops a page hash index when a page is freed from a fseg to the file system. Drops possible hash index if the page happens to be in the buffer pool.
| 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 1188 of file btr0sea.cc.
| UNIV_INTERN void btr_search_enable | ( | void | ) |
Enable the adaptive hash search system.
Definition at line 236 of file btr0sea.cc.
| UNIV_INLINE btr_search_t * btr_search_get_info | ( | dict_index_t * | index | ) |
Returns search info for an index.
| 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.
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 815 of file btr0sea.cc.
| UNIV_INTERN btr_search_t * btr_search_info_create | ( | mem_heap_t * | heap | ) |
Creates and initializes a search info struct.
Creates and initializes a search info struct.
| heap | in: heap where created |
Definition at line 254 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.
Returns the value of ref_count. The value is protected by btr_search_latch.
| info | in: search info. |
Definition at line 296 of file btr0sea.cc.
| UNIV_INLINE void btr_search_info_update | ( | dict_index_t * | index, |
| btr_cur_t * | cursor ) |
Updates the search info. in: cursor which was just positioned
| index | in: index of the cursor |
| 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). in: record descriptor
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 1431 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. in: hash index hash table size
Creates and initializes the adaptive search system at a database start.
| hash_size | in: hash index hash table size |
Definition at line 167 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. 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
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 1546 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. in: cursor which was positioned on the record to delete using btr_cur_search_..., the record is not yet deleted
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 1494 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. 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
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 1597 of file btr0sea.cc.
|
extern |
Flag: has the search system been enabled? Protected by btr_search_latch and btr_search_enabled_mutex.
Definition at line 48 of file btr0sea.cc.
|
extern |
Flag: whether the search system has completed its disabling process, It is set to TRUE right after buf_pool_drop_hash_index() in btr_search_disable(), indicating hash index entries are cleaned up. Protected by btr_search_latch and btr_search_enabled_mutex.
Definition at line 49 of file btr0sea.cc.
|
extern |
The latch protecting the adaptive search system.
This latch protects the (1) hash index; (2) columns of a record to which we have a pointer in the hash index;
but does NOT protect:
(3) next record offset field in a record; (4) next or previous records on the same page.
Bear in mind (3) and (4) when using the hash index.
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 77 of file btr0sea.cc.
|
extern |
The adaptive hash index
Definition at line 84 of file btr0sea.cc.