Commit 12b1ba19 authored by Marko Mäkelä's avatar Marko Mäkelä

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.
parent daca7e70
......@@ -9371,10 +9371,6 @@ create_table_def(
: 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
......
......@@ -10143,10 +10143,6 @@ create_table_def(
: 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
......
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