1
0
mirror of https://github.com/MariaDB/server.git synced 2025-09-02 09:41:40 +03:00

MDEV-13818 CREATE INDEX leaks memory if running out of undo log space

row_merge_create_index_graph(): Relay the internal state
from dict_create_index_step(). Our caller should free the index
only if it was not copied, added to the cache, and freed.

row_merge_create_index(): Free the index template if it was
not added to the cache. This is a safer variant of the logic
that was introduced in 65070beffd in 10.2.

prepare_inplace_alter_table_dict(): Add additional fault injection
to exercise a code path where we have already added an index
to the cache.
This commit is contained in:
Marko Mäkelä
2019-03-07 15:35:55 +02:00
parent 1a5028f430
commit e3adf96aeb
8 changed files with 58 additions and 30 deletions

View File

@@ -3,6 +3,9 @@
#
CREATE TABLE t1(c1 INT PRIMARY KEY, c2 CHAR(1), c3 INT UNSIGNED) ENGINE=InnoDB;
SET @saved_debug_dbug = @@SESSION.debug_dbug;
SET DEBUG_DBUG='+d,create_index_metadata_fail';
ALTER TABLE t1 ADD INDEX (c2), ADD INDEX (c3);
ERROR HY000: The table 't1' is full
SET DEBUG_DBUG='+d,ib_create_table_fail_too_many_trx';
ALTER TABLE t1 ADD INDEX (c2), ADD INDEX (c3);
ERROR HY000: Too many active concurrent transactions
@@ -11,21 +14,21 @@ ALTER TABLE t1 ADD INDEX (c2), ADD INDEX (c3);
SET DEBUG_DBUG='+d,dict_set_index_corrupted';
CHECK TABLE t1;
Table Op Msg_type Msg_text
test.t1 check Warning InnoDB: Index c2 is marked as corrupted
test.t1 check Warning InnoDB: Index c3 is marked as corrupted
test.t1 check Warning InnoDB: Index "c2" is marked as corrupted
test.t1 check Warning InnoDB: Index "c3" is marked as corrupted
test.t1 check error Corrupt
CHECK TABLE t1;
Table Op Msg_type Msg_text
test.t1 check Warning InnoDB: Index c2 is marked as corrupted
test.t1 check Warning InnoDB: Index c3 is marked as corrupted
test.t1 check Warning InnoDB: Index "c2" is marked as corrupted
test.t1 check Warning InnoDB: Index "c3" is marked as corrupted
test.t1 check error Corrupt
ALTER TABLE t1 DROP INDEX c2;
CHECK TABLE t1;
Table Op Msg_type Msg_text
test.t1 check Warning InnoDB: Index c3 is marked as corrupted
test.t1 check Warning InnoDB: Index "c3" is marked as corrupted
test.t1 check error Corrupt
ALTER TABLE t1 ADD INDEX (c2,c3);
ERROR HY000: Index c3 is corrupted
ERROR HY000: Index "c3" is corrupted
ALTER TABLE t1 CHANGE c3 c3 INT NOT NULL;
CHECK TABLE t1;
Table Op Msg_type Msg_text