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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
d04de1aa
Commit
d04de1aa
authored
Jun 30, 2023
by
Marko Mäkelä
Browse files
Options
Browse Files
Download
Plain Diff
Merge 10.6 into 10.9
parents
8e2b20bf
3e89b4fc
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
37 additions
and
30 deletions
+37
-30
mysql-test/suite/innodb/r/gap_lock_split.result
mysql-test/suite/innodb/r/gap_lock_split.result
+6
-2
mysql-test/suite/innodb/t/gap_lock_split.test
mysql-test/suite/innodb/t/gap_lock_split.test
+9
-2
storage/innobase/btr/btr0cur.cc
storage/innobase/btr/btr0cur.cc
+22
-26
No files found.
mysql-test/suite/innodb/r/gap_lock_split.result
View file @
d04de1aa
SET @save_frequency=@@GLOBAL.innodb_purge_rseg_truncate_frequency;
SET GLOBAL innodb_purge_rseg_truncate_frequency=1;
CREATE TABLE t1(id INT PRIMARY key, val VARCHAR(16000)) ENGINE=InnoDB;
CREATE TABLE t1(id INT PRIMARY key, val VARCHAR(16000))
ENGINE=InnoDB STATS_PERSISTENT=0;
INSERT INTO t1 (id,val) SELECT 2*seq,'x' FROM seq_0_to_1023;
connect con1,localhost,root,,;
InnoDB 0 transactions not purged
START TRANSACTION WITH CONSISTENT SNAPSHOT;
connection default;
DELETE FROM t1 WHERE id=1788;
SET @saved_dbug = @@GLOBAL.debug_dbug;
SET @@GLOBAL.debug_dbug="d,enable_row_purge_del_mark_exit_sync_point";
BEGIN;
SELECT * FROM t1 WHERE id=1788 FOR UPDATE;
id val
connection con1;
COMMIT;
InnoDB 0 transactions not purged
SET DEBUG_SYNC = 'now WAIT_FOR row_purge_del_mark_finished';
SET @@GLOBAL.debug_dbug = @saved_dbug;
connection default;
INSERT INTO t1 (id,val) VALUES (1787, REPEAT('x',2000));
connection con1;
...
...
mysql-test/suite/innodb/t/gap_lock_split.test
View file @
d04de1aa
--
source
include
/
have_innodb
.
inc
--
source
include
/
have_sequence
.
inc
--
source
include
/
have_debug
.
inc
--
source
include
/
have_debug_sync
.
inc
SET
@
save_frequency
=@@
GLOBAL
.
innodb_purge_rseg_truncate_frequency
;
SET
GLOBAL
innodb_purge_rseg_truncate_frequency
=
1
;
CREATE
TABLE
t1
(
id
INT
PRIMARY
key
,
val
VARCHAR
(
16000
))
ENGINE
=
InnoDB
;
CREATE
TABLE
t1
(
id
INT
PRIMARY
key
,
val
VARCHAR
(
16000
))
ENGINE
=
InnoDB
STATS_PERSISTENT
=
0
;
INSERT
INTO
t1
(
id
,
val
)
SELECT
2
*
seq
,
'x'
FROM
seq_0_to_1023
;
connect
(
con1
,
localhost
,
root
,,);
...
...
@@ -16,13 +18,18 @@ connection default;
DELETE
FROM
t1
WHERE
id
=
1788
;
SET
@
saved_dbug
=
@@
GLOBAL
.
debug_dbug
;
SET
@@
GLOBAL
.
debug_dbug
=
"d,enable_row_purge_del_mark_exit_sync_point"
;
BEGIN
;
# This will return no result, but should acquire a gap lock.
SELECT
*
FROM
t1
WHERE
id
=
1788
FOR
UPDATE
;
connection
con1
;
COMMIT
;
source
include
/
wait_all_purged
.
inc
;
SET
DEBUG_SYNC
=
'now WAIT_FOR row_purge_del_mark_finished'
;
SET
@@
GLOBAL
.
debug_dbug
=
@
saved_dbug
;
connection
default
;
INSERT
INTO
t1
(
id
,
val
)
VALUES
(
1787
,
REPEAT
(
'x'
,
2000
));
...
...
storage/innobase/btr/btr0cur.cc
View file @
d04de1aa
...
...
@@ -4991,8 +4991,6 @@ class btr_est_cur_t
page_id_t
m_page_id
;
/** Current block */
buf_block_t
*
m_block
;
/** mtr savepoint of the current block */
ulint
m_savepoint
;
/** Page search mode, can differ from m_mode for non-leaf pages, see c-tor
comments for details */
page_cur_mode_t
m_page_mode
;
...
...
@@ -5051,7 +5049,6 @@ class btr_est_cur_t
bool
fetch_child
(
ulint
level
,
mtr_t
&
mtr
,
const
buf_block_t
*
right_parent
)
{
buf_block_t
*
parent_block
=
m_block
;
ulint
parent_savepoint
=
m_savepoint
;
m_block
=
btr_block_get
(
*
index
(),
m_page_id
.
page_no
(),
RW_S_LATCH
,
!
level
,
&
mtr
,
nullptr
);
...
...
@@ -5059,9 +5056,10 @@ class btr_est_cur_t
return
false
;
if
(
parent_block
&&
parent_block
!=
right_parent
)
mtr
.
rollback_to_savepoint
(
parent_savepoint
,
parent_savepoint
+
1
);
m_savepoint
=
mtr
.
get_savepoint
()
-
1
;
{
ut_ad
(
mtr
.
get_savepoint
()
>=
2
);
mtr
.
rollback_to_savepoint
(
1
,
2
);
}
return
level
==
ULINT_UNDEFINED
||
btr_page_get_level
(
m_block
->
page
.
frame
)
==
level
;
...
...
@@ -5123,10 +5121,10 @@ class btr_est_cur_t
return
true
;
}
/**
Gets
page id of the current record child.
/**
Read
page id of the current record child.
@param offsets offsets array.
@param heap heap for offsets array */
void
get_chil
d
(
rec_offs
**
offsets
,
mem_heap_t
**
heap
)
void
read_child_page_i
d
(
rec_offs
**
offsets
,
mem_heap_t
**
heap
)
{
const
rec_t
*
node_ptr
=
page_cur_get_rec
(
&
m_page_cur
);
...
...
@@ -5196,11 +5194,7 @@ class btr_est_cur_t
/** Copies block pointer and savepoint from another btr_est_cur_t in the case
if both left and right border cursors point to the same block.
@param o reference to the other btr_est_cur_t object. */
void
set_block
(
const
btr_est_cur_t
&
o
)
{
m_block
=
o
.
m_block
;
m_savepoint
=
o
.
m_savepoint
;
}
void
set_block
(
const
btr_est_cur_t
&
o
)
{
m_block
=
o
.
m_block
;
}
/** @return current record number. */
ulint
nth_rec
()
const
{
return
m_nth_rec
;
}
...
...
@@ -5239,7 +5233,6 @@ static ha_rows btr_estimate_n_rows_in_range_on_level(
pages before reaching right_page_no, then we estimate the average from the
pages scanned so far. */
static
constexpr
uint
n_pages_read_limit
=
9
;
ulint
savepoint
=
0
;
buf_block_t
*
block
=
nullptr
;
const
dict_index_t
*
index
=
left_cur
.
index
();
...
...
@@ -5269,9 +5262,6 @@ static ha_rows btr_estimate_n_rows_in_range_on_level(
{
page_t
*
page
;
buf_block_t
*
prev_block
=
block
;
ulint
prev_savepoint
=
savepoint
;
savepoint
=
mtr
.
get_savepoint
();
/* Fetch the page. */
block
=
btr_block_get
(
*
index
,
page_id
.
page_no
(),
RW_S_LATCH
,
!
level
,
&
mtr
,
...
...
@@ -5279,9 +5269,11 @@ static ha_rows btr_estimate_n_rows_in_range_on_level(
if
(
prev_block
)
{
mtr
.
rollback_to_savepoint
(
prev_savepoint
,
prev_savepoint
+
1
);
if
(
block
)
savepoint
--
;
ulint
savepoint
=
mtr
.
get_savepoint
();
/* Index s-lock, p1, p2 latches, can also be p1 and p2 parent latch if
they are not diverged */
ut_ad
(
savepoint
>=
3
);
mtr
.
rollback_to_savepoint
(
savepoint
-
2
,
savepoint
-
1
);
}
if
(
!
block
||
btr_page_get_level
(
buf_block_get_frame
(
block
))
!=
level
)
...
...
@@ -5312,8 +5304,8 @@ static ha_rows btr_estimate_n_rows_in_range_on_level(
if
(
block
)
{
ut_ad
(
block
==
mtr
.
at_savepoint
(
savepoint
));
mtr
.
rollback_to_savepoint
(
savepoint
,
savepoint
+
1
);
ut_ad
(
block
==
mtr
.
at_savepoint
(
mtr
.
get_savepoint
()
-
1
));
mtr
.
rollback_to_savepoint
(
mtr
.
get_savepoint
()
-
1
);
}
return
(
n_rows
);
...
...
@@ -5322,8 +5314,8 @@ static ha_rows btr_estimate_n_rows_in_range_on_level(
if
(
block
)
{
ut_ad
(
block
==
mtr
.
at_savepoint
(
savepoint
));
mtr
.
rollback_to_savepoint
(
savepoint
,
savepoint
+
1
);
ut_ad
(
block
==
mtr
.
at_savepoint
(
mtr
.
get_savepoint
()
-
1
));
mtr
.
rollback_to_savepoint
(
mtr
.
get_savepoint
()
-
1
);
}
is_n_rows_exact
=
false
;
...
...
@@ -5517,8 +5509,12 @@ ha_rows btr_estimate_n_rows_in_range(dict_index_t *index,
{
ut_ad
(
height
>
0
);
height
--
;
p1
.
get_child
(
&
offsets
,
&
heap
);
p2
.
get_child
(
&
offsets
,
&
heap
);
ut_ad
(
mtr
.
memo_contains
(
p1
.
index
()
->
lock
,
MTR_MEMO_S_LOCK
));
ut_ad
(
mtr
.
memo_contains_flagged
(
p1
.
block
(),
MTR_MEMO_PAGE_S_FIX
));
p1
.
read_child_page_id
(
&
offsets
,
&
heap
);
ut_ad
(
mtr
.
memo_contains
(
p2
.
index
()
->
lock
,
MTR_MEMO_S_LOCK
));
ut_ad
(
mtr
.
memo_contains_flagged
(
p2
.
block
(),
MTR_MEMO_PAGE_S_FIX
));
p2
.
read_child_page_id
(
&
offsets
,
&
heap
);
goto
search_loop
;
}
...
...
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