mirror of
https://github.com/MariaDB/server.git
synced 2025-01-31 11:01:52 +01:00
136d21c82f
In commit d30f17af49
the change of
the loop iteration broke another error handling path that did
"goto error_handling_drop_uncached". Cover this code path with
fault injection, and revert to the correct iteration.
There are two fault injection labels innodb_OOM_prepare_inplace_alter.
Their order was swapped in MDEV-11369, so that the label that used
to be covered in an ADD INDEX code path would become unreachable
because the label that is executed for any ALTER TABLE was executed
first. Let us introduce the label innodb_OOM_prepare_add_index
for the more specific case.
524 lines
19 KiB
Text
524 lines
19 KiB
Text
call mtr.add_suppression("InnoDB: Warning: Small buffer pool size");
|
|
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, c3 TEXT)
|
|
ENGINE=InnoDB STATS_PERSISTENT=0;
|
|
INSERT INTO t1 VALUES (1,1,''), (2,2,''), (3,3,''), (4,4,''), (5,5,'');
|
|
SET GLOBAL innodb_monitor_enable = module_ddl;
|
|
SELECT name, count FROM INFORMATION_SCHEMA.INNODB_METRICS WHERE subsystem = 'ddl';
|
|
name count
|
|
ddl_background_drop_indexes 0
|
|
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
|
|
SET DEBUG_SYNC = 'RESET';
|
|
SET DEBUG_SYNC = 'write_row_noreplace SIGNAL have_handle WAIT_FOR go_ahead';
|
|
INSERT INTO t1 VALUES(1,2,3);
|
|
connect con1,localhost,root,,;
|
|
connection con1;
|
|
SET DEBUG_SYNC = 'now WAIT_FOR have_handle';
|
|
SET lock_wait_timeout = 1;
|
|
ALTER TABLE t1 ADD UNIQUE INDEX(c2);
|
|
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
|
|
SET DEBUG_SYNC = 'now SIGNAL go_ahead';
|
|
connection default;
|
|
ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
|
|
SELECT name, count FROM INFORMATION_SCHEMA.INNODB_METRICS WHERE subsystem = 'ddl';
|
|
name count
|
|
ddl_background_drop_indexes 0
|
|
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
|
|
connection con1;
|
|
SET @saved_debug_dbug = @@SESSION.debug_dbug;
|
|
SET DEBUG_DBUG = '+d,innodb_OOM_prepare_inplace_alter';
|
|
ALTER TABLE t1 ADD UNIQUE INDEX(c2);
|
|
ERROR HY000: Out of memory.
|
|
SET DEBUG_DBUG = @saved_debug_dbug;
|
|
SET DEBUG_DBUG = '+d,innodb_OOM_inplace_alter';
|
|
CREATE UNIQUE INDEX c2 ON t1(c2);
|
|
ERROR HY000: Out of memory.
|
|
SET DEBUG_DBUG = @saved_debug_dbug;
|
|
SET DEBUG_DBUG = '+d,innodb_OOM_prepare_add_index';
|
|
ALTER TABLE t1 ADD KEY(c2), ADD KEY c3_10(c3(10)), ADD KEY c3_c2(c3(4),c2);
|
|
ERROR HY000: Out of memory.
|
|
SET DEBUG_DBUG = @saved_debug_dbug;
|
|
CREATE UNIQUE INDEX c2 ON t1(c2);
|
|
DROP INDEX c2 ON t1;
|
|
connection default;
|
|
SHOW CREATE TABLE t1;
|
|
Table Create Table
|
|
t1 CREATE TABLE `t1` (
|
|
`c1` int(11) NOT NULL,
|
|
`c2` int(11) DEFAULT NULL,
|
|
`c3` text DEFAULT NULL,
|
|
PRIMARY KEY (`c1`)
|
|
) ENGINE=InnoDB DEFAULT CHARSET=latin1 STATS_PERSISTENT=0
|
|
BEGIN;
|
|
INSERT INTO t1 VALUES(7,4,2);
|
|
connection con1;
|
|
SET DEBUG_SYNC = 'row_log_apply_before SIGNAL scanned WAIT_FOR rollback_done';
|
|
ALTER TABLE t1 ADD UNIQUE INDEX(c2);
|
|
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
|
|
connection default;
|
|
COMMIT;
|
|
connection con1;
|
|
ALTER TABLE t1 ADD UNIQUE INDEX(c2);
|
|
ERROR 23000: Duplicate entry '4' for key 'c2'
|
|
connection default;
|
|
DELETE FROM t1 WHERE c1 = 7;
|
|
connection con1;
|
|
ALTER TABLE t1 ADD FOREIGN KEY(c2) REFERENCES t1(c2), ALGORITHM = INPLACE;
|
|
ERROR 0A000: ALGORITHM=INPLACE is not supported. Reason: Adding foreign keys needs foreign_key_checks=OFF. Try ALGORITHM=COPY
|
|
ALTER TABLE t1 ADD UNIQUE INDEX(c2), LOCK = EXCLUSIVE, ALGORITHM = INPLACE;
|
|
DROP INDEX c2 ON t1;
|
|
ALTER TABLE t1 ADD UNIQUE INDEX(c2);
|
|
connection default;
|
|
SET DEBUG_SYNC = 'now WAIT_FOR scanned';
|
|
SELECT name, count FROM INFORMATION_SCHEMA.INNODB_METRICS WHERE subsystem = 'ddl';
|
|
name count
|
|
ddl_background_drop_indexes 0
|
|
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
|
|
BEGIN;
|
|
INSERT INTO t1 VALUES(7,4,2);
|
|
ROLLBACK;
|
|
SET DEBUG_SYNC = 'now SIGNAL rollback_done';
|
|
connection con1;
|
|
ERROR 23000: Duplicate entry '4' for key 'c2'
|
|
SET DEBUG_SYNC = 'row_log_apply_after SIGNAL created WAIT_FOR dml_done';
|
|
ALTER TABLE t1 ADD UNIQUE INDEX(c2);
|
|
connection default;
|
|
SET DEBUG_SYNC = 'now WAIT_FOR created';
|
|
SELECT name, count FROM INFORMATION_SCHEMA.INNODB_METRICS WHERE subsystem = 'ddl';
|
|
name count
|
|
ddl_background_drop_indexes 0
|
|
ddl_background_drop_tables 0
|
|
ddl_online_create_index 0
|
|
ddl_pending_alter_table 1
|
|
ddl_sort_file_alter_table 0
|
|
ddl_log_file_alter_table 0
|
|
INSERT INTO t1 VALUES(6,3,1);
|
|
SET DEBUG_SYNC = 'now SIGNAL dml_done';
|
|
connection con1;
|
|
ERROR 23000: Duplicate entry for key 'c2'
|
|
DELETE FROM t1 WHERE c1=6;
|
|
ALTER TABLE t1 ADD UNIQUE INDEX(c2);
|
|
SELECT name, count FROM INFORMATION_SCHEMA.INNODB_METRICS WHERE subsystem = 'ddl';
|
|
name count
|
|
ddl_background_drop_indexes 0
|
|
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
|
|
connection default;
|
|
INSERT INTO t1 VALUES(6,3,1);
|
|
ERROR 23000: Duplicate entry '3' for key 'c2'
|
|
INSERT INTO t1 VALUES(7,4,2);
|
|
ERROR 23000: Duplicate entry '4' for key 'c2'
|
|
ALTER TABLE t1 STATS_PERSISTENT=1;
|
|
ANALYZE TABLE t1;
|
|
Table Op Msg_type Msg_text
|
|
test.t1 analyze status OK
|
|
UPDATE mysql.innodb_index_stats SET stat_value = 5
|
|
WHERE database_name = 'test' AND table_name= 't1' AND index_name = 'PRIMARY'
|
|
AND stat_value = 6;
|
|
SELECT * FROM mysql.innodb_index_stats WHERE table_name IN ('t1');
|
|
database_name table_name index_name last_update stat_name stat_value sample_size stat_description
|
|
test t1 PRIMARY LAST_UPDATE n_diff_pfx01 5 1 c1
|
|
test t1 PRIMARY LAST_UPDATE n_leaf_pages 1 NULL Number of leaf pages in the index
|
|
test t1 PRIMARY LAST_UPDATE size 1 NULL Number of pages in the index
|
|
test t1 c2 LAST_UPDATE n_diff_pfx01 5 1 c2
|
|
test t1 c2 LAST_UPDATE n_leaf_pages 1 NULL Number of leaf pages in the index
|
|
test t1 c2 LAST_UPDATE size 1 NULL Number of pages in the index
|
|
CREATE TABLE t1_c2_stats SELECT * FROM mysql.innodb_index_stats
|
|
WHERE database_name = 'test' AND table_name = 't1' and index_name = 'c2';
|
|
ALTER TABLE t1_c2_stats ENGINE=INNODB;
|
|
DROP INDEX c2 ON t1;
|
|
ANALYZE TABLE t1_c2_stats;
|
|
Table Op Msg_type Msg_text
|
|
test.t1_c2_stats analyze status OK
|
|
SELECT * FROM mysql.innodb_index_stats WHERE table_name IN ('t1', 't1_c2_stats');
|
|
database_name table_name index_name last_update stat_name stat_value sample_size stat_description
|
|
test t1 PRIMARY LAST_UPDATE n_diff_pfx01 5 1 c1
|
|
test t1 PRIMARY LAST_UPDATE n_leaf_pages 1 NULL Number of leaf pages in the index
|
|
test t1 PRIMARY LAST_UPDATE size 1 NULL Number of pages in the index
|
|
connection con1;
|
|
KILL QUERY @id;
|
|
ERROR 70100: Query execution was interrupted
|
|
SET DEBUG_SYNC = 'row_log_apply_before SIGNAL c2d_created WAIT_FOR kill_done';
|
|
CREATE INDEX c2d ON t1(c2);
|
|
connection default;
|
|
SET DEBUG_SYNC = 'now WAIT_FOR c2d_created';
|
|
SELECT name, count FROM INFORMATION_SCHEMA.INNODB_METRICS WHERE subsystem = 'ddl';
|
|
name count
|
|
ddl_background_drop_indexes 0
|
|
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
|
|
KILL QUERY @id;
|
|
SET DEBUG_SYNC = 'now SIGNAL kill_done';
|
|
connection con1;
|
|
ERROR 70100: Query execution was interrupted
|
|
SELECT name, count FROM INFORMATION_SCHEMA.INNODB_METRICS WHERE subsystem = 'ddl';
|
|
name count
|
|
ddl_background_drop_indexes 0
|
|
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
|
|
connection default;
|
|
CHECK TABLE t1;
|
|
Table Op Msg_type Msg_text
|
|
test.t1 check status OK
|
|
INSERT INTO t1 SELECT 5 + c1, c2, c3 FROM t1;
|
|
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;
|
|
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
|
|
ANALYZE TABLE t1;
|
|
Table Op Msg_type Msg_text
|
|
test.t1 analyze status OK
|
|
connection con1;
|
|
UPDATE t1_c2_stats SET index_name = 'c2d';
|
|
UPDATE t1_c2_stats SET stat_value = 2 WHERE stat_name = 'n_diff_pfx01';
|
|
INSERT INTO t1_c2_stats
|
|
SELECT database_name, table_name, index_name, last_update, 'n_diff_pfx02', 80,
|
|
sample_size, 'c2,c1' FROM t1_c2_stats
|
|
WHERE stat_name = 'n_diff_pfx01' AND stat_description = 'c2';
|
|
INSERT INTO mysql.innodb_index_stats SELECT * FROM t1_c2_stats;
|
|
DROP TABLE t1_c2_stats;
|
|
CREATE INDEX c2d ON t1(c2);
|
|
SHOW INDEX FROM t1;
|
|
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
|
|
t1 0 PRIMARY 1 c1 A 80 NULL NULL BTREE
|
|
t1 1 c2d 1 c2 A 10 NULL NULL YES BTREE
|
|
EXPLAIN SELECT COUNT(*) FROM t1 WHERE c2 > 3;
|
|
id select_type table type possible_keys key key_len ref rows Extra
|
|
1 SIMPLE t1 range c2d c2d 5 NULL 32 Using where; Using index
|
|
SHOW CREATE TABLE t1;
|
|
Table Create Table
|
|
t1 CREATE TABLE `t1` (
|
|
`c1` int(11) NOT NULL,
|
|
`c2` int(11) DEFAULT NULL,
|
|
`c3` text DEFAULT NULL,
|
|
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),
|
|
ALGORITHM = INPLACE;
|
|
connection default;
|
|
INSERT INTO t1 SELECT 80 + c1, c2, c3 FROM t1;
|
|
INSERT INTO t1 SELECT 160 + c1, c2, c3 FROM t1;
|
|
SET DEBUG_SYNC = 'now WAIT_FOR c2e_created';
|
|
SELECT name, count FROM INFORMATION_SCHEMA.INNODB_METRICS WHERE subsystem = 'ddl';
|
|
name count
|
|
ddl_background_drop_indexes 0
|
|
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
|
|
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;
|
|
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
|
|
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 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
|
|
SELECT name, count FROM INFORMATION_SCHEMA.INNODB_METRICS WHERE subsystem = 'ddl';
|
|
name count
|
|
ddl_background_drop_indexes 1
|
|
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 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
|
|
SELECT name, count FROM INFORMATION_SCHEMA.INNODB_METRICS WHERE subsystem = 'ddl';
|
|
name count
|
|
ddl_background_drop_indexes 1
|
|
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 1
|
|
connection default;
|
|
ALTER TABLE t1 COMMENT 'testing if c2e will be dropped';
|
|
SELECT name, count FROM INFORMATION_SCHEMA.INNODB_METRICS WHERE subsystem = 'ddl';
|
|
name count
|
|
ddl_background_drop_indexes 0
|
|
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 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);
|
|
connection default;
|
|
SET DEBUG_SYNC = 'now WAIT_FOR c2f_created';
|
|
SELECT name, count FROM INFORMATION_SCHEMA.INNODB_METRICS WHERE subsystem = 'ddl';
|
|
name count
|
|
ddl_background_drop_indexes 0
|
|
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 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;
|
|
ROLLBACK;
|
|
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
|
|
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 2
|
|
SET DEBUG_SYNC = 'now SIGNAL dml3_done';
|
|
connection con1;
|
|
Warnings:
|
|
Note 1831 Duplicate index `c2f`. This is deprecated and will be disallowed in a future release
|
|
ALTER TABLE t1 CHANGE c2 c22f INT;
|
|
SELECT name, count FROM INFORMATION_SCHEMA.INNODB_METRICS WHERE subsystem = 'ddl';
|
|
name count
|
|
ddl_background_drop_indexes 0
|
|
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 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
|
|
CHECK TABLE t1;
|
|
Table Op Msg_type Msg_text
|
|
test.t1 check status OK
|
|
ALTER TABLE t1 ADD UNIQUE INDEX c3p5(c3(5));
|
|
ERROR 23000: Duplicate entry 'NULL' for key 'c3p5'
|
|
UPDATE t1 SET c3 = NULL WHERE c3 = '';
|
|
SET lock_wait_timeout = 1;
|
|
SET DEBUG_SYNC = 'row_log_apply_before SIGNAL c3p5_created WAIT_FOR ins_done';
|
|
ALTER TABLE t1 ADD UNIQUE INDEX c3p5(c3(5));
|
|
connection default;
|
|
SET DEBUG_SYNC = 'now WAIT_FOR c3p5_created';
|
|
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 = '?c3p5';
|
|
name pos
|
|
c3 0
|
|
SET DEBUG_SYNC = 'ib_after_row_insert SIGNAL ins_done WAIT_FOR ddl_timed_out';
|
|
INSERT INTO t1 VALUES(347,33101,NULL);
|
|
connection con1;
|
|
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
|
|
SET DEBUG_SYNC = 'now SIGNAL ddl_timed_out';
|
|
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 = 'c3p5';
|
|
name pos
|
|
SELECT name, count FROM INFORMATION_SCHEMA.INNODB_METRICS WHERE subsystem = 'ddl';
|
|
name count
|
|
ddl_background_drop_indexes 1
|
|
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 2
|
|
connection default;
|
|
SELECT name, count FROM INFORMATION_SCHEMA.INNODB_METRICS WHERE subsystem = 'ddl';
|
|
name count
|
|
ddl_background_drop_indexes 1
|
|
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 2
|
|
connection default;
|
|
SHOW CREATE TABLE t1;
|
|
Table Create Table
|
|
t1 CREATE TABLE `t1` (
|
|
`c1` int(11) NOT NULL,
|
|
`c22f` int(11) DEFAULT NULL,
|
|
`c3` text DEFAULT NULL,
|
|
PRIMARY KEY (`c1`),
|
|
KEY `c2d` (`c22f`),
|
|
KEY `c2f` (`c22f`)
|
|
) ENGINE=InnoDB DEFAULT CHARSET=latin1 STATS_PERSISTENT=1 COMMENT='testing if c2e will be dropped'
|
|
ALTER TABLE t1 DROP INDEX c2d, DROP INDEX c2f;
|
|
SELECT name, count FROM INFORMATION_SCHEMA.INNODB_METRICS WHERE subsystem = 'ddl';
|
|
name count
|
|
ddl_background_drop_indexes 0
|
|
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 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'
|
|
SET DEBUG_SYNC = 'RESET';
|
|
SET GLOBAL innodb_monitor_disable = module_ddl;
|
|
DROP TABLE t1;
|
|
#
|
|
# MDEV-13205 assertion !dict_index_is_online_ddl(index) upon ALTER TABLE
|
|
#
|
|
CREATE TABLE t1 (c VARCHAR(64)) ENGINE=InnoDB;
|
|
SET DEBUG_SYNC = 'row_log_apply_before SIGNAL t1u_created WAIT_FOR dup_done';
|
|
ALTER TABLE t1 ADD UNIQUE(c);
|
|
connection con1;
|
|
SET DEBUG_SYNC = 'now WAIT_FOR t1u_created';
|
|
BEGIN;
|
|
INSERT INTO t1 VALUES('bar'),('bar');
|
|
SET DEBUG_SYNC = 'now SIGNAL dup_done';
|
|
connection default;
|
|
ERROR 23000: Duplicate entry 'bar' for key 'c'
|
|
SET DEBUG_SYNC = 'RESET';
|
|
disconnect con1;
|
|
CREATE TABLE t2 (c VARCHAR(64)) ENGINE=InnoDB;
|
|
ALTER TABLE t2 ADD FOREIGN KEY (c) REFERENCES t1 (c);
|
|
ERROR HY000: Can't create table `test`.`t2` (errno: 150 "Foreign key constraint is incorrectly formed")
|
|
DROP TABLE t2,t1;
|
|
SET GLOBAL innodb_file_per_table = @global_innodb_file_per_table_orig;
|
|
SET GLOBAL innodb_monitor_enable = default;
|
|
SET GLOBAL innodb_monitor_disable = default;
|