summaryrefslogtreecommitdiff
path: root/storage/innobase/fts/fts0fts.cc
diff options
context:
space:
mode:
Diffstat (limited to 'storage/innobase/fts/fts0fts.cc')
-rw-r--r--storage/innobase/fts/fts0fts.cc19
1 files changed, 16 insertions, 3 deletions
diff --git a/storage/innobase/fts/fts0fts.cc b/storage/innobase/fts/fts0fts.cc
index f8914d74f45..e1fd80bba24 100644
--- a/storage/innobase/fts/fts0fts.cc
+++ b/storage/innobase/fts/fts0fts.cc
@@ -52,14 +52,14 @@ by looking up the key word in the obsolete table names */
/** This is maximum FTS cache for each table and would be
a configurable variable */
-ulong fts_max_cache_size;
+Atomic_relaxed<size_t> fts_max_cache_size;
/** Whether the total memory used for FTS cache is exhausted, and we will
need a sync to free some memory */
bool fts_need_sync = false;
/** Variable specifying the total memory allocated for FTS cache */
-ulong fts_max_total_cache_size;
+Atomic_relaxed<size_t> fts_max_total_cache_size;
/** This is FTS result cache limit for each query and would be
a configurable variable */
@@ -4219,11 +4219,17 @@ fts_sync(
fts_sync_begin(sync);
begin_sync:
- if (cache->total_size > fts_max_cache_size) {
+ const size_t fts_cache_size= fts_max_cache_size;
+ if (cache->total_size > fts_cache_size) {
/* Avoid the case: sync never finish when
insert/update keeps comming. */
ut_ad(sync->unlock_cache);
sync->unlock_cache = false;
+ ib::warn() << "Total InnoDB FTS size "
+ << cache->total_size << " for the table "
+ << cache->sync->table->name
+ << " exceeds the innodb_ft_cache_size "
+ << fts_cache_size;
}
for (i = 0; i < ib_vector_size(cache->indexes); ++i) {
@@ -4244,6 +4250,13 @@ begin_sync:
if (error != DB_SUCCESS) {
goto end_sync;
}
+
+ if (!sync->unlock_cache
+ && cache->total_size < fts_max_cache_size) {
+ /* Reset the unlock cache if the value
+ is less than innodb_ft_cache_size */
+ sync->unlock_cache = true;
+ }
}
DBUG_EXECUTE_IF("fts_instrument_sync_interrupted",