Skip to content

Commit

Permalink
MDEV-22765 i_s_fts_index_cache_fill_one_index() is not protect by the…
Browse files Browse the repository at this point in the history
… lock

- i_s_fts_index_cache_fill() should take shared lock of fts cache
before accessing index cache to avoid reading stale data.
  • Loading branch information
Thirunarayanan committed Jul 14, 2020
1 parent e80183d commit dc58987
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
3 changes: 3 additions & 0 deletions storage/innobase/handler/i_s.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3375,6 +3375,8 @@ i_s_fts_index_cache_fill(
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;

Expand All @@ -3385,6 +3387,7 @@ i_s_fts_index_cache_fill(
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);

Expand Down
3 changes: 3 additions & 0 deletions storage/xtradb/handler/i_s.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3367,6 +3367,8 @@ i_s_fts_index_cache_fill(
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;

Expand All @@ -3377,6 +3379,7 @@ i_s_fts_index_cache_fill(
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);

Expand Down

0 comments on commit dc58987

Please sign in to comment.