Commit a7e9395f authored by Marko Mäkelä's avatar Marko Mäkelä

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.
parent 7de38492
...@@ -194,15 +194,13 @@ FTS auxiliary INDEX table and clear the cache at the end. ...@@ -194,15 +194,13 @@ FTS auxiliary INDEX table and clear the cache at the end.
@param[in,out] sync sync state @param[in,out] sync sync state
@param[in] unlock_cache whether unlock cache lock when write node @param[in] unlock_cache whether unlock cache lock when write node
@param[in] wait whether wait when a sync is in progress @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 */ @return DB_SUCCESS if all OK */
static static
dberr_t dberr_t
fts_sync( fts_sync(
fts_sync_t* sync, fts_sync_t* sync,
bool unlock_cache, bool unlock_cache,
bool wait, bool wait);
bool has_dict);
/****************************************************************//** /****************************************************************//**
Release all resources help by the words rb tree e.g., the node ilist. */ Release all resources help by the words rb tree e.g., the node ilist. */
...@@ -3424,7 +3422,7 @@ fts_add_doc_from_tuple( ...@@ -3424,7 +3422,7 @@ fts_add_doc_from_tuple(
if (cache->total_size > fts_max_cache_size / 5 if (cache->total_size > fts_max_cache_size / 5
|| fts_need_sync) { || fts_need_sync) {
fts_sync(cache->sync, true, false, false); fts_sync(cache->sync, true, false);
} }
mtr_start(&mtr); mtr_start(&mtr);
...@@ -3602,7 +3600,7 @@ fts_add_doc_by_id( ...@@ -3602,7 +3600,7 @@ fts_add_doc_by_id(
DBUG_EXECUTE_IF( DBUG_EXECUTE_IF(
"fts_instrument_sync_debug", "fts_instrument_sync_debug",
fts_sync(cache->sync, true, true, false); fts_sync(cache->sync, true, true);
); );
DEBUG_SYNC_C("fts_instrument_sync_request"); DEBUG_SYNC_C("fts_instrument_sync_request");
...@@ -4309,15 +4307,13 @@ FTS auxiliary INDEX table and clear the cache at the end. ...@@ -4309,15 +4307,13 @@ FTS auxiliary INDEX table and clear the cache at the end.
@param[in,out] sync sync state @param[in,out] sync sync state
@param[in] unlock_cache whether unlock cache lock when write node @param[in] unlock_cache whether unlock cache lock when write node
@param[in] wait whether wait when a sync is in progress @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 */ @return DB_SUCCESS if all OK */
static static
dberr_t dberr_t
fts_sync( fts_sync(
fts_sync_t* sync, fts_sync_t* sync,
bool unlock_cache, bool unlock_cache,
bool wait, bool wait)
bool has_dict)
{ {
if (srv_read_only_mode) { if (srv_read_only_mode) {
return DB_READ_ONLY; return DB_READ_ONLY;
...@@ -4350,12 +4346,6 @@ fts_sync( ...@@ -4350,12 +4346,6 @@ fts_sync(
DEBUG_SYNC_C("fts_sync_begin"); DEBUG_SYNC_C("fts_sync_begin");
fts_sync_begin(sync); 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: begin_sync:
if (cache->total_size > fts_max_cache_size) { if (cache->total_size > fts_max_cache_size) {
/* Avoid the case: sync never finish when /* Avoid the case: sync never finish when
...@@ -4446,16 +4436,9 @@ fts_sync( ...@@ -4446,16 +4436,9 @@ fts_sync(
/** Run SYNC on the table, i.e., write out data from the cache to the /** 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. FTS auxiliary INDEX table and clear the cache at the end.
@param[in,out] table fts table @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] 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. */ @return DB_SUCCESS on success, error code on failure. */
dberr_t dberr_t fts_sync_table(dict_table_t* table, bool wait)
fts_sync_table(
dict_table_t* table,
bool unlock_cache,
bool wait,
bool has_dict)
{ {
dberr_t err = DB_SUCCESS; dberr_t err = DB_SUCCESS;
...@@ -4463,8 +4446,7 @@ fts_sync_table( ...@@ -4463,8 +4446,7 @@ fts_sync_table(
if (!dict_table_is_discarded(table) && table->fts->cache if (!dict_table_is_discarded(table) && table->fts->cache
&& !dict_table_is_corrupted(table)) { && !dict_table_is_corrupted(table)) {
err = fts_sync(table->fts->cache->sync, err = fts_sync(table->fts->cache->sync, !wait, wait);
unlock_cache, wait, has_dict);
} }
return(err); return(err);
......
...@@ -2773,7 +2773,7 @@ static void fts_optimize_sync_table(table_id_t table_id) ...@@ -2773,7 +2773,7 @@ static void fts_optimize_sync_table(table_id_t table_id)
table_id, FALSE, DICT_TABLE_OP_NORMAL)) { table_id, FALSE, DICT_TABLE_OP_NORMAL)) {
if (fil_table_accessible(table) if (fil_table_accessible(table)
&& table->fts && table->fts->cache) { && table->fts && table->fts->cache) {
fts_sync_table(table, true, false, false); fts_sync_table(table, false);
} }
dict_table_close(table, FALSE, FALSE); dict_table_close(table, FALSE, FALSE);
......
...@@ -14726,7 +14726,7 @@ ha_innobase::optimize( ...@@ -14726,7 +14726,7 @@ ha_innobase::optimize(
if (innodb_optimize_fulltext_only) { if (innodb_optimize_fulltext_only) {
if (m_prebuilt->table->fts && m_prebuilt->table->fts->cache if (m_prebuilt->table->fts && m_prebuilt->table->fts->cache
&& !dict_table_is_discarded(m_prebuilt->table)) { && !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); fts_optimize_table(m_prebuilt->table);
} }
try_alter = false; try_alter = false;
......
...@@ -781,16 +781,9 @@ fts_drop_orphaned_tables(void); ...@@ -781,16 +781,9 @@ fts_drop_orphaned_tables(void);
/** Run SYNC on the table, i.e., write out data from the cache to the /** 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. FTS auxiliary INDEX table and clear the cache at the end.
@param[in,out] table fts table @param[in,out] table fts table
@param[in] unlock_cache whether unlock cache when write node @param[in] wait whether to wait for existing sync to finish
@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. */ @return DB_SUCCESS on success, error code on failure. */
dberr_t dberr_t fts_sync_table(dict_table_t* table, bool wait = true);
fts_sync_table(
dict_table_t* table,
bool unlock_cache,
bool wait,
bool has_dict);
/****************************************************************//** /****************************************************************//**
Free the query graph but check whether dict_sys->mutex is already Free the query graph but check whether dict_sys->mutex is already
......
...@@ -2730,8 +2730,7 @@ row_merge_read_clustered_index( ...@@ -2730,8 +2730,7 @@ row_merge_read_clustered_index(
if (max_doc_id && err == DB_SUCCESS) { if (max_doc_id && err == DB_SUCCESS) {
/* Sync fts cache for other fts indexes to keep all /* Sync fts cache for other fts indexes to keep all
fts indexes consistent in sync_doc_id. */ fts indexes consistent in sync_doc_id. */
err = fts_sync_table(const_cast<dict_table_t*>(new_table), err = fts_sync_table(const_cast<dict_table_t*>(new_table));
false, true, false);
if (err == DB_SUCCESS) { if (err == DB_SUCCESS) {
fts_update_next_doc_id(NULL, new_table, max_doc_id); fts_update_next_doc_id(NULL, new_table, max_doc_id);
......
...@@ -2759,36 +2759,6 @@ innobase_start_or_create_for_mysql() ...@@ -2759,36 +2759,6 @@ innobase_start_or_create_for_mysql()
return(DB_SUCCESS); 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. */ /** Shut down background threads that can generate undo log. */
void void
srv_shutdown_bg_undo_sources() srv_shutdown_bg_undo_sources()
......
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