mariadb/mysql-test/suite/encryption/t/innodb-encryption-alter.test
Marko Mäkelä 069d0472b3 MDEV-12762 Some files in current 10.2 tree seem to be reverted to an old state
The issue was a bad merge of MDEV-12253 from 10.1 to 10.2
in commit f9cc391863.
In that merge, I wrongly assumed that all test file conflicts
for mysql-test/suite/encryption had been properly resolved in
bb-10.2-MDEV-12253 (commit 76aa6be77635c7017459ce33b41c837c9acb606d)
while in fact, some files there had been copied from the 10.1 branch.

This commit is based on a manually done conflict resolution of
the mysql-test/suite/encryption on the same merge, applied to
the current 10.2 branch.

As part of this commit, the test encryption.innodb-bad-key-change4
which was shortly disabled due to MDEV-11336 will be re-enabled again.
(While the test enables innodb_defragment, it does not fail even though
enabling innodb_defragment currently has no effect.)
2017-05-10 09:06:57 +03:00

90 lines
2.4 KiB
Text

-- source include/have_innodb.inc
-- source include/have_file_key_management_plugin.inc
#
# MDEV-8817: Failing assertion: new_state->key_version != ENCRYPTION_KEY_VERSION_INVALID
#
let $encrypt_tables = `SELECT @@innodb_encrypt_tables`;
let $threads = `SELECT @@innodb_encryption_threads`;
SET GLOBAL innodb_encrypt_tables = ON;
SET GLOBAL innodb_encryption_threads = 4;
CREATE TABLE t1 (pk INT PRIMARY KEY AUTO_INCREMENT, c VARCHAR(256)) ENGINE=INNODB ENCRYPTED=NO ENCRYPTION_KEY_ID=4;
DROP TABLE t1;
set innodb_default_encryption_key_id = 99;
--error 1005
CREATE TABLE t1 (pk INT PRIMARY KEY AUTO_INCREMENT, c VARCHAR(256)) ENGINE=INNODB;
SHOW WARNINGS;
--error 1005
CREATE TABLE t1 (pk INT PRIMARY KEY AUTO_INCREMENT, c VARCHAR(256)) ENGINE=INNODB ENCRYPTED=YES;
SHOW WARNINGS;
set innodb_default_encryption_key_id = 4;
CREATE TABLE t1 (pk INT PRIMARY KEY AUTO_INCREMENT, c VARCHAR(256)) ENGINE=INNODB ENCRYPTED=YES;
SHOW CREATE TABLE t1;
DROP TABLE t1;
CREATE TABLE t1 (pk INT PRIMARY KEY AUTO_INCREMENT, c VARCHAR(256)) ENGINE=INNODB;
SHOW CREATE TABLE t1;
CREATE TABLE t2 (pk INT PRIMARY KEY AUTO_INCREMENT, c VARCHAR(256)) ENGINE=INNODB ENCRYPTED=NO ENCRYPTION_KEY_ID=1;
--replace_regex /#sql-[0-9a-f_]*/#sql-temporary/
--error 1005
ALTER TABLE t1 ENCRYPTION_KEY_ID=99;
--replace_regex /#sql-[0-9a-f_]*/#sql-temporary/
SHOW WARNINGS;
set innodb_default_encryption_key_id = 1;
--disable_warnings
--disable_query_log
let $i = 400;
while ($i)
{
INSERT INTO t1 values(NULL, substring(MD5(RAND()), -128));
dec $i;
}
commit;
INSERT INTO t2 select * from t1;
--disable_abort_on_error
--connect (con1,localhost,root,,test)
--connect (con2,localhost,root,,test)
let $i = 50;
while ($i)
{
connection con1;
send ALTER TABLE t1 ENCRYPTED=NO ENCRYPTION_KEY_ID=1;
connection con2;
send ALTER TABLE t1 ENCRYPTED=YES ENCRYPTION_KEY_ID=4;
connection default;
send ALTER TABLE t2 ENCRYPTED=NO ENCRYPTION_KEY_ID=1;
connection con1;
--reap;
ALTER TABLE t1 ENCRYPTED=NO ENCRYPTION_KEY_ID=1;
connection con2;
--reap
ALTER TABLE t1 ENCRYPTED=YES ENCRYPTION_KEY_ID=4;
connection default;
--reap
ALTER TABLE t2 ENCRYPTED=YES ENCRYPTION_KEY_ID=1;
ALTER TABLE t1 ENCRYPTED=NO ENCRYPTION_KEY_ID=1;
dec $i;
}
connection default;
--disconnect con1
--disconnect con2
--enable_abort_on_error
--enable_warnings
--enable_query_log
drop table t1,t2;
# reset system
--disable_query_log
EVAL SET GLOBAL innodb_encrypt_tables = $encrypt_tables;
EVAL SET GLOBAL innodb_encryption_threads = $threads;
--enable_query_log