Skip to content

File extendible_hash.c

FileList > cubrid > src > storage > extendible_hash.c

Go to the source code of this file

  • #include <stdio.h>
  • #include <stdlib.h>
  • #include <string.h>
  • #include <stddef.h>
  • #include <math.h>
  • #include "chartype.h"
  • #include "storage_common.h"
  • #include "memory_alloc.h"
  • #include "object_representation.h"
  • #include "error_manager.h"
  • #include "xserver_interface.h"
  • #include "log_manager.h"
  • #include "extendible_hash.h"
  • #include "page_buffer.h"
  • #include "lock_manager.h"
  • #include "slotted_page.h"
  • #include "file_manager.h"
  • #include "overflow_file.h"
  • #include "memory_hash.h"
  • #include "tz_support.h"
  • #include "db_date.h"
  • #include "thread_compat.hpp"
  • #include "memory_wrapper.hpp"

Classes

Type Name
struct ehash_bucket_header
struct ehash_dir_header
struct ehash_dir_record
struct ehash_repetition

Public Types

Type Name
typedef struct ehash_bucket_header EHASH_BUCKET_HEADER
typedef struct ehash_dir_header EHASH_DIR_HEADER
typedef struct ehash_dir_record EHASH_DIR_RECORD
typedef unsigned int EHASH_HASH_KEY
typedef struct ehash_repetition EHASH_REPETITION
enum EHASH_RESULT

Public Functions

Type Name
void * ehash_delete (THREAD_ENTRY * thread_p, EHID * ehid_p, void * key_p)
void ehash_dump (THREAD_ENTRY * thread_p, EHID * ehid_p)
void * ehash_insert (THREAD_ENTRY * thread_p, EHID * ehid_p, void * key_p, OID * value_p)
int ehash_map (THREAD_ENTRY * thread_p, EHID * ehid_p, int(*)(THREAD_ENTRY *thread_p, void *key, void *data, void *args) apply_function, void * args)
void ehash_print_bucket (THREAD_ENTRY * thread_p, EHID * ehid_p, int nth_ptr)
int ehash_rv_connect_bucket_redo (THREAD_ENTRY * thread_p, LOG_RCV * recv_p)
int ehash_rv_delete_redo (THREAD_ENTRY * thread_p, LOG_RCV * recv_p)
int ehash_rv_delete_undo (THREAD_ENTRY * thread_p, LOG_RCV * recv_p)
int ehash_rv_increment (THREAD_ENTRY * thread_p, LOG_RCV * recv_p)
int ehash_rv_init_bucket_redo (THREAD_ENTRY * thread_p, LOG_RCV * recv_p)
int ehash_rv_init_dir_new_page_redo (THREAD_ENTRY * thread_p, LOG_RCV * rcv)
int ehash_rv_init_dir_redo (THREAD_ENTRY * thread_p, LOG_RCV * recv_p)
int ehash_rv_insert_redo (THREAD_ENTRY * thread_p, LOG_RCV * recv_p)
int ehash_rv_insert_undo (THREAD_ENTRY * thread_p, LOG_RCV * recv_p)
EH_SEARCH ehash_search (THREAD_ENTRY * thread_p, EHID * ehid_p, void * key_p, OID * value_p)
EHID * xehash_create (THREAD_ENTRY * thread_p, EHID * ehid_p, DB_TYPE key_type, int exp_num_entries, OID * class_oid_p, int attr_id, bool is_tmp)
int xehash_destroy (THREAD_ENTRY * thread_p, EHID * ehid_p)

Public Static Functions

Type Name
void ehash_adjust_local_depth (THREAD_ENTRY * thread_p, EHID * ehid, PAGE_PTR dir_Rpgptr, EHASH_DIR_HEADER * dir_header, int depth, int delta, bool is_temp)
char * ehash_allocate_recdes (RECDES * recdes, int size, short type)
int ehash_ansi_sql_strncmp (const char * s, const char * t, int max)
int ehash_apply_each (THREAD_ENTRY * thread_p, EHID * ehid, RECDES * recdes, DB_TYPE key_type, char * bucrec_ptr, OID * assoc_value, int * out_apply_error, int(*)(THREAD_ENTRY *thread_p, void *key, void *data, void *args) apply_function, void * args)
bool ehash_binary_search_bucket (THREAD_ENTRY * thread_p, PAGE_PTR buc_pgptr, PGSLOTID num_record, DB_TYPE key_type, void * key, PGSLOTID * position)
EHASH_RESULT ehash_check_merge_possible (THREAD_ENTRY * thread_p, EHID * ehid, EHASH_DIR_HEADER * dir_header, VPID * buc_vpid, PAGE_PTR buc_pgptr, int location, int lock_type, int * old_local_depth, VPID * sib_vpid, PAGE_PTR * out_sib_pgptr, PGSLOTID * out_first_slotid, int * out_num_recs, int * out_loc)
int ehash_compare_key (THREAD_ENTRY * thread_p, char * bucrec_ptr, DB_TYPE key_type, void * key, INT16 rec_type, int * out_compare_result)
int ehash_compare_overflow (THREAD_ENTRY * thread_p, const VPID * ovf_vpid, char * key, int * comp_result)
char * ehash_compose_overflow (THREAD_ENTRY * thread_p, RECDES * recdes)
int ehash_compose_record (DB_TYPE key_type, void * key_ptr, OID * value_ptr, RECDES * recdes)
int ehash_connect_bucket (THREAD_ENTRY * thread_p, EHID * ehid, int local_depth, EHASH_HASH_KEY hash_key, VPID * buc_vpid, bool is_temp)
EHID * ehash_create_helper (THREAD_ENTRY * thread_p, EHID * ehid, DB_TYPE key_type, int exp_num_entries, OID * class_oid, int attr_id, bool istmp)
int ehash_create_overflow_file (THREAD_ENTRY * thread_p, EHID * ehid, PAGE_PTR dir_Rpgptr, EHASH_DIR_HEADER * dir_header, FILE_TYPE file_type)
void ehash_dir_locate (int * out_page_no_p, int * out_offset_p)
int ehash_distribute_records_into_two_bucket (THREAD_ENTRY * thread_p, EHASH_DIR_HEADER * dir_header, PAGE_PTR buc_pgptr, EHASH_BUCKET_HEADER * buc_header, int num_recs, PGSLOTID first_slotid, PAGE_PTR sib_pgptr)
void ehash_dump_bucket (THREAD_ENTRY * thread_p, PAGE_PTR buc_pgptr, DB_TYPE key_type)
int ehash_expand_directory (THREAD_ENTRY * thread_p, EHID * ehid, int new_depth, bool is_temp)
PAGE_PTR ehash_extend_bucket (THREAD_ENTRY * thread_p, EHID * ehid, PAGE_PTR dir_Rpgptr, EHASH_DIR_HEADER * dir_header, PAGE_PTR buc_pgptr, void * key, EHASH_HASH_KEY hash_key, int * new_bit, VPID * buc_vpid, bool is_temp)
int ehash_find_bucket_vpid (THREAD_ENTRY * thread_p, EHID * ehid, EHASH_DIR_HEADER * dir_header, int location, PGBUF_LATCH_MODE latch, VPID * out_vpid)
PAGE_PTR ehash_find_bucket_vpid_with_hash (THREAD_ENTRY * thread_p, EHID * ehid, void * key, PGBUF_LATCH_MODE root_latch, PGBUF_LATCH_MODE bucket_latch, VPID * out_vpid, EHASH_HASH_KEY * out_hash_key, int * out_location)
char ehash_find_depth (THREAD_ENTRY * thread_p, EHID * ehid, int location, VPID * vpid, VPID * sib_vpid)
int ehash_find_first_bit_position (THREAD_ENTRY * thread_p, EHASH_DIR_HEADER * dir_header, PAGE_PTR buc_pgptr, EHASH_BUCKET_HEADER * buc_header, void * key, int num_recs, PGSLOTID first_slotid, int * old_local_depth, int * new_local_depth)
PAGE_PTR ehash_fix_ehid_page (THREAD_ENTRY * thread_p, EHID * ehid, PGBUF_LATCH_MODE latch_mode)
PAGE_PTR ehash_fix_nth_page (THREAD_ENTRY * thread_p, const VFID * vfid, int offset, PGBUF_LATCH_MODE mode)
PAGE_PTR ehash_fix_old_page (THREAD_ENTRY * thread_p, const VFID * vfid, const VPID * vpid, PGBUF_LATCH_MODE mode)
void ehash_free_recdes (RECDES * recdes)
short ehash_get_key_size (DB_TYPE key_type)
int ehash_get_pseudo_key (THREAD_ENTRY * thread_p, RECDES * recdes, DB_TYPE key_type, EHASH_HASH_KEY * out_hash_key)
EHASH_HASH_KEY ehash_hash (void * orig_key, DB_TYPE key_type)
EHASH_HASH_KEY ehash_hash_eight_bytes_type (char * key)
EHASH_HASH_KEY ehash_hash_four_bytes_type (char * key)
EHASH_HASH_KEY ehash_hash_string_type (char * key, char * orig_key)
EHASH_HASH_KEY ehash_hash_two_bytes_type (char * key)
int ehash_initialize_bucket_new_page (THREAD_ENTRY * thread_p, PAGE_PTR page_p, void * alignment_depth)
int ehash_initialize_dir_new_page (THREAD_ENTRY * thread_p, PAGE_PTR page_p, void * args)
EHASH_RESULT ehash_insert_bucket_after_extend_if_need (THREAD_ENTRY * thread_p, EHID * ehid, PAGE_PTR dir_Rpgptr, EHASH_DIR_HEADER * dir_header, VPID * buc_vpid, void * key, EHASH_HASH_KEY hash_key, int lock_type, bool is_temp, OID * value_ptr, VPID * existing_ovf_vpid)
void * ehash_insert_helper (THREAD_ENTRY * thread_p, EHID * ehid, void * key, OID * value_ptr, int lock_type, VPID * existing_ovf_vpid)
EHASH_RESULT ehash_insert_to_bucket (THREAD_ENTRY * thread_p, EHID * ehid, VFID * ovf_file, bool is_temp, PAGE_PTR buc_pgptr, DB_TYPE key_type, void * key_ptr, OID * value_ptr, VPID * existing_ovf_vpid)
int ehash_insert_to_bucket_after_create (THREAD_ENTRY * thread_p, EHID * ehid, PAGE_PTR dir_Rpgptr, EHASH_DIR_HEADER * dir_header, VPID * buc_vpid, int location, EHASH_HASH_KEY hash_key, bool is_temp, void * key, OID * value_ptr, VPID * existing_ovf_vpid)
bool ehash_locate_slot (THREAD_ENTRY * thread_p, PAGE_PTR page, DB_TYPE key_type, void * key, PGSLOTID * position)
void ehash_merge (THREAD_ENTRY * thread_p, EHID * ehid, void * key, bool is_temp)
int ehash_merge_permanent (THREAD_ENTRY * thread_p, EHID * ehid, PAGE_PTR dir_Rpgptr, EHASH_DIR_HEADER * dir_header, PAGE_PTR buc_pgptr, PAGE_PTR sib_pgptr, VPID * buc_vpid, VPID * sib_vpid, int num_recs, int loc, PGSLOTID first_slotid, int * out_new_local_depth, bool is_temp)
char * ehash_read_ehid_from_record (char * rec_p, EHID * ehid_p)
char * ehash_read_oid_from_record (char * rec_p, OID * oid_p)
int ehash_rv_delete (THREAD_ENTRY * thread_p, EHID * ehid, void * key)
void ehash_shrink_directory (THREAD_ENTRY * thread_p, EHID * ehid, int new_depth, bool is_temp)
void ehash_shrink_directory_if_need (THREAD_ENTRY * thread_p, EHID * ehid, EHASH_DIR_HEADER * dir_header, bool is_temp)
PAGE_PTR ehash_split_bucket (THREAD_ENTRY * thread_p, EHASH_DIR_HEADER * dir_header, PAGE_PTR buc_pgptr, void * key, int * old_local_depth, int * new_local_depth, VPID * sib_vpid, bool is_temp)
char * ehash_write_ehid_to_record (char * rec_p, EHID * ehid_p)
int ehash_write_key_to_record (RECDES * recdes, DB_TYPE key_type, void * key_ptr, short key_size, OID * value_ptr, bool long_str)
char * ehash_write_oid_to_record (char * rec_p, OID * oid_p)

Macros

Type Name
define CLEARBIT (word, pos) ( (word) & ~(1 &lt;&lt; ([**EHASH\_HASH\_KEY\_BITS**](extendible__hash_8c.md#define-ehash_hash_key_bits) - (pos))) )
define EHASH_DIR_HEADER_SIZE (([**ssize\_t**](broker__monitor_8c.md#function-timeout)) ((([**sizeof**](broker__monitor_8c.md#function-timeout)([**EHASH\_DIR\_HEADER**](extendible__hash_8c.md#typedef-ehash_dir_header)) + [**sizeof**](broker__monitor_8c.md#function-timeout)([**int**](broker__monitor_8c.md#function-timeout)) - 1 ) / [**sizeof**](broker__monitor_8c.md#function-timeout)([**int**](broker__monitor_8c.md#function-timeout)) ) \* [**sizeof**](broker__monitor_8c.md#function-timeout)([**int**](broker__monitor_8c.md#function-timeout))))
define EHASH_HASH_KEY_BITS ([**sizeof**](broker__monitor_8c.md#function-timeout)([**EHASH\_HASH\_KEY**](extendible__hash_8c.md#typedef-ehash_hash_key)) \* 8)
define EHASH_LAST_OFFSET_IN_FIRST_PAGE ([**EHASH\_DIR\_HEADER\_SIZE**](extendible__hash_8c.md#define-ehash_dir_header_size) + ([**EHASH\_NUM\_FIRST\_PAGES**](extendible__hash_8c.md#define-ehash_num_first_pages) - 1) \* [**sizeof**](broker__monitor_8c.md#function-timeout)([**EHASH\_DIR\_RECORD**](extendible__hash_8c.md#typedef-ehash_dir_record)))
define EHASH_LAST_OFFSET_IN_NON_FIRST_PAGE (([**EHASH\_NUM\_NON\_FIRST\_PAGES**](extendible__hash_8c.md#define-ehash_num_non_first_pages) - 1) \* [**sizeof**](broker__monitor_8c.md#function-timeout)([**EHASH\_DIR\_RECORD**](extendible__hash_8c.md#typedef-ehash_dir_record)))
define EHASH_LONG_STRING_PREFIX_SIZE 10
define EHASH_MAX_STRING_SIZE ([**DB\_PAGESIZE**](storage__common_8h.md#define-db_pagesize) - ([**SSIZEOF**](broker__monitor_8c.md#function-timeout)([**EHASH\_BUCKET\_HEADER**](extendible__hash_8c.md#typedef-ehash_bucket_header)) + 16))
define EHASH_NUM_FIRST_PAGES (([**DB\_PAGESIZE**](storage__common_8h.md#define-db_pagesize) - [**EHASH\_DIR\_HEADER\_SIZE**](extendible__hash_8c.md#define-ehash_dir_header_size)) / [**SSIZEOF**](broker__monitor_8c.md#function-timeout) ([**EHASH\_DIR\_RECORD**](extendible__hash_8c.md#typedef-ehash_dir_record)))
define EHASH_NUM_NON_FIRST_PAGES ([**DB\_PAGESIZE**](storage__common_8h.md#define-db_pagesize) / [**sizeof**](broker__monitor_8c.md#function-timeout)([**EHASH\_DIR\_RECORD**](extendible__hash_8c.md#typedef-ehash_dir_record)))
define EHASH_OVERFLOW_RATE 0.9 /\* [**UPPER**](broker__monitor_8c.md#function-timeout) [**THRESHOLD**](broker__monitor_8c.md#function-timeout) [**for**](dynamic__load_8c.md#function-for) [**a**](broker__monitor_8c.md#function-timeout) merge operation. \*/
define EHASH_OVERFLOW_THRESHOLD ([**EHASH\_OVERFLOW\_RATE**](extendible__hash_8c.md#define-ehash_overflow_rate) \* [**DB\_PAGESIZE**](storage__common_8h.md#define-db_pagesize))
define EHASH_SHORT_BITS ([**sizeof**](broker__monitor_8c.md#function-timeout)([**short**](broker__monitor_8c.md#function-timeout)) \* 8)
define EHASH_UNDERFLOW_RATE 0.4 /\* [**LOWER**](broker__monitor_8c.md#function-timeout) [**THRESHOLD**](broker__monitor_8c.md#function-timeout) [**for**](dynamic__load_8c.md#function-for) [**a**](broker__monitor_8c.md#function-timeout) merge operation. \*/
define EHASH_UNDERFLOW_THRESHOLD ([**EHASH\_UNDERFLOW\_RATE**](extendible__hash_8c.md#define-ehash_underflow_rate) \* [**DB\_PAGESIZE**](storage__common_8h.md#define-db_pagesize))
define FIND_OFFSET (hash_key, depth) ([**GETBITS**](query__hash__scan_8c.md#define-getbits)(([**hash\_key**](broker__monitor_8c.md#function-timeout)), 1, (depth)))
define GETBIT (word, pos) ([**GETBITS**](query__hash__scan_8c.md#define-getbits)((word), (pos), 1))
define GETBITS (value, pos, n) ( ((value) &gt;&gt; ( [**EHASH\_HASH\_KEY\_BITS**](extendible__hash_8c.md#define-ehash_hash_key_bits) - (pos) - (n) + 1)) & (~(~0UL &lt;&lt; (n))) )
define SETBIT (word, pos) ( (word) \| (1 &lt;&lt; ([**EHASH\_HASH\_KEY\_BITS**](extendible__hash_8c.md#define-ehash_hash_key_bits) - (pos))) )

Public Types Documentation

typedef EHASH_BUCKET_HEADER

typedef struct ehash_bucket_header EHASH_BUCKET_HEADER;

typedef EHASH_DIR_HEADER

typedef struct ehash_dir_header EHASH_DIR_HEADER;

typedef EHASH_DIR_RECORD

typedef struct ehash_dir_record EHASH_DIR_RECORD;

typedef EHASH_HASH_KEY

typedef unsigned int EHASH_HASH_KEY;

typedef EHASH_REPETITION

typedef struct ehash_repetition EHASH_REPETITION;

enum EHASH_RESULT

enum EHASH_RESULT {
    EHASH_SUCCESSFUL_COMPLETION,
    EHASH_BUCKET_FULL,
    EHASH_BUCKET_UNDERFLOW,
    EHASH_BUCKET_EMPTY,
    EHASH_FULL_SIBLING_BUCKET,
    EHASH_NO_SIBLING_BUCKET,
    EHASH_ERROR_OCCURRED
};

Public Functions Documentation

function ehash_delete

void * ehash_delete (
    THREAD_ENTRY * thread_p,
    EHID * ehid_p,
    void * key_p
) 

function ehash_dump

void ehash_dump (
    THREAD_ENTRY * thread_p,
    EHID * ehid_p
) 

function ehash_insert

void * ehash_insert (
    THREAD_ENTRY * thread_p,
    EHID * ehid_p,
    void * key_p,
    OID * value_p
) 

function ehash_map

int ehash_map (
    THREAD_ENTRY * thread_p,
    EHID * ehid_p,
    int (*)( THREAD_ENTRY *thread_p, void *key, void *data, void *args) apply_function,
    void * args
) 

function ehash_print_bucket

void ehash_print_bucket (
    THREAD_ENTRY * thread_p,
    EHID * ehid_p,
    int nth_ptr
) 

function ehash_rv_connect_bucket_redo

int ehash_rv_connect_bucket_redo (
    THREAD_ENTRY * thread_p,
    LOG_RCV * recv_p
) 

function ehash_rv_delete_redo

int ehash_rv_delete_redo (
    THREAD_ENTRY * thread_p,
    LOG_RCV * recv_p
) 

function ehash_rv_delete_undo

int ehash_rv_delete_undo (
    THREAD_ENTRY * thread_p,
    LOG_RCV * recv_p
) 

function ehash_rv_increment

int ehash_rv_increment (
    THREAD_ENTRY * thread_p,
    LOG_RCV * recv_p
) 

function ehash_rv_init_bucket_redo

int ehash_rv_init_bucket_redo (
    THREAD_ENTRY * thread_p,
    LOG_RCV * recv_p
) 

function ehash_rv_init_dir_new_page_redo

int ehash_rv_init_dir_new_page_redo (
    THREAD_ENTRY * thread_p,
    LOG_RCV * rcv
) 

function ehash_rv_init_dir_redo

int ehash_rv_init_dir_redo (
    THREAD_ENTRY * thread_p,
    LOG_RCV * recv_p
) 

function ehash_rv_insert_redo

int ehash_rv_insert_redo (
    THREAD_ENTRY * thread_p,
    LOG_RCV * recv_p
) 

function ehash_rv_insert_undo

int ehash_rv_insert_undo (
    THREAD_ENTRY * thread_p,
    LOG_RCV * recv_p
) 

EH_SEARCH ehash_search (
    THREAD_ENTRY * thread_p,
    EHID * ehid_p,
    void * key_p,
    OID * value_p
) 

function xehash_create

EHID * xehash_create (
    THREAD_ENTRY * thread_p,
    EHID * ehid_p,
    DB_TYPE key_type,
    int exp_num_entries,
    OID * class_oid_p,
    int attr_id,
    bool is_tmp
) 

function xehash_destroy

int xehash_destroy (
    THREAD_ENTRY * thread_p,
    EHID * ehid_p
) 

Public Static Functions Documentation

function ehash_adjust_local_depth

static void ehash_adjust_local_depth (
    THREAD_ENTRY * thread_p,
    EHID * ehid,
    PAGE_PTR dir_Rpgptr,
    EHASH_DIR_HEADER * dir_header,
    int depth,
    int delta,
    bool is_temp
) 

function ehash_allocate_recdes

static char * ehash_allocate_recdes (
    RECDES * recdes,
    int size,
    short type
) 

function ehash_ansi_sql_strncmp

static int ehash_ansi_sql_strncmp (
    const  char * s,
    const  char * t,
    int max
) 

function ehash_apply_each

static int ehash_apply_each (
    THREAD_ENTRY * thread_p,
    EHID * ehid,
    RECDES * recdes,
    DB_TYPE key_type,
    char * bucrec_ptr,
    OID * assoc_value,
    int * out_apply_error,
    int (*)( THREAD_ENTRY *thread_p, void *key, void *data, void *args) apply_function,
    void * args
) 

function ehash_binary_search_bucket

static bool ehash_binary_search_bucket (
    THREAD_ENTRY * thread_p,
    PAGE_PTR buc_pgptr,
    PGSLOTID num_record,
    DB_TYPE key_type,
    void * key,
    PGSLOTID * position
) 

function ehash_check_merge_possible

static EHASH_RESULT ehash_check_merge_possible (
    THREAD_ENTRY * thread_p,
    EHID * ehid,
    EHASH_DIR_HEADER * dir_header,
    VPID * buc_vpid,
    PAGE_PTR buc_pgptr,
    int location,
    int lock_type,
    int * old_local_depth,
    VPID * sib_vpid,
    PAGE_PTR * out_sib_pgptr,
    PGSLOTID * out_first_slotid,
    int * out_num_recs,
    int * out_loc
) 

function ehash_compare_key

static int ehash_compare_key (
    THREAD_ENTRY * thread_p,
    char * bucrec_ptr,
    DB_TYPE key_type,
    void * key,
    INT16 rec_type,
    int * out_compare_result
) 

function ehash_compare_overflow

static int ehash_compare_overflow (
    THREAD_ENTRY * thread_p,
    const  VPID * ovf_vpid,
    char * key,
    int * comp_result
) 

function ehash_compose_overflow

static char * ehash_compose_overflow (
    THREAD_ENTRY * thread_p,
    RECDES * recdes
) 

function ehash_compose_record

static int ehash_compose_record (
    DB_TYPE key_type,
    void * key_ptr,
    OID * value_ptr,
    RECDES * recdes
) 

function ehash_connect_bucket

static int ehash_connect_bucket (
    THREAD_ENTRY * thread_p,
    EHID * ehid,
    int local_depth,
    EHASH_HASH_KEY hash_key,
    VPID * buc_vpid,
    bool is_temp
) 

function ehash_create_helper

static EHID * ehash_create_helper (
    THREAD_ENTRY * thread_p,
    EHID * ehid,
    DB_TYPE key_type,
    int exp_num_entries,
    OID * class_oid,
    int attr_id,
    bool istmp
) 

function ehash_create_overflow_file

static int ehash_create_overflow_file (
    THREAD_ENTRY * thread_p,
    EHID * ehid,
    PAGE_PTR dir_Rpgptr,
    EHASH_DIR_HEADER * dir_header,
    FILE_TYPE file_type
) 

function ehash_dir_locate

static void ehash_dir_locate (
    int * out_page_no_p,
    int * out_offset_p
) 

function ehash_distribute_records_into_two_bucket

static int ehash_distribute_records_into_two_bucket (
    THREAD_ENTRY * thread_p,
    EHASH_DIR_HEADER * dir_header,
    PAGE_PTR buc_pgptr,
    EHASH_BUCKET_HEADER * buc_header,
    int num_recs,
    PGSLOTID first_slotid,
    PAGE_PTR sib_pgptr
) 

function ehash_dump_bucket

static void ehash_dump_bucket (
    THREAD_ENTRY * thread_p,
    PAGE_PTR buc_pgptr,
    DB_TYPE key_type
) 

function ehash_expand_directory

static int ehash_expand_directory (
    THREAD_ENTRY * thread_p,
    EHID * ehid,
    int new_depth,
    bool is_temp
) 

function ehash_extend_bucket

static PAGE_PTR ehash_extend_bucket (
    THREAD_ENTRY * thread_p,
    EHID * ehid,
    PAGE_PTR dir_Rpgptr,
    EHASH_DIR_HEADER * dir_header,
    PAGE_PTR buc_pgptr,
    void * key,
    EHASH_HASH_KEY hash_key,
    int * new_bit,
    VPID * buc_vpid,
    bool is_temp
) 

function ehash_find_bucket_vpid

static int ehash_find_bucket_vpid (
    THREAD_ENTRY * thread_p,
    EHID * ehid,
    EHASH_DIR_HEADER * dir_header,
    int location,
    PGBUF_LATCH_MODE latch,
    VPID * out_vpid
) 

function ehash_find_bucket_vpid_with_hash

static PAGE_PTR ehash_find_bucket_vpid_with_hash (
    THREAD_ENTRY * thread_p,
    EHID * ehid,
    void * key,
    PGBUF_LATCH_MODE root_latch,
    PGBUF_LATCH_MODE bucket_latch,
    VPID * out_vpid,
    EHASH_HASH_KEY * out_hash_key,
    int * out_location
) 

function ehash_find_depth

static char ehash_find_depth (
    THREAD_ENTRY * thread_p,
    EHID * ehid,
    int location,
    VPID * vpid,
    VPID * sib_vpid
) 

function ehash_find_first_bit_position

static int ehash_find_first_bit_position (
    THREAD_ENTRY * thread_p,
    EHASH_DIR_HEADER * dir_header,
    PAGE_PTR buc_pgptr,
    EHASH_BUCKET_HEADER * buc_header,
    void * key,
    int num_recs,
    PGSLOTID first_slotid,
    int * old_local_depth,
    int * new_local_depth
) 

function ehash_fix_ehid_page

static PAGE_PTR ehash_fix_ehid_page (
    THREAD_ENTRY * thread_p,
    EHID * ehid,
    PGBUF_LATCH_MODE latch_mode
) 

function ehash_fix_nth_page

static PAGE_PTR ehash_fix_nth_page (
    THREAD_ENTRY * thread_p,
    const  VFID * vfid,
    int offset,
    PGBUF_LATCH_MODE mode
) 

function ehash_fix_old_page

static PAGE_PTR ehash_fix_old_page (
    THREAD_ENTRY * thread_p,
    const  VFID * vfid,
    const  VPID * vpid,
    PGBUF_LATCH_MODE mode
) 

function ehash_free_recdes

static void ehash_free_recdes (
    RECDES * recdes
) 

function ehash_get_key_size

static short ehash_get_key_size (
    DB_TYPE key_type
) 

function ehash_get_pseudo_key

static int ehash_get_pseudo_key (
    THREAD_ENTRY * thread_p,
    RECDES * recdes,
    DB_TYPE key_type,
    EHASH_HASH_KEY * out_hash_key
) 

function ehash_hash

static EHASH_HASH_KEY ehash_hash (
    void * orig_key,
    DB_TYPE key_type
) 

function ehash_hash_eight_bytes_type

static EHASH_HASH_KEY ehash_hash_eight_bytes_type (
    char * key
) 

function ehash_hash_four_bytes_type

static EHASH_HASH_KEY ehash_hash_four_bytes_type (
    char * key
) 

function ehash_hash_string_type

static EHASH_HASH_KEY ehash_hash_string_type (
    char * key,
    char * orig_key
) 

function ehash_hash_two_bytes_type

static EHASH_HASH_KEY ehash_hash_two_bytes_type (
    char * key
) 

function ehash_initialize_bucket_new_page

static int ehash_initialize_bucket_new_page (
    THREAD_ENTRY * thread_p,
    PAGE_PTR page_p,
    void * alignment_depth
) 

function ehash_initialize_dir_new_page

static int ehash_initialize_dir_new_page (
    THREAD_ENTRY * thread_p,
    PAGE_PTR page_p,
    void * args
) 

function ehash_insert_bucket_after_extend_if_need

static EHASH_RESULT ehash_insert_bucket_after_extend_if_need (
    THREAD_ENTRY * thread_p,
    EHID * ehid,
    PAGE_PTR dir_Rpgptr,
    EHASH_DIR_HEADER * dir_header,
    VPID * buc_vpid,
    void * key,
    EHASH_HASH_KEY hash_key,
    int lock_type,
    bool is_temp,
    OID * value_ptr,
    VPID * existing_ovf_vpid
) 

function ehash_insert_helper

static void * ehash_insert_helper (
    THREAD_ENTRY * thread_p,
    EHID * ehid,
    void * key,
    OID * value_ptr,
    int lock_type,
    VPID * existing_ovf_vpid
) 

function ehash_insert_to_bucket

static EHASH_RESULT ehash_insert_to_bucket (
    THREAD_ENTRY * thread_p,
    EHID * ehid,
    VFID * ovf_file,
    bool is_temp,
    PAGE_PTR buc_pgptr,
    DB_TYPE key_type,
    void * key_ptr,
    OID * value_ptr,
    VPID * existing_ovf_vpid
) 

function ehash_insert_to_bucket_after_create

static int ehash_insert_to_bucket_after_create (
    THREAD_ENTRY * thread_p,
    EHID * ehid,
    PAGE_PTR dir_Rpgptr,
    EHASH_DIR_HEADER * dir_header,
    VPID * buc_vpid,
    int location,
    EHASH_HASH_KEY hash_key,
    bool is_temp,
    void * key,
    OID * value_ptr,
    VPID * existing_ovf_vpid
) 

function ehash_locate_slot

static bool ehash_locate_slot (
    THREAD_ENTRY * thread_p,
    PAGE_PTR page,
    DB_TYPE key_type,
    void * key,
    PGSLOTID * position
) 

function ehash_merge

static void ehash_merge (
    THREAD_ENTRY * thread_p,
    EHID * ehid,
    void * key,
    bool is_temp
) 

function ehash_merge_permanent

static int ehash_merge_permanent (
    THREAD_ENTRY * thread_p,
    EHID * ehid,
    PAGE_PTR dir_Rpgptr,
    EHASH_DIR_HEADER * dir_header,
    PAGE_PTR buc_pgptr,
    PAGE_PTR sib_pgptr,
    VPID * buc_vpid,
    VPID * sib_vpid,
    int num_recs,
    int loc,
    PGSLOTID first_slotid,
    int * out_new_local_depth,
    bool is_temp
) 

function ehash_read_ehid_from_record

static char * ehash_read_ehid_from_record (
    char * rec_p,
    EHID * ehid_p
) 

function ehash_read_oid_from_record

static char * ehash_read_oid_from_record (
    char * rec_p,
    OID * oid_p
) 

function ehash_rv_delete

static int ehash_rv_delete (
    THREAD_ENTRY * thread_p,
    EHID * ehid,
    void * key
) 

function ehash_shrink_directory

static void ehash_shrink_directory (
    THREAD_ENTRY * thread_p,
    EHID * ehid,
    int new_depth,
    bool is_temp
) 

function ehash_shrink_directory_if_need

static void ehash_shrink_directory_if_need (
    THREAD_ENTRY * thread_p,
    EHID * ehid,
    EHASH_DIR_HEADER * dir_header,
    bool is_temp
) 

function ehash_split_bucket

static PAGE_PTR ehash_split_bucket (
    THREAD_ENTRY * thread_p,
    EHASH_DIR_HEADER * dir_header,
    PAGE_PTR buc_pgptr,
    void * key,
    int * old_local_depth,
    int * new_local_depth,
    VPID * sib_vpid,
    bool is_temp
) 

function ehash_write_ehid_to_record

static char * ehash_write_ehid_to_record (
    char * rec_p,
    EHID * ehid_p
) 

function ehash_write_key_to_record

static int ehash_write_key_to_record (
    RECDES * recdes,
    DB_TYPE key_type,
    void * key_ptr,
    short key_size,
    OID * value_ptr,
    bool long_str
) 

function ehash_write_oid_to_record

static char * ehash_write_oid_to_record (
    char * rec_p,
    OID * oid_p
) 

Macro Definition Documentation

define CLEARBIT

#define CLEARBIT (
    word,
    pos
) `( (word) & ~(1 << ( EHASH_HASH_KEY_BITS - (pos))) )`

define EHASH_DIR_HEADER_SIZE

#define EHASH_DIR_HEADER_SIZE `(( ssize_t ) ((( sizeof ( EHASH_DIR_HEADER ) + sizeof ( int ) - 1 ) / sizeof ( int ) ) * sizeof ( int )))`

define EHASH_HASH_KEY_BITS

#define EHASH_HASH_KEY_BITS `( sizeof ( EHASH_HASH_KEY ) * 8)`

define EHASH_LAST_OFFSET_IN_FIRST_PAGE

#define EHASH_LAST_OFFSET_IN_FIRST_PAGE `( EHASH_DIR_HEADER_SIZE + ( EHASH_NUM_FIRST_PAGES - 1) * sizeof ( EHASH_DIR_RECORD ))`

define EHASH_LAST_OFFSET_IN_NON_FIRST_PAGE

#define EHASH_LAST_OFFSET_IN_NON_FIRST_PAGE `(( EHASH_NUM_NON_FIRST_PAGES - 1) * sizeof ( EHASH_DIR_RECORD ))`

define EHASH_LONG_STRING_PREFIX_SIZE

#define EHASH_LONG_STRING_PREFIX_SIZE `10`

define EHASH_MAX_STRING_SIZE

#define EHASH_MAX_STRING_SIZE `( DB_PAGESIZE - ( SSIZEOF ( EHASH_BUCKET_HEADER ) + 16))`

define EHASH_NUM_FIRST_PAGES

#define EHASH_NUM_FIRST_PAGES `(( DB_PAGESIZE - EHASH_DIR_HEADER_SIZE ) / SSIZEOF ( EHASH_DIR_RECORD ))`

define EHASH_NUM_NON_FIRST_PAGES

#define EHASH_NUM_NON_FIRST_PAGES `( DB_PAGESIZE / sizeof ( EHASH_DIR_RECORD ))`

define EHASH_OVERFLOW_RATE

#define EHASH_OVERFLOW_RATE `0.9    /* UPPER  THRESHOLD  for  a merge operation. */`

define EHASH_OVERFLOW_THRESHOLD

#define EHASH_OVERFLOW_THRESHOLD `( EHASH_OVERFLOW_RATE * DB_PAGESIZE )`

define EHASH_SHORT_BITS

#define EHASH_SHORT_BITS `( sizeof ( short ) * 8)`

define EHASH_UNDERFLOW_RATE

#define EHASH_UNDERFLOW_RATE `0.4   /* LOWER  THRESHOLD  for  a merge operation. */`

define EHASH_UNDERFLOW_THRESHOLD

#define EHASH_UNDERFLOW_THRESHOLD `( EHASH_UNDERFLOW_RATE * DB_PAGESIZE )`

define FIND_OFFSET

#define FIND_OFFSET (
    hash_key,
    depth
) `( GETBITS (( hash_key ), 1, (depth)))`

define GETBIT

#define GETBIT (
    word,
    pos
) `( GETBITS ((word), (pos), 1))`

define GETBITS

#define GETBITS (
    value,
    pos,
    n
) `( ((value) >> ( EHASH_HASH_KEY_BITS - (pos) - (n) + 1)) & (~(~0UL << (n))) )`

define SETBIT

#define SETBIT (
    word,
    pos
) `( (word) | (1 << ( EHASH_HASH_KEY_BITS - (pos))) )`


The documentation for this class was generated from the following file cubrid/src/storage/extendible_hash.c