MySQL 9.1.0
Source Code Documentation
|
The hash table with external chains. More...
#include "ha0ha.h"
#include <sys/types.h>
#include "buf0buf.h"
#include "btr0sea.h"
#include "page0page.h"
Macros | |
#define | PRINT_USED_CELLS |
Functions | |
hash_table_t * | ib_create (size_t n, latch_id_t id, size_t n_sync_obj, uint32_t type) |
Creates a hash table with at least n array cells. More... | |
void | ha_clear (hash_table_t *table) |
Empties a hash table and frees the memory heaps. More... | |
static void | ha_btr_search_latch_x_locked (const hash_table_t *table) |
Verify if latch corresponding to the hash table is x-latched. More... | |
bool | ha_insert_for_hash_func (hash_table_t *table, uint64_t hash_value, buf_block_t *block, const rec_t *data) |
Inserts an entry into a hash table. More... | |
void | ha_delete_hash_node (hash_table_t *table, ha_node_t *del_node) |
Deletes a hash node. More... | |
bool | ha_search_and_update_if_found_func (hash_table_t *table, uint64_t hash_value, const rec_t *data, buf_block_t *new_block, const rec_t *new_data) |
Looks for an element when we know the pointer to the data and updates the pointer to data if found. More... | |
void | ha_remove_a_node_to_page (hash_table_t *table, uint64_t hash_value, const page_t *page) |
Removes from the chain determined by hash value a single node whose data pointer points to the page given. More... | |
bool | ha_validate (hash_table_t *table, uint64_t start_index, uint64_t end_index) |
Validates a given range of the cells in hash table. More... | |
void | ha_print_info (FILE *file, hash_table_t *table) |
Prints info of a hash table. More... | |
The hash table with external chains.
Created 8/22/1994 Heikki Tuuri
#define PRINT_USED_CELLS |
|
static |
Verify if latch corresponding to the hash table is x-latched.
[in] | table | hash table |
void ha_clear | ( | hash_table_t * | table | ) |
Empties a hash table and frees the memory heaps.
in, own: hash table
table | in, own: hash table |
void ha_delete_hash_node | ( | hash_table_t * | table, |
ha_node_t * | del_node | ||
) |
Deletes a hash node.
in: node to be deleted
table | in: hash table |
del_node | in: node to be deleted |
bool ha_insert_for_hash_func | ( | hash_table_t * | table, |
uint64_t | hash_value, | ||
buf_block_t * | block, | ||
const rec_t * | data | ||
) |
Inserts an entry into a hash table.
If an entry with the same hash 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.
[in] | table | hash table |
[in] | hash_value | hashed value of data; if a node with the same hash value already exists, it is updated to point to the same data, and no new node is created! |
[in] | block | buffer block containing the data |
[in] | data | data, must not be NULL |
void ha_print_info | ( | FILE * | file, |
hash_table_t * | table | ||
) |
Prints info of a hash table.
[in] | file | File where to print |
[in] | table | Hash table |
void ha_remove_a_node_to_page | ( | hash_table_t * | table, |
uint64_t | hash_value, | ||
const page_t * | page | ||
) |
Removes from the chain determined by hash value a single node whose data pointer points to the page given.
Note that the node deleted can have a different hash value.
[in] | table | Hash table |
[in] | hash_value | Hash value |
[in] | page | Buffer page |
bool ha_search_and_update_if_found_func | ( | hash_table_t * | table, |
uint64_t | hash_value, | ||
const rec_t * | data, | ||
buf_block_t * | new_block, | ||
const rec_t * | new_data | ||
) |
Looks for an element when we know the pointer to the data and updates the pointer to data if found.
[in,out] | table | hash table |
[in] | hash_value | hashed value of the searched data |
[in] | data | pointer to the data |
[in] | new_block | block containing new data |
[in] | new_data | new pointer to the data |
bool ha_validate | ( | hash_table_t * | table, |
uint64_t | start_index, | ||
uint64_t | end_index | ||
) |
Validates a given range of the cells in hash table.
[in] | table | Hash table |
[in] | start_index | Start index |
[in] | end_index | End index |
hash_table_t * ib_create | ( | size_t | n, |
latch_id_t | id, | ||
size_t | n_sync_obj, | ||
uint32_t | type | ||
) |
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.
[in] | n | number of array cells |
[in] | id | latch ID |
[in] | n_sync_obj | Number of sync objects protecting the hash table. Must be a power of 2, or 0. |
[in] | type | type of datastructure for which the memory heap is going to be used: MEM_HEAP_FOR_BTR_SEARCH or MEM_HEAP_FOR_PAGE_HASH |