summaryrefslogtreecommitdiff
path: root/storage/xtradb/handler/handler0alter.cc
diff options
context:
space:
mode:
Diffstat (limited to 'storage/xtradb/handler/handler0alter.cc')
-rw-r--r--storage/xtradb/handler/handler0alter.cc21
1 files changed, 21 insertions, 0 deletions
diff --git a/storage/xtradb/handler/handler0alter.cc b/storage/xtradb/handler/handler0alter.cc
index 32b1fcf4b79..4b09820d400 100644
--- a/storage/xtradb/handler/handler0alter.cc
+++ b/storage/xtradb/handler/handler0alter.cc
@@ -4509,11 +4509,15 @@ err_exit:
rename_foreign:
trx->op_info = "renaming column in SYS_FOREIGN_COLS";
+ std::list<dict_foreign_t*> fk_evict;
+ bool foreign_modified;
+
for (dict_foreign_set::const_iterator it = user_table->foreign_set.begin();
it != user_table->foreign_set.end();
++it) {
dict_foreign_t* foreign = *it;
+ foreign_modified = false;
for (unsigned i = 0; i < foreign->n_fields; i++) {
if (strcmp(foreign->foreign_col_names[i], from)) {
@@ -4541,6 +4545,11 @@ rename_foreign:
if (error != DB_SUCCESS) {
goto err_exit;
}
+ foreign_modified = true;
+ }
+
+ if (foreign_modified) {
+ fk_evict.push_back(foreign);
}
}
@@ -4549,7 +4558,9 @@ rename_foreign:
it != user_table->referenced_set.end();
++it) {
+ foreign_modified = false;
dict_foreign_t* foreign = *it;
+
for (unsigned i = 0; i < foreign->n_fields; i++) {
if (strcmp(foreign->referenced_col_names[i], from)) {
continue;
@@ -4576,7 +4587,17 @@ rename_foreign:
if (error != DB_SUCCESS) {
goto err_exit;
}
+ foreign_modified = true;
}
+
+ if (foreign_modified) {
+ fk_evict.push_back(foreign);
+ }
+ }
+
+ if (new_clustered) {
+ std::for_each(fk_evict.begin(), fk_evict.end(),
+ dict_foreign_remove_from_cache);
}
trx->op_info = "";