summaryrefslogtreecommitdiff
path: root/storage/innobase/fts/fts0fts.cc
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2021-08-31 13:54:20 +0300
committerMarko Mäkelä <marko.makela@mariadb.com>2021-08-31 13:54:20 +0300
commit094de71742fbed4d49d38017d56f13100050c747 (patch)
tree32e10fe4ea999fb8e3ccdc18d0e47baeb8c461d6 /storage/innobase/fts/fts0fts.cc
parent6a2cd6f4b406cc3167799f589af1b96c4cd6943c (diff)
downloadmariadb-git-094de71742fbed4d49d38017d56f13100050c747.tar.gz
MDEV-25919 preparation: Various cleanup
que_eval_sql(): Remove the parameter lock_dict. The only caller with lock_dict=true was dict_stats_exec_sql(), which will now explicitly invoke dict_sys.lock() and dict_sys.unlock() by itself. row_import_cleanup(): Do not unnecessarily lock the dictionary. Concurrent access to the table during ALTER TABLE...IMPORT TABLESPACE is prevented by MDL and the fact that there cannot exist any undo log or change buffer records that would refer to the table or tablespace. row_import_for_mysql(): Do not unnecessarily lock the dictionary while accessing fil_system. Thanks to MDL_EXCLUSIVE that was acquired by the SQL layer, only one IMPORT may be in effect for the table name. row_quiesce_set_state(): Do not unnecessarily lock the dictionary. The dict_table_t::quiesce state is documented to be protected by all index latches, which we are acquiring. dict_table_close(): Introduce a simpler variant with fewer parameters. dict_table_close(): Reduce the amount of calls. We can simply invoke dict_table_t::release() on startup or in DDL operations, or when the table is inaccessible. In none of these cases, there is no need to invalidate the InnoDB persistent statistics. pars_info_t::graph_owns_us: Remove (unused). pars_info_free(): Define inline. fts_delete(), trx_t::evict_table(), row_prebuilt_free(), row_rename_table_for_mysql(): Simplify. row_mysql_lock_data_dictionary(): Remove some references; use dict_sys.lock() and dict_sys.unlock() instead. row_mysql_lock_table(): Remove. Use lock_table_for_trx() instead. ha_innobase::check_if_supported_inplace_alter(), row_create_table_for_mysql(): Simply assert dict_sys.sys_tables_exist(). In commit 49e2c8f0a6fefdeac50925f758090d6bd099768d and commit 1bd681c8b3c5213ce1f7976940a7dc38b48a0d39 srv_start() actually guarantees that the system tables will exist, or the server is in read-only mode, or startup will fail. Reviewed by: Thirunarayanan Balathandayuthapani
Diffstat (limited to 'storage/innobase/fts/fts0fts.cc')
-rw-r--r--storage/innobase/fts/fts0fts.cc42
1 files changed, 14 insertions, 28 deletions
diff --git a/storage/innobase/fts/fts0fts.cc b/storage/innobase/fts/fts0fts.cc
index fd2f689825a..1d0d9b71489 100644
--- a/storage/innobase/fts/fts0fts.cc
+++ b/storage/innobase/fts/fts0fts.cc
@@ -1593,8 +1593,7 @@ dberr_t fts_lock_tables(trx_t *trx, const dict_table_t &table)
}
/** Drops the common ancillary tables needed for supporting an FTS index
-on the given table. row_mysql_lock_data_dictionary must have been called
-before this.
+on the given table.
@param trx transaction to drop fts common table
@param fts_table table with an FTS index
@param rename whether to rename before dropping
@@ -1653,8 +1652,7 @@ dberr_t fts_drop_index_tables(trx_t *trx, const dict_index_t &index)
/****************************************************************//**
Drops FTS ancillary tables needed for supporting an FTS index
-on the given table. row_mysql_lock_data_dictionary must have been called
-before this.
+on the given table.
@return DB_SUCCESS or error code */
static MY_ATTRIBUTE((nonnull, warn_unused_result))
dberr_t
@@ -1795,8 +1793,7 @@ fts_create_one_common_table(
}
/** Creates the common auxiliary tables needed for supporting an FTS index
-on the given table. row_mysql_lock_data_dictionary must have been called
-before this.
+on the given table.
The following tables are created.
CREATE TABLE $FTS_PREFIX_DELETED
(doc_id BIGINT UNSIGNED, UNIQUE CLUSTERED INDEX on doc_id)
@@ -1974,8 +1971,7 @@ fts_create_one_index_table(
}
/** Creates the column specific ancillary tables needed for supporting an
-FTS index on the given table. row_mysql_lock_data_dictionary must have
-been called before this.
+FTS index on the given table.
All FTS AUX Index tables have the following schema.
CREAT TABLE $FTS_PREFIX_INDEX_[1-6](
@@ -2754,7 +2750,6 @@ fts_delete(
{
que_t* graph;
fts_table_t fts_table;
- dberr_t error = DB_SUCCESS;
doc_id_t write_doc_id;
dict_table_t* table = ftt->table;
doc_id_t doc_id = row->doc_id;
@@ -2765,7 +2760,7 @@ fts_delete(
/* we do not index Documents whose Doc ID value is 0 */
if (doc_id == FTS_NULL_DOC_ID) {
ut_ad(!DICT_TF2_FLAG_IS_SET(table, DICT_TF2_FTS_HAS_DOC_ID));
- return(error);
+ return DB_SUCCESS;
}
ut_a(row->state == FTS_DELETE || row->state == FTS_MODIFY);
@@ -2800,29 +2795,20 @@ fts_delete(
}
/* Note the deleted document for OPTIMIZE to purge. */
- if (error == DB_SUCCESS) {
- char table_name[MAX_FULL_NAME_LEN];
+ char table_name[MAX_FULL_NAME_LEN];
- trx->op_info = "adding doc id to FTS DELETED";
+ trx->op_info = "adding doc id to FTS DELETED";
- info->graph_owns_us = TRUE;
+ fts_table.suffix = "DELETED";
- fts_table.suffix = "DELETED";
-
- fts_get_table_name(&fts_table, table_name);
- pars_info_bind_id(info, "deleted", table_name);
-
- graph = fts_parse_sql(
- &fts_table,
- info,
- "BEGIN INSERT INTO $deleted VALUES (:doc_id);");
+ fts_get_table_name(&fts_table, table_name);
+ pars_info_bind_id(info, "deleted", table_name);
- error = fts_eval_sql(trx, graph);
+ graph = fts_parse_sql(&fts_table, info,
+ "BEGIN INSERT INTO $deleted VALUES (:doc_id);");
- que_graph_free(graph);
- } else {
- pars_info_free(info);
- }
+ dberr_t error = fts_eval_sql(trx, graph);
+ que_graph_free(graph);
/* Increment the total deleted count, this is used to calculate the
number of documents indexed. */