summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2019-07-25 13:34:36 +0300
committerMarko Mäkelä <marko.makela@mariadb.com>2019-07-25 13:34:36 +0300
commita7e9395f9de0cc19cf79064f5df796d98ec19762 (patch)
treead308db1fd38174921fdae5049f37922cd0c3e57
parent7de38492fcb806d10649e72130a30cf13dd5124d (diff)
downloadmariadb-git-a7e9395f9de0cc19cf79064f5df796d98ec19762.tar.gz
fts_sync_table(), fts_sync() dead code removal
fts_sync(): Remove the constant parameter has_dict=false. fts_sync_table(): Remove the constant parameter has_dict=false, and the redundant parameter unlock_cache = !wait. Make wait=true the default parameter.
-rw-r--r--storage/innobase/fts/fts0fts.cc30
-rw-r--r--storage/innobase/fts/fts0opt.cc2
-rw-r--r--storage/innobase/handler/ha_innodb.cc2
-rw-r--r--storage/innobase/include/fts0fts.h11
-rw-r--r--storage/innobase/row/row0merge.cc3
-rw-r--r--storage/innobase/srv/srv0start.cc30
6 files changed, 11 insertions, 67 deletions
diff --git a/storage/innobase/fts/fts0fts.cc b/storage/innobase/fts/fts0fts.cc
index fb808abf413..8e7f012cf80 100644
--- a/storage/innobase/fts/fts0fts.cc
+++ b/storage/innobase/fts/fts0fts.cc
@@ -194,15 +194,13 @@ FTS auxiliary INDEX table and clear the cache at the end.
@param[in,out] sync sync state
@param[in] unlock_cache whether unlock cache lock when write node
@param[in] wait whether wait when a sync is in progress
-@param[in] has_dict whether has dict operation lock
@return DB_SUCCESS if all OK */
static
dberr_t
fts_sync(
fts_sync_t* sync,
bool unlock_cache,
- bool wait,
- bool has_dict);
+ bool wait);
/****************************************************************//**
Release all resources help by the words rb tree e.g., the node ilist. */
@@ -3424,7 +3422,7 @@ fts_add_doc_from_tuple(
if (cache->total_size > fts_max_cache_size / 5
|| fts_need_sync) {
- fts_sync(cache->sync, true, false, false);
+ fts_sync(cache->sync, true, false);
}
mtr_start(&mtr);
@@ -3602,7 +3600,7 @@ fts_add_doc_by_id(
DBUG_EXECUTE_IF(
"fts_instrument_sync_debug",
- fts_sync(cache->sync, true, true, false);
+ fts_sync(cache->sync, true, true);
);
DEBUG_SYNC_C("fts_instrument_sync_request");
@@ -4309,15 +4307,13 @@ FTS auxiliary INDEX table and clear the cache at the end.
@param[in,out] sync sync state
@param[in] unlock_cache whether unlock cache lock when write node
@param[in] wait whether wait when a sync is in progress
-@param[in] has_dict whether has dict operation lock
@return DB_SUCCESS if all OK */
static
dberr_t
fts_sync(
fts_sync_t* sync,
bool unlock_cache,
- bool wait,
- bool has_dict)
+ bool wait)
{
if (srv_read_only_mode) {
return DB_READ_ONLY;
@@ -4350,12 +4346,6 @@ fts_sync(
DEBUG_SYNC_C("fts_sync_begin");
fts_sync_begin(sync);
- /* When sync in background, we hold dict operation lock
- to prevent DDL like DROP INDEX, etc. */
- if (has_dict) {
- sync->trx->dict_operation_lock_mode = RW_S_LATCH;
- }
-
begin_sync:
if (cache->total_size > fts_max_cache_size) {
/* Avoid the case: sync never finish when
@@ -4446,16 +4436,9 @@ end_sync:
/** Run SYNC on the table, i.e., write out data from the cache to the
FTS auxiliary INDEX table and clear the cache at the end.
@param[in,out] table fts table
-@param[in] unlock_cache whether unlock cache when write node
@param[in] wait whether wait for existing sync to finish
-@param[in] has_dict whether has dict operation lock
@return DB_SUCCESS on success, error code on failure. */
-dberr_t
-fts_sync_table(
- dict_table_t* table,
- bool unlock_cache,
- bool wait,
- bool has_dict)
+dberr_t fts_sync_table(dict_table_t* table, bool wait)
{
dberr_t err = DB_SUCCESS;
@@ -4463,8 +4446,7 @@ fts_sync_table(
if (!dict_table_is_discarded(table) && table->fts->cache
&& !dict_table_is_corrupted(table)) {
- err = fts_sync(table->fts->cache->sync,
- unlock_cache, wait, has_dict);
+ err = fts_sync(table->fts->cache->sync, !wait, wait);
}
return(err);
diff --git a/storage/innobase/fts/fts0opt.cc b/storage/innobase/fts/fts0opt.cc
index f297b7e2594..88e40685eb9 100644
--- a/storage/innobase/fts/fts0opt.cc
+++ b/storage/innobase/fts/fts0opt.cc
@@ -2773,7 +2773,7 @@ static void fts_optimize_sync_table(table_id_t table_id)
table_id, FALSE, DICT_TABLE_OP_NORMAL)) {
if (fil_table_accessible(table)
&& table->fts && table->fts->cache) {
- fts_sync_table(table, true, false, false);
+ fts_sync_table(table, false);
}
dict_table_close(table, FALSE, FALSE);
diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc
index 7fab6d04194..3a3688e35df 100644
--- a/storage/innobase/handler/ha_innodb.cc
+++ b/storage/innobase/handler/ha_innodb.cc
@@ -14726,7 +14726,7 @@ ha_innobase::optimize(
if (innodb_optimize_fulltext_only) {
if (m_prebuilt->table->fts && m_prebuilt->table->fts->cache
&& !dict_table_is_discarded(m_prebuilt->table)) {
- fts_sync_table(m_prebuilt->table, false, true, false);
+ fts_sync_table(m_prebuilt->table);
fts_optimize_table(m_prebuilt->table);
}
try_alter = false;
diff --git a/storage/innobase/include/fts0fts.h b/storage/innobase/include/fts0fts.h
index 1466c219045..fa657b72e70 100644
--- a/storage/innobase/include/fts0fts.h
+++ b/storage/innobase/include/fts0fts.h
@@ -781,16 +781,9 @@ fts_drop_orphaned_tables(void);
/** Run SYNC on the table, i.e., write out data from the cache to the
FTS auxiliary INDEX table and clear the cache at the end.
@param[in,out] table fts table
-@param[in] unlock_cache whether unlock cache when write node
-@param[in] wait whether wait for existing sync to finish
-@param[in] has_dict whether has dict operation lock
+@param[in] wait whether to wait for existing sync to finish
@return DB_SUCCESS on success, error code on failure. */
-dberr_t
-fts_sync_table(
- dict_table_t* table,
- bool unlock_cache,
- bool wait,
- bool has_dict);
+dberr_t fts_sync_table(dict_table_t* table, bool wait = true);
/****************************************************************//**
Free the query graph but check whether dict_sys->mutex is already
diff --git a/storage/innobase/row/row0merge.cc b/storage/innobase/row/row0merge.cc
index 3783b926efa..7fba9817b11 100644
--- a/storage/innobase/row/row0merge.cc
+++ b/storage/innobase/row/row0merge.cc
@@ -2730,8 +2730,7 @@ wait_again:
if (max_doc_id && err == DB_SUCCESS) {
/* Sync fts cache for other fts indexes to keep all
fts indexes consistent in sync_doc_id. */
- err = fts_sync_table(const_cast<dict_table_t*>(new_table),
- false, true, false);
+ err = fts_sync_table(const_cast<dict_table_t*>(new_table));
if (err == DB_SUCCESS) {
fts_update_next_doc_id(NULL, new_table, max_doc_id);
diff --git a/storage/innobase/srv/srv0start.cc b/storage/innobase/srv/srv0start.cc
index f3e91dee159..3cd5f289991 100644
--- a/storage/innobase/srv/srv0start.cc
+++ b/storage/innobase/srv/srv0start.cc
@@ -2759,36 +2759,6 @@ files_checked:
return(DB_SUCCESS);
}
-#if 0
-/********************************************************************
-Sync all FTS cache before shutdown */
-static
-void
-srv_fts_close(void)
-/*===============*/
-{
- dict_table_t* table;
-
- for (table = UT_LIST_GET_FIRST(dict_sys->table_LRU);
- table; table = UT_LIST_GET_NEXT(table_LRU, table)) {
- fts_t* fts = table->fts;
-
- if (fts != NULL) {
- fts_sync_table(table);
- }
- }
-
- for (table = UT_LIST_GET_FIRST(dict_sys->table_non_LRU);
- table; table = UT_LIST_GET_NEXT(table_LRU, table)) {
- fts_t* fts = table->fts;
-
- if (fts != NULL) {
- fts_sync_table(table);
- }
- }
-}
-#endif
-
/** Shut down background threads that can generate undo log. */
void
srv_shutdown_bg_undo_sources()