summaryrefslogtreecommitdiff
path: root/storage/xtradb/fts/fts0opt.cc
diff options
context:
space:
mode:
Diffstat (limited to 'storage/xtradb/fts/fts0opt.cc')
-rw-r--r--storage/xtradb/fts/fts0opt.cc31
1 files changed, 31 insertions, 0 deletions
diff --git a/storage/xtradb/fts/fts0opt.cc b/storage/xtradb/fts/fts0opt.cc
index 2f8739d3d2c..4472482da81 100644
--- a/storage/xtradb/fts/fts0opt.cc
+++ b/storage/xtradb/fts/fts0opt.cc
@@ -2614,6 +2614,12 @@ UNIV_INTERN void fts_optimize_add_table(dict_table_t* table)
return;
}
+ /* If there is no fts index present then don't add to
+ optimize queue. */
+ if (!ib_vector_size(table->fts->indexes)) {
+ return;
+ }
+
/* Make sure table with FTS index cannot be evicted */
if (table->can_be_evicted) {
dict_table_move_from_lru_to_non_lru(table);
@@ -2622,6 +2628,10 @@ UNIV_INTERN void fts_optimize_add_table(dict_table_t* table)
msg = fts_optimize_create_msg(FTS_MSG_ADD_TABLE, table);
ib_wqueue_add(fts_optimize_wq, msg, msg->heap);
+
+ mutex_enter(&table->fts->bg_threads_mutex);
+ table->fts->in_queue = true;
+ mutex_exit(&table->fts->bg_threads_mutex);
}
/**********************************************************************//**
@@ -2650,6 +2660,15 @@ fts_optimize_remove_table(
return;
}
+ fts_t* fts = table->fts;
+ mutex_enter(&fts->bg_threads_mutex);
+ bool is_in_optimize_queue = fts->in_queue;
+ mutex_exit(&fts->bg_threads_mutex);
+
+ if (!is_in_optimize_queue) {
+ return;
+ }
+
msg = fts_optimize_create_msg(FTS_MSG_DEL_TABLE, NULL);
/* We will wait on this event until signalled by the consumer. */
@@ -2667,6 +2686,10 @@ fts_optimize_remove_table(
os_event_wait(event);
os_event_free(event);
+
+ mutex_enter(&fts->bg_threads_mutex);
+ fts->in_queue = false;
+ mutex_exit(&fts->bg_threads_mutex);
}
/** Send sync fts cache for the table.
@@ -2700,6 +2723,10 @@ fts_optimize_request_sync_table(
msg->ptr = table_id;
ib_wqueue_add(fts_optimize_wq, msg, msg->heap);
+
+ mutex_enter(&table->fts->bg_threads_mutex);
+ table->fts->in_queue = true;
+ mutex_exit(&table->fts->bg_threads_mutex);
}
/** Add a table to fts_slots if it doesn't already exist. */
@@ -2844,6 +2871,10 @@ static void fts_optimize_sync_table(table_id_t table_id)
fts_sync_table(table, true, false, false);
}
+ DBUG_EXECUTE_IF(
+ "ib_optimize_wq_hang",
+ os_thread_sleep(6000000););
+
dict_table_close(table, FALSE, FALSE);
}
}