Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mariadb
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
b0ab8786
Commit
b0ab8786
authored
Dec 17, 2008
by
marko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
branches/zip: Introduce UNIV_AHI_DEBUG for debugging the adaptive hash
index without enabling UNIV_DEBUG.
parent
fc249aa5
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
64 additions
and
46 deletions
+64
-46
ChangeLog
ChangeLog
+8
-0
btr/btr0sea.c
btr/btr0sea.c
+3
-3
buf/buf0buf.c
buf/buf0buf.c
+3
-1
buf/buf0lru.c
buf/buf0lru.c
+3
-1
ha/ha0ha.c
ha/ha0ha.c
+20
-16
ha/hash0hash.c
ha/hash0hash.c
+2
-2
include/buf0buf.h
include/buf0buf.h
+2
-2
include/ha0ha.h
include/ha0ha.h
+12
-12
include/ha0ha.ic
include/ha0ha.ic
+7
-7
include/hash0hash.h
include/hash0hash.h
+2
-2
include/univ.i
include/univ.i
+2
-0
No files found.
ChangeLog
View file @
b0ab8786
2008-12-17 The InnoDB Team
* include/univ.i, include/buf0buf.h, include/hash0hash.h,
include/ha0ha.h, include/ha0ha.ic, ha/ha0ha.c, ha/hash0hash.c,
btr/btr0sea.c, buf/buf0lru.c, buf/buf0buf.c:
Introduce the preprocessor symbol UNIV_AHI_DEBUG for enabling
adaptive hash index debugging independently of UNIV_DEBUG.
2008-12-02 The InnoDB Team
* row/row0merge.c:
...
...
btr/btr0sea.c
View file @
b0ab8786
...
...
@@ -1102,7 +1102,7 @@ next_rec:
block
->
index
=
NULL
;
cleanup:
#if
def
UNIV_DEBUG
#if
defined UNIV_AHI_DEBUG || defined
UNIV_DEBUG
if
(
UNIV_UNLIKELY
(
block
->
n_pointers
))
{
/* Corruption */
ut_print_timestamp
(
stderr
);
...
...
@@ -1118,9 +1118,9 @@ cleanup:
}
else
{
rw_lock_x_unlock
(
&
btr_search_latch
);
}
#else
/* UNIV_DEBUG */
#else
/* UNIV_
AHI_DEBUG || UNIV_
DEBUG */
rw_lock_x_unlock
(
&
btr_search_latch
);
#endif
/* UNIV_DEBUG */
#endif
/* UNIV_
AHI_DEBUG || UNIV_
DEBUG */
mem_free
(
folds
);
}
...
...
buf/buf0buf.c
View file @
b0ab8786
...
...
@@ -658,8 +658,10 @@ buf_block_init(
block
->
page
.
in_free_list
=
FALSE
;
block
->
page
.
in_LRU_list
=
FALSE
;
block
->
in_unzip_LRU_list
=
FALSE
;
block
->
n_pointers
=
0
;
#endif
/* UNIV_DEBUG */
#if defined UNIV_AHI_DEBUG || defined UNIV_DEBUG
block
->
n_pointers
=
0
;
#endif
/* UNIV_AHI_DEBUG || UNIV_DEBUG */
page_zip_des_init
(
&
block
->
page
.
zip
);
mutex_create
(
&
block
->
mutex
,
SYNC_BUF_BLOCK
);
...
...
buf/buf0lru.c
View file @
b0ab8786
...
...
@@ -1569,7 +1569,9 @@ buf_LRU_block_free_non_file_page(
ut_error
;
}
ut_ad
(
block
->
n_pointers
==
0
);
#if defined UNIV_AHI_DEBUG || defined UNIV_DEBUG
ut_a
(
block
->
n_pointers
==
0
);
#endif
/* UNIV_AHI_DEBUG || UNIV_DEBUG */
ut_ad
(
!
block
->
page
.
in_free_list
);
ut_ad
(
!
block
->
page
.
in_flush_list
);
ut_ad
(
!
block
->
page
.
in_LRU_list
);
...
...
ha/ha0ha.c
View file @
b0ab8786
...
...
@@ -40,9 +40,9 @@ ha_create_func(
table
=
hash_create
(
n
);
#if
def
UNIV_DEBUG
#if
defined UNIV_AHI_DEBUG || defined
UNIV_DEBUG
table
->
adaptive
=
TRUE
;
#endif
/* UNIV_DEBUG */
#endif
/* UNIV_
AHI_DEBUG || UNIV_
DEBUG */
/* Creating MEM_HEAP_BTR_SEARCH type heaps can potentially fail,
but in practise it never should in this case, hence the asserts. */
...
...
@@ -111,9 +111,9 @@ ha_insert_for_fold_func(
the same fold value already exists, it is
updated to point to the same data, and no new
node is created! */
#if
def
UNIV_DEBUG
#if
defined UNIV_AHI_DEBUG || defined
UNIV_DEBUG
buf_block_t
*
block
,
/* in: buffer block containing the data */
#endif
/* UNIV_DEBUG */
#endif
/* UNIV_
AHI_DEBUG || UNIV_
DEBUG */
void
*
data
)
/* in: data, must not be NULL */
{
hash_cell_t
*
cell
;
...
...
@@ -122,7 +122,9 @@ ha_insert_for_fold_func(
ulint
hash
;
ut_ad
(
table
&&
data
);
ut_ad
(
block
->
frame
==
page_align
(
data
));
#if defined UNIV_AHI_DEBUG || defined UNIV_DEBUG
ut_a
(
block
->
frame
==
page_align
(
data
));
#endif
/* UNIV_AHI_DEBUG || UNIV_DEBUG */
ut_ad
(
!
table
->
mutexes
||
mutex_own
(
hash_get_mutex
(
table
,
fold
)));
hash
=
hash_calc_hash
(
fold
,
table
);
...
...
@@ -133,7 +135,7 @@ ha_insert_for_fold_func(
while
(
prev_node
!=
NULL
)
{
if
(
prev_node
->
fold
==
fold
)
{
#if
def
UNIV_DEBUG
#if
defined UNIV_AHI_DEBUG || defined
UNIV_DEBUG
if
(
table
->
adaptive
)
{
buf_block_t
*
prev_block
=
prev_node
->
block
;
ut_a
(
prev_block
->
frame
...
...
@@ -144,7 +146,7 @@ ha_insert_for_fold_func(
}
prev_node
->
block
=
block
;
#endif
/* UNIV_DEBUG */
#endif
/* UNIV_
AHI_DEBUG || UNIV_
DEBUG */
prev_node
->
data
=
data
;
return
(
TRUE
);
...
...
@@ -168,11 +170,11 @@ ha_insert_for_fold_func(
ha_node_set_data
(
node
,
block
,
data
);
#if
def
UNIV_DEBUG
#if
defined UNIV_AHI_DEBUG || defined
UNIV_DEBUG
if
(
table
->
adaptive
)
{
block
->
n_pointers
++
;
}
#endif
/* UNIV_DEBUG */
#endif
/* UNIV_
AHI_DEBUG || UNIV_
DEBUG */
node
->
fold
=
fold
;
node
->
next
=
NULL
;
...
...
@@ -205,13 +207,13 @@ ha_delete_hash_node(
hash_table_t
*
table
,
/* in: hash table */
ha_node_t
*
del_node
)
/* in: node to be deleted */
{
#if
def
UNIV_DEBUG
#if
defined UNIV_AHI_DEBUG || defined
UNIV_DEBUG
if
(
table
->
adaptive
)
{
ut_a
(
del_node
->
block
->
frame
=
page_align
(
del_node
->
data
));
ut_a
(
del_node
->
block
->
n_pointers
>
0
);
del_node
->
block
->
n_pointers
--
;
}
#endif
/* UNIV_DEBUG */
#endif
/* UNIV_
AHI_DEBUG || UNIV_
DEBUG */
HASH_DELETE_AND_COMPACT
(
ha_node_t
,
next
,
table
,
del_node
);
}
...
...
@@ -247,20 +249,22 @@ ha_search_and_update_if_found_func(
hash_table_t
*
table
,
/* in: hash table */
ulint
fold
,
/* in: folded value of the searched data */
void
*
data
,
/* in: pointer to the data */
#if
def
UNIV_DEBUG
#if
defined UNIV_AHI_DEBUG || defined
UNIV_DEBUG
buf_block_t
*
new_block
,
/* in: block containing new_data */
#endif
#endif
/* UNIV_AHI_DEBUG || UNIV_DEBUG */
void
*
new_data
)
/* in: new pointer to the data */
{
ha_node_t
*
node
;
ut_ad
(
!
table
->
mutexes
||
mutex_own
(
hash_get_mutex
(
table
,
fold
)));
ut_ad
(
new_block
->
frame
==
page_align
(
new_data
));
#if defined UNIV_AHI_DEBUG || defined UNIV_DEBUG
ut_a
(
new_block
->
frame
==
page_align
(
new_data
));
#endif
/* UNIV_AHI_DEBUG || UNIV_DEBUG */
node
=
ha_search_with_data
(
table
,
fold
,
data
);
if
(
node
)
{
#if
def
UNIV_DEBUG
#if
defined UNIV_AHI_DEBUG || defined
UNIV_DEBUG
if
(
table
->
adaptive
)
{
ut_a
(
node
->
block
->
n_pointers
>
0
);
node
->
block
->
n_pointers
--
;
...
...
@@ -268,7 +272,7 @@ ha_search_and_update_if_found_func(
}
node
->
block
=
new_block
;
#endif
/* UNIV_DEBUG */
#endif
/* UNIV_
AHI_DEBUG || UNIV_
DEBUG */
node
->
data
=
new_data
;
}
}
...
...
ha/hash0hash.c
View file @
b0ab8786
...
...
@@ -89,9 +89,9 @@ hash_create(
array
=
ut_malloc
(
sizeof
(
hash_cell_t
)
*
prime
);
#if
def
UNIV_DEBUG
#if
defined UNIV_AHI_DEBUG || defined
UNIV_DEBUG
table
->
adaptive
=
FALSE
;
#endif
/* UNIV_DEBUG */
#endif
/* UNIV_
AHI_DEBUG || UNIV_
DEBUG */
table
->
array
=
array
;
table
->
n_cells
=
prime
;
table
->
n_mutexes
=
0
;
...
...
include/buf0buf.h
View file @
b0ab8786
...
...
@@ -1162,11 +1162,11 @@ struct buf_block_struct{
An exception to this is when we init or create a page
in the buffer pool in buf0buf.c. */
#if
def
UNIV_DEBUG
#if
defined UNIV_AHI_DEBUG || defined
UNIV_DEBUG
ulint
n_pointers
;
/* used in debugging: the number of
pointers in the adaptive hash index
pointing to this frame */
#endif
/* UNIV_DEBUG */
#endif
/* UNIV_
AHI_DEBUG || UNIV_
DEBUG */
unsigned
is_hashed
:
1
;
/* TRUE if hash index has already been
built on this page; note that it does
not guarantee that the index is
...
...
include/ha0ha.h
View file @
b0ab8786
...
...
@@ -36,18 +36,18 @@ ha_search_and_update_if_found_func(
hash_table_t
*
table
,
/* in: hash table */
ulint
fold
,
/* in: folded value of the searched data */
void
*
data
,
/* in: pointer to the data */
#if
def
UNIV_DEBUG
#if
defined UNIV_AHI_DEBUG || defined
UNIV_DEBUG
buf_block_t
*
new_block
,
/* in: block containing new_data */
#endif
#endif
/* UNIV_AHI_DEBUG || UNIV_DEBUG */
void
*
new_data
);
/* in: new pointer to the data */
#if
def
UNIV_DEBUG
#if
defined UNIV_AHI_DEBUG || defined
UNIV_DEBUG
# 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)
#else
#else
/* UNIV_AHI_DEBUG || UNIV_DEBUG */
# 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_data)
#endif
#endif
/* UNIV_AHI_DEBUG || UNIV_DEBUG */
/*****************************************************************
Creates a hash table with >= n array cells. The actual number of cells is
chosen to be a prime number slightly bigger than n. */
...
...
@@ -92,16 +92,16 @@ ha_insert_for_fold_func(
the same fold value already exists, it is
updated to point to the same data, and no new
node is created! */
#if
def
UNIV_DEBUG
#if
defined UNIV_AHI_DEBUG || defined
UNIV_DEBUG
buf_block_t
*
block
,
/* in: buffer block containing the data */
#endif
/* UNIV_DEBUG */
#endif
/* UNIV_
AHI_DEBUG || UNIV_
DEBUG */
void
*
data
);
/* in: data, must not be NULL */
#if
def
UNIV_DEBUG
#if
defined UNIV_AHI_DEBUG || defined
UNIV_DEBUG
# define ha_insert_for_fold(t,f,b,d) ha_insert_for_fold_func(t,f,b,d)
#else
#else
/* UNIV_AHI_DEBUG || UNIV_DEBUG */
# define ha_insert_for_fold(t,f,b,d) ha_insert_for_fold_func(t,f,d)
#endif
#endif
/* UNIV_AHI_DEBUG || UNIV_DEBUG */
/*****************************************************************
Deletes an entry from a hash table. */
...
...
@@ -158,9 +158,9 @@ 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 */
#if
def
UNIV_DEBUG
#if
defined UNIV_AHI_DEBUG || defined
UNIV_DEBUG
buf_block_t
*
block
;
/* buffer block containing the data, or NULL */
#endif
/* UNIV_DEBUG */
#endif
/* UNIV_
AHI_DEBUG || UNIV_
DEBUG */
void
*
data
;
/* pointer to the data */
ulint
fold
;
/* fold value for the data */
};
...
...
include/ha0ha.ic
View file @
b0ab8786
...
...
@@ -37,22 +37,22 @@ void
ha_node_set_data_func(
/*==================*/
ha_node_t* node, /* in: hash chain node */
#if
def
UNIV_DEBUG
#if
defined UNIV_AHI_DEBUG || defined
UNIV_DEBUG
buf_block_t* block, /* in: buffer block containing the data */
#endif /* UNIV_DEBUG */
#endif /* UNIV_
AHI_DEBUG || UNIV_
DEBUG */
void* data) /* in: pointer to the data */
{
#if
def
UNIV_DEBUG
#if
defined UNIV_AHI_DEBUG || defined
UNIV_DEBUG
node->block = block;
#endif /* UNIV_DEBUG */
#endif /* UNIV_
AHI_DEBUG || UNIV_
DEBUG */
node->data = data;
}
#if
def
UNIV_DEBUG
#if
defined UNIV_AHI_DEBUG || defined
UNIV_DEBUG
# define ha_node_set_data(n,b,d) ha_node_set_data_func(n,b,d)
#else /* UNIV_DEBUG */
#else /* UNIV_
AHI_DEBUG || UNIV_
DEBUG */
# define ha_node_set_data(n,b,d) ha_node_set_data_func(n,d)
#endif /* UNIV_DEBUG */
#endif /* UNIV_
AHI_DEBUG || UNIV_
DEBUG */
/**********************************************************************
Gets the next node in a hash chain. */
...
...
include/hash0hash.h
View file @
b0ab8786
...
...
@@ -363,10 +363,10 @@ struct hash_cell_struct{
/* The hash table structure */
struct
hash_table_struct
{
#if
def
UNIV_DEBUG
#if
defined UNIV_AHI_DEBUG || defined
UNIV_DEBUG
ibool
adaptive
;
/* TRUE if this is the hash table of the
adaptive hash index */
#endif
/* UNIV_DEBUG */
#endif
/* UNIV_
AHI_DEBUG || UNIV_
DEBUG */
ulint
n_cells
;
/* number of cells in the hash table */
hash_cell_t
*
array
;
/* pointer to cell array */
ulint
n_mutexes
;
/* if mutexes != NULL, then the number of
...
...
include/univ.i
View file @
b0ab8786
...
...
@@ -130,6 +130,8 @@ command. Not tested on Windows. */
Valgrind instrumentation */
#
define
UNIV_DEBUG_PRINT
/* Enable the compilation of
some debug print functions */
#
define
UNIV_AHI_DEBUG
/* Enable adaptive hash index
debugging without UNIV_DEBUG */
#
define
UNIV_BUF_DEBUG
/* Enable buffer pool
debugging without UNIV_DEBUG */
#
define
UNIV_DEBUG
/* Enable ut_ad() assertions
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment