summaryrefslogtreecommitdiff
path: root/innobase/include
diff options
context:
space:
mode:
Diffstat (limited to 'innobase/include')
-rw-r--r--innobase/include/buf0buf.h8
-rw-r--r--innobase/include/ha0ha.h18
-rw-r--r--innobase/include/hash0hash.h18
3 files changed, 35 insertions, 9 deletions
diff --git a/innobase/include/buf0buf.h b/innobase/include/buf0buf.h
index 53599d03c73..f72207be29c 100644
--- a/innobase/include/buf0buf.h
+++ b/innobase/include/buf0buf.h
@@ -29,6 +29,7 @@ Created 11/5/1995 Heikki Tuuri
#include "buf0types.h"
#include "sync0rw.h"
#include "hash0hash.h"
+#include "ha0ha.h"
#include "ut0byte.h"
#include "os0proc.h"
@@ -817,7 +818,7 @@ struct buf_block_struct{
records with the same prefix should be
indexed in the hash index */
- /* The following 4 fields are protected by btr_search_latch: */
+ /* The following 6 fields are protected by btr_search_latch: */
ibool is_hashed; /* TRUE if hash index has already been
built on this page; note that it does
@@ -834,6 +835,11 @@ struct buf_block_struct{
ulint curr_side; /* BTR_SEARCH_LEFT_SIDE or
BTR_SEARCH_RIGHT_SIDE in hash
indexing */
+ ha_node_t* hash_nodes; /* a doubly linked list of hash nodes
+ for this buffer block; this points to
+ the first node in the list if any;
+ note that we do not use UT_LST_ macros
+ to manipulate this list */
/* 6. Debug fields */
#ifdef UNIV_SYNC_DEBUG
rw_lock_t debug_latch; /* in the debug version, each thread
diff --git a/innobase/include/ha0ha.h b/innobase/include/ha0ha.h
index bdaecfcc57a..5e3af9c1869 100644
--- a/innobase/include/ha0ha.h
+++ b/innobase/include/ha0ha.h
@@ -54,7 +54,7 @@ ha_create(
/*****************************************************************
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. */
+is inserted. This function is only used in the adaptive hash index. */
ibool
ha_insert_for_fold(
@@ -111,7 +111,6 @@ void
ha_remove_all_nodes_to_page(
/*========================*/
hash_table_t* table, /* in: hash table */
- ulint fold, /* in: fold value */
page_t* page); /* in: buffer page */
/*****************************************************************
Validates a hash table. */
@@ -134,9 +133,18 @@ ha_print_info(
typedef struct ha_node_struct ha_node_t;
struct ha_node_struct {
- ha_node_t* next; /* next chain node or NULL if none */
- void* data; /* pointer to the data */
- ulint fold; /* fold value for the data */
+ ha_node_t* next; /* next chain node; NULL if none */
+ void* data; /* pointer to the data */
+ ulint fold; /* fold value for the data */
+ ha_node_t* next_for_block;/* in an adaptive hash index
+ (btr0sea.c), a doubly linked list of hash
+ nodes for the buffer block; these nodes
+ contain pointers to index records on the
+ page; in the last node this field is NULL;
+ note that we do not use UT_LST_ macros
+ to manipulate this list */
+ ha_node_t* prev_for_block;/* pointer to the previous node; in the
+ first node NULL */
};
#ifndef UNIV_NONINL
diff --git a/innobase/include/hash0hash.h b/innobase/include/hash0hash.h
index 51315e40875..befe8a8d757 100644
--- a/innobase/include/hash0hash.h
+++ b/innobase/include/hash0hash.h
@@ -166,7 +166,7 @@ hash_get_n_cells(
/***********************************************************************
Deletes a struct which is stored in the heap of the hash table, and compacts
the heap. The fold value must be stored in the struct NODE in a field named
-'fold'. */
+'fold'. This macro is only used for the adaptive hash index. */
#define HASH_DELETE_AND_COMPACT(TYPE, NAME, TABLE, NODE)\
do {\
@@ -192,11 +192,23 @@ do {\
\
*(NODE) = *top_node111;\
\
+ /* Update the adaptive hash list of the buffer block that\
+ corresponds to the top node */\
+ if (top_node111->next_for_block != NULL) {\
+ (top_node111->next_for_block)->prev_for_block = NODE;\
+ }\
+\
+ if (top_node111->prev_for_block != NULL) {\
+ (top_node111->prev_for_block)->next_for_block = NODE;\
+ } else {\
+ buf_block_align(top_node111->data)->hash_nodes = NODE;\
+ }\
+\
+ /* Look for the hash pointer to the top node, to update it */\
+\
cell111 = hash_get_nth_cell(TABLE,\
hash_calc_hash(top_node111->fold, TABLE));\
\
- /* Look for the pointer to the top node, to update it */\
-\
if (cell111->node == top_node111) {\
/* The top node is the first in the chain */\
\