mirror of
https://github.com/MariaDB/server.git
synced 2025-12-07 17:42:39 +03:00
The motivation of introducing the parameter innodb_purge_rseg_truncate_frequency in mysql/mysql-server@28bbd66ea5 and mysql/mysql-server@8fc2120fed seems to have been to avoid stalls due to freeing undo log pages or truncating undo log tablespaces. In MariaDB Server, innodb_undo_log_truncate=ON should be a much lighter operation than in MySQL, because it will not involve any log checkpoint. Another source of performance stalls should be trx_purge_truncate_rseg_history(), which is shrinking the history list by freeing the undo log pages whose undo records have been purged. To alleviate that, we will introduce a purge_truncation_task that will offload this from the purge_coordinator_task. In that way, the next innodb_purge_batch_size pages may be parsed and purged while the pages from the previous batch are being freed and the history list being shrunk. The processing of innodb_undo_log_truncate=ON will still remain the responsibility of the purge_coordinator_task. purge_coordinator_state::count: Remove. We will ignore innodb_purge_rseg_truncate_frequency, and act as if it had been set to 1 (the maximum shrinking frequency). purge_coordinator_state::do_purge(): Invoke an asynchronous task purge_truncation_callback() to free the undo log pages. purge_sys_t::iterator::free_history(): Free those undo log pages that have been processed. This used to be a part of trx_purge_truncate_history(). purge_sys_t::clone_end_view(): Take a new value of purge_sys.head as a parameter, so that it will be updated while holding exclusive purge_sys.latch. This is needed for race-free access to the field in purge_truncation_callback(). Reviewed by: Vladislav Lesin
67 lines
2.1 KiB
Plaintext
67 lines
2.1 KiB
Plaintext
--echo #
|
|
--echo # Bug #20445525 ADD A CONSISTENCY CHECK AGAINST DB_TRX_ID BEING
|
|
--echo # IN THE FUTURE
|
|
--echo #
|
|
|
|
--source include/have_innodb.inc
|
|
--source include/not_embedded.inc
|
|
|
|
let PAGE_SIZE=`select @@innodb_page_size`;
|
|
|
|
CREATE TABLE t1(a INT) row_format=redundant engine=innoDB;
|
|
INSERT INTO t1 VALUES(1);
|
|
|
|
let MYSQLD_DATADIR=`select @@datadir`;
|
|
--source include/wait_all_purged.inc
|
|
let $restart_noprint=2;
|
|
--source include/shutdown_mysqld.inc
|
|
|
|
perl;
|
|
do "$ENV{MTR_SUITE_DIR}/include/crc32.pl";
|
|
my $file = "$ENV{MYSQLD_DATADIR}/test/t1.ibd";
|
|
open(FILE, "+<", $file) || die "Unable to open $file";
|
|
binmode FILE;
|
|
|
|
#Seek the the infimum record and get the offset to next record
|
|
#Infimum record exist at offset 101 for redundant format
|
|
#And offset to the next record is present 2 bytes prior to
|
|
#infimum record
|
|
|
|
my $ps= $ENV{PAGE_SIZE};
|
|
my $page;
|
|
die "Unable to read $file" unless sysread(FILE, $page, $ps) == $ps;
|
|
my $full_crc32 = unpack("N",substr($page,54,4)) & 0x10; # FIL_SPACE_FLAGS
|
|
sysseek(FILE, 3*$ps, 0) || die "Unable to seek $file\n";
|
|
die "Unable to read $file" unless sysread(FILE, $page, $ps) == $ps;
|
|
#In this case the first record should be at offset 135
|
|
die unless unpack("n", substr($page, 99, 2)) == 135;
|
|
|
|
substr($page,135+6,6) = "\xff" x 6;
|
|
|
|
my $polynomial = 0x82f63b78; # CRC-32C
|
|
if ($full_crc32)
|
|
{
|
|
my $ck = mycrc32(substr($page, 0, $ps - 4), 0, $polynomial);
|
|
substr($page, $ps - 4, 4) = pack("N", $ck);
|
|
}
|
|
else
|
|
{
|
|
my $ck= pack("N",mycrc32(substr($page, 4, 22), 0, $polynomial) ^
|
|
mycrc32(substr($page, 38, $ps - 38 - 8), 0, $polynomial));
|
|
substr($page,0,4)=$ck;
|
|
substr($page,$ps-8,4)=$ck;
|
|
}
|
|
sysseek(FILE, 3*$ps, 0) || die "Unable to rewind $file\n";
|
|
syswrite(FILE, $page, $ps)==$ps || die "Unable to write $file\n";
|
|
close(FILE) || die "Unable to close $file";
|
|
EOF
|
|
|
|
--source include/start_mysqld.inc
|
|
call mtr.add_suppression("\\[Warning\\] InnoDB: A transaction id in a record of table `test`\\.`t1` is newer than the system-wide maximum");
|
|
call mtr.add_suppression("\\[ERROR\\] InnoDB: We detected index corruption");
|
|
call mtr.add_suppression("Index for table 't1' is corrupt; try to repair it");
|
|
|
|
--error ER_NOT_KEYFILE
|
|
SELECT * FROM t1;
|
|
DROP TABLE t1;
|