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.
parent e80183db
...@@ -3375,6 +3375,8 @@ i_s_fts_index_cache_fill( ...@@ -3375,6 +3375,8 @@ i_s_fts_index_cache_fill(
conv_str.f_len = sizeof word; conv_str.f_len = sizeof word;
conv_str.f_str = word; conv_str.f_str = word;
rw_lock_s_lock(&cache->lock);
for (ulint i = 0; i < ib_vector_size(cache->indexes); i++) { for (ulint i = 0; i < ib_vector_size(cache->indexes); i++) {
fts_index_cache_t* index_cache; fts_index_cache_t* index_cache;
...@@ -3385,6 +3387,7 @@ i_s_fts_index_cache_fill( ...@@ -3385,6 +3387,7 @@ i_s_fts_index_cache_fill(
index_cache, thd, &conv_str, tables)); index_cache, thd, &conv_str, tables));
} }
rw_lock_s_unlock(&cache->lock);
dict_table_close(user_table, FALSE, FALSE); dict_table_close(user_table, FALSE, FALSE);
rw_lock_s_unlock(&dict_operation_lock); rw_lock_s_unlock(&dict_operation_lock);
......
...@@ -3367,6 +3367,8 @@ i_s_fts_index_cache_fill( ...@@ -3367,6 +3367,8 @@ i_s_fts_index_cache_fill(
conv_str.f_len = sizeof word; conv_str.f_len = sizeof word;
conv_str.f_str = word; conv_str.f_str = word;
rw_lock_s_lock(&cache->lock);
for (ulint i = 0; i < ib_vector_size(cache->indexes); i++) { for (ulint i = 0; i < ib_vector_size(cache->indexes); i++) {
fts_index_cache_t* index_cache; fts_index_cache_t* index_cache;
...@@ -3377,6 +3379,7 @@ i_s_fts_index_cache_fill( ...@@ -3377,6 +3379,7 @@ i_s_fts_index_cache_fill(
index_cache, thd, &conv_str, tables)); index_cache, thd, &conv_str, tables));
} }
rw_lock_s_unlock(&cache->lock);
dict_table_close(user_table, FALSE, FALSE); dict_table_close(user_table, FALSE, FALSE);
rw_lock_s_unlock(&dict_operation_lock); rw_lock_s_unlock(&dict_operation_lock);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment