summaryrefslogtreecommitdiff
path: root/mysql-test/suite/innodb
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2017-09-16 22:31:53 +0300
committerMarko Mäkelä <marko.makela@mariadb.com>2017-09-17 11:05:33 +0300
commitd9277732d7dbe7e3793c70cdc769ade16168695d (patch)
tree1fdf3a99a924ef9c2f73ac6e9a7027eaa8048d13 /mysql-test/suite/innodb
parentc2815c7c2c7f9dcf4e9f241e10d154faf561103f (diff)
parent836d4e74d9416a1af839f8068c5a07bee6f4b71e (diff)
downloadmariadb-git-d9277732d7dbe7e3793c70cdc769ade16168695d.tar.gz
Merge 10.1 into 10.2
This should also fix the MariaDB 10.2.2 bug MDEV-13826 CREATE FULLTEXT INDEX on encrypted table fails. MDEV-12634 FIXME: Modify innodb-index-online, innodb-table-online so that they will write and read merge sort files. InnoDB 5.7 introduced some optimizations to avoid using the files for small tables. Many collation test results have been adjusted for MDEV-10191.
Diffstat (limited to 'mysql-test/suite/innodb')
-rw-r--r--mysql-test/suite/innodb/r/innodb-index-online,crypt.rdiff20
-rw-r--r--mysql-test/suite/innodb/r/innodb-index-online.result111
-rw-r--r--mysql-test/suite/innodb/r/innodb-table-online,crypt.rdiff20
-rw-r--r--mysql-test/suite/innodb/r/innodb-table-online.result105
-rw-r--r--mysql-test/suite/innodb/t/innodb-index-online.opt2
-rw-r--r--mysql-test/suite/innodb/t/innodb-index-online.test77
-rw-r--r--mysql-test/suite/innodb/t/innodb-table-online-master.opt2
-rw-r--r--mysql-test/suite/innodb/t/innodb-table-online.test80
8 files changed, 375 insertions, 42 deletions
diff --git a/mysql-test/suite/innodb/r/innodb-index-online,crypt.rdiff b/mysql-test/suite/innodb/r/innodb-index-online,crypt.rdiff
new file mode 100644
index 00000000000..166cdf7a8b6
--- /dev/null
+++ b/mysql-test/suite/innodb/r/innodb-index-online,crypt.rdiff
@@ -0,0 +1,20 @@
+--- innodb-index-online.result
++++ innodb-index-online,crypt.reject
+@@ -301,7 +301,7 @@
+ @merge_encrypt_1>@merge_encrypt_0, @merge_decrypt_1>@merge_decrypt_0,
+ @rowlog_encrypt_1>@rowlog_encrypt_0;
+ sort_balance @merge_encrypt_1>@merge_encrypt_0 @merge_decrypt_1>@merge_decrypt_0 @rowlog_encrypt_1>@rowlog_encrypt_0
+-0 0 0 0
++0 0 0 1
+ SET DEBUG_SYNC = 'now SIGNAL dml2_done';
+ connection con1;
+ ERROR HY000: Creating index 'c2e' required more than 'innodb_online_alter_log_max_size' bytes of modification log. Please try again
+@@ -423,7 +423,7 @@
+ @rowlog_encrypt_2-@rowlog_encrypt_1>0 as log_encrypted,
+ @rowlog_decrypt_2-@rowlog_decrypt_1>0 as log_decrypted;
+ sort_encrypted sort_decrypted log_encrypted log_decrypted
+-0 0 0 0
++0 0 1 1
+ connection con1;
+ SELECT COUNT(c22f) FROM t1;
+ COUNT(c22f)
diff --git a/mysql-test/suite/innodb/r/innodb-index-online.result b/mysql-test/suite/innodb/r/innodb-index-online.result
index 6ebe52bb8fc..5427f13043d 100644
--- a/mysql-test/suite/innodb/r/innodb-index-online.result
+++ b/mysql-test/suite/innodb/r/innodb-index-online.result
@@ -214,6 +214,17 @@ t1 CREATE TABLE `t1` (
PRIMARY KEY (`c1`),
KEY `c2d` (`c2`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 STATS_PERSISTENT=1
+connection default;
+SET @merge_encrypt_0=
+(SELECT variable_value FROM information_schema.global_status
+WHERE variable_name = 'innodb_encryption_n_merge_blocks_encrypted');
+SET @merge_decrypt_0=
+(SELECT variable_value FROM information_schema.global_status
+WHERE variable_name = 'innodb_encryption_n_merge_blocks_decrypted');
+SET @rowlog_encrypt_0=
+(SELECT variable_value FROM information_schema.global_status
+WHERE variable_name = 'innodb_encryption_n_rowlog_blocks_encrypted');
+connection con1;
SET DEBUG_SYNC = 'row_log_apply_before SIGNAL c2e_created WAIT_FOR dml2_done';
SET lock_wait_timeout = 10;
ALTER TABLE t1 DROP INDEX c2d, ADD INDEX c2e(c2),
@@ -246,6 +257,22 @@ BEGIN;
UPDATE t1 SET c2 = c2 + 1;
DELETE FROM t1;
ROLLBACK;
+BEGIN;
+DELETE FROM t1;
+ROLLBACK;
+UPDATE t1 SET c2 = c2 + 1;
+BEGIN;
+UPDATE t1 SET c2 = c2 + 1;
+DELETE FROM t1;
+ROLLBACK;
+BEGIN;
+DELETE FROM t1;
+ROLLBACK;
+UPDATE t1 SET c2 = c2 + 1;
+BEGIN;
+UPDATE t1 SET c2 = c2 + 1;
+DELETE FROM t1;
+ROLLBACK;
SELECT name, count FROM INFORMATION_SCHEMA.INNODB_METRICS WHERE subsystem = 'ddl';
name count
ddl_background_drop_indexes 0
@@ -253,12 +280,28 @@ ddl_background_drop_tables 0
ddl_online_create_index 1
ddl_pending_alter_table 1
ddl_sort_file_alter_table 0
-ddl_log_file_alter_table 0
+ddl_log_file_alter_table 1
SELECT sf.name, sf.pos FROM INFORMATION_SCHEMA.INNODB_SYS_INDEXES si
INNER JOIN INFORMATION_SCHEMA.INNODB_SYS_FIELDS sf
ON si.index_id = sf.index_id WHERE si.name = '?c2e';
name pos
c2 0
+SET @merge_encrypt_1=
+(SELECT variable_value FROM information_schema.global_status
+WHERE variable_name = 'innodb_encryption_n_merge_blocks_encrypted');
+SET @merge_decrypt_1=
+(SELECT variable_value FROM information_schema.global_status
+WHERE variable_name = 'innodb_encryption_n_merge_blocks_decrypted');
+SET @rowlog_encrypt_1=
+(SELECT variable_value FROM information_schema.global_status
+WHERE variable_name = 'innodb_encryption_n_rowlog_blocks_encrypted');
+SELECT
+(@merge_encrypt_1-@merge_encrypt_0)-
+(@merge_decrypt_1-@merge_decrypt_0) as sort_balance,
+@merge_encrypt_1>@merge_encrypt_0, @merge_decrypt_1>@merge_decrypt_0,
+@rowlog_encrypt_1>@rowlog_encrypt_0;
+sort_balance @merge_encrypt_1>@merge_encrypt_0 @merge_decrypt_1>@merge_decrypt_0 @rowlog_encrypt_1>@rowlog_encrypt_0
+0 0 0 0
SET DEBUG_SYNC = 'now SIGNAL dml2_done';
connection con1;
ERROR HY000: Creating index 'c2e' required more than 'innodb_online_alter_log_max_size' bytes of modification log. Please try again
@@ -269,7 +312,7 @@ ddl_background_drop_tables 0
ddl_online_create_index 0
ddl_pending_alter_table 0
ddl_sort_file_alter_table 0
-ddl_log_file_alter_table 0
+ddl_log_file_alter_table 1
SELECT sf.name, sf.pos FROM INFORMATION_SCHEMA.INNODB_SYS_INDEXES si
INNER JOIN INFORMATION_SCHEMA.INNODB_SYS_FIELDS sf
ON si.index_id = sf.index_id WHERE si.name = 'c2e';
@@ -281,7 +324,7 @@ ddl_background_drop_tables 0
ddl_online_create_index 0
ddl_pending_alter_table 0
ddl_sort_file_alter_table 0
-ddl_log_file_alter_table 0
+ddl_log_file_alter_table 1
connection default;
ALTER TABLE t1 COMMENT 'testing if c2e will be dropped';
SELECT name, count FROM INFORMATION_SCHEMA.INNODB_METRICS WHERE subsystem = 'ddl';
@@ -291,7 +334,19 @@ ddl_background_drop_tables 0
ddl_online_create_index 0
ddl_pending_alter_table 0
ddl_sort_file_alter_table 0
-ddl_log_file_alter_table 0
+ddl_log_file_alter_table 1
+SET @merge_encrypt_1=
+(SELECT variable_value FROM information_schema.global_status
+WHERE variable_name = 'innodb_encryption_n_merge_blocks_encrypted');
+SET @merge_decrypt_1=
+(SELECT variable_value FROM information_schema.global_status
+WHERE variable_name = 'innodb_encryption_n_merge_blocks_decrypted');
+SET @rowlog_encrypt_1=
+(SELECT variable_value FROM information_schema.global_status
+WHERE variable_name = 'innodb_encryption_n_rowlog_blocks_encrypted');
+SET @rowlog_decrypt_1=
+(SELECT variable_value FROM information_schema.global_status
+WHERE variable_name = 'innodb_encryption_n_rowlog_blocks_decrypted');
connection con1;
SET DEBUG_SYNC = 'row_log_apply_before SIGNAL c2f_created WAIT_FOR dml3_done';
ALTER TABLE t1 ADD INDEX c2f(c2);
@@ -304,7 +359,15 @@ ddl_background_drop_tables 0
ddl_online_create_index 1
ddl_pending_alter_table 1
ddl_sort_file_alter_table 0
-ddl_log_file_alter_table 0
+ddl_log_file_alter_table 1
+BEGIN;
+INSERT INTO t1 SELECT 320 + c1, c2, c3 FROM t1 WHERE c1 > 160;
+DELETE FROM t1 WHERE c1 > 320;
+ROLLBACK;
+BEGIN;
+UPDATE t1 SET c2 = c2 + 1;
+DELETE FROM t1;
+ROLLBACK;
BEGIN;
INSERT INTO t1 SELECT 320 + c1, c2, c3 FROM t1 WHERE c1 > 160;
DELETE FROM t1 WHERE c1 > 320;
@@ -320,7 +383,7 @@ ddl_background_drop_tables 0
ddl_online_create_index 1
ddl_pending_alter_table 1
ddl_sort_file_alter_table 0
-ddl_log_file_alter_table 0
+ddl_log_file_alter_table 2
SET DEBUG_SYNC = 'now SIGNAL dml3_done';
connection con1;
Warnings:
@@ -333,7 +396,35 @@ ddl_background_drop_tables 0
ddl_online_create_index 0
ddl_pending_alter_table 0
ddl_sort_file_alter_table 0
-ddl_log_file_alter_table 0
+ddl_log_file_alter_table 2
+connection default;
+SET @merge_encrypt_2=
+(SELECT variable_value FROM information_schema.global_status
+WHERE variable_name = 'innodb_encryption_n_merge_blocks_encrypted');
+SET @merge_decrypt_2=
+(SELECT variable_value FROM information_schema.global_status
+WHERE variable_name = 'innodb_encryption_n_merge_blocks_decrypted');
+SET @rowlog_encrypt_2=
+(SELECT variable_value FROM information_schema.global_status
+WHERE variable_name = 'innodb_encryption_n_rowlog_blocks_encrypted');
+SET @rowlog_decrypt_2=
+(SELECT variable_value FROM information_schema.global_status
+WHERE variable_name = 'innodb_encryption_n_rowlog_blocks_decrypted');
+SELECT
+(@merge_encrypt_2-@merge_encrypt_1)-
+(@merge_decrypt_2-@merge_decrypt_1) as sort_balance,
+(@rowlog_encrypt_2-@rowlog_encrypt_1)-
+(@rowlog_decrypt_2-@rowlog_decrypt_1) as log_balance;
+sort_balance log_balance
+0 0
+SELECT
+@merge_encrypt_2-@merge_encrypt_1>0 as sort_encrypted,
+@merge_decrypt_2-@merge_decrypt_1>0 as sort_decrypted,
+@rowlog_encrypt_2-@rowlog_encrypt_1>0 as log_encrypted,
+@rowlog_decrypt_2-@rowlog_decrypt_1>0 as log_decrypted;
+sort_encrypted sort_decrypted log_encrypted log_decrypted
+0 0 0 0
+connection con1;
SELECT COUNT(c22f) FROM t1;
COUNT(c22f)
320
@@ -369,7 +460,7 @@ ddl_background_drop_tables 0
ddl_online_create_index 0
ddl_pending_alter_table 0
ddl_sort_file_alter_table 0
-ddl_log_file_alter_table 0
+ddl_log_file_alter_table 2
connection default;
SELECT name, count FROM INFORMATION_SCHEMA.INNODB_METRICS WHERE subsystem = 'ddl';
name count
@@ -378,7 +469,7 @@ ddl_background_drop_tables 0
ddl_online_create_index 0
ddl_pending_alter_table 0
ddl_sort_file_alter_table 0
-ddl_log_file_alter_table 0
+ddl_log_file_alter_table 2
connection con1;
disconnect con1;
connection default;
@@ -400,7 +491,7 @@ ddl_background_drop_tables 0
ddl_online_create_index 0
ddl_pending_alter_table 0
ddl_sort_file_alter_table 0
-ddl_log_file_alter_table 0
+ddl_log_file_alter_table 2
ALTER TABLE t1 ADD INDEX c2h(c22f), ALGORITHM = INPLACE;
ALTER TABLE t1 ADD INDEX c2h(c22f), ALGORITHM = COPY;
ERROR 42000: Duplicate key name 'c2h'
diff --git a/mysql-test/suite/innodb/r/innodb-table-online,crypt.rdiff b/mysql-test/suite/innodb/r/innodb-table-online,crypt.rdiff
new file mode 100644
index 00000000000..cd0904367f9
--- /dev/null
+++ b/mysql-test/suite/innodb/r/innodb-table-online,crypt.rdiff
@@ -0,0 +1,20 @@
+--- innodb-table-online.result
++++ innodb-table-online,crypt.reject
+@@ -291,7 +291,7 @@
+ @merge_encrypt_1>@merge_encrypt_0, @merge_decrypt_1>@merge_decrypt_0,
+ @rowlog_encrypt_1>@rowlog_encrypt_0;
+ sort_balance @merge_encrypt_1>@merge_encrypt_0 @merge_decrypt_1>@merge_decrypt_0 @rowlog_encrypt_1>@rowlog_encrypt_0
+-0 0 0 0
++0 0 0 1
+ SET DEBUG_SYNC = 'now SIGNAL dml2_done';
+ # session con1
+ connection con1;
+@@ -393,7 +393,7 @@
+ @rowlog_encrypt_2-@rowlog_encrypt_1>0 as log_encrypted,
+ @rowlog_decrypt_2-@rowlog_decrypt_1>0 as log_decrypted;
+ sort_encrypted sort_decrypted log_encrypted log_decrypted
+-0 0 0 0
++0 0 1 1
+ ALTER TABLE t1 DROP PRIMARY KEY, ADD PRIMARY KEY c3p5(c3(5));
+ ERROR 23000: Duplicate entry '' for key 'PRIMARY'
+ UPDATE t1 SET c3 = NULL WHERE c3 = '';
diff --git a/mysql-test/suite/innodb/r/innodb-table-online.result b/mysql-test/suite/innodb/r/innodb-table-online.result
index a162bcef420..49f44c0f655 100644
--- a/mysql-test/suite/innodb/r/innodb-table-online.result
+++ b/mysql-test/suite/innodb/r/innodb-table-online.result
@@ -3,7 +3,7 @@ call mtr.add_suppression("InnoDB: Error: table 'test/t1'");
call mtr.add_suppression("MySQL is trying to open a table handle but the .ibd file for");
SET @global_innodb_file_per_table_orig = @@global.innodb_file_per_table;
SET GLOBAL innodb_file_per_table = on;
-CREATE TABLE t1 (c1 INT PRIMARY KEY, c2 INT NOT NULL, c3 TEXT NOT NULL)
+CREATE TABLE t1 (c1 INT PRIMARY KEY, c2 INT NOT NULL, c3 CHAR(255) NOT NULL)
ENGINE = InnoDB;
INSERT INTO t1 VALUES (1,1,''), (2,2,''), (3,3,''), (4,4,''), (5,5,'');
SET GLOBAL innodb_monitor_enable = module_ddl;
@@ -62,7 +62,7 @@ Table Create Table
t1 CREATE TABLE `t1` (
`c1` int(11) NOT NULL,
`c2` int(11) NOT NULL,
- `c3` text NOT NULL,
+ `c3` char(255) NOT NULL,
PRIMARY KEY (`c1`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=REDUNDANT
BEGIN;
@@ -95,7 +95,7 @@ Table Create Table
t1 CREATE TABLE `t1` (
`c1` int(11) NOT NULL,
`c2` int(11) NOT NULL,
- `c3` text NOT NULL,
+ `c3` char(255) NOT NULL,
UNIQUE KEY `c2` (`c2`),
UNIQUE KEY `c2_2` (`c2`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=COMPACT
@@ -106,7 +106,7 @@ Table Create Table
t1 CREATE TABLE `t1` (
`c1` int(11) NOT NULL,
`c2` int(11) NOT NULL,
- `c3` text NOT NULL,
+ `c3` char(255) NOT NULL,
UNIQUE KEY `c2` (`c2`),
UNIQUE KEY `c2_2` (`c2`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=COMPACT
@@ -138,7 +138,7 @@ Table Create Table
t1 CREATE TABLE `t1` (
`c1` int(11) NOT NULL,
`c2` int(11) NOT NULL,
- `c3` text NOT NULL,
+ `c3` char(255) NOT NULL,
UNIQUE KEY `c2` (`c2`),
UNIQUE KEY `c2_2` (`c2`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=COMPACT
@@ -204,10 +204,19 @@ INSERT INTO t1 SELECT 20 + c1, c2, c3 FROM t1;
INSERT INTO t1 SELECT 40 + c1, c2, c3 FROM t1;
EXPLAIN SELECT COUNT(*) FROM t1 WHERE c2 > 3;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ALL NULL NULL NULL NULL 80 Using where
+1 SIMPLE t1 ALL NULL NULL NULL NULL ROWS Using where
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
test.t1 analyze status OK
+SET @merge_encrypt_0=
+(SELECT variable_value FROM information_schema.global_status
+WHERE variable_name = 'innodb_encryption_n_merge_blocks_encrypted');
+SET @merge_decrypt_0=
+(SELECT variable_value FROM information_schema.global_status
+WHERE variable_name = 'innodb_encryption_n_merge_blocks_decrypted');
+SET @rowlog_encrypt_0=
+(SELECT variable_value FROM information_schema.global_status
+WHERE variable_name = 'innodb_encryption_n_rowlog_blocks_encrypted');
# session con1
connection con1;
SHOW CREATE TABLE t1;
@@ -215,7 +224,7 @@ Table Create Table
t1 CREATE TABLE `t1` (
`c1` int(11) NOT NULL,
`c2` int(11) NOT NULL,
- `c3` text NOT NULL,
+ `c3` char(255) NOT NULL,
PRIMARY KEY (`c1`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=COMPACT
SET DEBUG_SYNC = 'row_log_table_apply1_before SIGNAL rebuilt2 WAIT_FOR dml2_done';
@@ -234,7 +243,7 @@ ddl_background_drop_tables 0
ddl_online_create_index 1
ddl_pending_alter_table 1
ddl_sort_file_alter_table 0
-ddl_log_file_alter_table 0
+ddl_log_file_alter_table 1
BEGIN;
DELETE FROM t1;
ROLLBACK;
@@ -266,7 +275,23 @@ ddl_background_drop_tables 0
ddl_online_create_index 1
ddl_pending_alter_table 1
ddl_sort_file_alter_table 0
-ddl_log_file_alter_table 0
+ddl_log_file_alter_table 1
+SET @merge_encrypt_1=
+(SELECT variable_value FROM information_schema.global_status
+WHERE variable_name = 'innodb_encryption_n_merge_blocks_encrypted');
+SET @merge_decrypt_1=
+(SELECT variable_value FROM information_schema.global_status
+WHERE variable_name = 'innodb_encryption_n_merge_blocks_decrypted');
+SET @rowlog_encrypt_1=
+(SELECT variable_value FROM information_schema.global_status
+WHERE variable_name = 'innodb_encryption_n_rowlog_blocks_encrypted');
+SELECT
+(@merge_encrypt_1-@merge_encrypt_0)-
+(@merge_decrypt_1-@merge_decrypt_0) as sort_balance,
+@merge_encrypt_1>@merge_encrypt_0, @merge_decrypt_1>@merge_decrypt_0,
+@rowlog_encrypt_1>@rowlog_encrypt_0;
+sort_balance @merge_encrypt_1>@merge_encrypt_0 @merge_decrypt_1>@merge_decrypt_0 @rowlog_encrypt_1>@rowlog_encrypt_0
+0 0 0 0
SET DEBUG_SYNC = 'now SIGNAL dml2_done';
# session con1
connection con1;
@@ -278,15 +303,27 @@ ddl_background_drop_tables 0
ddl_online_create_index 0
ddl_pending_alter_table 0
ddl_sort_file_alter_table 0
-ddl_log_file_alter_table 0
+ddl_log_file_alter_table 1
+SET @merge_encrypt_1=
+(SELECT variable_value FROM information_schema.global_status
+WHERE variable_name = 'innodb_encryption_n_merge_blocks_encrypted');
+SET @merge_decrypt_1=
+(SELECT variable_value FROM information_schema.global_status
+WHERE variable_name = 'innodb_encryption_n_merge_blocks_decrypted');
+SET @rowlog_encrypt_1=
+(SELECT variable_value FROM information_schema.global_status
+WHERE variable_name = 'innodb_encryption_n_rowlog_blocks_encrypted');
+SET @rowlog_decrypt_1=
+(SELECT variable_value FROM information_schema.global_status
+WHERE variable_name = 'innodb_encryption_n_rowlog_blocks_decrypted');
SET DEBUG_SYNC = 'row_log_table_apply1_before SIGNAL rebuilt3 WAIT_FOR dml3_done';
ALTER TABLE t1 ADD PRIMARY KEY(c22f), CHANGE c2 c22f INT;
ERROR 42000: Multiple primary key defined
ALTER TABLE t1 DROP PRIMARY KEY, ADD PRIMARY KEY(c22f), CHANGE c2 c22f INT;
ERROR 23000: Duplicate entry '5' for key 'PRIMARY'
ALTER TABLE t1 DROP PRIMARY KEY, ADD PRIMARY KEY(c1,c22f,c4(5)),
-CHANGE c2 c22f INT, CHANGE c3 c3 TEXT NULL, CHANGE c1 c1 INT AFTER c22f,
-ADD COLUMN c4 VARCHAR(6) DEFAULT 'Online';
+CHANGE c2 c22f INT, CHANGE c3 c3 CHAR(255) NULL, CHANGE c1 c1 INT AFTER c22f,
+ADD COLUMN c4 VARCHAR(6) DEFAULT 'Online', LOCK=NONE;
# session default
connection default;
SET DEBUG_SYNC = 'now WAIT_FOR rebuilt3';
@@ -297,7 +334,7 @@ ddl_background_drop_tables 0
ddl_online_create_index 1
ddl_pending_alter_table 1
ddl_sort_file_alter_table 0
-ddl_log_file_alter_table 0
+ddl_log_file_alter_table 1
BEGIN;
INSERT INTO t1 SELECT 320 + c1, c2, c3 FROM t1 WHERE c1 > 240;
DELETE FROM t1 WHERE c1 > 320;
@@ -313,7 +350,7 @@ ddl_background_drop_tables 0
ddl_online_create_index 1
ddl_pending_alter_table 1
ddl_sort_file_alter_table 0
-ddl_log_file_alter_table 0
+ddl_log_file_alter_table 2
SET DEBUG_SYNC = 'now SIGNAL dml3_done';
# session con1
connection con1;
@@ -324,13 +361,39 @@ ddl_background_drop_tables 0
ddl_online_create_index 0
ddl_pending_alter_table 0
ddl_sort_file_alter_table 0
-ddl_log_file_alter_table 0
+ddl_log_file_alter_table 2
SELECT COUNT(c22f) FROM t1;
COUNT(c22f)
320
CHECK TABLE t1;
Table Op Msg_type Msg_text
test.t1 check status OK
+SET @merge_encrypt_2=
+(SELECT variable_value FROM information_schema.global_status
+WHERE variable_name = 'innodb_encryption_n_merge_blocks_encrypted');
+SET @merge_decrypt_2=
+(SELECT variable_value FROM information_schema.global_status
+WHERE variable_name = 'innodb_encryption_n_merge_blocks_decrypted');
+SET @rowlog_encrypt_2=
+(SELECT variable_value FROM information_schema.global_status
+WHERE variable_name = 'innodb_encryption_n_rowlog_blocks_encrypted');
+SET @rowlog_decrypt_2=
+(SELECT variable_value FROM information_schema.global_status
+WHERE variable_name = 'innodb_encryption_n_rowlog_blocks_decrypted');
+SELECT
+(@merge_encrypt_2-@merge_encrypt_1)-
+(@merge_decrypt_2-@merge_decrypt_1) as sort_balance,
+(@rowlog_encrypt_2-@rowlog_encrypt_1)-
+(@rowlog_decrypt_2-@rowlog_decrypt_1) as log_balance;
+sort_balance log_balance
+0 0
+SELECT
+@merge_encrypt_2-@merge_encrypt_1>0 as sort_encrypted,
+@merge_decrypt_2-@merge_decrypt_1>0 as sort_decrypted,
+@rowlog_encrypt_2-@rowlog_encrypt_1>0 as log_encrypted,
+@rowlog_decrypt_2-@rowlog_decrypt_1>0 as log_decrypted;
+sort_encrypted sort_decrypted log_encrypted log_decrypted
+0 0 0 0
ALTER TABLE t1 DROP PRIMARY KEY, ADD PRIMARY KEY c3p5(c3(5));
ERROR 23000: Duplicate entry '' for key 'PRIMARY'
UPDATE t1 SET c3 = NULL WHERE c3 = '';
@@ -342,13 +405,13 @@ SET @@sql_mode = 'STRICT_TRANS_TABLES';
ALTER TABLE t1 DROP COLUMN c22f, DROP PRIMARY KEY, ADD PRIMARY KEY c3p5(c3(5)),
ALGORITHM = INPLACE;
ERROR 22004: Invalid use of NULL value
-ALTER TABLE t1 MODIFY c3 TEXT NOT NULL;
+ALTER TABLE t1 MODIFY c3 CHAR(255) NOT NULL;
ERROR 22004: Invalid use of NULL value
SET @@sql_mode = @old_sql_mode;
-UPDATE t1 SET c3=CONCAT(c1,REPEAT('foo',c1)) WHERE c3 IS NULL;
+UPDATE t1 SET c3=LEFT(CONCAT(c1,REPEAT('foo',c1)),255) WHERE c3 IS NULL;
SET DEBUG_SYNC = 'row_log_table_apply1_before SIGNAL c3p5_created0 WAIT_FOR ins_done0';
SET @@sql_mode = 'STRICT_TRANS_TABLES';
-ALTER TABLE t1 MODIFY c3 TEXT NOT NULL, DROP COLUMN c22f,
+ALTER TABLE t1 MODIFY c3 CHAR(255) NOT NULL, DROP COLUMN c22f,
DROP PRIMARY KEY, ADD PRIMARY KEY(c1,c4(5)),
ADD COLUMN c5 CHAR(5) DEFAULT 'tired' FIRST;
# session default
@@ -367,7 +430,7 @@ connection default;
ROLLBACK;
# session con1
connection con1;
-ALTER TABLE t1 MODIFY c3 TEXT NOT NULL;
+ALTER TABLE t1 MODIFY c3 CHAR(255) NOT NULL;
SET DEBUG_SYNC = 'row_log_table_apply1_before SIGNAL c3p5_created WAIT_FOR ins_done';
ALTER TABLE t1 DROP PRIMARY KEY, DROP COLUMN c22f,
ADD COLUMN c6 VARCHAR(1000) DEFAULT
@@ -391,7 +454,7 @@ ddl_background_drop_tables 0
ddl_online_create_index 0
ddl_pending_alter_table 0
ddl_sort_file_alter_table 4
-ddl_log_file_alter_table 0
+ddl_log_file_alter_table 2
# session default
connection default;
SELECT COUNT(*) FROM t1;
@@ -422,7 +485,7 @@ Table Create Table
t1 CREATE TABLE `t1` (
`c22f` int(11) NOT NULL,
`c1` int(11) NOT NULL,
- `c3` text NOT NULL,
+ `c3` char(255) NOT NULL,
`c4` varchar(6) NOT NULL DEFAULT 'Online',
PRIMARY KEY (`c1`,`c22f`,`c4`(5))
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=REDUNDANT
diff --git a/mysql-test/suite/innodb/t/innodb-index-online.opt b/mysql-test/suite/innodb/t/innodb-index-online.opt
index a11d16860eb..ff20edbe2f7 100644
--- a/mysql-test/suite/innodb/t/innodb-index-online.opt
+++ b/mysql-test/suite/innodb/t/innodb-index-online.opt
@@ -1,5 +1,5 @@
--loose-innodb-sort-buffer-size=64k
---loose-innodb-online-alter-log-max-size=64k
+--loose-innodb-online-alter-log-max-size=128k
--loose-innodb-buffer-pool-size=5M
--loose-innodb-log-buffer-size=256k
--loose-innodb-sys-indexes
diff --git a/mysql-test/suite/innodb/t/innodb-index-online.test b/mysql-test/suite/innodb/t/innodb-index-online.test
index 24e3cd1ba22..efd700498c6 100644
--- a/mysql-test/suite/innodb/t/innodb-index-online.test
+++ b/mysql-test/suite/innodb/t/innodb-index-online.test
@@ -1,4 +1,5 @@
--source include/innodb_page_size_small.inc
+--source include/innodb_encrypt_log.inc
--source include/have_debug_sync.inc
let $innodb_metrics_select=
@@ -200,6 +201,18 @@ EXPLAIN SELECT COUNT(*) FROM t1 WHERE c2 > 3;
SHOW CREATE TABLE t1;
+connection default;
+SET @merge_encrypt_0=
+(SELECT variable_value FROM information_schema.global_status
+WHERE variable_name = 'innodb_encryption_n_merge_blocks_encrypted');
+SET @merge_decrypt_0=
+(SELECT variable_value FROM information_schema.global_status
+WHERE variable_name = 'innodb_encryption_n_merge_blocks_decrypted');
+SET @rowlog_encrypt_0=
+(SELECT variable_value FROM information_schema.global_status
+WHERE variable_name = 'innodb_encryption_n_rowlog_blocks_encrypted');
+connection con1;
+
# Exceed the configured innodb_online_alter_log_max_size.
# The actual limit is a multiple of innodb_sort_buf_size,
# because that is the size of the in-memory log buffers.
@@ -223,7 +236,7 @@ SET DEBUG_SYNC = 'now WAIT_FOR c2e_created';
# At this point, the clustered index scan must have completed,
# but the modification log keeps accumulating due to the DEBUG_SYNC.
eval $innodb_metrics_select;
-let $c= 2;
+let $c= 4;
while ($c)
{
BEGIN;
@@ -243,6 +256,22 @@ SELECT sf.name, sf.pos FROM INFORMATION_SCHEMA.INNODB_SYS_INDEXES si
INNER JOIN INFORMATION_SCHEMA.INNODB_SYS_FIELDS sf
ON si.index_id = sf.index_id WHERE si.name = '?c2e';
+SET @merge_encrypt_1=
+(SELECT variable_value FROM information_schema.global_status
+WHERE variable_name = 'innodb_encryption_n_merge_blocks_encrypted');
+SET @merge_decrypt_1=
+(SELECT variable_value FROM information_schema.global_status
+WHERE variable_name = 'innodb_encryption_n_merge_blocks_decrypted');
+SET @rowlog_encrypt_1=
+(SELECT variable_value FROM information_schema.global_status
+WHERE variable_name = 'innodb_encryption_n_rowlog_blocks_encrypted');
+
+SELECT
+(@merge_encrypt_1-@merge_encrypt_0)-
+(@merge_decrypt_1-@merge_decrypt_0) as sort_balance,
+@merge_encrypt_1>@merge_encrypt_0, @merge_decrypt_1>@merge_decrypt_0,
+@rowlog_encrypt_1>@rowlog_encrypt_0;
+
# Release con1.
SET DEBUG_SYNC = 'now SIGNAL dml2_done';
@@ -270,6 +299,19 @@ ALTER TABLE t1 COMMENT 'testing if c2e will be dropped';
# Check that the 'zombie' index c2e was dropped.
eval $innodb_metrics_select;
+SET @merge_encrypt_1=
+(SELECT variable_value FROM information_schema.global_status
+WHERE variable_name = 'innodb_encryption_n_merge_blocks_encrypted');
+SET @merge_decrypt_1=
+(SELECT variable_value FROM information_schema.global_status
+WHERE variable_name = 'innodb_encryption_n_merge_blocks_decrypted');
+SET @rowlog_encrypt_1=
+(SELECT variable_value FROM information_schema.global_status
+WHERE variable_name = 'innodb_encryption_n_rowlog_blocks_encrypted');
+SET @rowlog_decrypt_1=
+(SELECT variable_value FROM information_schema.global_status
+WHERE variable_name = 'innodb_encryption_n_rowlog_blocks_decrypted');
+
connection con1;
# Accumulate and apply some modification log.
SET DEBUG_SYNC = 'row_log_apply_before SIGNAL c2f_created WAIT_FOR dml3_done';
@@ -282,6 +324,9 @@ connection default;
SET DEBUG_SYNC = 'now WAIT_FOR c2f_created';
# Generate some log (delete-mark, delete-unmark, insert etc.)
eval $innodb_metrics_select;
+let $c= 2;
+while ($c)
+{
BEGIN;
INSERT INTO t1 SELECT 320 + c1, c2, c3 FROM t1 WHERE c1 > 160;
DELETE FROM t1 WHERE c1 > 320;
@@ -290,6 +335,8 @@ BEGIN;
UPDATE t1 SET c2 = c2 + 1;
DELETE FROM t1;
ROLLBACK;
+dec $c;
+}
eval $innodb_metrics_select;
# Release con1.
SET DEBUG_SYNC = 'now SIGNAL dml3_done';
@@ -300,6 +347,34 @@ reap;
ALTER TABLE t1 CHANGE c2 c22f INT;
eval $innodb_metrics_select;
+
+connection default;
+
+SET @merge_encrypt_2=
+(SELECT variable_value FROM information_schema.global_status
+WHERE variable_name = 'innodb_encryption_n_merge_blocks_encrypted');
+SET @merge_decrypt_2=
+(SELECT variable_value FROM information_schema.global_status
+WHERE variable_name = 'innodb_encryption_n_merge_blocks_decrypted');
+SET @rowlog_encrypt_2=
+(SELECT variable_value FROM information_schema.global_status
+WHERE variable_name = 'innodb_encryption_n_rowlog_blocks_encrypted');
+SET @rowlog_decrypt_2=
+(SELECT variable_value FROM information_schema.global_status
+WHERE variable_name = 'innodb_encryption_n_rowlog_blocks_decrypted');
+
+SELECT
+(@merge_encrypt_2-@merge_encrypt_1)-
+(@merge_decrypt_2-@merge_decrypt_1) as sort_balance,
+(@rowlog_encrypt_2-@rowlog_encrypt_1)-
+(@rowlog_decrypt_2-@rowlog_decrypt_1) as log_balance;
+SELECT
+@merge_encrypt_2-@merge_encrypt_1>0 as sort_encrypted,
+@merge_decrypt_2-@merge_decrypt_1>0 as sort_decrypted,
+@rowlog_encrypt_2-@rowlog_encrypt_1>0 as log_encrypted,
+@rowlog_decrypt_2-@rowlog_decrypt_1>0 as log_decrypted;
+
+connection con1;
SELECT COUNT(c22f) FROM t1;
CHECK TABLE t1;
diff --git a/mysql-test/suite/innodb/t/innodb-table-online-master.opt b/mysql-test/suite/innodb/t/innodb-table-online-master.opt
index 9ac01ffb5ad..92eea2b0d2e 100644
--- a/mysql-test/suite/innodb/t/innodb-table-online-master.opt
+++ b/mysql-test/suite/innodb/t/innodb-table-online-master.opt
@@ -1 +1 @@
---innodb-sort-buffer-size=64k --innodb-online-alter-log-max-size=64k --innodb-buffer-pool-size=5M --innodb-log-buffer-size=256k
+--innodb-sort-buffer-size=64k --innodb-online-alter-log-max-size=512k --innodb-buffer-pool-size=5M --innodb-log-buffer-size=256k
diff --git a/mysql-test/suite/innodb/t/innodb-table-online.test b/mysql-test/suite/innodb/t/innodb-table-online.test
index a1977fa06a4..dddbbb34117 100644
--- a/mysql-test/suite/innodb/t/innodb-table-online.test
+++ b/mysql-test/suite/innodb/t/innodb-table-online.test
@@ -1,4 +1,5 @@
--source include/innodb_page_size_small.inc
+--source include/innodb_encrypt_log.inc
--source include/have_debug.inc
--source include/have_debug_sync.inc
@@ -17,7 +18,7 @@ SET GLOBAL innodb_file_per_table = on;
# Save the initial number of concurrent sessions.
--source include/count_sessions.inc
-CREATE TABLE t1 (c1 INT PRIMARY KEY, c2 INT NOT NULL, c3 TEXT NOT NULL)
+CREATE TABLE t1 (c1 INT PRIMARY KEY, c2 INT NOT NULL, c3 CHAR(255) NOT NULL)
ENGINE = InnoDB;
INSERT INTO t1 VALUES (1,1,''), (2,2,''), (3,3,''), (4,4,''), (5,5,'');
@@ -183,10 +184,20 @@ INSERT INTO t1 SELECT 10 + c1, c2, c3 FROM t1;
INSERT INTO t1 SELECT 20 + c1, c2, c3 FROM t1;
INSERT INTO t1 SELECT 40 + c1, c2, c3 FROM t1;
# Purge may or may not have cleaned up the DELETE FROM t1 WHERE c1 = 7;
---replace_result 81 80
+--replace_column 9 ROWS
EXPLAIN SELECT COUNT(*) FROM t1 WHERE c2 > 3;
ANALYZE TABLE t1;
+SET @merge_encrypt_0=
+(SELECT variable_value FROM information_schema.global_status
+WHERE variable_name = 'innodb_encryption_n_merge_blocks_encrypted');
+SET @merge_decrypt_0=
+(SELECT variable_value FROM information_schema.global_status
+WHERE variable_name = 'innodb_encryption_n_merge_blocks_decrypted');
+SET @rowlog_encrypt_0=
+(SELECT variable_value FROM information_schema.global_status
+WHERE variable_name = 'innodb_encryption_n_rowlog_blocks_encrypted');
+
--echo # session con1
connection con1;
SHOW CREATE TABLE t1;
@@ -228,6 +239,22 @@ while ($c)
# Temporary table should exist until the DDL thread notices the overflow.
eval $innodb_metrics_select;
+SET @merge_encrypt_1=
+(SELECT variable_value FROM information_schema.global_status
+WHERE variable_name = 'innodb_encryption_n_merge_blocks_encrypted');
+SET @merge_decrypt_1=
+(SELECT variable_value FROM information_schema.global_status
+WHERE variable_name = 'innodb_encryption_n_merge_blocks_decrypted');
+SET @rowlog_encrypt_1=
+(SELECT variable_value FROM information_schema.global_status
+WHERE variable_name = 'innodb_encryption_n_rowlog_blocks_encrypted');
+
+SELECT
+(@merge_encrypt_1-@merge_encrypt_0)-
+(@merge_decrypt_1-@merge_decrypt_0) as sort_balance,
+@merge_encrypt_1>@merge_encrypt_0, @merge_decrypt_1>@merge_decrypt_0,
+@rowlog_encrypt_1>@rowlog_encrypt_0;
+
# Release con1.
SET DEBUG_SYNC = 'now SIGNAL dml2_done';
@@ -241,6 +268,19 @@ reap;
# when the above error was noticed.
eval $innodb_metrics_select;
+SET @merge_encrypt_1=
+(SELECT variable_value FROM information_schema.global_status
+WHERE variable_name = 'innodb_encryption_n_merge_blocks_encrypted');
+SET @merge_decrypt_1=
+(SELECT variable_value FROM information_schema.global_status
+WHERE variable_name = 'innodb_encryption_n_merge_blocks_decrypted');
+SET @rowlog_encrypt_1=
+(SELECT variable_value FROM information_schema.global_status
+WHERE variable_name = 'innodb_encryption_n_rowlog_blocks_encrypted');
+SET @rowlog_decrypt_1=
+(SELECT variable_value FROM information_schema.global_status
+WHERE variable_name = 'innodb_encryption_n_rowlog_blocks_decrypted');
+
# Accumulate and apply some modification log.
SET DEBUG_SYNC = 'row_log_table_apply1_before SIGNAL rebuilt3 WAIT_FOR dml3_done';
--error ER_MULTIPLE_PRI_KEY
@@ -249,8 +289,8 @@ ALTER TABLE t1 ADD PRIMARY KEY(c22f), CHANGE c2 c22f INT;
ALTER TABLE t1 DROP PRIMARY KEY, ADD PRIMARY KEY(c22f), CHANGE c2 c22f INT;
--send
ALTER TABLE t1 DROP PRIMARY KEY, ADD PRIMARY KEY(c1,c22f,c4(5)),
-CHANGE c2 c22f INT, CHANGE c3 c3 TEXT NULL, CHANGE c1 c1 INT AFTER c22f,
-ADD COLUMN c4 VARCHAR(6) DEFAULT 'Online';
+CHANGE c2 c22f INT, CHANGE c3 c3 CHAR(255) NULL, CHANGE c1 c1 INT AFTER c22f,
+ADD COLUMN c4 VARCHAR(6) DEFAULT 'Online', LOCK=NONE;
--echo # session default
connection default;
@@ -276,6 +316,30 @@ eval $innodb_metrics_select;
SELECT COUNT(c22f) FROM t1;
CHECK TABLE t1;
+SET @merge_encrypt_2=
+(SELECT variable_value FROM information_schema.global_status
+WHERE variable_name = 'innodb_encryption_n_merge_blocks_encrypted');
+SET @merge_decrypt_2=
+(SELECT variable_value FROM information_schema.global_status
+WHERE variable_name = 'innodb_encryption_n_merge_blocks_decrypted');
+SET @rowlog_encrypt_2=
+(SELECT variable_value FROM information_schema.global_status
+WHERE variable_name = 'innodb_encryption_n_rowlog_blocks_encrypted');
+SET @rowlog_decrypt_2=
+(SELECT variable_value FROM information_schema.global_status
+WHERE variable_name = 'innodb_encryption_n_rowlog_blocks_decrypted');
+
+SELECT
+(@merge_encrypt_2-@merge_encrypt_1)-
+(@merge_decrypt_2-@merge_decrypt_1) as sort_balance,
+(@rowlog_encrypt_2-@rowlog_encrypt_1)-
+(@rowlog_decrypt_2-@rowlog_decrypt_1) as log_balance;
+SELECT
+@merge_encrypt_2-@merge_encrypt_1>0 as sort_encrypted,
+@merge_decrypt_2-@merge_decrypt_1>0 as sort_decrypted,
+@rowlog_encrypt_2-@rowlog_encrypt_1>0 as log_encrypted,
+@rowlog_decrypt_2-@rowlog_decrypt_1>0 as log_decrypted;
+
# Create a column prefix index.
--error ER_DUP_ENTRY
ALTER TABLE t1 DROP PRIMARY KEY, ADD PRIMARY KEY c3p5(c3(5));
@@ -292,15 +356,15 @@ ALTER TABLE t1 DROP COLUMN c22f, DROP PRIMARY KEY, ADD PRIMARY KEY c3p5(c3(5)),
ALGORITHM = INPLACE;
--error ER_INVALID_USE_OF_NULL
-ALTER TABLE t1 MODIFY c3 TEXT NOT NULL;
+ALTER TABLE t1 MODIFY c3 CHAR(255) NOT NULL;
SET @@sql_mode = @old_sql_mode;
-UPDATE t1 SET c3=CONCAT(c1,REPEAT('foo',c1)) WHERE c3 IS NULL;
+UPDATE t1 SET c3=LEFT(CONCAT(c1,REPEAT('foo',c1)),255) WHERE c3 IS NULL;
SET DEBUG_SYNC = 'row_log_table_apply1_before SIGNAL c3p5_created0 WAIT_FOR ins_done0';
# NULL -> NOT NULL only allowed INPLACE if strict sql_mode is on.
SET @@sql_mode = 'STRICT_TRANS_TABLES';
--send
-ALTER TABLE t1 MODIFY c3 TEXT NOT NULL, DROP COLUMN c22f,
+ALTER TABLE t1 MODIFY c3 CHAR(255) NOT NULL, DROP COLUMN c22f,
DROP PRIMARY KEY, ADD PRIMARY KEY(c1,c4(5)),
ADD COLUMN c5 CHAR(5) DEFAULT 'tired' FIRST;
@@ -325,7 +389,7 @@ ROLLBACK;
--echo # session con1
connection con1;
-ALTER TABLE t1 MODIFY c3 TEXT NOT NULL;
+ALTER TABLE t1 MODIFY c3 CHAR(255) NOT NULL;
SET DEBUG_SYNC = 'row_log_table_apply1_before SIGNAL c3p5_created WAIT_FOR ins_done';
--send
ALTER TABLE t1 DROP PRIMARY KEY, DROP COLUMN c22f,