Repository navigation
Closed
Labels
kind/bugSomething isn't workingseverity/s2Medium-high impact: Logical errors or data errors that may occur
Description
Is there an existing issue for the same bug?
- I have checked the existing issues.
Branch Name
main
Commit ID
b24d1b3 (2026-10-16)
Other Environment Information
- Hardware: macOS arm64 (Apple Silicon), single-node standalone (
./mo-service -launch etc/launch/launch.toml, LOG+TN+CN single process, DISK-V2 backend) - OS: macOS
- Others:
experimental_fulltext2_index = 1required to useCREATE FULLTEXT2 INDEX
Actual Behavior
A FULLTEXT2 index never receives rows inserted or updated after the index is created.
- New terms introduced by an
INSERTafterCREATE FULLTEXT2 INDEXare never returned byMATCH ... AGAINST— not immediately, not after waiting 60+ seconds. - An
UPDATEthat changes the indexed text leaves the old terms searchable and never adds the new terms. - Only
DELETEpropagates to the index — and onlyDROP INDEX+CREATE FULLTEXT2 INDEXrebuild fixes the content.
set experimental_fulltext2_index = 1;
drop database if exists dml;
create database dml;
use dml;
create table t (id int auto_increment primary key, body text);
insert into t (body) values ('apple banana');
create fulltext2 index i on t(body);
-- A: baseline — works, pre-existing data is indexed
select id from t where match(body) against ('apple'); -- -> 1 (correct)
-- B: insert AFTER the index exists
insert into t (body) values ('cherry date');
select id from t where match(body) against ('cherry'); -- -> EMPTY (should be 2)
-- C: wait 60 s — still empty (verified with three successive sleeps)
-- (after ~60 s) select id from t where match(body) against ('cherry'); -- -> still EMPTY
-- D: update the existing row
update t set body = 'elderberry fig' where id = 1;
select id from t where match(body) against ('elderberry'); -- -> EMPTY (should be 1)
select id from t where match(body) against ('apple'); -- -> 1 (should be EMPTY — stale term)
select id from t where match(body) against ('banana'); -- -> 1 (should be EMPTY — stale term)
-- E: delete works
select id from t where match(body) against ('cherry'); -- -> EMPTY (correct, row 2 deleted)Expected Behavior
FULLTEXT2 incremental maintenance must behave like the classic FULLTEXT engine on the same server:
| Operation | classic FULLTEXT (same server, same shape) |
FULLTEXT2 |
|---|---|---|
INSERT after index built |
New term searchable immediately | Never indexed |
UPDATE removes/improves text |
Old term gone / new term in | Old term stays, new term never indexed |
DELETE |
Removed | Same (works) |
DROP INDEX + rebuild |
— | Rebuilt index is correct |
Direct side-by-side control on the same instance:
create table classic_t (id int auto_increment primary key, body text);
insert into classic_t (body) values ('apple banana');
create fulltext index icl on classic_t(body);
insert into classic_t (body) values ('cherry date');
select id from classic_t where match(body) against ('cherry'); -- -> 2 (correct)
create table ft2_t (id int auto_increment primary key, body text);
insert into ft2_t (body) values ('apple banana');
create fulltext2 index i2 on ft2_t(body);
insert into ft2_t (body) values ('cherry date');
select id from ft2_t where match(body) against ('cherry'); -- -> EMPTY (wrong)
-- even after waiting 15 s: still EMPTYAdditional information
- Verified 5 independent runs across separate standalone instances; behaviour is 100% deterministic.
SELECT git_version();->b24d1b3- The ISCP executor is alive and iterating — log shows
ISCP-Task flush watermarkevery 5 s withjobCount=7. mo_catalog.mo_iscp_logrow for the index job showsjob_state=3, watermark (LSN) advances periodically, yet the delta is never materialized into the index.- Checked for duplicates: not
#27964(INCLUDE-column rename), not#27788(cross-CN cache), not#26973(performance bound), not#28986(multi-column NULL), not#30335(COPY ALTER covered search), not#28847(data branch). - Related:
#29887(NL multi-word bug) is a separate issue in the same area but different semantics.
Metadata
Metadata
Assignees
Labels
kind/bugSomething isn't workingseverity/s2Medium-high impact: Logical errors or data errors that may occur
Activity
Ariznawlll commentedon Oct 18, 2026
Root-cause narrowing (official main b24d1b3, single-node standalone)
I instrumented the ISCP pipeline during the non-converging incremental insert, and found a sharper symptom that should narrow the search:
The ISCP watermark advances every sync tick (15s), yet the FULLTEXT2 index content never updates.
Observed over 90s after
INSERTof a row whose term should be searchable:mo_iscp_log.job_statusfor the index job showsLSN: 8,Stage: 1,ErrorCode: 0,ErrorMsg: ""— i.e. the consumer reports healthy progress (no error) while the delta is silently dropped.So the failure is not "ISCP never consumes" (my initial guess) — the executor clearly advances its watermark over the new logtail. The delta is being acknowledged but not materialized into the FULLTEXT2 posting/segment store. Likely candidates: the fulltext2 build path skipping the tail-build for post-create inserts, or the search side reading a generation that is never swapped to include the delta.
This also explains why
DROP INDEX+ rebuild fixes it (fresh full build) and why pre-create rows are searchable (initial build), while post-create inserts/updates are lost (incremental path).Environment: macOS arm64,
./mo-service -launchsingle process (LOG+TN+CN), git_versionb24d1b3, sink/source topology not involved here.Ariznawlll commentedon Oct 18, 2026
Control: classic FULLTEXT incremental is correct on the same build
Side-by-side on the same instance (same b24d1b3, same process), the classic FULLTEXT engine handles every incremental case correctly, confirming this is FULLTEXT2-specific:
cherrysearchable immediately (1 row)This isolates the defect to the FULLTEXT2 tail/incremental build path (the
RunFulltext2ISCP consumer →TailBuilder→ CdcTail frames), which the code itself notes is "CDC/txn-coupled: not exercised by package unit tests" — only its primitives are unit-tested. Classic FULLTEXT uses a different incremental path that is proven correct.Ariznawlll commentedon Oct 18, 2026
Control: classic FULLTEXT incremental is correct on the same build
Side-by-side on the same instance (same b24d1b3, same process), the classic FULLTEXT engine handles every incremental case correctly, confirming this is FULLTEXT2-specific:
This isolates the defect to the FULLTEXT2 tail/incremental build path (RunFulltext2 ISCP consumer -> TailBuilder -> CdcTail frames), which the code itself notes is "CDC/txn-coupled: not exercised by package unit tests" — only its primitives are unit-tested. Classic FULLTEXT uses a different, proven-correct incremental path.
fix(fulltext2): evict idle search cache after CDC flush so incrementa…
Ariznawlll commentedon Oct 20, 2026
测试版本
main;隔离源码完整 commit21966565287edf9f7d7f519af60d269711608945,服务端git_version()=2196656528。fed3bf59700158212a9135d0b619c3849034bb65,已进入该 main。mo-service,etc/launch/launch.toml单进程 1 CN / 1 TN / 1 LogService、DISK-V2,MySQL 协议 127.0.0.1:6001;experimental_fulltext2_index=1,其余 FULLTEXT2 刷新设置采用默认值。原问题验证
按 issue 的实际 SQL 路径,在每轮独立创建并清理的数据库中执行:先插入
apple banana、再创建 FULLTEXT2 索引并查询预存词(命中 id=1、预热查询缓存);随后才INSERT ('cherry date'),等待 25 秒后查cherry;再将 id=1UPDATE为elderberry fig,等待 25 秒后查新旧词;最后 DELETE id=2,等待 25 秒后查cherry。三轮实际结果完全一致:
cherry在插入后均返回 id=2;更新后elderberry均返回 id=1、apple和banana均返回空;删除后cherry均返回空,基表仅余(1,'elderberry fig')。原报告中“增量 INSERT/UPDATE 60 秒仍不可见、旧词仍命中”没有再出现。这里验证的是25 秒检查点,没有声称立即可见或测得精确刷新延迟。Happy Path 覆盖
apple三轮均命中 id=1;增量插入/更新后的新词按上述结果三轮均可见。apple只命中非 NULL 行,未出现虚假cherry命中。cherry date,三轮均立即命中 id=2。所有测试库已删除。Unhappy Path 覆盖
apple/banana三轮均不再错误命中;删除后cherry三轮均不再错误命中。cherry在插入前返回空。白盒验证
在同一最新 main 上运行
pkg/fulltext2.TestEvictIdleCache及pkg/iscp.TestRunFulltext2RefreshesIdleCacheAfterNonEmptyCDCFlush,两个包的定向 Go 测试-count=3均 PASS。后者覆盖非空 CDC flush 后驱逐空闲热缓存、下一读者重载已提交数据的修复路径;本轮未运行-race。回归测试
fulltext2_async/warm_refreshBVT 覆盖缓存刷新相关路径。本轮独立真实 SQL 三轮补足了原报告的端到端 INSERT/UPDATE/DELETE 可见性。MATCH会使 idle-only 驱逐条件时序不稳定,不能把偶发时序输出做成功 golden。未运行 MOTR 全套。CI Required、Ubuntu/x86 UT、multi-CN BVT job 成功;另一 TKE run 的镜像构建 job 失败,后续 TKE 用例跳过,不能计为该环境的产品验收。测试证据
git_version()=2196656528;原路径每轮输出均为insert ((2,),) update ((1,),) () () delete (),三轮末行result 3/3 PASS, all test databases dropped;独立 NULL/传统 FULLTEXT 对照亦为 3/3 PASS。测试结论
测试通过。
docs: clarify FULLTEXT2 CDC cache refresh acceptance (#33589)