Commit 7c9651a3 authored by Darshan M N's avatar Darshan M N Committed by Marko Mäkelä

BUG#25479538 ASSERT:SIZE == SPACE->SIZE DURING BUF_READ_AHEAD_RANDOM

Issue
=====
The original issue was that the size of a fil_per_table tablespace was calculated
incorrectly during truncate in the presence of an fts index. This incorrect calculation
was fixed as part of BUG#25053705 along with a testcase to reproduce the bug. The
assert that was added as part of it to reproduce the bug was wrong and resulted in
this bug.

Fix
===
Although the assert was removed earlier in a seperate commit as it was blocking the
ntest, this patch replaces the other parts of the code that were added to reproduce
the bug and replaces it with code that tries to reproduce the bug in a different way.

The new code basically tries to tweak conditions so as to simulate the random read
where a page that doesn't exist is tried to be read.

RB: 15890
Reviewed-by: default avatarJimmy Yang <Jimmy.Yang@oracle.com>
Reviewed-by: default avatarSatya Bodapati <satya.bodapati@oracle.com>
parent 3bc094d3
#
# Bug#25053705 - INVALID I/O ON TABLE AFTER TRUNCATE
#
CREATE TABLE t1 (a INT, d INT, b VARCHAR(198), c CHAR(158), FULLTEXT fts1(c,b),
FULLTEXT fts2(c));
TRUNCATE TABLE t1;
INSERT INTO t1 (a,d,b,c) VALUES (
'79795','6',repeat('uololoaroolccaaruolraloouuoocorrcorurlu','1'),
repeat('orouculcaocuocloooolooloooaorlroclouulrrucclulalouaulrluorooaclllluuorc
cuullucocraloracurooulrooauuar','1'));
CREATE TABLE t2 (a INT, d INT, b VARCHAR(198), c CHAR(158), FULLTEXT fts1(c,b));
INSERT INTO t2 VALUES (1, 1, repeat('uololoaroolccaaruolraloouuoocorrcorurlu','1'),
repeat('orouculcaocuocloooolooloooaorlroclouulrrucclulalouaulrluorooaclllluuorccuullucocraloracurooulrooauuar','1'));
create procedure insert_t2(IN total int)
begin
declare i int default 1;
while (i <= total) DO
insert into t2 select * from t2;
set i = i + 1;
end while;
end|
CALL insert_t2(15);
SET SESSION debug="+d,innodb_invalid_read_after_truncate";
INSERT INTO t1 (a,d,b,c) VALUES (
'7795','6',repeat('uololoaroolccaaruolraloouuoocorrcorurlu','1'),
repeat('orouculcaocuocloooolooloooaorlroclouulrrucclulalouaulrluorooaclllluuorc
cuullucocraloracurooulrooauuar','1'));
SET SESSION debug="-d,innodb_invalid_read_after_truncate";
DROP PROCEDURE insert_t2;
DROP TABLE t1;
DROP TABLE t2;
--source include/have_innodb_64k.inc
--source include/have_debug.inc
--echo #
--echo # Bug#25053705 - INVALID I/O ON TABLE AFTER TRUNCATE
--echo #
CREATE TABLE t1 (a INT, d INT, b VARCHAR(198), c CHAR(158), FULLTEXT fts1(c,b),
FULLTEXT fts2(c));
TRUNCATE TABLE t1;
INSERT INTO t1 (a,d,b,c) VALUES (
'79795','6',repeat('uololoaroolccaaruolraloouuoocorrcorurlu','1'),
repeat('orouculcaocuocloooolooloooaorlroclouulrrucclulalouaulrluorooaclllluuorc
cuullucocraloracurooulrooauuar','1'));
# The following CREATE TABLE and INSERTs are used to remove the pages related to table t1
# from the buffer pool.
CREATE TABLE t2 (a INT, d INT, b VARCHAR(198), c CHAR(158), FULLTEXT fts1(c,b));
INSERT INTO t2 VALUES (1, 1, repeat('uololoaroolccaaruolraloouuoocorrcorurlu','1'),
repeat('orouculcaocuocloooolooloooaorlroclouulrrucclulalouaulrluorooaclllluuorccuullucocraloracurooulrooauuar','1'));
delimiter |;
create procedure insert_t2(IN total int)
begin
declare i int default 1;
while (i <= total) DO
insert into t2 select * from t2;
set i = i + 1;
end while;
end|
delimiter ;|
CALL insert_t2(15);
SET SESSION debug="+d,innodb_invalid_read_after_truncate";
INSERT INTO t1 (a,d,b,c) VALUES (
'7795','6',repeat('uololoaroolccaaruolraloouuoocorrcorurlu','1'),
repeat('orouculcaocuocloooolooloooaorlroclouulrrucclulalouaulrluorooaclllluuorc
cuullucocraloracurooulrooauuar','1'));
SET SESSION debug="-d,innodb_invalid_read_after_truncate";
DROP PROCEDURE insert_t2;
DROP TABLE t1;
DROP TABLE t2;
......@@ -176,6 +176,18 @@ buf_read_page_low(
dst = ((buf_block_t*) bpage)->frame;
}
/* This debug code is only for 5.7. In trunk, with newDD,
the space->name is no longer same as table name. */
DBUG_EXECUTE_IF("innodb_invalid_read_after_truncate",
fil_space_t* space = fil_space_get(page_id.space());
if (space != NULL && strcmp(space->name, "test/t1") == 0
&& page_id.page_no() == space->size - 1) {
type = IORequest::READ;
sync = true;
}
);
IORequest request(type | IORequest::READ);
*err = fil_io(
......@@ -321,6 +333,19 @@ buf_read_ahead_random(
that is, reside near the start of the LRU list. */
for (i = low; i < high; i++) {
/* This debug code is only for 5.7. In trunk, with newDD,
the space->name is no longer same as table name. */
DBUG_EXECUTE_IF("innodb_invalid_read_after_truncate",
fil_space_t* space = fil_space_get(page_id.space());
if (space != NULL
&& strcmp(space->name, "test/t1") == 0) {
high = space->size;
buf_pool_mutex_exit(buf_pool);
goto read_ahead;
}
);
const buf_page_t* bpage = buf_page_hash_get(
buf_pool, page_id_t(page_id.space(), i));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment