summaryrefslogtreecommitdiff
path: root/storage/innobase/fts
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2022-02-25 11:47:27 +0200
committerMarko Mäkelä <marko.makela@mariadb.com>2022-02-25 11:47:27 +0200
commitf42d6234bdc5838f140f6a4541acb17a96434ba6 (patch)
tree02046da29cb9ef24fca74709a4d4b4e1901cc0ed /storage/innobase/fts
parent97ed3dd6df2f37d7616df3252b027e47017625c8 (diff)
parent0eabc285a3c0cf0285d569a29c549634238fbdae (diff)
downloadmariadb-git-f42d6234bdc5838f140f6a4541acb17a96434ba6.tar.gz
Merge 10.4 into 10.5 (MDEV-27913)
Diffstat (limited to 'storage/innobase/fts')
-rw-r--r--storage/innobase/fts/fts0fts.cc21
1 files changed, 17 insertions, 4 deletions
diff --git a/storage/innobase/fts/fts0fts.cc b/storage/innobase/fts/fts0fts.cc
index 06fea24e9f6..971ecabf5a8 100644
--- a/storage/innobase/fts/fts0fts.cc
+++ b/storage/innobase/fts/fts0fts.cc
@@ -53,14 +53,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 */
@@ -4246,7 +4246,7 @@ fts_sync(
ulint i;
dberr_t error = DB_SUCCESS;
fts_cache_t* cache = sync->table->fts->cache;
-
+ size_t fts_cache_size= 0;
rw_lock_x_lock(&cache->lock);
/* Check if cache is being synced.
@@ -4271,11 +4271,17 @@ fts_sync(
fts_sync_begin(sync);
begin_sync:
- if (cache->total_size > fts_max_cache_size) {
+ 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) {
@@ -4296,6 +4302,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",