11/* ****************************************************************************
22
3- Copyright (c) 2011, 2017 , Oracle and/or its affiliates. All Rights Reserved.
3+ Copyright (c) 2011, 2018 , Oracle and/or its affiliates. All Rights Reserved.
44Copyright (c) 2016, 2018, MariaDB Corporation.
55
66This program is free software; you can redistribute it and/or modify it under
@@ -869,37 +869,28 @@ fts_drop_index(
869869
870870err = fts_drop_index_tables (trx, index);
871871
872- for (;;) {
873- bool retry = false ;
874- if (index->index_fts_syncing ) {
875- retry = true ;
876- }
877- if (!retry){
878- fts_free (table);
879- break ;
880- }
872+ while (index->index_fts_syncing
873+ && !trx_is_interrupted (trx)) {
881874DICT_BG_YIELD (trx);
882875}
876+
877+ fts_free (table);
878+
883879return (err);
884880}
885881
886- for (;;) {
887- bool retry = false ;
888- if (index->index_fts_syncing ) {
889- retry = true ;
890- }
891- if (!retry){
892- current_doc_id = table->fts ->cache ->next_doc_id ;
893- first_doc_id = table->fts ->cache ->first_doc_id ;
894- fts_cache_clear (table->fts ->cache );
895- fts_cache_destroy (table->fts ->cache );
896- table->fts ->cache = fts_cache_create (table);
897- table->fts ->cache ->next_doc_id = current_doc_id;
898- table->fts ->cache ->first_doc_id = first_doc_id;
899- break ;
900- }
882+ while (index->index_fts_syncing
883+ && !trx_is_interrupted (trx)) {
901884DICT_BG_YIELD (trx);
902885}
886+
887+ current_doc_id = table->fts ->cache ->next_doc_id ;
888+ first_doc_id = table->fts ->cache ->first_doc_id ;
889+ fts_cache_clear (table->fts ->cache );
890+ fts_cache_destroy (table->fts ->cache );
891+ table->fts ->cache = fts_cache_create (table);
892+ table->fts ->cache ->next_doc_id = current_doc_id;
893+ table->fts ->cache ->first_doc_id = first_doc_id;
903894} else {
904895fts_cache_t * cache = table->fts ->cache ;
905896fts_index_cache_t * index_cache;
@@ -909,18 +900,14 @@ fts_drop_index(
909900index_cache = fts_find_index_cache (cache, index);
910901
911902if (index_cache != NULL ) {
912- for (;;) {
913- bool retry = false ;
914- if (index->index_fts_syncing ) {
915- retry = true ;
916- }
917- if (!retry && index_cache->words ) {
918- fts_words_free (index_cache->words );
919- rbt_free (index_cache->words );
920- break ;
921- }
903+ while (index->index_fts_syncing
904+ && !trx_is_interrupted (trx)) {
922905DICT_BG_YIELD (trx);
923906}
907+ if (index_cache->words ) {
908+ fts_words_free (index_cache->words );
909+ rbt_free (index_cache->words );
910+ }
924911
925912ib_vector_remove (cache->indexes , *(void **) index_cache);
926913}
0 commit comments