MDEV-32028 InnoDB scrubbing doesn't write zero while freeing the extent

Problem:
========
InnoDB fails to mark the page status as FREED during
freeing of an extent of a segment. This behaviour affects
scrubbing and doesn't write all zeroes in file even though
pages are freed.

Solution:
========
InnoDB should mark the page status as FREED before
reinitialize the extent descriptor entry.
parent aeb8eae5
SET @save_debug=@@GLOBAL.INNODB_LIMIT_OPTIMISTIC_INSERT_DEBUG;
SET @save_scrub=@@GLOBAL.INNODB_IMMEDIATE_SCRUB_DATA_UNCOMPRESSED;
SET @save_freq=@@GLOBAL.INNODB_PURGE_RSEG_TRUNCATE_FREQUENCY;
SET GLOBAL INNODB_PURGE_RSEG_TRUNCATE_FREQUENCY=1;
SET GLOBAL INNODB_IMMEDIATE_SCRUB_DATA_UNCOMPRESSED=1;
SET GLOBAL INNODB_LIMIT_OPTIMISTIC_INSERT_DEBUG=2;
CREATE TABLE t1(f1 INT AUTO_INCREMENT PRIMARY KEY,
f2 VARCHAR(256) GENERATED ALWAYS as('repairman'),
INDEX idx(f2))ENGINE= InnoDB;
INSERT INTO t1(f1) SELECT seq FROM seq_1_to_50;
FLUSH TABLE t1 FOR EXPORT;
FOUND 108 /repairman/ in t1.ibd
UNLOCK TABLES;
ALTER TABLE t1 DROP INDEX idx;
InnoDB 0 transactions not purged
FLUSH TABLE t1 FOR EXPORT;
NOT FOUND /repairman/ in t1.ibd
UNLOCK TABLES;
DROP TABLE t1;
SET GLOBAL INNODB_LIMIT_OPTIMISTIC_INSERT_DEBUG=@save_debug;
SET GLOBAL INNODB_IMMEDIATE_SCRUB_DATA_UNCOMPRESSED=@save_scrub;
SET GLOBAL INNODB_PURGE_RSEG_TRUNCATE_FREQUENCY = @save_freq;
--source include/have_innodb.inc
--source include/have_sequence.inc
--source include/have_debug.inc
SET @save_debug=@@GLOBAL.INNODB_LIMIT_OPTIMISTIC_INSERT_DEBUG;
SET @save_scrub=@@GLOBAL.INNODB_IMMEDIATE_SCRUB_DATA_UNCOMPRESSED;
SET @save_freq=@@GLOBAL.INNODB_PURGE_RSEG_TRUNCATE_FREQUENCY;
SET GLOBAL INNODB_PURGE_RSEG_TRUNCATE_FREQUENCY=1;
SET GLOBAL INNODB_IMMEDIATE_SCRUB_DATA_UNCOMPRESSED=1;
SET GLOBAL INNODB_LIMIT_OPTIMISTIC_INSERT_DEBUG=2;
let $MYSQLD_DATADIR=`select @@datadir`;
CREATE TABLE t1(f1 INT AUTO_INCREMENT PRIMARY KEY,
f2 VARCHAR(256) GENERATED ALWAYS as('repairman'),
INDEX idx(f2))ENGINE= InnoDB;
INSERT INTO t1(f1) SELECT seq FROM seq_1_to_50;
FLUSH TABLE t1 FOR EXPORT;
let SEARCH_PATTERN= repairman;
let SEARCH_FILE= $MYSQLD_DATADIR/test/t1.ibd;
-- source include/search_pattern_in_file.inc
UNLOCK TABLES;
ALTER TABLE t1 DROP INDEX idx;
-- source include/wait_all_purged.inc
FLUSH TABLE t1 FOR EXPORT;
-- source include/search_pattern_in_file.inc
UNLOCK TABLES;
DROP TABLE t1;
SET GLOBAL INNODB_LIMIT_OPTIMISTIC_INSERT_DEBUG=@save_debug;
SET GLOBAL INNODB_IMMEDIATE_SCRUB_DATA_UNCOMPRESSED=@save_scrub;
SET GLOBAL INNODB_PURGE_RSEG_TRUNCATE_FREQUENCY = @save_freq;
......@@ -2683,14 +2683,14 @@ fseg_free_extent(
not_full_n_used - descr_n_used);
}
fsp_free_extent(space, page, mtr);
for (uint32_t i = 0; i < FSP_EXTENT_SIZE; i++) {
if (!xdes_is_free(descr, i)) {
buf_page_free(space, first_page_in_extent + i, mtr,
__FILE__, __LINE__);
}
}
fsp_free_extent(space, page, mtr);
}
/**********************************************************************//**
......
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