~drizzle-trunk/drizzle/development

1 by brian
clean slate
1
/************************************************************************
2
The index tree adaptive search
3
4
(c) 1996 Innobase Oy
5
6
Created 2/17/1996 Heikki Tuuri
7
*************************************************************************/
8
9
#include "dict0mem.h"
10
#include "btr0cur.h"
11
#include "buf0buf.h"
12
13
/*************************************************************************
14
Updates the search info. */
15
16
void
17
btr_search_info_update_slow(
18
/*========================*/
19
	btr_search_t*	info,	/* in/out: search info */
20
	btr_cur_t*	cursor);/* in: cursor which was just positioned */
21
22
/************************************************************************
23
Returns search info for an index. */
24
UNIV_INLINE
25
btr_search_t*
26
btr_search_get_info(
27
/*================*/
28
				/* out: search info; search mutex reserved */
29
	dict_index_t*	index)	/* in: index */
30
{
31
	ut_ad(index);
32
33
	return(index->search_info);
34
}
35
36
/*************************************************************************
37
Updates the search info. */
38
UNIV_INLINE
39
void
40
btr_search_info_update(
41
/*===================*/
42
	dict_index_t*	index,	/* in: index of the cursor */
43
	btr_cur_t*	cursor)	/* in: cursor which was just positioned */
44
{
45
	btr_search_t*	info;
46
47
#ifdef UNIV_SYNC_DEBUG
48
	ut_ad(!rw_lock_own(&btr_search_latch, RW_LOCK_SHARED));
49
	ut_ad(!rw_lock_own(&btr_search_latch, RW_LOCK_EX));
50
#endif /* UNIV_SYNC_DEBUG */
51
52
	info = btr_search_get_info(index);
53
54
	info->hash_analysis++;
55
56
	if (info->hash_analysis < BTR_SEARCH_HASH_ANALYSIS) {
57
58
		/* Do nothing */
59
60
		return;
61
62
	}
63
64
	ut_ad(cursor->flag != BTR_CUR_HASH);
65
66
	btr_search_info_update_slow(info, cursor);
67
}