MySQL 8.0.40
Source Code Documentation
hash0hash.ic File Reference

The simple hash table utility. More...

#include "ut0rnd.h"

Functions

static hash_cell_thash_get_nth_cell (hash_table_t *table, size_t n)
 
static void hash_table_clear (hash_table_t *table)
 Clears a hash table so that all the cells become empty. More...
 
static size_t hash_get_n_cells (hash_table_t const *table)
 
static uint64_t hash_calc_cell_id (uint64_t hash_value, hash_table_t const *table)
 
static uint64_t hash_get_sync_obj_index (hash_table_t *table, uint64_t hash_value)
 Gets the sync object index for a hash value in a hash table. More...
 
static mem_heap_thash_get_heap (hash_table_t *table)
 Gets the heap for a hash value in a hash table. More...
 
static rw_lock_thash_get_nth_lock (hash_table_t *table, size_t i)
 Gets the nth rw_lock in a hash table. More...
 
static rw_lock_thash_get_lock (hash_table_t *table, uint64_t hash_value)
 Gets the rw_lock for a hash value in a hash table. More...
 
static rw_lock_thash_lock_s_confirm (rw_lock_t *hash_lock, hash_table_t *table, uint64_t hash_value)
 If not appropriate rw_lock for a hash value in a hash table, relock S-lock the another rw_lock until appropriate for a hash value. More...
 
static rw_lock_thash_lock_x_confirm (rw_lock_t *hash_lock, hash_table_t *table, uint64_t hash_value)
 If not appropriate rw_lock for a hash value in a hash table, relock X-lock the another rw_lock until appropriate for a hash value. More...
 
static void hash_assert_can_modify (hash_table_t *table, uint64_t hash_value)
 Assert that the synchronization object in a hash operation involving possible change in the hash table is held. More...
 
static void hash_assert_can_search (hash_table_t *table, uint64_t hash_value)
 Assert that the synchronization object in a hash search operation is held. More...
 

Detailed Description

The simple hash table utility.

Created 5/20/1997 Heikki Tuuri

Function Documentation

◆ hash_assert_can_modify()

static void hash_assert_can_modify ( hash_table_t table,
uint64_t  hash_value 
)
inlinestatic

Assert that the synchronization object in a hash operation involving possible change in the hash table is held.

We assert that the specific rw_lock is held in exclusive mode.

Parameters
[in]tableThe hash table
[in]hash_valueThe hash value for which the modification is performed

UNIV_HOTBACKUP

◆ hash_assert_can_search()

static void hash_assert_can_search ( hash_table_t table,
uint64_t  hash_value 
)
inlinestatic

Assert that the synchronization object in a hash search operation is held.

We assert that the specific rw_lock is held either in x-mode or s-mode.

Parameters
[in]tableThe hash table
[in]hash_valueThe hash value for which the search is performed

UNIV_HOTBACKUP

◆ hash_calc_cell_id()

static uint64_t hash_calc_cell_id ( uint64_t  hash_value,
hash_table_t const *  table 
)
inlinestatic

◆ hash_get_heap()

static mem_heap_t * hash_get_heap ( hash_table_t table)
inlinestatic

Gets the heap for a hash value in a hash table.

Returns
mem heap
Parameters
tablein: hash table

◆ hash_get_lock()

static rw_lock_t * hash_get_lock ( hash_table_t table,
uint64_t  hash_value 
)
inlinestatic

Gets the rw_lock for a hash value in a hash table.

Returns
rw_lock
Parameters
tablein: hash table
hash_valuein: hash value

◆ hash_get_n_cells()

static size_t hash_get_n_cells ( hash_table_t const *  table)
inlinestatic

◆ hash_get_nth_cell()

static hash_cell_t * hash_get_nth_cell ( hash_table_t table,
size_t  n 
)
inlinestatic

◆ hash_get_nth_lock()

static rw_lock_t * hash_get_nth_lock ( hash_table_t table,
size_t  i 
)
inlinestatic

Gets the nth rw_lock in a hash table.

Returns
rw_lock
Parameters
tablein: hash table
iin: index of the rw_lock

◆ hash_get_sync_obj_index()

static uint64_t hash_get_sync_obj_index ( hash_table_t table,
uint64_t  hash_value 
)
inlinestatic

Gets the sync object index for a hash value in a hash table.

Returns
index
Parameters
tablein: hash table
hash_valuein: hash value

◆ hash_lock_s_confirm()

static rw_lock_t * hash_lock_s_confirm ( rw_lock_t hash_lock,
hash_table_t table,
uint64_t  hash_value 
)
inlinestatic

If not appropriate rw_lock for a hash value in a hash table, relock S-lock the another rw_lock until appropriate for a hash value.

Parameters
[in]hash_locklatched rw_lock to be confirmed
[in]tablehash table
[in]hash_valuehash value
Returns
latched rw_lock

◆ hash_lock_x_confirm()

static rw_lock_t * hash_lock_x_confirm ( rw_lock_t hash_lock,
hash_table_t table,
uint64_t  hash_value 
)
inlinestatic

If not appropriate rw_lock for a hash value in a hash table, relock X-lock the another rw_lock until appropriate for a hash value.

Parameters
[in]hash_locklatched rw_lock to be confirmed
[in]tablehash table
[in]hash_valuehash value
Returns
latched rw_lock

◆ hash_table_clear()

static void hash_table_clear ( hash_table_t table)
inlinestatic

Clears a hash table so that all the cells become empty.

Parameters
tablein/out: hash table