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
7f030634
Commit
7f030634
authored
Aug 15, 2011
by
Marko Mäkelä
Browse files
Options
Browse Files
Download
Plain Diff
Merge mysql-5.1 to mysql-5.5. Add a test case.
parents
84db3fb4
669ff037
Changes
13
Show whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
247 additions
and
95 deletions
+247
-95
mysql-test/suite/innodb/r/innodb_bug59733.result
mysql-test/suite/innodb/r/innodb_bug59733.result
+18
-0
mysql-test/suite/innodb/t/innodb_bug59733.test
mysql-test/suite/innodb/t/innodb_bug59733.test
+53
-0
storage/innobase/btr/btr0btr.c
storage/innobase/btr/btr0btr.c
+64
-36
storage/innobase/btr/btr0cur.c
storage/innobase/btr/btr0cur.c
+20
-14
storage/innobase/btr/btr0pcur.c
storage/innobase/btr/btr0pcur.c
+7
-4
storage/innobase/btr/btr0sea.c
storage/innobase/btr/btr0sea.c
+2
-1
storage/innobase/dict/dict0crea.c
storage/innobase/dict/dict0crea.c
+2
-2
storage/innobase/dict/dict0dict.c
storage/innobase/dict/dict0dict.c
+3
-2
storage/innobase/ibuf/ibuf0ibuf.c
storage/innobase/ibuf/ibuf0ibuf.c
+23
-11
storage/innobase/include/btr0btr.h
storage/innobase/include/btr0btr.h
+25
-7
storage/innobase/include/btr0btr.ic
storage/innobase/include/btr0btr.ic
+8
-2
storage/innobase/include/sync0sync.h
storage/innobase/include/sync0sync.h
+4
-5
storage/innobase/sync/sync0sync.c
storage/innobase/sync/sync0sync.c
+18
-11
No files found.
mysql-test/suite/innodb/r/innodb_bug59733.result
0 → 100644
View file @
7f030634
CREATE TABLE bug59733(a INT AUTO_INCREMENT PRIMARY KEY,b CHAR(1))ENGINE=InnoDB;
INSERT INTO bug59733 VALUES(0,'x');
INSERT INTO bug59733 SELECT 0,b FROM bug59733;
INSERT INTO bug59733 SELECT 0,b FROM bug59733;
INSERT INTO bug59733 SELECT 0,b FROM bug59733;
INSERT INTO bug59733 SELECT 0,b FROM bug59733;
INSERT INTO bug59733 SELECT 0,b FROM bug59733;
INSERT INTO bug59733 SELECT 0,b FROM bug59733;
INSERT INTO bug59733 SELECT 0,b FROM bug59733;
INSERT INTO bug59733 SELECT 0,b FROM bug59733;
INSERT INTO bug59733 SELECT 0,b FROM bug59733;
INSERT INTO bug59733 SELECT 0,b FROM bug59733;
INSERT INTO bug59733 SELECT 0,b FROM bug59733;
CREATE INDEX b ON bug59733 (b);
DELETE FROM bug59733 WHERE (a%100)=0;
DROP INDEX b ON bug59733;
CREATE INDEX b ON bug59733 (b);
DROP TABLE bug59733;
mysql-test/suite/innodb/t/innodb_bug59733.test
0 → 100644
View file @
7f030634
#
# Bug #59733 Possible deadlock when buffered changes are to be discarded
# in buf_page_create
#
--
source
include
/
have_innodb
.
inc
--
disable_query_log
# The flag innodb_change_buffering_debug is only available in debug builds.
# It instructs InnoDB to try to evict pages from the buffer pool when
# change buffering is possible, so that the change buffer will be used
# whenever possible.
--
error
0
,
ER_UNKNOWN_SYSTEM_VARIABLE
SET
@
innodb_change_buffering_debug_orig
=
@@
innodb_change_buffering_debug
;
--
error
0
,
ER_UNKNOWN_SYSTEM_VARIABLE
SET
GLOBAL
innodb_change_buffering_debug
=
1
;
--
enable_query_log
CREATE
TABLE
bug59733
(
a
INT
AUTO_INCREMENT
PRIMARY
KEY
,
b
CHAR
(
1
))
ENGINE
=
InnoDB
;
# Create enough rows for the table, so that the insert buffer will be
# used. There must be multiple index pages, because changes to the
# root page are never buffered.
INSERT
INTO
bug59733
VALUES
(
0
,
'x'
);
INSERT
INTO
bug59733
SELECT
0
,
b
FROM
bug59733
;
INSERT
INTO
bug59733
SELECT
0
,
b
FROM
bug59733
;
INSERT
INTO
bug59733
SELECT
0
,
b
FROM
bug59733
;
INSERT
INTO
bug59733
SELECT
0
,
b
FROM
bug59733
;
INSERT
INTO
bug59733
SELECT
0
,
b
FROM
bug59733
;
INSERT
INTO
bug59733
SELECT
0
,
b
FROM
bug59733
;
INSERT
INTO
bug59733
SELECT
0
,
b
FROM
bug59733
;
INSERT
INTO
bug59733
SELECT
0
,
b
FROM
bug59733
;
INSERT
INTO
bug59733
SELECT
0
,
b
FROM
bug59733
;
INSERT
INTO
bug59733
SELECT
0
,
b
FROM
bug59733
;
INSERT
INTO
bug59733
SELECT
0
,
b
FROM
bug59733
;
# Create the secondary index for which changes will be buffered.
CREATE
INDEX
b
ON
bug59733
(
b
);
# This should be buffered, if innodb_change_buffering_debug = 1 is in effect.
DELETE
FROM
bug59733
WHERE
(
a
%
100
)
=
0
;
# Drop the index in order to get free pages with orphaned buffered changes.
DROP
INDEX
b
ON
bug59733
;
# Create the index and attempt to reuse pages for which buffered changes exist.
CREATE
INDEX
b
ON
bug59733
(
b
);
DROP
TABLE
bug59733
;
--
disable_query_log
--
error
0
,
ER_UNKNOWN_SYSTEM_VARIABLE
SET
GLOBAL
innodb_change_buffering_debug
=
@
innodb_change_buffering_debug_orig
;
storage/innobase/btr/btr0btr.c
View file @
7f030634
...
...
@@ -690,7 +690,8 @@ btr_root_block_get(
zip_size
=
dict_table_zip_size
(
index
->
table
);
root_page_no
=
dict_index_get_page
(
index
);
block
=
btr_block_get
(
space
,
zip_size
,
root_page_no
,
RW_X_LATCH
,
mtr
);
block
=
btr_block_get
(
space
,
zip_size
,
root_page_no
,
RW_X_LATCH
,
index
,
mtr
);
ut_a
((
ibool
)
!!
page_is_comp
(
buf_block_get_frame
(
block
))
==
dict_table_is_comp
(
index
->
table
));
#ifdef UNIV_BTR_DEBUG
...
...
@@ -891,7 +892,7 @@ btr_page_alloc_for_ibuf(
dict_table_zip_size
(
index
->
table
),
node_addr
.
page
,
RW_X_LATCH
,
mtr
);
new_page
=
buf_block_get_frame
(
new_block
);
buf_block_dbg_add_level
(
new_block
,
SYNC_TREE_NODE_NEW
);
buf_block_dbg_add_level
(
new_block
,
SYNC_
IBUF_
TREE_NODE_NEW
);
flst_remove
(
root
+
PAGE_HEADER
+
PAGE_BTR_IBUF_FREE_LIST
,
new_page
+
PAGE_HEADER
+
PAGE_BTR_IBUF_FREE_LIST_NODE
,
...
...
@@ -1139,7 +1140,7 @@ btr_node_ptr_get_child(
page_no
=
btr_node_ptr_get_child_page_no
(
node_ptr
,
offsets
);
return
(
btr_block_get
(
space
,
dict_table_zip_size
(
index
->
table
),
page_no
,
RW_X_LATCH
,
mtr
));
page_no
,
RW_X_LATCH
,
index
,
mtr
));
}
/************************************************************//**
...
...
@@ -1312,7 +1313,8 @@ btr_create(
space
,
0
,
IBUF_HEADER
+
IBUF_TREE_SEG_HEADER
,
mtr
);
buf_block_dbg_add_level
(
ibuf_hdr_block
,
SYNC_TREE_NODE_NEW
);
buf_block_dbg_add_level
(
ibuf_hdr_block
,
SYNC_IBUF_TREE_NODE_NEW
);
ut_ad
(
buf_block_get_page_no
(
ibuf_hdr_block
)
==
IBUF_HEADER_PAGE_NO
);
...
...
@@ -1350,10 +1352,9 @@ btr_create(
page_no
=
buf_block_get_page_no
(
block
);
frame
=
buf_block_get_frame
(
block
);
buf_block_dbg_add_level
(
block
,
SYNC_TREE_NODE_NEW
);
if
(
type
&
DICT_IBUF
)
{
/* It is an insert buffer tree: initialize the free list */
buf_block_dbg_add_level
(
block
,
SYNC_IBUF_TREE_NODE_NEW
);
ut_ad
(
page_no
==
IBUF_TREE_ROOT_PAGE_NO
);
...
...
@@ -1361,6 +1362,8 @@ btr_create(
}
else
{
/* It is a non-ibuf tree: create a file segment for leaf
pages */
buf_block_dbg_add_level
(
block
,
SYNC_TREE_NODE_NEW
);
if
(
!
fseg_create
(
space
,
page_no
,
PAGE_HEADER
+
PAGE_BTR_SEG_LEAF
,
mtr
))
{
/* Not enough space for new segment, free root
...
...
@@ -1432,7 +1435,8 @@ btr_free_but_not_root(
leaf_loop:
mtr_start
(
&
mtr
);
root
=
btr_page_get
(
space
,
zip_size
,
root_page_no
,
RW_X_LATCH
,
&
mtr
);
root
=
btr_page_get
(
space
,
zip_size
,
root_page_no
,
RW_X_LATCH
,
NULL
,
&
mtr
);
#ifdef UNIV_BTR_DEBUG
ut_a
(
btr_root_fseg_validate
(
FIL_PAGE_DATA
+
PAGE_BTR_SEG_LEAF
+
root
,
space
));
...
...
@@ -1454,7 +1458,8 @@ leaf_loop:
top_loop:
mtr_start
(
&
mtr
);
root
=
btr_page_get
(
space
,
zip_size
,
root_page_no
,
RW_X_LATCH
,
&
mtr
);
root
=
btr_page_get
(
space
,
zip_size
,
root_page_no
,
RW_X_LATCH
,
NULL
,
&
mtr
);
#ifdef UNIV_BTR_DEBUG
ut_a
(
btr_root_fseg_validate
(
FIL_PAGE_DATA
+
PAGE_BTR_SEG_TOP
+
root
,
space
));
...
...
@@ -1480,13 +1485,13 @@ btr_free_root(
ulint
zip_size
,
/*!< in: compressed page size in bytes
or 0 for uncompressed pages */
ulint
root_page_no
,
/*!< in: root page number */
mtr_t
*
mtr
)
/*!< in: a mini-transaction which has already
been started */
mtr_t
*
mtr
)
/*!< in/out: mini-transaction */
{
buf_block_t
*
block
;
fseg_header_t
*
header
;
block
=
btr_block_get
(
space
,
zip_size
,
root_page_no
,
RW_X_LATCH
,
mtr
);
block
=
btr_block_get
(
space
,
zip_size
,
root_page_no
,
RW_X_LATCH
,
NULL
,
mtr
);
btr_search_drop_page_hash_index
(
block
);
...
...
@@ -2365,9 +2370,8 @@ btr_attach_half_pages(
/* Update page links of the level */
if
(
prev_page_no
!=
FIL_NULL
)
{
buf_block_t
*
prev_block
=
btr_block_get
(
space
,
zip_size
,
prev_page_no
,
RW_X_LATCH
,
mtr
);
buf_block_t
*
prev_block
=
btr_block_get
(
space
,
zip_size
,
prev_page_no
,
RW_X_LATCH
,
index
,
mtr
);
#ifdef UNIV_BTR_DEBUG
ut_a
(
page_is_comp
(
prev_block
->
frame
)
==
page_is_comp
(
page
));
ut_a
(
btr_page_get_next
(
prev_block
->
frame
,
mtr
)
...
...
@@ -2380,9 +2384,8 @@ btr_attach_half_pages(
}
if
(
next_page_no
!=
FIL_NULL
)
{
buf_block_t
*
next_block
=
btr_block_get
(
space
,
zip_size
,
next_page_no
,
RW_X_LATCH
,
mtr
);
buf_block_t
*
next_block
=
btr_block_get
(
space
,
zip_size
,
next_page_no
,
RW_X_LATCH
,
index
,
mtr
);
#ifdef UNIV_BTR_DEBUG
ut_a
(
page_is_comp
(
next_block
->
frame
)
==
page_is_comp
(
page
));
ut_a
(
btr_page_get_prev
(
next_block
->
frame
,
mtr
)
...
...
@@ -2804,17 +2807,42 @@ func_exit:
return
(
rec
);
}
#ifdef UNIV_SYNC_DEBUG
/*************************************************************//**
Removes a page from the level list of pages.
@param space in: space where removed
@param zip_size in: compressed page size in bytes, or 0 for uncompressed
@param page in/out: page to remove
@param index in: index tree
@param mtr in/out: mini-transaction */
# define btr_level_list_remove(space,zip_size,page,index,mtr) \
btr_level_list_remove_func(space,zip_size,page,index,mtr)
#else
/* UNIV_SYNC_DEBUG */
/*************************************************************//**
Removes a page from the level list of pages.
@param space in: space where removed
@param zip_size in: compressed page size in bytes, or 0 for uncompressed
@param page in/out: page to remove
@param index in: index tree
@param mtr in/out: mini-transaction */
# define btr_level_list_remove(space,zip_size,page,index,mtr) \
btr_level_list_remove_func(space,zip_size,page,mtr)
#endif
/* UNIV_SYNC_DEBUG */
/*************************************************************//**
Removes a page from the level list of pages. */
static
static
__attribute__
((
nonnull
))
void
btr_level_list_remove
(
/*==================*/
btr_level_list_remove
_func
(
/*==================
=====
*/
ulint
space
,
/*!< in: space where removed */
ulint
zip_size
,
/*!< in: compressed page size in bytes
or 0 for uncompressed pages */
page_t
*
page
,
/*!< in: page to remove */
mtr_t
*
mtr
)
/*!< in: mtr */
page_t
*
page
,
/*!< in/out: page to remove */
#ifdef UNIV_SYNC_DEBUG
const
dict_index_t
*
index
,
/*!< in: index tree */
#endif
/* UNIV_SYNC_DEBUG */
mtr_t
*
mtr
)
/*!< in/out: mini-transaction */
{
ulint
prev_page_no
;
ulint
next_page_no
;
...
...
@@ -2832,7 +2860,7 @@ btr_level_list_remove(
if
(
prev_page_no
!=
FIL_NULL
)
{
buf_block_t
*
prev_block
=
btr_block_get
(
space
,
zip_size
,
prev_page_no
,
RW_X_LATCH
,
mtr
);
RW_X_LATCH
,
index
,
mtr
);
page_t
*
prev_page
=
buf_block_get_frame
(
prev_block
);
#ifdef UNIV_BTR_DEBUG
...
...
@@ -2849,7 +2877,7 @@ btr_level_list_remove(
if
(
next_page_no
!=
FIL_NULL
)
{
buf_block_t
*
next_block
=
btr_block_get
(
space
,
zip_size
,
next_page_no
,
RW_X_LATCH
,
mtr
);
RW_X_LATCH
,
index
,
mtr
);
page_t
*
next_page
=
buf_block_get_frame
(
next_block
);
#ifdef UNIV_BTR_DEBUG
...
...
@@ -3175,7 +3203,7 @@ btr_compress(
if
(
is_left
)
{
merge_block
=
btr_block_get
(
space
,
zip_size
,
left_page_no
,
RW_X_LATCH
,
mtr
);
RW_X_LATCH
,
index
,
mtr
);
merge_page
=
buf_block_get_frame
(
merge_block
);
#ifdef UNIV_BTR_DEBUG
ut_a
(
btr_page_get_next
(
merge_page
,
mtr
)
...
...
@@ -3184,7 +3212,7 @@ btr_compress(
}
else
if
(
right_page_no
!=
FIL_NULL
)
{
merge_block
=
btr_block_get
(
space
,
zip_size
,
right_page_no
,
RW_X_LATCH
,
mtr
);
RW_X_LATCH
,
index
,
mtr
);
merge_page
=
buf_block_get_frame
(
merge_block
);
#ifdef UNIV_BTR_DEBUG
ut_a
(
btr_page_get_prev
(
merge_page
,
mtr
)
...
...
@@ -3273,7 +3301,7 @@ err_exit:
btr_search_drop_page_hash_index
(
block
);
/* Remove the page from the level list */
btr_level_list_remove
(
space
,
zip_size
,
page
,
mtr
);
btr_level_list_remove
(
space
,
zip_size
,
page
,
index
,
mtr
);
btr_node_ptr_delete
(
index
,
block
,
mtr
);
lock_update_merge_left
(
merge_block
,
orig_pred
,
block
);
...
...
@@ -3330,7 +3358,7 @@ err_exit:
#endif
/* UNIV_BTR_DEBUG */
/* Remove the page from the level list */
btr_level_list_remove
(
space
,
zip_size
,
page
,
mtr
);
btr_level_list_remove
(
space
,
zip_size
,
page
,
index
,
mtr
);
/* Replace the address of the old child node (= page) with the
address of the merge page to the right */
...
...
@@ -3522,7 +3550,7 @@ btr_discard_page(
if
(
left_page_no
!=
FIL_NULL
)
{
merge_block
=
btr_block_get
(
space
,
zip_size
,
left_page_no
,
RW_X_LATCH
,
mtr
);
RW_X_LATCH
,
index
,
mtr
);
merge_page
=
buf_block_get_frame
(
merge_block
);
#ifdef UNIV_BTR_DEBUG
ut_a
(
btr_page_get_next
(
merge_page
,
mtr
)
...
...
@@ -3530,7 +3558,7 @@ btr_discard_page(
#endif
/* UNIV_BTR_DEBUG */
}
else
if
(
right_page_no
!=
FIL_NULL
)
{
merge_block
=
btr_block_get
(
space
,
zip_size
,
right_page_no
,
RW_X_LATCH
,
mtr
);
RW_X_LATCH
,
index
,
mtr
);
merge_page
=
buf_block_get_frame
(
merge_block
);
#ifdef UNIV_BTR_DEBUG
ut_a
(
btr_page_get_prev
(
merge_page
,
mtr
)
...
...
@@ -3565,7 +3593,7 @@ btr_discard_page(
btr_node_ptr_delete
(
index
,
block
,
mtr
);
/* Remove the page from the level list */
btr_level_list_remove
(
space
,
zip_size
,
page
,
mtr
);
btr_level_list_remove
(
space
,
zip_size
,
page
,
index
,
mtr
);
#ifdef UNIV_ZIP_DEBUG
{
page_zip_des_t
*
merge_page_zip
...
...
@@ -4083,7 +4111,7 @@ loop:
if
(
right_page_no
!=
FIL_NULL
)
{
const
rec_t
*
right_rec
;
right_block
=
btr_block_get
(
space
,
zip_size
,
right_page_no
,
RW_X_LATCH
,
&
mtr
);
RW_X_LATCH
,
index
,
&
mtr
);
right_page
=
buf_block_get_frame
(
right_block
);
if
(
UNIV_UNLIKELY
(
btr_page_get_prev
(
right_page
,
&
mtr
)
!=
page_get_page_no
(
page
)))
{
...
...
@@ -4309,7 +4337,7 @@ node_ptr_fails:
mtr_start
(
&
mtr
);
block
=
btr_block_get
(
space
,
zip_size
,
right_page_no
,
RW_X_LATCH
,
&
mtr
);
RW_X_LATCH
,
index
,
&
mtr
);
page
=
buf_block_get_frame
(
block
);
goto
loop
;
...
...
storage/innobase/btr/btr0cur.c
View file @
7f030634
...
...
@@ -249,7 +249,8 @@ btr_cur_latch_leaves(
case
BTR_SEARCH_LEAF
:
case
BTR_MODIFY_LEAF
:
mode
=
latch_mode
==
BTR_SEARCH_LEAF
?
RW_S_LATCH
:
RW_X_LATCH
;
get_block
=
btr_block_get
(
space
,
zip_size
,
page_no
,
mode
,
mtr
);
get_block
=
btr_block_get
(
space
,
zip_size
,
page_no
,
mode
,
cursor
->
index
,
mtr
);
#ifdef UNIV_BTR_DEBUG
ut_a
(
page_is_comp
(
get_block
->
frame
)
==
page_is_comp
(
page
));
#endif
/* UNIV_BTR_DEBUG */
...
...
@@ -260,9 +261,9 @@ btr_cur_latch_leaves(
left_page_no
=
btr_page_get_prev
(
page
,
mtr
);
if
(
left_page_no
!=
FIL_NULL
)
{
get_block
=
btr_block_get
(
space
,
zip_size
,
left_page_no
,
RW_X_LATCH
,
mtr
);
get_block
=
btr_block_get
(
space
,
zip_size
,
left_page_no
,
RW_X_LATCH
,
cursor
->
index
,
mtr
);
#ifdef UNIV_BTR_DEBUG
ut_a
(
page_is_comp
(
get_block
->
frame
)
==
page_is_comp
(
page
));
...
...
@@ -272,8 +273,9 @@ btr_cur_latch_leaves(
get_block
->
check_index_page_at_flush
=
TRUE
;
}
get_block
=
btr_block_get
(
space
,
zip_size
,
page_no
,
RW_X_LATCH
,
mtr
);
get_block
=
btr_block_get
(
space
,
zip_size
,
page_no
,
RW_X_LATCH
,
cursor
->
index
,
mtr
);
#ifdef UNIV_BTR_DEBUG
ut_a
(
page_is_comp
(
get_block
->
frame
)
==
page_is_comp
(
page
));
#endif
/* UNIV_BTR_DEBUG */
...
...
@@ -282,9 +284,9 @@ btr_cur_latch_leaves(
right_page_no
=
btr_page_get_next
(
page
,
mtr
);
if
(
right_page_no
!=
FIL_NULL
)
{
get_block
=
btr_block_get
(
space
,
zip_size
,
right_page_no
,
RW_X_LATCH
,
mtr
);
get_block
=
btr_block_get
(
space
,
zip_size
,
right_page_no
,
RW_X_LATCH
,
cursor
->
index
,
mtr
);
#ifdef UNIV_BTR_DEBUG
ut_a
(
page_is_comp
(
get_block
->
frame
)
==
page_is_comp
(
page
));
...
...
@@ -303,8 +305,9 @@ btr_cur_latch_leaves(
left_page_no
=
btr_page_get_prev
(
page
,
mtr
);
if
(
left_page_no
!=
FIL_NULL
)
{
get_block
=
btr_block_get
(
space
,
zip_size
,
left_page_no
,
mode
,
mtr
);
get_block
=
btr_block_get
(
space
,
zip_size
,
left_page_no
,
mode
,
cursor
->
index
,
mtr
);
cursor
->
left_block
=
get_block
;
#ifdef UNIV_BTR_DEBUG
ut_a
(
page_is_comp
(
get_block
->
frame
)
...
...
@@ -315,7 +318,8 @@ btr_cur_latch_leaves(
get_block
->
check_index_page_at_flush
=
TRUE
;
}
get_block
=
btr_block_get
(
space
,
zip_size
,
page_no
,
mode
,
mtr
);
get_block
=
btr_block_get
(
space
,
zip_size
,
page_no
,
mode
,
cursor
->
index
,
mtr
);
#ifdef UNIV_BTR_DEBUG
ut_a
(
page_is_comp
(
get_block
->
frame
)
==
page_is_comp
(
page
));
#endif
/* UNIV_BTR_DEBUG */
...
...
@@ -669,7 +673,9 @@ retry_page_get:
ut_a
(
!
page_zip
||
page_zip_validate
(
page_zip
,
page
));
#endif
/* UNIV_ZIP_DEBUG */
buf_block_dbg_add_level
(
block
,
SYNC_TREE_NODE
);
buf_block_dbg_add_level
(
block
,
dict_index_is_ibuf
(
index
)
?
SYNC_IBUF_TREE_NODE
:
SYNC_TREE_NODE
);
}
ut_ad
(
index
->
id
==
btr_page_get_index_id
(
page
));
...
...
@@ -767,7 +773,7 @@ retry_page_get:
if
(
level
!=
0
)
{
/* x-latch the page */
page
=
btr_page_get
(
space
,
zip_size
,
page_no
,
RW_X_LATCH
,
mtr
);
space
,
zip_size
,
page_no
,
RW_X_LATCH
,
index
,
mtr
);
ut_a
((
ibool
)
!!
page_is_comp
(
page
)
==
dict_table_is_comp
(
index
->
table
));
...
...
storage/innobase/btr/btr0pcur.c
View file @
7f030634
/*****************************************************************************
Copyright (c) 1996, 201
0, Innobase Oy
. All Rights Reserved.
Copyright (c) 1996, 201
1, Oracle and/or its affiliates
. All Rights Reserved.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
...
...
@@ -266,8 +266,10 @@ btr_pcur_restore_position_func(
file
,
line
,
mtr
)))
{
cursor
->
pos_state
=
BTR_PCUR_IS_POSITIONED
;
buf_block_dbg_add_level
(
btr_pcur_get_block
(
cursor
),
SYNC_TREE_NODE
);
buf_block_dbg_add_level
(
btr_pcur_get_block
(
cursor
),
dict_index_is_ibuf
(
index
)
?
SYNC_IBUF_TREE_NODE
:
SYNC_TREE_NODE
);
if
(
cursor
->
rel_pos
==
BTR_PCUR_ON
)
{
#ifdef UNIV_DEBUG
...
...
@@ -417,7 +419,8 @@ btr_pcur_move_to_next_page(
ut_ad
(
next_page_no
!=
FIL_NULL
);
next_block
=
btr_block_get
(
space
,
zip_size
,
next_page_no
,
cursor
->
latch_mode
,
mtr
);
cursor
->
latch_mode
,
btr_pcur_get_btr_cur
(
cursor
)
->
index
,
mtr
);
next_page
=
buf_block_get_frame
(
next_block
);
#ifdef UNIV_BTR_DEBUG
ut_a
(
page_is_comp
(
next_page
)
==
page_is_comp
(
page
));
...
...
storage/innobase/btr/btr0sea.c
View file @
7f030634
/*****************************************************************************
Copyright (c) 1996, 20
09, Innobase Oy
. All Rights Reserved.
Copyright (c) 1996, 20
11, Oracle and/or its affiliates
. All Rights Reserved.
Copyright (c) 2008, Google Inc.
Portions of this file contain modifications contributed and copyrighted by
...
...
@@ -845,6 +845,7 @@ btr_search_guess_on_hash(
btr_pcur_t
pcur
;
#endif
ut_ad
(
index
&&
info
&&
tuple
&&
cursor
&&
mtr
);
ut_ad
(
!
dict_index_is_ibuf
(
index
));
ut_ad
((
latch_mode
==
BTR_SEARCH_LEAF
)
||
(
latch_mode
==
BTR_MODIFY_LEAF
));
...
...
storage/innobase/dict/dict0crea.c
View file @
7f030634
/*****************************************************************************
Copyright (c) 1996, 201
0, Innobase Oy
. All Rights Reserved.
Copyright (c) 1996, 201
1, Oracle and/or its affiliates
. All Rights Reserved.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
...
...
@@ -827,7 +827,7 @@ dict_truncate_index_tree(
appropriate field in the SYS_INDEXES record: this mini-transaction
marks the B-tree totally truncated */
btr_block_get
(
space
,
zip_size
,
root_page_no
,
RW_X_LATCH
,
mtr
);
btr_block_get
(
space
,
zip_size
,
root_page_no
,
RW_X_LATCH
,
NULL
,
mtr
);
btr_free_root
(
space
,
zip_size
,
root_page_no
,
mtr
);
create:
...
...
storage/innobase/dict/dict0dict.c
View file @
7f030634
/*****************************************************************************
Copyright (c) 1996, 201
0, Innobase Oy
. All Rights Reserved.
Copyright (c) 1996, 201
1, Oracle and/or its affiliates
. All Rights Reserved.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
...
...
@@ -1714,7 +1714,8 @@ undo_size_ok:
new_index
->
page
=
page_no
;
rw_lock_create
(
index_tree_rw_lock_key
,
&
new_index
->
lock
,
SYNC_INDEX_TREE
);
dict_index_is_ibuf
(
index
)
?
SYNC_IBUF_INDEX_TREE
:
SYNC_INDEX_TREE
);
if
(
!
UNIV_UNLIKELY
(
new_index
->
type
&
DICT_UNIVERSAL
))
{
...
...
storage/innobase/ibuf/ibuf0ibuf.c
View file @
7f030634
/*****************************************************************************
Copyright (c) 1997, 201
0, Innobase Oy
. All Rights Reserved.
Copyright (c) 1997, 201
1, Oracle and/or its affiliates
. All Rights Reserved.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
...
...
@@ -402,7 +402,7 @@ ibuf_tree_root_get(
block
=
buf_page_get
(
IBUF_SPACE_ID
,
0
,
FSP_IBUF_TREE_ROOT_PAGE_NO
,
RW_X_LATCH
,
mtr
);
buf_block_dbg_add_level
(
block
,
SYNC_
TREE_NODE
);
buf_block_dbg_add_level
(
block
,
SYNC_
IBUF_TREE_NODE_NEW
);
root
=
buf_block_get_frame
(
block
);
...
...
@@ -549,7 +549,7 @@ ibuf_init_at_db_start(void)
block
=
buf_page_get
(
IBUF_SPACE_ID
,
0
,
FSP_IBUF_TREE_ROOT_PAGE_NO
,
RW_X_LATCH
,
&
mtr
);
buf_block_dbg_add_level
(
block
,
SYNC_TREE_NODE
);
buf_block_dbg_add_level
(
block
,
SYNC_
IBUF_
TREE_NODE
);
root
=
buf_block_get_frame
(
block
);
}
...
...
@@ -2209,7 +2209,8 @@ ibuf_add_free_page(void)
}
else
{
buf_block_t
*
block
=
buf_page_get
(
IBUF_SPACE_ID
,
0
,
page_no
,
RW_X_LATCH
,
&
mtr
);
buf_block_dbg_add_level
(
block
,
SYNC_TREE_NODE_NEW
);
buf_block_dbg_add_level
(
block
,
SYNC_IBUF_TREE_NODE_NEW
);
page
=
buf_block_get_frame
(
block
);
}
...
...
@@ -2332,8 +2333,7 @@ ibuf_remove_free_page(void)
block
=
buf_page_get
(
IBUF_SPACE_ID
,
0
,
page_no
,
RW_X_LATCH
,
&
mtr
);
buf_block_dbg_add_level
(
block
,
SYNC_TREE_NODE
);
buf_block_dbg_add_level
(
block
,
SYNC_IBUF_TREE_NODE
);
page
=
buf_block_get_frame
(
block
);
}
...
...
@@ -3022,7 +3022,7 @@ ibuf_get_volume_buffered(
IBUF_SPACE_ID
,
0
,
prev_page_no
,
RW_X_LATCH
,
mtr
);
buf_block_dbg_add_level
(
block
,
SYNC_TREE_NODE
);
buf_block_dbg_add_level
(
block
,
SYNC_
IBUF_
TREE_NODE
);
prev_page
=
buf_block_get_frame
(
block
);
...
...
@@ -3095,7 +3095,7 @@ count_later:
IBUF_SPACE_ID
,
0
,
next_page_no
,
RW_X_LATCH
,
mtr
);
buf_block_dbg_add_level
(
block
,
SYNC_TREE_NODE
);
buf_block_dbg_add_level
(
block
,
SYNC_
IBUF_
TREE_NODE
);
next_page
=
buf_block_get_frame
(
block
);
...
...
@@ -3333,7 +3333,7 @@ ibuf_set_entry_counter(
IBUF_SPACE_ID
,
0
,
prev_page_no
,
RW_X_LATCH
,
mtr
);
buf_block_dbg_add_level
(
block
,
SYNC_TREE_NODE
);
buf_block_dbg_add_level
(
block
,
SYNC_
IBUF_
TREE_NODE
);
prev_page
=
buf_block_get_frame
(
block
);
...
...
@@ -4419,6 +4419,7 @@ ibuf_merge_or_delete_for_page(
ut_ad
(
!
block
||
buf_block_get_space
(
block
)
==
space
);
ut_ad
(
!
block
||
buf_block_get_page_no
(
block
)
==
page_no
);
ut_ad
(
!
block
||
buf_block_get_zip_size
(
block
)
==
zip_size
);
ut_ad
(
!
block
||
buf_block_get_io_fix
(
block
)
==
BUF_IO_READ
);
if
(
srv_force_recovery
>=
SRV_FORCE_NO_IBUF_MERGE
||
trx_sys_hdr_page
(
space
,
page_no
))
{
...
...
@@ -4571,7 +4572,13 @@ loop:
ut_a
(
success
);
buf_block_dbg_add_level
(
block
,
SYNC_TREE_NODE
);
/* This is a user page (secondary index leaf page),
but we pretend that it is a change buffer page in
order to obey the latching order. This should be OK,
because buffered changes are applied immediately while
the block is io-fixed. Other threads must not try to
latch an io-fixed block. */
buf_block_dbg_add_level
(
block
,
SYNC_IBUF_TREE_NODE
);
}
/* Position pcur in the insert buffer at the first entry for this
...
...
@@ -4675,7 +4682,12 @@ loop:
__FILE__
,
__LINE__
,
&
mtr
);
ut_a
(
success
);
buf_block_dbg_add_level
(
block
,
SYNC_TREE_NODE
);
/* This is a user page (secondary
index leaf page), but it should be OK
to use too low latching order for it,
as the block is io-fixed. */
buf_block_dbg_add_level
(
block
,
SYNC_IBUF_TREE_NODE
);
if
(
!
ibuf_restore_pos
(
space
,
page_no
,
search_tuple
,
...
...
storage/innobase/include/btr0btr.h
View file @
7f030634
...
...
@@ -199,26 +199,45 @@ btr_block_get_func(
ulint
mode
,
/*!< in: latch mode */
const
char
*
file
,
/*!< in: file name */
ulint
line
,
/*!< in: line where called */
mtr_t
*
mtr
)
/*!< in/out: mtr */
__attribute__
((
nonnull
));
# ifdef UNIV_SYNC_DEBUG
const
dict_index_t
*
index
,
/*!< in: index tree, may be NULL
if it is not an insert buffer tree */
# endif
/* UNIV_SYNC_DEBUG */
mtr_t
*
mtr
);
/*!< in/out: mini-transaction */
# ifdef UNIV_SYNC_DEBUG
/** Gets a buffer page and declares its latching order level.
@param space tablespace identifier
@param zip_size compressed page size in bytes or 0 for uncompressed pages
@param page_no page number
@param mode latch mode
@param index index tree, may be NULL if not the insert buffer tree
@param mtr mini-transaction handle
@return the block descriptor */
# define btr_block_get(space,zip_size,page_no,mode,index,mtr) \
btr_block_get_func(space,zip_size,page_no,mode, \
__FILE__,__LINE__,index,mtr)
# else
/* UNIV_SYNC_DEBUG */
/** Gets a buffer page and declares its latching order level.
@param space tablespace identifier
@param zip_size compressed page size in bytes or 0 for uncompressed pages
@param page_no page number
@param mode latch mode
@param idx index tree, may be NULL if not the insert buffer tree
@param mtr mini-transaction handle
@return the block descriptor */
#
define btr_block_get(space,zip_size,page_no,mode,mtr)
\
#
define btr_block_get(space,zip_size,page_no,mode,idx,mtr)
\
btr_block_get_func(space,zip_size,page_no,mode,__FILE__,__LINE__,mtr)
# endif
/* UNIV_SYNC_DEBUG */
/** Gets a buffer page and declares its latching order level.
@param space tablespace identifier
@param zip_size compressed page size in bytes or 0 for uncompressed pages
@param page_no page number
@param mode latch mode
@param idx index tree, may be NULL if not the insert buffer tree
@param mtr mini-transaction handle
@return the uncompressed page frame */
# define btr_page_get(space,zip_size,page_no,mode,
mtr)
\
buf_block_get_frame(btr_block_get(space,zip_size,page_no,mode,mtr))
# define btr_page_get(space,zip_size,page_no,mode,
idx,mtr)
\
buf_block_get_frame(btr_block_get(space,zip_size,page_no,mode,
idx,
mtr))
#endif
/* !UNIV_HOTBACKUP */
/**************************************************************//**
Gets the index id field of a page.
...
...
@@ -344,8 +363,7 @@ btr_free_root(
ulint
zip_size
,
/*!< in: compressed page size in bytes
or 0 for uncompressed pages */
ulint
root_page_no
,
/*!< in: root page number */
mtr_t
*
mtr
);
/*!< in: a mini-transaction which has already
been started */
mtr_t
*
mtr
);
/*!< in/out: mini-transaction */
/*************************************************************//**
Makes tree one level higher by splitting the root, and inserts
the tuple. It is assumed that mtr contains an x-latch on the tree.
...
...
storage/innobase/include/btr0btr.ic
View file @
7f030634
/*****************************************************************************
Copyright (c) 1994, 201
0, Innobase Oy
. All Rights Reserved.
Copyright (c) 1994, 201
1, Oracle and/or its affiliates
. All Rights Reserved.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
...
...
@@ -48,6 +48,10 @@ btr_block_get_func(
ulint mode, /*!< in: latch mode */
const char* file, /*!< in: file name */
ulint line, /*!< in: line where called */
#ifdef UNIV_SYNC_DEBUG
const dict_index_t* index, /*!< in: index tree, may be NULL
if it is not an insert buffer tree */
#endif /* UNIV_SYNC_DEBUG */
mtr_t* mtr) /*!< in/out: mtr */
{
buf_block_t* block;
...
...
@@ -57,7 +61,9 @@ btr_block_get_func(
if (mode != RW_NO_LATCH) {
buf_block_dbg_add_level(block, SYNC_TREE_NODE);
buf_block_dbg_add_level(
block, index != NULL && dict_index_is_ibuf(index)
? SYNC_IBUF_TREE_NODE : SYNC_TREE_NODE);
}
return(block);
...
...
storage/innobase/include/sync0sync.h
View file @
7f030634
...
...
@@ -638,10 +638,6 @@ or row lock! */
#define SYNC_DICT_HEADER 995
#define SYNC_IBUF_HEADER 914
#define SYNC_IBUF_PESS_INSERT_MUTEX 912
#define SYNC_IBUF_MUTEX 910
/* ibuf mutex is really below
SYNC_FSP_PAGE: we assign a value this
high only to make the program to pass
the debug checks */
/*-------------------------------*/
#define SYNC_INDEX_TREE 900
#define SYNC_TREE_NODE_NEW 892
...
...
@@ -657,8 +653,11 @@ or row lock! */
#define SYNC_FSP 400
#define SYNC_FSP_PAGE 395
/*------------------------------------- Insert buffer headers */
/*-------------------------------------
ibuf_mutex */
#define SYNC_IBUF_MUTEX 370
/*
ibuf_mutex */
/*------------------------------------- Insert buffer tree */
#define SYNC_IBUF_INDEX_TREE 360
#define SYNC_IBUF_TREE_NODE_NEW 359
#define SYNC_IBUF_TREE_NODE 358
#define SYNC_IBUF_BITMAP_MUTEX 351
#define SYNC_IBUF_BITMAP 350
/*------------------------------------- MySQL query cache mutex */
...
...
storage/innobase/sync/sync0sync.c
View file @
7f030634
...
...
@@ -1232,6 +1232,7 @@ sync_thread_add_level(
case
SYNC_DICT_HEADER
:
case
SYNC_TRX_I_S_RWLOCK
:
case
SYNC_TRX_I_S_LAST_READ
:
case
SYNC_IBUF_MUTEX
:
if
(
!
sync_thread_levels_g
(
array
,
level
,
TRUE
))
{
fprintf
(
stderr
,
"InnoDB: sync_thread_levels_g(array, %lu)"
...
...
@@ -1317,22 +1318,28 @@ sync_thread_add_level(
||
sync_thread_levels_g
(
array
,
SYNC_TREE_NODE
-
1
,
TRUE
));
break
;
case
SYNC_TREE_NODE_NEW
:
ut_a
(
sync_thread_levels_contain
(
array
,
SYNC_FSP_PAGE
)
||
sync_thread_levels_contain
(
array
,
SYNC_IBUF_MUTEX
));
ut_a
(
sync_thread_levels_contain
(
array
,
SYNC_FSP_PAGE
));
break
;
case
SYNC_INDEX_TREE
:
if
(
sync_thread_levels_contain
(
array
,
SYNC_IBUF_MUTEX
)
&&
sync_thread_levels_contain
(
array
,
SYNC_FSP
))
{
ut_a
(
sync_thread_levels_g
(
array
,
SYNC_FSP_PAGE
-
1
,
ut_a
(
sync_thread_levels_g
(
array
,
SYNC_TREE_NODE
-
1
,
TRUE
));
break
;
case
SYNC_IBUF_TREE_NODE
:
ut_a
(
sync_thread_levels_contain
(
array
,
SYNC_IBUF_INDEX_TREE
)
||
sync_thread_levels_g
(
array
,
SYNC_IBUF_TREE_NODE
-
1
,
TRUE
));
break
;
case
SYNC_IBUF_TREE_NODE_NEW
:
ut_a
(
sync_thread_levels_contain
(
array
,
SYNC_IBUF_MUTEX
));
break
;
case
SYNC_IBUF_INDEX_TREE
:
if
(
sync_thread_levels_contain
(
array
,
SYNC_FSP
))
{
ut_a
(
sync_thread_levels_g
(
array
,
SYNC_FSP_PAGE
-
1
,
TRUE
));
}
else
{
ut_a
(
sync_thread_levels_g
(
array
,
SYNC_TREE_NODE
-
1
,
TRUE
));
ut_a
(
sync_thread_levels_g
(
array
,
SYNC_IBUF_TREE_NODE
-
1
,
TRUE
));
}
break
;
case
SYNC_IBUF_MUTEX
:
ut_a
(
sync_thread_levels_g
(
array
,
SYNC_FSP_PAGE
-
1
,
TRUE
));
break
;
case
SYNC_IBUF_PESS_INSERT_MUTEX
:
ut_a
(
sync_thread_levels_g
(
array
,
SYNC_FSP
-
1
,
TRUE
));
ut_a
(
!
sync_thread_levels_contain
(
array
,
SYNC_IBUF_MUTEX
));
...
...
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