Bug #108796 Contribution by Tencent: fts query may read unconsistent data

Submitted: 17 Oct 2022 7:42 Modified: 17 Oct 2022 8:16
Reporter: qingxin sun (OCA) Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: FULLTEXT search Severity:S2 (Serious)
Version:8.0 OS:Any
Assigned to: CPU Architecture:Any
Tags: Contribution, fulltext search, innodb

[17 Oct 2022 7:42] qingxin sun
Description:
FTS query may read unconsistent data when background optimize thread do fts syncing.

Details: fts_sync_commit do these operations
1. clean fts cache clean   // fts_cache_clear
2. release ache lock       // rw_lock_x_unlock(&cache->lock);
3. commit the trx which write the fts cache data to auxiliary index table // fts_sql_commit

so if fts query hapends between operation 2 and 3, the fts query could not read
the data uncommitted.

How to repeat:
1. Insert some data adn commit
2. delay optimize thread before it commit the write trx(flush fts cache)
3. do fts query on the data just committed by operation 1,data not seen correctly

see following attachment patch file(based on 8.0.22 version).

Suggested fix:
fts sync commit should release cache lock after commit the trx.
[17 Oct 2022 7:43] qingxin sun
bug repeate test case

(*) I confirm the code being submitted is offered under the terms of the OCA, and that I am authorized to contribute it.

Contribution: 0001-test-case-for-opt-thread-fts-sync.patch (application/octet-stream, text), 3.93 KiB.

[17 Oct 2022 7:45] qingxin sun
how to fix patch

(*) I confirm the code being submitted is offered under the terms of the OCA, and that I am authorized to contribute it.

Contribution: 0001-fts-sync-commit-bug-fix.patch (application/octet-stream, text), 1.28 KiB.

[17 Oct 2022 8:16] MySQL Verification Team
Hello qingxin sun,

Thank you for the report and contribution.

regards,
Umesh

Portions of this website are copyright © 2001, 2002 The PHP Group

Page generated in 0.039 sec. using MySQL 8.4.7-u6-cloud

Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.