diff options
author | Marko Mäkelä <marko.makela@mariadb.com> | 2022-09-07 12:57:53 +0300 |
---|---|---|
committer | Marko Mäkelä <marko.makela@mariadb.com> | 2022-09-07 12:57:53 +0300 |
commit | bacaf2d4f4c6d77a0b6c1ae4daddd19f81ef6fa3 (patch) | |
tree | 33f5613e5753750f89c0544002c4ce28ca7dbce2 | |
parent | 1872a142b5f827758a68e7ee745b3451f5dbea2e (diff) | |
download | mariadb-git-bacaf2d4f4c6d77a0b6c1ae4daddd19f81ef6fa3.tar.gz |
MDEV-29342 Assertion failure in file que0que.cc line 728
Additional fixes for 10.6:
fts_sync_commit(): Release cache->lock also on rollback.
fts_sync_write_words(): Avoid a crash if an error occurs,
by stopping at the first error.
fts_add_doc_by_id(): Sync the doc id only after adding the doc id
to the cache.
-rw-r--r-- | mysql-test/suite/innodb_fts/r/misc_debug2.result | 8 | ||||
-rw-r--r-- | mysql-test/suite/innodb_fts/t/misc_debug2.test | 8 | ||||
-rw-r--r-- | storage/innobase/fts/fts0fts.cc | 14 |
3 files changed, 16 insertions, 14 deletions
diff --git a/mysql-test/suite/innodb_fts/r/misc_debug2.result b/mysql-test/suite/innodb_fts/r/misc_debug2.result index f1ebef6175f..2587b1c74b0 100644 --- a/mysql-test/suite/innodb_fts/r/misc_debug2.result +++ b/mysql-test/suite/innodb_fts/r/misc_debug2.result @@ -11,12 +11,12 @@ DROP TABLE mdev21563; # CREATE TABLE t1(f1 CHAR(100), FULLTEXT idx(f1))ENGINE=InnoDB; INSERT INTO t1 VALUES('mysql'), ('innodb'); -set debug_dbug="+d,fts_instrument_sync_debug"; +set debug_dbug="+d,fts_instrument_sync_request"; INSERT INTO t1 VALUES('test'); -set debug_dbug="-d,fts_instrument_sync_debug"; +set debug_dbug="-d,fts_instrument_sync_request"; INSERT INTO t1 VALUES('This is a fts issue'); # restart -set debug_dbug="+d,fts_instrument_sync_debug"; +set debug_dbug="+d,fts_instrument_sync_request"; UPDATE t1 SET f1="mariadb"; -set debug_dbug="-d,fts_instrument_sync_debug"; +set debug_dbug="-d,fts_instrument_sync_request"; DROP TABLE t1; diff --git a/mysql-test/suite/innodb_fts/t/misc_debug2.test b/mysql-test/suite/innodb_fts/t/misc_debug2.test index 1ba77f2481e..eb2f80ed24a 100644 --- a/mysql-test/suite/innodb_fts/t/misc_debug2.test +++ b/mysql-test/suite/innodb_fts/t/misc_debug2.test @@ -16,12 +16,12 @@ DROP TABLE mdev21563; --echo # CREATE TABLE t1(f1 CHAR(100), FULLTEXT idx(f1))ENGINE=InnoDB; INSERT INTO t1 VALUES('mysql'), ('innodb'); -set debug_dbug="+d,fts_instrument_sync_debug"; +set debug_dbug="+d,fts_instrument_sync_request"; INSERT INTO t1 VALUES('test'); -set debug_dbug="-d,fts_instrument_sync_debug"; +set debug_dbug="-d,fts_instrument_sync_request"; INSERT INTO t1 VALUES('This is a fts issue'); --source include/restart_mysqld.inc -set debug_dbug="+d,fts_instrument_sync_debug"; +set debug_dbug="+d,fts_instrument_sync_request"; UPDATE t1 SET f1="mariadb"; -set debug_dbug="-d,fts_instrument_sync_debug"; +set debug_dbug="-d,fts_instrument_sync_request"; DROP TABLE t1; diff --git a/storage/innobase/fts/fts0fts.cc b/storage/innobase/fts/fts0fts.cc index ae270bf72b2..faf598ddd72 100644 --- a/storage/innobase/fts/fts0fts.cc +++ b/storage/innobase/fts/fts0fts.cc @@ -3314,7 +3314,7 @@ fts_add_doc_by_id( dict_index_t* fts_id_index; ibool is_id_cluster; fts_cache_t* cache = ftt->table->fts->cache; - + bool need_sync= false; ut_ad(cache->get_docs); /* If Doc ID has been supplied by the user, then the table @@ -3443,7 +3443,7 @@ fts_add_doc_by_id( shouldn't hold the cache lock for longer time. So cache should sync whenever cache size exceeds 512 KB */ - bool need_sync = + need_sync = cache->total_size > 512*1024; mysql_mutex_unlock(&table->fts->cache->lock); @@ -3464,10 +3464,6 @@ fts_add_doc_by_id( need_sync= true; ); - if (need_sync) { - fts_sync_table(table); - } - mtr_start(&mtr); if (i < num_idx - 1) { @@ -3493,6 +3489,10 @@ func_exit: ut_free(pcur.old_rec_buf); mem_heap_free(heap); + + if (need_sync) { + fts_sync_table(table); + } } @@ -3898,6 +3898,7 @@ err_exit: ib::error() << "(" << error << ") writing" " word node to FTS auxiliary index table " << table->name; + break; } } @@ -3999,6 +4000,7 @@ 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; |