diff options
author | Marko Mäkelä <marko.makela@mariadb.com> | 2019-11-19 01:32:50 +0200 |
---|---|---|
committer | Marko Mäkelä <marko.makela@mariadb.com> | 2019-11-19 01:32:50 +0200 |
commit | 589a1235b64866c7bbe85da2a6f6bf19ee8282fe (patch) | |
tree | 764fbac823a956510db8f0c4f93608970414095e /mysql-test/suite | |
parent | 77a245fe5658b8d6d937620586ecd802b3432a78 (diff) | |
parent | 39d8652ca529e712430f57addc098b71521449e3 (diff) | |
download | mariadb-git-589a1235b64866c7bbe85da2a6f6bf19ee8282fe.tar.gz |
Merge 10.3 into 10.4
Diffstat (limited to 'mysql-test/suite')
-rw-r--r-- | mysql-test/suite/innodb/r/ibuf_not_empty.result | 6 | ||||
-rw-r--r-- | mysql-test/suite/innodb/t/ibuf_not_empty.test | 47 |
2 files changed, 44 insertions, 9 deletions
diff --git a/mysql-test/suite/innodb/r/ibuf_not_empty.result b/mysql-test/suite/innodb/r/ibuf_not_empty.result index dc852dfb8e5..3382c74174e 100644 --- a/mysql-test/suite/innodb/r/ibuf_not_empty.result +++ b/mysql-test/suite/innodb/r/ibuf_not_empty.result @@ -1,3 +1,4 @@ +SET GLOBAL innodb_purge_rseg_truncate_frequency=1; CREATE TABLE t1( a INT AUTO_INCREMENT PRIMARY KEY, b CHAR(1), @@ -5,6 +6,7 @@ c INT, INDEX(b)) ENGINE=InnoDB STATS_PERSISTENT=0; SET GLOBAL innodb_change_buffering_debug = 1; +BEGIN; INSERT INTO t1 VALUES(0,'x',1); INSERT INTO t1 SELECT 0,b,c FROM t1; INSERT INTO t1 SELECT 0,b,c FROM t1; @@ -18,14 +20,14 @@ INSERT INTO t1 SELECT 0,b,c FROM t1; INSERT INTO t1 SELECT 0,b,c FROM t1; INSERT INTO t1 SELECT 0,b,c FROM t1; INSERT INTO t1 SELECT 0,b,c FROM t1; +COMMIT; +InnoDB 0 transactions not purged # restart: --innodb-force-recovery=6 --innodb-change-buffer-dump check table t1; Table Op Msg_type Msg_text test.t1 check Warning InnoDB: Index 'b' contains #### entries, should be 4096. test.t1 check error Corrupt # restart -SET GLOBAL innodb_purge_rseg_truncate_frequency=1; -InnoDB 0 transactions not purged SET GLOBAL innodb_fast_shutdown=0; # restart DROP TABLE t1; diff --git a/mysql-test/suite/innodb/t/ibuf_not_empty.test b/mysql-test/suite/innodb/t/ibuf_not_empty.test index 14d8728cdf8..a3f4ad9ac5c 100644 --- a/mysql-test/suite/innodb/t/ibuf_not_empty.test +++ b/mysql-test/suite/innodb/t/ibuf_not_empty.test @@ -6,6 +6,7 @@ # The test is not big enough to use change buffering with larger page size. --source include/have_innodb_max_16k.inc +SET GLOBAL innodb_purge_rseg_truncate_frequency=1; --disable_query_log call mtr.add_suppression("InnoDB: Failed to find tablespace for table `test`\\.`t1` in the cache\\. Attempting to load the tablespace with space id"); call mtr.add_suppression("InnoDB: Allocated tablespace ID \\d+ for test.t1, old maximum was"); @@ -29,6 +30,7 @@ SET GLOBAL innodb_change_buffering_debug = 1; # Create enough rows for the table, so that the change buffer will be # used for modifying the secondary index page. There must be multiple # index pages, because changes to the root page are never buffered. +BEGIN; INSERT INTO t1 VALUES(0,'x',1); INSERT INTO t1 SELECT 0,b,c FROM t1; INSERT INTO t1 SELECT 0,b,c FROM t1; @@ -42,9 +44,13 @@ INSERT INTO t1 SELECT 0,b,c FROM t1; INSERT INTO t1 SELECT 0,b,c FROM t1; INSERT INTO t1 SELECT 0,b,c FROM t1; INSERT INTO t1 SELECT 0,b,c FROM t1; +COMMIT; let MYSQLD_DATADIR=`select @@datadir`; let PAGE_SIZE=`select @@innodb_page_size`; +# Ensure that purge will not access the truncated .ibd file +--source include/wait_all_purged.inc + --source include/shutdown_mysqld.inc # Corrupt the change buffer bitmap, to claim that pages are clean @@ -84,14 +90,41 @@ EOF --replace_regex /contains \d+ entries/contains #### entries/ check table t1; ---let $restart_parameters= ---source include/restart_mysqld.inc +--source include/shutdown_mysqld.inc -# Ensure that the slow shutdown will not time out due to running purge. -SET GLOBAL innodb_purge_rseg_truncate_frequency=1; ---source include/wait_all_purged.inc -# The change buffer merge for the injected corruption must complete -# without exceeding the 60-second shutdown_server timeout. +# Truncate the file to 5 pages, as if it were empty +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; +my $ps= $ENV{PAGE_SIZE}; +my $pages=5; +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 +substr($page,46,4)=pack("N", $pages); +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, 0, 0) || die "Unable to rewind $file\n"; +syswrite(FILE, $page, $ps)==$ps || die "Unable to write $file\n"; +truncate(FILE, $ps * $pages); +close(FILE) || die "Unable to close $file"; +EOF + +--let $restart_parameters= +--source include/start_mysqld.inc SET GLOBAL innodb_fast_shutdown=0; --source include/restart_mysqld.inc |