Repository navigation
Description
Background
PR #27461 added FULLTEXT2 cold-load observability and cache invalidation lifecycle changes. PR #27462 was stacked on it and added reusable immutable bases plus incremental tail/delete loading across cache generations.
The required cache contract is simpler and stricter: a cached FULLTEXT2 index is read-only for its entire lifetime. Visibility delay after CDC is accepted. CDC must not evict, refresh, or incrementally update the cached search index.
Problem
When CDC evicts the warm entry, the next search creates and loads a replacement cache entry. The load is serialized by the cache entry write lock, so concurrent searches for that index can wait for the refresh. Triggering this after every incremental update can therefore block concurrent searches.
Reverting only #27462 is insufficient. #27461 is its prerequisite and also changes the invalidation lifecycle, while the older CDC consumer already calls Cache.Remove after a successful flush.
Required behavior
- A cached FULLTEXT2 search index is immutable and read-only until ordinary stale/TTL eviction.
- CDC persists tail frames but does not evict, mutate, or incrementally refresh the cached search index.
- Visibility delay until the accepted stale/TTL boundary is allowed.
- Concurrent warm searches do not wait for a CDC-triggered cache refresh.
- Keep SQL, DDL, index format, ranking, and CDC wire protocol unchanged.
- Preserve deterministic mmap/temp-file cleanup at ordinary eviction, shutdown, MERGE, REBUILD, errors, and cancellation.
Immediate action
- Revert perf(fulltext2): reuse immutable bases across cache generations #27462 and perf(fulltext2): add cold-load observability #27461.
- Remove the pre-existing CDC-triggered
Cache.Removepath so reverting the two PRs does not leave immediate invalidation enabled. - Keep cache replacement on the existing stale/TTL lifecycle.
- Preserve the generic vector-cache lifecycle fixes already shared by other index algorithms; only the FULLTEXT2 observability/reuse behavior is reverted.
The current-main revert must also retain safe failed-load cleanup and partial tail-load cleanup, because those are independent correctness requirements rather than incremental-cache reuse behavior.
Validation
- FULLTEXT2 and vector-index cache package tests, including race coverage.
- CDC plus concurrent-search regression proving warm cached readers are not refreshed or blocked by CDC.
- TTL/stale eviction, MERGE, REBUILD, restart, cancellation, and cleanup coverage.
- Production-path FULLTEXT2 BVT where the cache contract is SQL-reachable; otherwise document the precise BVT boundary and equivalent deterministic regression.
Related
- [Performance]: avoid full base materialization on FULLTEXT2 cache miss and CDC invalidation #27445
- perf(fulltext2): add cold-load observability #27461
- perf(fulltext2): reuse immutable bases across cache generations #27462
QA decision
QA required: yes. This changes CDC visibility timing, cache invalidation, concurrent search behavior, and mmap/temp-file lifecycle. Deployment validation must cover CDC, stale/TTL expiry, MERGE, REBUILD, restart, and concurrent searches.
Activity
VioletQwQ-0 commentedon Sep 2, 2026
Draft PR #28017 implements the requested rollback of #27462 and #27461, removes CDC-triggered FULLTEXT2 cache eviction, and keeps the generic vector-cache lifecycle fixes from current main. Exact-head CI and the required QA validation are pending.
revert(fulltext2): keep cached indexes read-only (#28017)
VioletQwQ-0 commentedon Sep 3, 2026
QA 交接(#28017 -> #28005)
#28017 已合并,merge commit 为
1092ab739c120052fff0b8d1ff27854663cd098f;当前main为362b1fba26a2dd7780f1af982c3760e3d5f7f721。请 @Ariznawlll 基于该main版本执行验证。当前 PR 页面显示 TKE 的MO CHECKIN BVT TEST仍为进行中,不能作为 QA PASS。本次需要覆盖:
MERGE/REBUILD后的查询与索引生命周期。请在 QA 结果中写明精确 MatrixOne 版本/commit、CN 与 Proxy 拓扑、运行环境与架构,并对每个场景给出终态
PASS或FAIL及必要日志/现象。只有全部要求场景得到终态 PASS 后才可关闭 issue;当前 issue 保持 OPEN,阶段为phase/testing。fix(iscp): implement BuildTS on cacheFlushProbe test mock (merge inte…
fix(fulltext2): rebuild + refresh cache so COPY ALTER leaves the inde…
revert(fulltext2): keep cached indexes read-only (matrixorigin#28017)
fix(fulltext2): rebuild + refresh cache so COPY ALTER leaves the inde…
revert(fulltext2): keep cached indexes read-only (matrixorigin#28017)
revert(fulltext2): keep cached indexes read-only (matrixorigin#28017)
fix(fulltext2): rebuild + refresh cache so COPY ALTER leaves the inde…
Ariznawlll commentedon Sep 18, 2026
在 latest main
d9609d742b9000b54279f44e34295630b7238282复核实现后,此 issue 不能按原描述关闭,需研发先明确产品契约。原 issue 的验收要求是:已缓存的 FULLTEXT2 索引在其生命周期内保持只读;CDC 写入不应驱逐、修改或刷新该缓存。
当前实现与这一严格定义不一致:
pkg/iscp/fulltext2_consumer.go在 CDC tail flush 后仍调用fulltext2.EvictIdleCache;后者经pkg/fulltext2/search_cache.go和pkg/vectorindex/cache/cache.go会移除没有 in-flight search 的 idle cache entry。因此当前代码实现的是“不会驱逐正在被读取的 cache、idle 后允许刷新”的较弱语义,而不是“生命周期内不驱逐”的原始语义。请确认并落实以下二选一的契约:
MOTR #186 的多 CN CDC 脚本只能验证旧/新完整快照,不足以证明严格的“CDC 不驱逐 cache”契约。另请勿将本问题与 #29080 的
FORCE_SYNC/跨 CN 重建可见性混为一类;后者是独立场景。fix(fulltext2): keep warm search cache across ordinary CDC flushes (#…
Ariznawlll commentedon Nov 3, 2026
结论
测试不通过。按本 issue 当前写明的“CDC 不驱逐缓存”契约,最新 main 的非空 CDC 提交后仍会驱逐无在途搜索的缓存;正在使用的缓存有保护。需要研发确认这一行为与要求立即看到新 tail 的相关需求之间的最终产品契约。
关键证据
版本:官方
main@1876b2f93e14c03ba538e3806e245e3c3203979a,macOS / Apple Silicon;执行go test -race -p 1 ./pkg/iscp ./pkg/fulltext2 ./pkg/vectorindex/cache -run 'TestRunFulltext2RefreshesIdleCacheAfterNonEmptyCDCFlush|TestEvictIdleCache|TestRemoveIdleEvictsIdleButKeepsBusyAndSnapshots|TestFulltext2ConsumerContextCancelUnblocksRetrieverNext|TestFulltext2ConsumerCancelWhileWaitingForInput' -count=3,三包均通过。Happy case:确定性组件测试在非空 CDC 提交受控阻塞期间执行 warm search,旧 backend 服务查询、候选 backend 不加载;cache 测试同时覆盖 busy entry、snapshot 和取消清理。
与原契约的差异:上述 CDC 消费者测试 在提交后明确断言:空闲 warm backend 被销毁一次、原 cache entry 消失,下一次搜索加载新 generation 并观察 tail。实际 consumer 调用为
EvictIdleCache。这与 issue 中“CDC 不驱逐、只在 TTL/stale 边界替换”不同;不是说 busy reader 被强制驱逐。测试使用真实 CDC 编码和 consumer 流程,但 SQL executor、事务及 cache 后端为受控测试替身,不等同于完整部署的多 CN 并发搜索、TTL、MERGE / REBUILD、重启及 mmap 生命周期验收。
双 CN SQL 补充:现有
issue_28005_fulltext2_cdc_cache_multi_cn在两个直接 CN 上重复 3 轮通过;每轮 24 个并发查询在 15 秒内返回完整旧或新结果,CDC tail 持久化、MERGE 和本地 REBUILD 对照通过。该脚本允许完整的新 generation,不能证明 CDC 未驱逐缓存,也没有执行实际 CN/Proxy 重启或 TTL 等待。待解决点
docs: clarify FULLTEXT2 CDC cache refresh acceptance (#33589)
VioletQwQ-0 commentedon Dec 1, 2026
QA 交接更新(#33589 → #28005)
#33589 已合入
main(9081d1c140fdbc40dd6070d50986887266602191)。本次更新了 FULLTEXT2 缓存验收矩阵。PR 提交cfa32b10a2ce66a055c3e3cbb80f790f08b967b8的文档检查和CI Required已通过。此次合入仅涉及文档,现有「CDC 提交不驱逐缓存」要求下的 QA 结论仍为不通过。请研发先结合 #30401 的提交后可见性要求,明确采用严格不驱逐,还是保护正在搜索的缓存并允许空闲时刷新。契约明确且有对应可测构建后,请 @Ariznawlll 按矩阵复验,记录精确构建、部署拓扑和各场景终态。需核对多 CN 的 MATCH ID、空批次与回滚重试后的持久化结果,以及驱逐、MERGE、REBUILD、关停、取消和部分加载失败后的资源释放。本轮未执行 Linux mmap 加载失败测试或部署验收,issue 继续保持打开。
cpegeric commentedon Dec 2, 2026
Decision (2026-12-02): strict cache retention across CDC commits is superseded by idle refresh with the index-file cache.
RemoveIdle). Busy readers finish on their immutable generation. Named-snapshot entries are untouched. Other CNs converge through theIsStalegeneration check. This provides the post-commit visibility requested in [Bug]: FULLTEXT2 index never indexes rows inserted/updated after index creation (incremental DML lost) #30401.The current behavior and the remaining lifecycle and resource checks are documented in
docs/issue-plans/FULLTEXT2_28005_CACHE_TEST_MATRIX.md(#33589).Ariznawlll commentedon Dec 2, 2026
结论
未完成验收。 已按研发2026-12-02确认的新契约复测,不再把“非空CDC提交后驱逐空闲缓存”本身判为产品失败。本轮补齐真实双CN周期刷新和完整服务重启后的首次查询,均通过;Linux mmap加载失败资源释放、实际加载过程故障/取消及原始规模性能仍未完成,因此继续保持开放。
关键证据
采用的契约与版本
6302cd4e33f0fb61eb99ea1ddc6e698ccdc6825d。从隔离源码构建,两个本地CN实际git_version()一致。部署为同一macOS arm64主机上的两CN、一TN、一LogService,专用目录/端口。真实SQL和周期刷新
issue_28005_fulltext2_cdc_cache_multi_cn.py正式三轮通过:两CN预热IDs1,2;插入3后先读取hidden storage确认cdc_tail chunk_id确实前进,再由16线程执行24次跨CN读,结果只允许完整旧/新集合。MERGE得到1,2,3,REBUILD得到1,2,3,4。issue_28005_fulltext2_periodic_freshness.py,先读取GetVectorIndexCacheInfo,确认查询到2个CN且同一key至少有2个暖缓存条目。SetVectorIndexFreshnessInterval('1s')测试开关,确认两个CN都成功应用且无failed结果。它改变周期ticker,不调用EvictVectorIndexCache,不手工删除缓存。SetVectorIndexFreshnessInterval('0'),断言两个CN均恢复默认,无失败返回。这里30秒只用于1秒测试ticker下的有界等待,不声明默认约10分钟周期已经做过实测,也不是生产SLA。使用该开关的用例默认opt-in,只接入隔离双CN job,避免随意改变共享环境的进程级配置。
重启和白盒
pkg/fulltext2和pkg/vectorindex/cache选中16个顶层case,-count=3共48次通过,失败/跳过0。涵盖idle回收、busy/snapshot保护、generation捕获及查询失败、portable mmap释放、读者取消和被替换加载的重试等。pkg/iscp三个顶层case各三轮:TestRunFulltext2RefreshesIdleCacheAfterNonEmptyCDCFlush、TestFulltext2ConsumerContextCancelUnblocksRetrieverNext、TestFulltext2ConsumerCancelWhileWaitingForInput,9/9。它们使用已有受控executor/backend夹具,明确不等同于真实SQL加载失败或Linux/proc映射释放检查。-race,不冒称竞态检测通过。回归
docs/qa/local-20261202.md。[skip ci],新head远端CI未运行、不能写成CI通过;未向MatrixOne主库提测试PR。待解决点
TestFulltext2SearchLoadTailFailureReleasesOwnedMmap及真实/proc映射释放;本机macOS结果不能替代。最终结论:未完成验收。已通过:最新main本地双CN完整generation读取、加速周期刷新、MERGE/REBUILD、三轮重启后首次查询,以及57次portable原生控制;本轮已确认产品失败:无。未完成项:Linux mmap失败释放、其余真实故障/事务边界、原始规模性能和新回归CI。#28005保持开放,不转派。