Go to the source code of this file.
Classes | |
struct | ha_node_struct |
Macros | |
#define | ha0ha_h |
#define | ha_search_and_update_if_found(table, fold, data, new_block, new_data) ha_search_and_update_if_found_func(table,fold,data,new_data) |
#define | ha_create(n_c, n_m, level) ha_create_func(n_c,n_m) |
#define | ha_insert_for_fold(t, f, b, d) ha_insert_for_fold_func(t,f,d) |
#define | ASSERT_HASH_MUTEX_OWN(table, fold) ut_ad(!(table)->mutexes || mutex_own(hash_get_mutex(table, fold))) |
Typedefs | |
typedef struct ha_node_struct | ha_node_t |
Functions | |
UNIV_INLINE void * | ha_search_and_get_data (hash_table_t *table, ulint fold) |
UNIV_INTERN void | ha_search_and_update_if_found_func (hash_table_t *table, ulint fold, void *data, void *new_data) |
UNIV_INTERN hash_table_t * | ha_create_func (ulint n, ulint n_mutexes) |
UNIV_INTERN void | ha_clear (hash_table_t *table) |
UNIV_INTERN ibool | ha_insert_for_fold_func (hash_table_t *table, ulint fold, void *data) |
UNIV_INLINE ibool | ha_search_and_delete_if_found (hash_table_t *table, ulint fold, void *data) |
UNIV_INTERN void | ha_remove_all_nodes_to_page (hash_table_t *table, ulint fold, const page_t *page) |
UNIV_INTERN void | ha_print_info (FILE *file, hash_table_t *table) |
#define ASSERT_HASH_MUTEX_OWN | ( | table, | |
fold | |||
) | ut_ad(!(table)->mutexes || mutex_own(hash_get_mutex(table, fold))) |
Assert that the current thread is holding the mutex protecting a hash bucket corresponding to a fold value.
table | in: hash table |
fold | in: fold value |
Definition at line 230 of file ha0ha.h.
Referenced by ha_insert_for_fold_func(), ha_remove_all_nodes_to_page(), and ha_search_and_update_if_found_func().
#define ha_create | ( | n_c, | |
n_m, | |||
level | |||
) | ha_create_func(n_c,n_m) |
Creates a hash table.
n_c | in: number of array cells. The actual number of cells is chosen to be a slightly bigger prime number. |
level | in: level of the mutexes in the latching order |
n_m | in: number of mutexes to protect the hash table; must be a power of 2, or 0 |
Definition at line 114 of file ha0ha.h.
Referenced by btr_search_sys_create().
#define ha_insert_for_fold | ( | t, | |
f, | |||
b, | |||
d | |||
) | ha_insert_for_fold_func(t,f,d) |
Inserts an entry into a hash table. If an entry with the same fold number is found, its node is updated to point to the new data, and no new node is inserted.
t | in: hash table |
f | in: folded value of data |
b | ignored: buffer block containing the data |
d | in: data, must not be NULL |
Definition at line 165 of file ha0ha.h.
Referenced by btr_search_update_hash_on_insert().
#define ha_search_and_update_if_found | ( | table, | |
fold, | |||
data, | |||
new_block, | |||
new_data | |||
) | ha_search_and_update_if_found_func(table,fold,data,new_data) |
Looks for an element when we know the pointer to the data and updates the pointer to data if found.
table | in/out: hash table |
fold | in: folded value of the searched data |
data | in: pointer to the data |
new_block | ignored: block containing new_data |
new_data | in: new pointer to the data |
Definition at line 79 of file ha0ha.h.
Referenced by btr_search_update_hash_node_on_insert().
typedef struct ha_node_struct ha_node_t |
UNIV_INTERN void ha_clear | ( | hash_table_t * | table | ) |
Empties a hash table and frees the memory heaps. in, own: hash table
Empties a hash table and frees the memory heaps.
table | in, own: hash table |
Definition at line 95 of file ha0ha.cc.
References btr_search_latch, hash_get_n_cells(), hash_get_nth_cell(), hash_table_struct::heaps, mem_heap_free, hash_cell_struct::node, and ut_ad.
UNIV_INTERN hash_table_t* ha_create_func | ( | ulint | n, |
ulint | n_mutexes | ||
) |
Creates a hash table with at least n array cells. The actual number of cells is chosen to be a prime number slightly bigger than n.
Creates a hash table with at least n array cells. The actual number of cells is chosen to be a prime number slightly bigger than n.
n | in: number of array cells |
n_mutexes | in: number of mutexes to protect the hash table: must be a power of 2, or 0 |
Definition at line 43 of file ha0ha.cc.
References hash_table_struct::heaps, mem_heap_create_in_btr_search, ut_a, ut_ad, ut_is_2pow, and ut_min().
UNIV_INTERN ibool ha_insert_for_fold_func | ( | hash_table_t * | table, |
ulint | fold, | ||
void * | data | ||
) |
Inserts an entry into a hash table. If an entry with the same fold number is found, its node is updated to point to the new data, and no new node is inserted.
Inserts an entry into a hash table. If an entry with the same fold number is found, its node is updated to point to the new data, and no new node is inserted. If btr_search_enabled is set to FALSE, we will only allow updating existing nodes, but no new node is allowed to be added.
table | in: hash table |
fold | in: folded value of data; if a node with the same fold value already exists, it is updated to point to the same data, and no new node is created! |
data | in: data, must not be NULL |
Definition at line 133 of file ha0ha.cc.
References ASSERT_HASH_MUTEX_OWN, ha_node_struct::data, ha_node_struct::fold, buf_block_struct::frame, hash_calc_hash(), hash_get_heap(), hash_get_nth_cell(), mem_heap_alloc(), ha_node_struct::next, hash_cell_struct::node, page_align(), ut_a, and ut_ad.
UNIV_INTERN void ha_print_info | ( | FILE * | file, |
hash_table_t * | table | ||
) |
Prints info of a hash table. in: hash table
Prints info of a hash table.
file | in: file where to print |
table | in: hash table |
Definition at line 410 of file ha0ha.cc.
References hash_get_n_cells(), hash_get_nth_cell(), hash_table_struct::heaps, hash_cell_struct::node, ut_ad, and UT_LIST_GET_LEN.
UNIV_INTERN void ha_remove_all_nodes_to_page | ( | hash_table_t * | table, |
ulint | fold, | ||
const page_t * | page | ||
) |
Removes from the chain determined by fold all nodes whose data pointer points to the page given. in: buffer page
Removes from the chain determined by fold all nodes whose data pointer points to the page given.
table | in: hash table |
fold | in: fold value |
page | in: buffer page |
Definition at line 314 of file ha0ha.cc.
References ASSERT_HASH_MUTEX_OWN, page_align(), ut_a, and ut_ad.
UNIV_INLINE ibool ha_search_and_delete_if_found | ( | hash_table_t * | table, |
ulint | fold, | ||
void * | data | ||
) |
Looks for an element when we know the pointer to the data and deletes it from the hash table if found.
table | in: hash table |
fold | in: folded value of the searched data |
Referenced by btr_search_update_hash_on_delete().
UNIV_INLINE void* ha_search_and_get_data | ( | hash_table_t * | table, |
ulint | fold | ||
) |
Looks for an element in a hash table.
table | in: hash table |
Referenced by btr_search_guess_on_hash().
UNIV_INTERN void ha_search_and_update_if_found_func | ( | hash_table_t * | table, |
ulint | fold, | ||
void * | data, | ||
void * | new_data | ||
) |
Looks for an element when we know the pointer to the data and updates the pointer to data if found. in: new pointer to the data
Looks for an element when we know the pointer to the data, and updates the pointer to data, if found.
table | in/out: hash table |
fold | in: folded value of the searched data |
data | in: pointer to the data |
new_data | in: new pointer to the data |
Definition at line 271 of file ha0ha.cc.
References ASSERT_HASH_MUTEX_OWN, ha_node_struct::data, page_align(), ut_a, and ut_ad.