Repository navigation
Description
Environment
- MatrixOne official
main:6987fda6c4a13295b8d525706342fc6033094d2e - Topology: 2 CN / 1 TN / 1 Log
- Client: MySQL Connector/J 8.4.0 (binary protocol)
Problem
After a table with a synchronized FULLTEXT2 index is copied with DATA BRANCH CREATE TABLE, deleting an inherited row from the branch does not fully shadow the copied full-text posting.
A covered full-text query that only projects columns stored by the index returns the deleted primary key. Projecting a non-covered base-table column introduces a join and happens to filter the ghost row, so two equivalent predicates return different row sets.
Reproduction
SET experimental_fulltext2_index = 1;
CREATE DATABASE ft2_branch_delete;
USE ft2_branch_delete;
CREATE TABLE src (
id BIGINT PRIMARY KEY,
body TEXT NOT NULL,
tag INT NOT NULL
);
INSERT INTO src VALUES
(1, 'alpha inherited row', 10),
(2, 'beta retained row', 20);
CREATE FULLTEXT2 INDEX ft ON src(body) INCLUDE(tag);
ALTER TABLE src ALTER REINDEX ft FULLTEXT2 FORCE_SYNC;
DATA BRANCH CREATE TABLE leaf FROM src;
DELETE FROM leaf WHERE id = 1;
INSERT INTO leaf VALUES (3, 'alpha branch new', 30);Wait until the branch FULLTEXT2 storage table has durably consumed the DML (MAX(chunk_id) for index_id='cdc_tail' AND tag=1 advances). Do not execute MATCH while waiting, so the query cache is not pre-warmed.
SELECT id, body FROM leaf ORDER BY id;
-- 2 | beta retained row
-- 3 | alpha branch new
SELECT id
FROM leaf
WHERE MATCH(body) AGAINST('alpha')
ORDER BY id;
SELECT id, body
FROM leaf
WHERE MATCH(body) AGAINST('alpha')
ORDER BY id;Actual result
The covered query returns the deleted inherited row:
SELECT id ... => 1, 3
SELECT id, body ... => 3 | alpha branch new
EXPLAIN shows that the first query uses the FULLTEXT2 covered path without a base-table join, while the second query joins the base table and therefore masks the stale posting.
The branch base table contains only ids 2 and 3. Rebuilding the branch index with ALTER TABLE leaf ALTER REINDEX ft FULLTEXT2 FORCE_SYNC changes the covered result to the correct id 3.
Expected result
Both queries should return only id 3. A DELETE consumed by branch index CDC must create a tombstone newer than the copied base posting, including on the covered-index execution path.
Reproducibility and isolation
- Reproduced in 3/3 fresh databases.
- In every run, the hidden FULLTEXT2 tail watermark advanced before the first
MATCHquery. - The source table's equivalent delete/insert sequence returned the correct result.
- A cold service restart also retained the branch ghost posting, so this is persisted index state rather than a warm-cache visibility delay.
- This differs from [Bug]: DATA BRANCH leaves FULLTEXT2 and HNSW indexes uninitialized but queryable #27950: that issue covered branch index initialization plus UPDATE/INSERT; the missing operation here is DELETE of a row inherited from the copied FULLTEXT2 base.
- This differs from [Performance]: keep FULLTEXT2 cache read-only across CDC updates #28005: no
MATCHquery is issued before durable CDC-tail advancement, and the incorrect result survives a cold restart.
Relevant implementation gap
RestoreTable copies special-index hidden tables and re-registers index CDC from the post-clone timestamp. FULLTEXT2 has plain tombstone/liveness unit coverage, but the copied-base plus branch-delete generation boundary is not covered; the persisted branch tail delete does not shadow the inherited base posting on the covered path.
Activity
Ariznawlll commentedon Sep 15, 2026
在当前最新官方
main(ceaf9c6f88ab184d4e1684d413bfe40ae4b56a44,2 CN / 1 TN / 1 Log)上,分支删除后的 FULLTEXT2 covered-path 残留仍可稳定得到,3/3 个全新数据库一致:每轮均先等待 branch 隐藏索引表的
cdc_tailwatermark 前进,再执行第一次MATCH;不是查询预热或尚未消费 CDC。EXPLAIN仍显示id-only 查询没有 base-table Join,而投影body的查询包含 Join。执行ALTER TABLE leaf ALTER REINDEX ft FULLTEXT2 FORCE_SYNC后,covered 查询恢复为仅返回3。同批次还验证了服务冷重启后该残留仍存在,说明错误状态已进入可恢复的索引数据,而不只是当前 CN 的内存缓存。
gouhongshen commentedon Oct 11, 2026
PR #29863 is trying to fix this issue.
fix(iscp): deliver trailing delete so a branch delete shadows a copie…
fix(iscp): deliver trailing delete so a branch delete shadows a copie…
fix(iscp): deliver trailing delete so a branch delete shadows a copie…
fix(iscp): deliver trailing delete so a branch delete shadows a copie…
fix(iscp): deliver trailing delete so a branch delete shadows a copie…
fix(iscp): deliver trailing delete so a branch delete shadows a copie…
fix(iscp): deliver trailing delete so a branch delete shadows a copie…
fix(iscp): deliver trailing delete so a branch delete shadows a copie…
fix(iscp): deliver trailing delete so a branch delete shadows a copie…
fix(iscp): deliver trailing delete so a branch delete shadows a copie…
fix(iscp): deliver trailing delete so a branch delete shadows a copie…
fix(iscp): deliver trailing delete so a branch delete shadows a copie…
fix(iscp): deliver trailing delete so a branch delete shadows a copie…
gouhongshen commentedon Oct 12, 2026
PR #29863 has merged and is awaiting manual validation. The issue remains open.
Ariznawlll commentedon Oct 22, 2026
测试版本
main:75ae9a79d626622e6ccec0bcb28412f5fcf84c7f,产品源码未修改;已确认包含 fix(iscp): deliver trailing delete so a branch delete shadows a copied index #29863 的 merge commit41ac6242b7620aa069db91492db1d41584319b05。useServerPrepStmts=true、cachePrepStmts=false。原问题验证
10 个全新数据库分别建立原报告的
src(id BIGINT PRIMARY KEY, body TEXT NOT NULL, tag INT NOT NULL),源表为(1,'alpha inherited row',10),(2,'beta retained row',20)。源 FULLTEXT2 索引 FORCE_SYNC 后创建 leaf;删除继承行 1,插入新行 3。额外插入并删除瞬时行 9。每轮在最后一条 DML 完成后读取服务端纳秒时间作为 fence,等 leaf 的全部 live ISCP job 的 watermark 严格大于该 fence 且 ErrorCode=0,才开始第一次 MATCH。没有对 leaf 执行 REINDEX,也没有用 MATCH 预热。
原始自然语言
MATCH(body) AGAINST('alpha')与布尔模式均实际执行,分别检查:两个 CN 均验证精确结果和 covered plan(Fulltext Index Scan、无 base-table Join)。自然语言和布尔模式版本在冷重启前检查一次,再完成 10 个完整关停/恢复周期:同一持久化目录、每次全新服务进程及 Java 客户端,所有关停 exit=0。10 个数据库 × 2 CN ×(重启前 1 次 + 重启后 10 次)= 220 组检查通过。未复现原报告持久化 ghost row。
Happy Path 覆盖
Unhappy Path 覆盖
(2,20),(3,30),src 仍为(1,10),(2,20)。白盒验证
本轮使用真实 SQL、Connector/J 二进制协议和真实进程冷恢复;没有 white-box hook 或替换产品实现。未单独新增 Go mock/UT。
回归测试
已检查 main 的
test/distributed/cases/git4data/branch/edge/branch_fulltext2_inherited_delete.sql以及现有 MOTR。新增独立 MOTR #257,没有加入 #247。script/12_git4data/issue_28847_inherited_delete.py与独立预期.out,最新 head0211c158d97d505bf6f60f66218c7f4b75e92f03。测试证据
The job was not started because an Actions budget is preventing further use.;最新 head 的 run 为 39762721980,亦未运行测试。branch-28847-setup.log、branch-binary-natural-before.log、branch-binary-cycle-{1..10}.log、restart-natural-cycles.log、branch-negative.log和motr-28847-natural-{1..3}.log;这些本地文件未冒充公开下载制品。测试结论
测试通过。