Commit 42742426 authored by Annamalai Gurusami's avatar Annamalai Gurusami

Bug #19908343 SERVER CRASHES WHEN EXECUTING ALTER TABLE

Problem:

In the function dict_foreign_remove_from_cache(), the rb tree was updated
without actually verifying whether the given foreign key object is there in the
rb tree or not.  There can be an existing foreign key object with the same id 
in the rb tree, which must not be removed.  Such a scenario comes when an
attempt is made to add a foreign key object with a duplicate identifier.

Solution:

When the foreign key object is removed from the dictionary cache, ensure
that the foreign key object removed from the rbt is the correct one.

rb#7168 approved by Jimmy and Marko.
parent 352b6bc9
......@@ -2529,10 +2529,17 @@ dict_foreign_remove_from_cache(
foreign);
rbt = foreign->referenced_table->referenced_rbt;
if (rbt != NULL) {
const ib_rbt_node_t* node
= rbt_lookup(rbt, foreign->id);
dict_foreign_t* val = *(dict_foreign_t**) node->value;
if (val == foreign) {
rbt_delete(rbt, foreign->id);
}
}
}
if (foreign->foreign_table) {
ib_rbt_t* rbt;
......@@ -2543,9 +2550,15 @@ dict_foreign_remove_from_cache(
rbt = foreign->foreign_table->foreign_rbt;
if (rbt != NULL) {
const ib_rbt_node_t* node
= rbt_lookup(rbt, foreign->id);
dict_foreign_t* val = *(dict_foreign_t**) node->value;
if (val == foreign) {
rbt_delete(rbt, foreign->id);
}
}
}
dict_foreign_free(foreign);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment