20
20
/*********************************************************************
21
21
Creates and initializes the adaptive search system at a database start. */
24
24
btr_search_sys_create(
25
25
/*==================*/
26
26
ulint hash_size); /* in: hash index hash table size */
28
/************************************************************************
29
Disable the adaptive hash search system and empty the index. */
32
btr_search_disable(void);
33
/*====================*/
34
/************************************************************************
35
Enable the adaptive hash search system. */
38
btr_search_enable(void);
39
/*====================*/
27
41
/************************************************************************
28
42
Returns search info for an index. */
53
67
of the index. Note that if mode is PAGE_CUR_LE, which is used in inserts,
54
68
and the function returns TRUE, then cursor->up_match and cursor->low_match
55
69
both have sensible values. */
58
72
btr_search_guess_on_hash(
59
73
/*=====================*/
60
74
/* out: TRUE if succeeded */
61
75
dict_index_t* index, /* in: index */
62
76
btr_search_t* info, /* in: index search info */
63
dtuple_t* tuple, /* in: logical record */
77
const dtuple_t* tuple, /* in: logical record */
64
78
ulint mode, /* in: PAGE_CUR_L, ... */
65
79
ulint latch_mode, /* in: BTR_SEARCH_LEAF, ... */
66
80
btr_cur_t* cursor, /* out: tree cursor */
73
87
then the hash index for page, if any, is dropped. If new_page is not hashed,
74
88
and page is hashed, then a new hash index is built to new_page with the same
75
89
parameters as page (this often happens when a page is split). */
78
92
btr_search_move_or_delete_hash_entries(
79
93
/*===================================*/
80
page_t* new_page, /* in: records are copied
94
buf_block_t* new_block, /* in: records are copied
82
page_t* page, /* in: index page */
96
buf_block_t* block, /* in: index page from which
97
records were copied, and the
98
copied records will be deleted
83
100
dict_index_t* index); /* in: record descriptor */
84
101
/************************************************************************
85
102
Drops a page hash index. */
88
105
btr_search_drop_page_hash_index(
89
106
/*============================*/
90
page_t* page); /* in: index page, s- or x-latched */
107
buf_block_t* block); /* in: block containing index page,
108
s- or x-latched, or an index page
109
for which we know that
110
block->buf_fix_count == 0 */
91
111
/************************************************************************
92
112
Drops a page hash index when a page is freed from a fseg to the file system.
93
113
Drops possible hash index if the page happens to be in the buffer pool. */
96
116
btr_search_drop_page_hash_when_freed(
97
117
/*=================================*/
98
118
ulint space, /* in: space id */
119
ulint zip_size, /* in: compressed page size in bytes
120
or 0 for uncompressed pages */
99
121
ulint page_no); /* in: page number */
100
122
/************************************************************************
101
123
Updates the page hash index when a single record is inserted on a page. */
104
126
btr_search_update_hash_node_on_insert(
105
127
/*==================================*/
128
150
the record is not yet deleted */
129
151
/************************************************************************
130
152
Validates the search system. */
133
155
btr_search_validate(void);
134
156
/*======================*/
135
157
/* out: TRUE if ok */
159
/* Flag: has the search system been disabled? */
160
extern ibool btr_search_disabled;
137
162
/* The search info struct in an index */
139
164
struct btr_search_struct{
140
165
/* The following fields are not protected by any latch.
141
166
Unfortunately, this means that they must be aligned to
142
167
the machine word, i.e., they cannot be turned into bit-fields. */
143
page_t* root_guess; /* the root page frame when it was last time
168
buf_block_t* root_guess;/* the root page frame when it was last time
144
169
fetched, or NULL */
145
170
ulint hash_analysis; /* when this exceeds BTR_SEARCH_HASH_ANALYSIS,
146
171
the hash analysis starts; this is reset if no