mirror of
				https://github.com/MariaDB/server.git
				synced 2025-10-31 15:50:51 +03:00 
			
		
		
		
	
		
			
				
	
	
		
			88 lines
		
	
	
		
			3.1 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
			
		
		
	
	
			88 lines
		
	
	
		
			3.1 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
| #
 | |
| # MDEV-11759: Encryption code in MariaDB 10.1/10.2 causes compatibility problems
 | |
| #
 | |
| 
 | |
| -- source include/have_innodb.inc
 | |
| -- source include/have_file_key_management_plugin.inc
 | |
| # Don't test under embedded
 | |
| -- source include/not_embedded.inc
 | |
| 
 | |
| call mtr.add_suppression("InnoDB: Table `test`\\.`t[13]` (has an unreadable root page|is corrupted)");
 | |
| call mtr.add_suppression("InnoDB: Encrypted page \\[page id: space=\\d+, page number=[36]\\] in file .*test.t[123]\\.ibd looks corrupted; key_version=");
 | |
| call mtr.add_suppression("\\[ERROR\\] InnoDB: We detected index corruption in an InnoDB type table");
 | |
| call mtr.add_suppression("\\[ERROR\\] (mysqld|mariadbd).*: Index for table 't2' is corrupt; try to repair it");
 | |
| 
 | |
| SET GLOBAL innodb_file_per_table = ON;
 | |
| set global innodb_compression_algorithm = 1;
 | |
| 
 | |
| --echo # Create and populate tables to be corrupted
 | |
| CREATE TABLE t1 (a INT AUTO_INCREMENT PRIMARY KEY, b TEXT,c char(200)) ENGINE=InnoDB encrypted=yes;
 | |
| CREATE TABLE t2 (a INT AUTO_INCREMENT PRIMARY KEY, b TEXT,c char(200)) ENGINE=InnoDB row_format=compressed encrypted=yes;
 | |
| CREATE TABLE t3 (a INT AUTO_INCREMENT PRIMARY KEY, b TEXT, c char(200)) ENGINE=InnoDB page_compressed=yes encrypted=yes;
 | |
| 
 | |
| BEGIN;
 | |
| INSERT INTO t1 (b,c) VALUES ('corrupt me','secret');
 | |
| --disable_query_log
 | |
| --let $i = 100
 | |
| while ($i)
 | |
| {
 | |
|   INSERT INTO t1 (b,c) VALUES (REPEAT('abcabcabc', 100),'secretsecret');
 | |
|   dec $i;
 | |
| }
 | |
| --enable_query_log
 | |
| 
 | |
| INSERT INTO t1 (b,c) VALUES ('corrupt me','moresecretmoresecret');
 | |
| INSERT INTO t2 select * from t1;
 | |
| INSERT INTO t3 select * from t1;
 | |
| COMMIT;
 | |
| 
 | |
| let INNODB_PAGE_SIZE=`select @@innodb_page_size`;
 | |
| let MYSQLD_DATADIR=`select @@datadir`;
 | |
| 
 | |
| --source include/shutdown_mysqld.inc
 | |
| 
 | |
| --echo # Backup tables before corrupting
 | |
| --copy_file $MYSQLD_DATADIR/test/t1.ibd $MYSQLD_DATADIR/test/t1.ibd.backup
 | |
| --copy_file $MYSQLD_DATADIR/test/t2.ibd $MYSQLD_DATADIR/test/t2.ibd.backup
 | |
| --copy_file $MYSQLD_DATADIR/test/t3.ibd $MYSQLD_DATADIR/test/t3.ibd.backup
 | |
| 
 | |
| --echo # Corrupt tables
 | |
| 
 | |
| perl;
 | |
| open(FILE, "+<", "$ENV{MYSQLD_DATADIR}/test/t1.ibd") or die "open";
 | |
| binmode FILE;
 | |
| seek(FILE, $ENV{'INNODB_PAGE_SIZE'} * 3 + 26, SEEK_SET) or die "seek";
 | |
| print FILE pack("H*", "c001cafedeadb017");
 | |
| close FILE or die "close";
 | |
| open(FILE, "+<", "$ENV{MYSQLD_DATADIR}/test/t2.ibd") or die "open";
 | |
| binmode FILE;
 | |
| seek(FILE, $ENV{'INNODB_PAGE_SIZE'} * 3 + 26, SEEK_SET) or die "seek";
 | |
| print FILE pack("H*", "c001cafedeadb017");
 | |
| close FILE or die "close";
 | |
| open(FILE, "+<", "$ENV{MYSQLD_DATADIR}/test/t3.ibd") or die "open";
 | |
| binmode FILE;
 | |
| seek(FILE, $ENV{'INNODB_PAGE_SIZE'} * 3 + 26, SEEK_SET) or die "seek";
 | |
| print FILE pack("H*", "c001cafedeadb017");
 | |
| close FILE or die "close";
 | |
| EOF
 | |
| 
 | |
| --source include/start_mysqld.inc
 | |
| 
 | |
| --error ER_NO_SUCH_TABLE_IN_ENGINE
 | |
| SELECT * FROM t1;
 | |
| --error ER_GET_ERRMSG,ER_NOT_KEYFILE
 | |
| SELECT * FROM t2;
 | |
| --error ER_NO_SUCH_TABLE_IN_ENGINE
 | |
| SELECT * FROM t3;
 | |
| 
 | |
| --source include/shutdown_mysqld.inc
 | |
| 
 | |
| --echo # Restore the original tables
 | |
| --move_file $MYSQLD_DATADIR/test/t1.ibd.backup $MYSQLD_DATADIR/test/t1.ibd
 | |
| --move_file $MYSQLD_DATADIR/test/t2.ibd.backup $MYSQLD_DATADIR/test/t2.ibd
 | |
| --move_file $MYSQLD_DATADIR/test/t3.ibd.backup $MYSQLD_DATADIR/test/t3.ibd
 | |
| 
 | |
| --source include/start_mysqld.inc
 | |
| 
 | |
| DROP TABLE t1,t2,t3;
 |