summaryrefslogtreecommitdiff
path: root/mysql-test/suite/mariabackup/unencrypted_page_compressed.test
diff options
context:
space:
mode:
authorThirunarayanan Balathandayuthapani <thiru@mariadb.com>2018-12-18 18:07:17 +0530
committerThirunarayanan Balathandayuthapani <thiru@mariadb.com>2018-12-18 18:07:17 +0530
commit171271edf8204d6a958a00631ea6ce4050f84b9e (patch)
tree2d0725dd2fe4375349d9c087788ac2154bd1605b /mysql-test/suite/mariabackup/unencrypted_page_compressed.test
parent84f119f25c6464b791ae7b494d6dadf0c5974477 (diff)
downloadmariadb-git-171271edf8204d6a958a00631ea6ce4050f84b9e.tar.gz
MDEV-18025 Mariabackup fails to detect corrupted page_compressed=1 tables
Problem: ======= Mariabackup seems to fail to verify the pages of compressed tables. The reason is that both fil_space_verify_crypt_checksum() and buf_page_is_corrupted() will skip the validation for compressed pages. Fix: ==== Mariabackup should call fil_page_decompress() for compressed and encrypted compressed page. After that, call buf_page_is_corrupted() to check the page corruption.
Diffstat (limited to 'mysql-test/suite/mariabackup/unencrypted_page_compressed.test')
-rw-r--r--mysql-test/suite/mariabackup/unencrypted_page_compressed.test46
1 files changed, 46 insertions, 0 deletions
diff --git a/mysql-test/suite/mariabackup/unencrypted_page_compressed.test b/mysql-test/suite/mariabackup/unencrypted_page_compressed.test
new file mode 100644
index 00000000000..48df75bc5c2
--- /dev/null
+++ b/mysql-test/suite/mariabackup/unencrypted_page_compressed.test
@@ -0,0 +1,46 @@
+CREATE TABLE t1 (a INT AUTO_INCREMENT PRIMARY KEY, b TEXT, c char(200)) ENGINE=InnoDB page_compressed=yes;
+insert into t1(b, c) values("mariadb", "mariabackup");
+
+let $MYSQLD_DATADIR=`select @@datadir`;
+let t1_IBD = $MYSQLD_DATADIR/test/t1.ibd;
+let INNODB_PAGE_SIZE=`select @@innodb_page_size`;
+
+--source include/shutdown_mysqld.inc
+
+--echo # Corrupt the table
+
+perl;
+use strict;
+use warnings;
+use Fcntl qw(:DEFAULT :seek);
+
+my $ibd_file = $ENV{'t1_IBD'};
+
+my $chunk;
+my $page_size = $ENV{'INNODB_PAGE_SIZE'};
+
+sysopen IBD_FILE, $ibd_file, O_RDWR || die "Unable to open $ibd_file";
+sysseek IBD_FILE, 16384 * 3 + 75, SEEK_CUR;
+$chunk = '\xAA\xAA\xAA\xAA';
+syswrite IBD_FILE, $chunk, 4;
+
+close IBD_FILE;
+EOF
+
+--source include/start_mysqld.inc
+
+echo # xtrabackup backup;
+--disable_result_log
+let $targetdir=$MYSQLTEST_VARDIR/tmp/backup;
+let $backuplog=$MYSQLTEST_VARDIR/tmp/backup.log;
+--error 1
+exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --target-dir=$targetdir > $backuplog;
+--enable_result_log
+
+--let SEARCH_PATTERN=Database page corruption detected
+--let SEARCH_FILE=$backuplog
+--source include/search_pattern_in_file.inc
+remove_file $backuplog;
+
+drop table t1;
+rmdir $targetdir;