diff options
author | Thirunarayanan Balathandayuthapani <thiru@mariadb.com> | 2022-09-20 11:29:08 +0530 |
---|---|---|
committer | Thirunarayanan Balathandayuthapani <thiru@mariadb.com> | 2022-09-20 12:15:01 +0530 |
commit | 9bcefaac3b7a06eb8ff42be77f7ff02d56c8ef15 (patch) | |
tree | fa85e657b1bed369bbd6a9c076f251f7042b589e | |
parent | 5d9d379329abcbb661ed6c027efbb9fd763958c6 (diff) | |
download | mariadb-git-bb-10.6-MDEV-29277.tar.gz |
MDEV-29277 On error, fts_sync_table() fails to release a table handlebb-10.6-MDEV-29277
fts_sync_commit() fails to release the auxiliary table handle
when it encounters error. This issue is caused by
commit 1fd7d3a9adac50de37e40e92188077e3515de505(MDEV-25581).
fts_cache_clear() releases the auxiliary table handles.
MDEV-25581's patch clear the cache only if fts_sync_commit was
successful.
-rw-r--r-- | storage/innobase/fts/fts0fts.cc | 78 |
1 files changed, 39 insertions, 39 deletions
diff --git a/storage/innobase/fts/fts0fts.cc b/storage/innobase/fts/fts0fts.cc index faf598ddd72..df60a2aadd1 100644 --- a/storage/innobase/fts/fts0fts.cc +++ b/storage/innobase/fts/fts0fts.cc @@ -3960,6 +3960,43 @@ fts_sync_index( return(fts_sync_write_words(trx, index_cache)); } +/** Rollback a sync operation +@param[in,out] sync sync state */ +static +void +fts_sync_rollback( + fts_sync_t* sync) +{ + trx_t* trx = sync->trx; + fts_cache_t* cache = sync->table->fts->cache; + + for (ulint i = 0; i < ib_vector_size(cache->indexes); ++i) { + ulint j; + fts_index_cache_t* index_cache; + + index_cache = static_cast<fts_index_cache_t*>( + ib_vector_get(cache->indexes, i)); + + for (j = 0; fts_index_selector[j].value; ++j) { + + if (index_cache->ins_graph[j] != NULL) { + + que_graph_free(index_cache->ins_graph[j]); + + index_cache->ins_graph[j] = NULL; + } + } + } + + mysql_mutex_unlock(&cache->lock); + + fts_sql_rollback(trx); + + /* Avoid assertion in trx_t::free(). */ + trx->dict_operation_lock_mode = false; + trx->free(); +} + /** Commit the SYNC, change state of processed doc ids etc. @param[in,out] sync sync state @return DB_SUCCESS if all OK */ @@ -4000,10 +4037,10 @@ fts_sync_commit( mysql_mutex_unlock(&cache->lock); fts_sql_commit(trx); } else { - mysql_mutex_unlock(&cache->lock); - fts_sql_rollback(trx); ib::error() << "(" << error << ") during SYNC of " "table " << sync->table->name; + fts_sync_rollback(sync); + return error; } if (UNIV_UNLIKELY(fts_enable_diag_print) && elapsed_time) { @@ -4023,43 +4060,6 @@ fts_sync_commit( return(error); } -/** Rollback a sync operation -@param[in,out] sync sync state */ -static -void -fts_sync_rollback( - fts_sync_t* sync) -{ - trx_t* trx = sync->trx; - fts_cache_t* cache = sync->table->fts->cache; - - for (ulint i = 0; i < ib_vector_size(cache->indexes); ++i) { - ulint j; - fts_index_cache_t* index_cache; - - index_cache = static_cast<fts_index_cache_t*>( - ib_vector_get(cache->indexes, i)); - - for (j = 0; fts_index_selector[j].value; ++j) { - - if (index_cache->ins_graph[j] != NULL) { - - que_graph_free(index_cache->ins_graph[j]); - - index_cache->ins_graph[j] = NULL; - } - } - } - - mysql_mutex_unlock(&cache->lock); - - fts_sql_rollback(trx); - - /* Avoid assertion in trx_t::free(). */ - trx->dict_operation_lock_mode = false; - trx->free(); -} - /** Run SYNC on the table, i.e., write out data from the cache to the FTS auxiliary INDEX table and clear the cache at the end. @param[in,out] sync sync state |