summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2018-12-07 12:54:02 +0200
committerMarko Mäkelä <marko.makela@mariadb.com>2018-12-07 13:12:39 +0200
commit12b1ba195cb0802053bc2fae3b507ec9721685f8 (patch)
treebfd35574bc038af06683b0b6d949f83b726320c9
parentdaca7e70d70cfc59b4139239bbd09b7c63912be9 (diff)
downloadmariadb-git-12b1ba195cb0802053bc2fae3b507ec9721685f8.tar.gz
MDEV-17904 Crash in fts_is_sync_needed() after failed ALTER or CREATE TABLE
create_table_def(), ha_innobase::create(): Defer fts_optimize_add_table() until after the table has been successfully created.
-rw-r--r--storage/innobase/handler/ha_innodb.cc8
-rw-r--r--storage/xtradb/handler/ha_innodb.cc8
2 files changed, 8 insertions, 8 deletions
diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc
index 85c5529a096..b1e37ea0fa4 100644
--- a/storage/innobase/handler/ha_innodb.cc
+++ b/storage/innobase/handler/ha_innodb.cc
@@ -9371,10 +9371,6 @@ err_col:
: ER_TABLESPACE_EXISTS, MYF(0), display_name);
}
- if (err == DB_SUCCESS && (flags2 & DICT_TF2_FTS)) {
- fts_optimize_add_table(table);
- }
-
error_ret:
DBUG_RETURN(convert_error_code_to_mysql(err, flags, thd));
}
@@ -10441,6 +10437,10 @@ ha_innobase::create(
trx_free_for_mysql(trx);
DBUG_RETURN(-1);
}
+
+ mutex_enter(&dict_sys->mutex);
+ fts_optimize_add_table(innobase_table);
+ mutex_exit(&dict_sys->mutex);
}
/* Note: We can't call update_thd() as prebuilt will not be
diff --git a/storage/xtradb/handler/ha_innodb.cc b/storage/xtradb/handler/ha_innodb.cc
index 52ef0b01534..5eadc42f56e 100644
--- a/storage/xtradb/handler/ha_innodb.cc
+++ b/storage/xtradb/handler/ha_innodb.cc
@@ -10143,10 +10143,6 @@ err_col:
: ER_TABLESPACE_EXISTS, MYF(0), display_name);
}
- if (err == DB_SUCCESS && (flags2 & DICT_TF2_FTS)) {
- fts_optimize_add_table(table);
- }
-
error_ret:
DBUG_RETURN(convert_error_code_to_mysql(err, flags, thd));
}
@@ -11218,6 +11214,10 @@ ha_innobase::create(
trx_free_for_mysql(trx);
DBUG_RETURN(-1);
}
+
+ mutex_enter(&dict_sys->mutex);
+ fts_optimize_add_table(innobase_table);
+ mutex_exit(&dict_sys->mutex);
}
/* Note: We can't call update_thd() as prebuilt will not be