InnoDB Plugin  1.0
Data Structures | Macros | Functions
ha0ha.h File Reference
#include "univ.i"
#include "hash0hash.h"
#include "page0types.h"
#include "buf0types.h"
#include "rem0types.h"
#include "ha0ha.ic"
Include dependency graph for ha0ha.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  ha_node_t

Macros

#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_block,new_data)
#define ha_create(n_c, n_m, type, level)   ha_create_func(n_c,level,n_m,type)
#define ha_insert_for_fold(t, f, b, d)

Functions

UNIV_INLINE const rec_t * ha_search_and_get_data (hash_table_t *table, ulint fold)
UNIV_INTERN ibool ha_search_and_update_if_found_func (hash_table_t *table, ulint fold, const rec_t *data, buf_block_t *new_block, const rec_t *new_data)
UNIV_INTERN hash_table_tha_create_func (ulint n, ulint mutex_level, ulint n_mutexes, ulint type)
UNIV_INTERN void ha_clear (hash_table_t *table)
UNIV_INTERN ibool ha_insert_for_fold_func (hash_table_t *table, ulint fold, buf_block_t *block, const rec_t *data)
UNIV_INLINE ibool ha_search_and_delete_if_found (hash_table_t *table, ulint fold, const rec_t *data)
UNIV_INTERN void ha_remove_all_nodes_to_page (hash_table_t *table, ulint fold, const page_t *page)
UNIV_INTERN ibool ha_validate (hash_table_t *table, ulint start_index, ulint end_index)
UNIV_INTERN void ha_print_info (FILE *file, hash_table_t *table)
UNIV_INLINE void hash_assert_can_modify (hash_table_t *table, ulint fold)
UNIV_INLINE void hash_assert_can_search (hash_table_t *table, ulint fold)

Detailed Description

The hash table with external chains

Created 8/18/1994 Heikki Tuuri

Macro Definition Documentation

#define ha_create (   n_c,
  n_m,
  type,
  level 
)    ha_create_func(n_c,level,n_m,type)
Creates a hash table.
Returns
own: created table
Parameters
n_cin: number of array cells. The actual number of cells is chosen to be a slightly bigger prime number.
levelin: level of the mutexes in the latching order
n_min: number of mutexes to protect the hash table; must be a power of 2, or 0
#define ha_insert_for_fold (   t,
  f,
  b,
 
)
Value:
do { \
ha_insert_for_fold_func(t,f,b,d); \
MONITOR_INC(MONITOR_ADAPTIVE_HASH_ROW_ADDED); \
} while(0)

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.

Returns
TRUE if succeed, FALSE if no more memory could be allocated
Parameters
tin: hash table
fin: folded value of data
bin: buffer block containing the data
din: data, must not be NULL
#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_block,new_data)
Looks for an element when we know the pointer to the data and

updates the pointer to data if found.

Parameters
tablein/out: hash table
foldin: folded value of the searched data
datain: pointer to the data
new_blockin: block containing new_data
new_datain: new pointer to the data

Function Documentation

UNIV_INTERN void ha_clear ( hash_table_t table)

Empties a hash table and frees the memory heaps. in, own: hash table

UNIV_INTERN hash_table_t* ha_create_func ( ulint  n,
ulint  mutex_level,
ulint  n_mutexes,
ulint  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.

Returns
own: created table in: type of datastructure for which the memory heap is going to be used e.g.: MEM_HEAP_FOR_BTR_SEARCH or MEM_HEAP_FOR_PAGE_HASH
Parameters
nin: number of array cells
mutex_levelin: level of the mutexes in the latching order: this is used in the debug version
n_mutexesin: number of mutexes to protect the hash table: must be a power of 2, or 0
UNIV_INTERN ibool ha_insert_for_fold_func ( hash_table_t table,
ulint  fold,
buf_block_t block,
const rec_t *  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.

Returns
TRUE if succeed, FALSE if no more memory could be allocated in: data, must not be NULL
Parameters
tablein: hash table
foldin: 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!
blockin: buffer block containing the data
UNIV_INTERN void ha_print_info ( FILE *  file,
hash_table_t table 
)

Prints info of a hash table. in: hash table

Parameters
filein: file where to print
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

Parameters
tablein: hash table
foldin: fold value
UNIV_INLINE ibool ha_search_and_delete_if_found ( hash_table_t table,
ulint  fold,
const rec_t *  data 
)

Looks for an element when we know the pointer to the data and deletes it from the hash table if found.

Returns
TRUE if found in: pointer to the data

Looks for an element when we know the pointer to the data, and deletes it from the hash table, if found.

Returns
TRUE if found
Parameters
tablein: hash table
foldin: folded value of the searched data
datain: pointer to the data
UNIV_INLINE const rec_t* ha_search_and_get_data ( hash_table_t table,
ulint  fold 
)

Looks for an element in a hash table.

Returns
pointer to the data of the first hash table node in chain having the fold number, NULL if not found in: folded value of the searched data

Looks for an element in a hash table.

Returns
pointer to the data of the first hash table node in chain having the fold number, NULL if not found
Parameters
tablein: hash table
foldin: folded value of the searched data
UNIV_INTERN ibool ha_search_and_update_if_found_func ( hash_table_t table,
ulint  fold,
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.

Returns
TRUE if found in: new pointer to the data
Parameters
tablein/out: hash table
foldin: folded value of the searched data
datain: pointer to the data
new_blockin: block containing new_data
UNIV_INTERN ibool ha_validate ( hash_table_t table,
ulint  start_index,
ulint  end_index 
)

Validates a given range of the cells in hash table.

Returns
TRUE if ok in: end index
Parameters
tablein: hash table
start_indexin: start index
UNIV_INLINE void hash_assert_can_modify ( hash_table_t table,
ulint  fold 
)

Assert that the synchronization object in a hash operation involving possible change in the hash table is held. Note that in case of mutexes we assert that mutex is owned while in case of rw-locks we assert that it is held in exclusive mode. in: fold value

Assert that the synchronization object in a hash operation involving possible change in the hash table is held. Note that in case of mutexes we assert that mutex is owned while in case of rw-locks we assert that it is held in exclusive mode.

Parameters
tablein: hash table
foldin: fold value
UNIV_INLINE void hash_assert_can_search ( hash_table_t table,
ulint  fold 
)

Assert that the synchronization object in a hash search operation is held. Note that in case of mutexes we assert that mutex is owned while in case of rw-locks we assert that it is held either in x-mode or s-mode. in: fold value

Assert that the synchronization object in a hash search operation is held. Note that in case of mutexes we assert that mutex is owned while in case of rw-locks we assert that it is held either in x-mode or s-mode.

Parameters
tablein: hash table
foldin: fold value