summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThirunarayanan Balathandayuthapani <thiru@mariadb.com>2020-07-14 14:26:49 +0530
committerThirunarayanan Balathandayuthapani <thiru@mariadb.com>2020-07-14 14:26:49 +0530
commitdc58987eb7112bd60122114abd56e6f9438f457f (patch)
treeb83bc4e410295a2592ecdbe3ab48e6e2df9f60aa
parente80183dbd595984a42e1265d7a257d8ca14b3bb8 (diff)
downloadmariadb-git-dc58987eb7112bd60122114abd56e6f9438f457f.tar.gz
MDEV-22765 i_s_fts_index_cache_fill_one_index() is not protect by the lock
- i_s_fts_index_cache_fill() should take shared lock of fts cache before accessing index cache to avoid reading stale data.
-rw-r--r--storage/innobase/handler/i_s.cc3
-rw-r--r--storage/xtradb/handler/i_s.cc3
2 files changed, 6 insertions, 0 deletions
diff --git a/storage/innobase/handler/i_s.cc b/storage/innobase/handler/i_s.cc
index 21eb9da481e..894e798ee27 100644
--- a/storage/innobase/handler/i_s.cc
+++ b/storage/innobase/handler/i_s.cc
@@ -3375,6 +3375,8 @@ no_fts:
conv_str.f_len = sizeof word;
conv_str.f_str = word;
+ rw_lock_s_lock(&cache->lock);
+
for (ulint i = 0; i < ib_vector_size(cache->indexes); i++) {
fts_index_cache_t* index_cache;
@@ -3385,6 +3387,7 @@ no_fts:
index_cache, thd, &conv_str, tables));
}
+ rw_lock_s_unlock(&cache->lock);
dict_table_close(user_table, FALSE, FALSE);
rw_lock_s_unlock(&dict_operation_lock);
diff --git a/storage/xtradb/handler/i_s.cc b/storage/xtradb/handler/i_s.cc
index 8eb53502da8..8d7612ab16d 100644
--- a/storage/xtradb/handler/i_s.cc
+++ b/storage/xtradb/handler/i_s.cc
@@ -3367,6 +3367,8 @@ no_fts:
conv_str.f_len = sizeof word;
conv_str.f_str = word;
+ rw_lock_s_lock(&cache->lock);
+
for (ulint i = 0; i < ib_vector_size(cache->indexes); i++) {
fts_index_cache_t* index_cache;
@@ -3377,6 +3379,7 @@ no_fts:
index_cache, thd, &conv_str, tables));
}
+ rw_lock_s_unlock(&cache->lock);
dict_table_close(user_table, FALSE, FALSE);
rw_lock_s_unlock(&dict_operation_lock);