Skip to content

Commit 1849dfe

Browse files
MDEV-34256 InnoDB throws out of bound write due to temporary
tablespace truncation - InnoDB fails with out of bound write error after temporary tablespace truncation. This issue caused by commit c507678 (MDEV-28699). InnoDB fail to clear freed ranges if shrinking size is the last offset of the freed range.
1 parent 4579487 commit 1849dfe

File tree

3 files changed

+37
-1
lines changed

3 files changed

+37
-1
lines changed
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
set @old_innodb_buffer_pool_size = @@innodb_buffer_pool_size;
2+
set @old_immediate_scrub_data_val= @@innodb_immediate_scrub_data_uncompressed;
3+
SET GLOBAL innodb_immediate_scrub_data_uncompressed=1;
4+
SET GLOBAL innodb_buffer_pool_size= 16777216;
5+
CREATE TEMPORARY TABLE t1(c1 MEDIUMTEXT) ENGINE=InnoDB;
6+
INSERT INTO t1 VALUES (repeat(1,16777215));
7+
DROP TEMPORARY TABLE t1;
8+
SET GLOBAL innodb_truncate_temporary_tablespace_now=1;
9+
SET GLOBAL innodb_buffer_pool_size=10485760;
10+
set global innodb_buffer_pool_size = @old_innodb_buffer_pool_size;
11+
set global innodb_immediate_scrub_data_uncompressed = @old_immediate_scrub_data_val;
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
--source include/have_innodb.inc
2+
3+
set @old_innodb_buffer_pool_size = @@innodb_buffer_pool_size;
4+
set @old_immediate_scrub_data_val= @@innodb_immediate_scrub_data_uncompressed;
5+
6+
SET GLOBAL innodb_immediate_scrub_data_uncompressed=1;
7+
SET GLOBAL innodb_buffer_pool_size= 16777216;
8+
9+
CREATE TEMPORARY TABLE t1(c1 MEDIUMTEXT) ENGINE=InnoDB;
10+
INSERT INTO t1 VALUES (repeat(1,16777215));
11+
DROP TEMPORARY TABLE t1;
12+
SET GLOBAL innodb_truncate_temporary_tablespace_now=1;
13+
14+
let $wait_timeout = 180;
15+
let $wait_condition =
16+
SELECT SUBSTR(variable_value, 1, 30) = 'Completed resizing buffer pool'
17+
FROM information_schema.global_status
18+
WHERE LOWER(variable_name) = 'innodb_buffer_pool_resize_status';
19+
20+
SET GLOBAL innodb_buffer_pool_size=10485760;
21+
--source include/wait_condition.inc
22+
23+
set global innodb_buffer_pool_size = @old_innodb_buffer_pool_size;
24+
set global innodb_immediate_scrub_data_uncompressed = @old_immediate_scrub_data_val;
25+
--source include/wait_condition.inc

storage/innobase/fsp/fsp0fsp.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3714,7 +3714,7 @@ inline void fil_space_t::clear_freed_ranges(uint32_t threshold)
37143714
{
37153715
if (range.first >= threshold)
37163716
continue;
3717-
else if (range.last > threshold)
3717+
else if (range.last >= threshold)
37183718
{
37193719
range_t new_range{range.first, threshold - 1};
37203720
current_ranges.add_range(new_range);

0 commit comments

Comments
 (0)