diff options
author | Marko Mäkelä <marko.makela@mariadb.com> | 2020-10-22 13:27:18 +0300 |
---|---|---|
committer | Marko Mäkelä <marko.makela@mariadb.com> | 2020-10-22 13:27:18 +0300 |
commit | 46957a6a77518b579c6c8e1345666f84a5a59455 (patch) | |
tree | c0e463f14123cd09bb4d5854d32577e44b3a9827 /storage/innobase/fts | |
parent | 1619ae899099c4934f3b5919b2398c95a7cacc94 (diff) | |
parent | e3d692aa092a76415ce1ce0e9662338873d84abb (diff) | |
download | mariadb-git-46957a6a77518b579c6c8e1345666f84a5a59455.tar.gz |
Merge 10.3 into 10.4
Diffstat (limited to 'storage/innobase/fts')
-rw-r--r-- | storage/innobase/fts/fts0fts.cc | 5 | ||||
-rw-r--r-- | storage/innobase/fts/fts0opt.cc | 5 | ||||
-rw-r--r-- | storage/innobase/fts/fts0que.cc | 15 |
3 files changed, 19 insertions, 6 deletions
diff --git a/storage/innobase/fts/fts0fts.cc b/storage/innobase/fts/fts0fts.cc index 7174645b613..4bdc556cee8 100644 --- a/storage/innobase/fts/fts0fts.cc +++ b/storage/innobase/fts/fts0fts.cc @@ -5285,7 +5285,6 @@ fts_t::fts_t( mem_heap_t* heap) : added_synced(0), dict_locked(0), - bg_threads(0), add_wq(NULL), cache(NULL), doc_col(ULINT_UNDEFINED), in_queue(false), @@ -5293,8 +5292,6 @@ fts_t::fts_t( { ut_a(table->fts == NULL); - mutex_create(LATCH_ID_FTS_BG_THREADS, &bg_threads_mutex); - ib_alloc_t* heap_alloc = ib_heap_allocator_create(fts_heap); indexes = ib_vector_create(heap_alloc, sizeof(dict_index_t*), 4); @@ -5305,8 +5302,6 @@ fts_t::fts_t( /** fts_t destructor. */ fts_t::~fts_t() { - mutex_free(&bg_threads_mutex); - ut_ad(add_wq == NULL); if (cache != NULL) { diff --git a/storage/innobase/fts/fts0opt.cc b/storage/innobase/fts/fts0opt.cc index dcd613aa933..d0513643230 100644 --- a/storage/innobase/fts/fts0opt.cc +++ b/storage/innobase/fts/fts0opt.cc @@ -2574,6 +2574,11 @@ fts_optimize_remove_table( if (fts_opt_start_shutdown) { ib::info() << "Try to remove table " << table->name << " after FTS optimize thread exiting."; + /* If the table can't be removed then wait till + fts optimize thread shuts down */ + while (fts_optimize_wq) { + os_thread_sleep(10000); + } return; } diff --git a/storage/innobase/fts/fts0que.cc b/storage/innobase/fts/fts0que.cc index f3ba0c60c52..a3e36f7d0da 100644 --- a/storage/innobase/fts/fts0que.cc +++ b/storage/innobase/fts/fts0que.cc @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 2007, 2018, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 2007, 2020, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 2017, 2020, MariaDB Corporation. This program is free software; you can redistribute it and/or modify it under @@ -144,6 +144,8 @@ struct fts_query_t { ib_rbt_t* wildcard_words; /*!< words with wildcard */ bool multi_exist; /*!< multiple FTS_EXIST oper */ + byte visiting_sub_exp; /*!< count of nested + fts_ast_visit_sub_exp() */ st_mysql_ftparser* parser; /*!< fts plugin parser */ }; @@ -2963,6 +2965,8 @@ fts_query_get_token( return(new_ptr); } +static dberr_t fts_ast_visit_sub_exp(fts_ast_node_t*, fts_ast_callback, void*); + /*****************************************************************//** Visit every node of the AST. */ static @@ -3087,6 +3091,14 @@ fts_ast_visit_sub_exp( ut_a(node->type == FTS_AST_SUBEXP_LIST); + /* To avoid stack overflow, we limit the mutual recursion + depth between fts_ast_visit(), fts_query_visitor() and + fts_ast_visit_sub_exp(). */ + if (query->visiting_sub_exp++ > 31) { + query->error = DB_OUT_OF_MEMORY; + DBUG_RETURN(query->error); + } + cur_oper = query->oper; /* Save current result set */ @@ -3109,6 +3121,7 @@ fts_ast_visit_sub_exp( /* Reinstate parent node state */ query->multi_exist = multi_exist; query->oper = cur_oper; + query->visiting_sub_exp--; /* Merge the sub-expression result with the parent result set. */ subexpr_doc_ids = query->doc_ids; |