Repository navigation
Description
Is there an existing issue for the same bug?
- I have checked open and closed issues.
#28931 is the existing historical CREATE INDEX/concurrent UPDATE report, fixed on main by #29235. #27487 covers the INSERT metadata-lock mechanism. This item specifically tracks the remaining 4.2-dev backport evaluation, not a claim of a newly reproduced race. No equivalent branch-specific backport tracker was found.
Branch Name
4.2-dev
Commit ID
58edabfe8f9f8a6c126e0634e7246c031a6f0ade (freshly fetched from the upstream remote on 2026-11-05).
Comparison: main 1d51125661c60ff5216c1216a897a3d312875336.
Other Environment Information
Source review of both fixed revisions; isolated local macOS arm64 builds, Go 1.27.1. Local handoff checks used two CN SQL endpoints, one TN and one LogService. No shared test-environment or production mutations were performed.
Actual Behavior
Code-confirmed gap; row loss has not been reproduced on this 4.2-dev revision.
- fix: serialize CREATE INDEX with concurrent DDL and DML #29235 (
3ab5a06612) is an ancestor of the inspected main, but not of the inspected 4.2-dev. Inspection of the implementation, not ancestry alone, confirms the missing handoff. - 4.2 CreateIndex takes catalog locks, resolves the relation, and proceeds to backfill/publish. It lacks main's base-relation definition-change fence and lock-held snapshot refresh.
- main CreateIndex converts catalog-lock retry to definition-change replan, acquires the base-relation fence, and invokes advanceIndexDDLSnapshot before construction. Its read-barrier/snapshot dependencies must be included in backport assessment.
- 4.2 already deep-copies scan ObjectRefs before
NotLockMetathrough [4.2-dev] fix ODKU metadata ownership and parent-owned index drop #29749. Thus the absence of the original fix: preserve insert metadata lock during index creation #27792 commit hash is not evidence that its INSERT ownership correction is missing.
The historical #28931 shows why stale planning/backfill snapshots matter: a successful concurrent UPDATE can be omitted by a successful new index; the unique-index case can publish an incomplete constraint. That historical reproduction is not being attributed to this latest 4.2 revision or to the unresolved old-row cohort under investigation.
Expected Behavior
CREATE INDEX must have a complete handoff with concurrent writers: prior committed writes are visible to backfill; later writes use the newly published index definition or retry. Evaluate backporting the complete main synchronization and snapshot/replan closure, including dependencies and deterministic two-CN coverage.
Steps to Reproduce
There is no fresh failing reproduction for this revision yet. A local bounded check held a writer transaction before CREATE INDEX on another CN, then committed it. INSERT, indexed-column UPDATE, DELETE and non-indexed UPDATE each produced consistent base/hidden-index keys. These four passing schedules do not cover the precise plan-before-commit/barrier window and do not disprove the gap.
Synthetic regression direction:
CREATE TABLE t(id INT PRIMARY KEY, k INT);
INSERT INTO t VALUES (1,10),(2,20);
-- CN2: compile CREATE INDEX ix ON t(k), pause before admission/backfill.
-- CN1: UPDATE t SET k=11 WHERE id=1; commit.
-- CN2: resume CREATE INDEX.
SELECT id,k FROM t IGNORE INDEX(ix) WHERE k=11;
SELECT id,k FROM t FORCE INDEX(ix) WHERE k=11;Use a deterministic planning barrier, as in main's TestIssue28931StaleUpdatePlanCannotBypassNewIndex; plain simultaneous submission is not an equivalent coverage claim. Also test a conflicting UNIQUE build, both writer/DDL admission orders, and physical hidden-key equality rather than counts alone.
Additional information
- Related historical full-primary-key maintenance defect: [Bug]: VARCHAR equality predicate returns zero rows with owner-bound PK and covering secondary index #25341, fixed by fix: maintain covering secondary indexes #25342 on main/4.2. That is a separate mechanism.
- Related main investigation tracker: [Bug]: Investigate remaining causes of secondary index inconsistency #32245.
- This backport item does not establish the origin of old rows missing from non-PK-covering indexes in a test environment.
Activity
fix: synchronize index builds with concurrent writes on 4.2-dev (#32346)
Ariznawlll commentedon Nov 13, 2026
结论
测试通过。本次在已执行的 4.2-dev 并发建索引场景中未复现原 Issue 描述的数据遗漏;旧计划窗口与跨 CN 回归的测试范围及限制如下。
关键证据
4.2-dev。在隔离的 2 CN / 1 TN / 1 LogService 环境验证,首轮两个 CN 的git_version()均为fa67e0ebbee8d6bb66a9d5e87afdd16dac6948ab。原生确定性测试TestIssue28931StaleUpdatePlanCannotBypassNewIndex在 race 模式下 10/10 通过,包含普通索引和唯一索引相关子场景;同轮公开 SQL 用例在两个 CN 各运行三次通过。完整运行记录。4.2-dev中注册。其隔离 CI 的两个 CN 均核对为4.2-dev@2397892f71a937903f72dab41bd2199479102eef,让写事务与 CREATE INDEX 分别走不同 CN,分别测试两个方向各 3 次:观察到 DDL 与写事务重叠后提交 UPDATE、DELETE 和 INSERT,校验基础表完整结果、旧值和新值的强制索引查询、隐藏索引记录的主键,目标步骤 6/6 通过;本轮 race 模式下的原生确定性测试也 10/10 通过,专项 CI 完整通过。本轮运行记录。SQL 重叠不等同于内部旧计划同步点,后者由上述原生测试覆盖。4.2-dev分支并执行已注册的回归;PR 合入后该用例才会进入每日执行,当前尚未合入。待解决点
Error 1176: Key 'ix_payload' doesn't exist;之后的目标测试未再出现,但尚未确认那次错误的根因,不能据此断言其原因已消除。历史记录。