mirror of
https://github.com/MariaDB/server.git
synced 2025-01-18 04:53:01 +01:00
MDEV-18222: Duplicated call to dict_foreign_remove_from_cache()
innobase_rename_column_try(): Declare fk_evict as std::set instead of std::list, in order to filter out duplicates.
This commit is contained in:
parent
f877f6b49d
commit
5e06ee41a4
4 changed files with 33 additions and 8 deletions
|
@ -49,3 +49,15 @@ INSERT INTO t3 SET a=1;
|
|||
kill query @id;
|
||||
ERROR 70100: Query execution was interrupted
|
||||
DROP TABLE t3,t1;
|
||||
#
|
||||
# MDEV-18222 InnoDB: Failing assertion: heap->magic_n == MEM_BLOCK_MAGIC_N
|
||||
# or ASAN heap-use-after-free in dict_foreign_remove_from_cache upon CHANGE COLUMN
|
||||
#
|
||||
CREATE TABLE t1 (a INT, UNIQUE(a), KEY(a)) ENGINE=InnoDB;
|
||||
ALTER TABLE t1 ADD FOREIGN KEY (a) REFERENCES t1 (a);
|
||||
SET SESSION FOREIGN_KEY_CHECKS = OFF;
|
||||
ALTER TABLE t1 CHANGE COLUMN a a TIME NOT NULL;
|
||||
ALTER TABLE t1 ADD pk INT NOT NULL AUTO_INCREMENT PRIMARY KEY;
|
||||
ALTER TABLE t1 CHANGE COLUMN a b TIME;
|
||||
SET SESSION FOREIGN_KEY_CHECKS = ON;
|
||||
DROP TABLE t1;
|
||||
|
|
|
@ -73,3 +73,16 @@ reap;
|
|||
disconnect fk;
|
||||
|
||||
DROP TABLE t3,t1;
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-18222 InnoDB: Failing assertion: heap->magic_n == MEM_BLOCK_MAGIC_N
|
||||
--echo # or ASAN heap-use-after-free in dict_foreign_remove_from_cache upon CHANGE COLUMN
|
||||
--echo #
|
||||
CREATE TABLE t1 (a INT, UNIQUE(a), KEY(a)) ENGINE=InnoDB;
|
||||
ALTER TABLE t1 ADD FOREIGN KEY (a) REFERENCES t1 (a);
|
||||
SET SESSION FOREIGN_KEY_CHECKS = OFF;
|
||||
ALTER TABLE t1 CHANGE COLUMN a a TIME NOT NULL;
|
||||
ALTER TABLE t1 ADD pk INT NOT NULL AUTO_INCREMENT PRIMARY KEY;
|
||||
ALTER TABLE t1 CHANGE COLUMN a b TIME;
|
||||
SET SESSION FOREIGN_KEY_CHECKS = ON;
|
||||
DROP TABLE t1;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*****************************************************************************
|
||||
|
||||
Copyright (c) 2005, 2018, Oracle and/or its affiliates. All Rights Reserved.
|
||||
Copyright (c) 2017, 2018, MariaDB Corporation.
|
||||
Copyright (c) 2017, 2019, MariaDB Corporation.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify it under
|
||||
the terms of the GNU General Public License as published by the Free Software
|
||||
|
@ -4579,7 +4579,7 @@ err_exit:
|
|||
rename_foreign:
|
||||
trx->op_info = "renaming column in SYS_FOREIGN_COLS";
|
||||
|
||||
std::list<dict_foreign_t*> fk_evict;
|
||||
std::set<dict_foreign_t*> fk_evict;
|
||||
bool foreign_modified;
|
||||
|
||||
for (dict_foreign_set::const_iterator it = user_table->foreign_set.begin();
|
||||
|
@ -4619,7 +4619,7 @@ rename_foreign:
|
|||
}
|
||||
|
||||
if (foreign_modified) {
|
||||
fk_evict.push_back(foreign);
|
||||
fk_evict.insert(foreign);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -4661,7 +4661,7 @@ rename_foreign:
|
|||
}
|
||||
|
||||
if (foreign_modified) {
|
||||
fk_evict.push_back(foreign);
|
||||
fk_evict.insert(foreign);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*****************************************************************************
|
||||
|
||||
Copyright (c) 2005, 2018, Oracle and/or its affiliates. All Rights Reserved.
|
||||
Copyright (c) 2017, 2018, MariaDB Corporation.
|
||||
Copyright (c) 2017, 2019, MariaDB Corporation.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify it under
|
||||
the terms of the GNU General Public License as published by the Free Software
|
||||
|
@ -4593,7 +4593,7 @@ err_exit:
|
|||
rename_foreign:
|
||||
trx->op_info = "renaming column in SYS_FOREIGN_COLS";
|
||||
|
||||
std::list<dict_foreign_t*> fk_evict;
|
||||
std::set<dict_foreign_t*> fk_evict;
|
||||
bool foreign_modified;
|
||||
|
||||
for (dict_foreign_set::const_iterator it = user_table->foreign_set.begin();
|
||||
|
@ -4633,7 +4633,7 @@ rename_foreign:
|
|||
}
|
||||
|
||||
if (foreign_modified) {
|
||||
fk_evict.push_back(foreign);
|
||||
fk_evict.insert(foreign);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -4675,7 +4675,7 @@ rename_foreign:
|
|||
}
|
||||
|
||||
if (foreign_modified) {
|
||||
fk_evict.push_back(foreign);
|
||||
fk_evict.insert(foreign);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue