mirror of
https://github.com/MariaDB/server.git
synced 2025-06-03 07:02:23 +03:00
When MariaDB 10.1.0 introduced table options for encryption and compression, it unnecessarily changed ha_innobase::check_if_supported_inplace_alter() so that ALGORITHM=COPY is forced when these parameters differ. A better solution is to move the check to innobase_need_rebuild(). In that way, the ALGORITHM=INPLACE interface (yes, the syntax is very misleading) can be used for rebuilding the table much more efficiently, with merge sort, with no undo logging, and allowing concurrent DML operations.
97 lines
2.7 KiB
Plaintext
97 lines
2.7 KiB
Plaintext
-- 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
|
|
#
|
|
|
|
--disable_query_log
|
|
let $innodb_file_format_orig = `SELECT @@innodb_file_format`;
|
|
let $innodb_file_per_table_orig = `SELECT @@innodb_file_per_table`;
|
|
let $encrypt_tables = `SELECT @@innodb_encrypt_tables`;
|
|
let $threads = `SELECT @@innodb_encryption_threads`;
|
|
--enable_query_log
|
|
|
|
SET GLOBAL innodb_file_format = `Barracuda`;
|
|
SET GLOBAL innodb_file_per_table = ON;
|
|
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;
|
|
--error ER_ILLEGAL_HA_CREATE_OPTION
|
|
ALTER TABLE t1 ENCRYPTION_KEY_ID=99;
|
|
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_file_per_table = $innodb_file_per_table_orig;
|
|
EVAL SET GLOBAL innodb_file_format = $innodb_file_format_orig;
|
|
EVAL SET GLOBAL innodb_encrypt_tables = $encrypt_tables;
|
|
EVAL SET GLOBAL innodb_encryption_threads = $threads;
|
|
--enable_query_log
|