Repository navigation
Description
Is there an existing issue for the same bug?
- I have checked open and closed issues.
This is an investigation tracker, not a claim that the historical #29235 race remains unfixed on main. Existing concrete reports are linked rather than duplicated: #25341, #25873, #28931 and #32056. No tracker for the remaining non-PK-covering old-row cohort was found.
Branch Name
main (investigation scope; the field origin/version is unresolved)
Commit ID
Code reviewed and locally built: 1d51125661c60ff5216c1216a897a3d312875336.
Comparison branch: 4.2-dev 58edabfe8f9f8a6c126e0634e7246c031a6f0ade.
Other Environment Information
The motivating observations came from a test environment. All SQL shown here is synthetic. Exact historical deployed versions and DDL records are unavailable; current code must not be used as proof of which code produced the historical state.
Actual Behavior
An investigation found historical base rows without matching hidden-index entries, including ordinary and unique indexes whose declared columns do not cover the full primary key. Some tables show an old cohort entirely absent from their indexes while subsequent rows are maintained. Later table rebuilds preserved that gap. The reported field sample did not show orphan, stale-key or duplicate entries. Inspection was partial: not all indexes received a key-level comparison.
Established boundaries
- Fixed historical mechanism: [Bug]: VARCHAR equality predicate returns zero rows with owner-bound PK and covering secondary index #25341 skipped maintenance for indexes whose declared columns cover the primary key. Current main and 4.2
getValidIndexesmaintain regular indexes withTableExist=true. This does not explain the non-covering group without additional evidence. - Propagation, not origin:
SkipIndexesCopysuppresses copy-side DML maintenance for unaffected indexes; cloneUnaffectedIndexes copies the existing hidden data. On both exact local revisions, a deliberately removed entry in a disposable synthetic table remained missing after an unrelated-column COPY ALTER; changing an indexed column rebuilt that index and removed the injected gap. An ALTER-created table/index identity is therefore not evidence that the index was rebuilt from the base rows. - Separate reproduced defect: [Bug]: COPY ALTER of a composite primary-key type leaves stale secondary-index references and misses rows #32056 covers composite-PK type changes cloning old secondary-index references. This investigation reproduced it on both exact revisions: two base rows and two index rows, but two missing current-PK references and two orphan old-PK references. New inserts use the new encoding. This differs from the field's reported missing-only pattern and is not assigned as its cause.
- Additional ALTER trigger: on both revisions,
MODIFY id BIGINT, ADD extra INTfor a single-column INT PK andUNIQUE(u)succeeds but clones INT index objects into a BIGINT origin-PK schema. Reading that unique index fails withobject column type INT does not match destination type BIGINT. Reversing the clauses rebuilds correctly. This is a separatepkAffectedoverwrite trigger in the same invalidation/clone boundary; supporting details will be added to [Bug]: COPY ALTER of a composite primary-key type leaves stale secondary-index references and misses rows #32056. - Historical candidate only: fix table clone visibility for repeated alter #24987 fixed repeated ALTER in one transaction omitting uncommitted index objects. Both current branches and the checked
ce99d32contain that fix. It resembles missing-all-old-rows, but requires proof that the earlier affected deployment lacked it and executed that sequence. - main contains fix: serialize CREATE INDEX with concurrent DDL and DML #29235's CREATE INDEX synchronization. A separate branch tracker evaluates the remaining 4.2 gap; no latest-4.2 row-loss reproduction is claimed.
Expected Behavior
Identify the first operation that made a healthy base/index pair inconsistent, with a public-interface reproducer and exact version. Keep origin, later propagation, and unrelated confirmed defects separate.
Steps to Reproduce
The motivating missing-only historical cohort is not reproduced. #32056 supplies an independently reproducible stale-reference failure, not a reproduction of that field signature.
Synthetic propagation control (only in a disposable local database):
CREATE TABLE t(id INT PRIMARY KEY, k INT, n INT, KEY ix(k));
INSERT INTO t VALUES(1,10,0),(2,20,0);
-- Diagnostic setup only: remove the hidden ix entry for id=1.
-- This intentionally starts from an inconsistent index, so it proves propagation only.
ALTER TABLE t MODIFY n BIGINT;
-- Gap remains in the replacement hidden table.
ALTER TABLE t MODIFY k BIGINT;
-- ix is rebuilt from base rows; gap disappears.Additional information
Investigation checklist:
- Obtain historical deployed commit/image chronology and the DDL/transaction sequence around the first observed rebuild; distinguish application timestamps from physical write/commit time.
- Check earlier snapshots or source clones to locate the first inconsistent generation.
- Fix/validate PK dependency invalidation across all ALTER clauses ([Bug]: COPY ALTER of a composite primary-key type leaves stale secondary-index references and misses rows #32056 and the single-PK clause-order trigger).
- Evaluate the complete 4.2 CREATE INDEX backport: [Bug]: [4.2-dev] CREATE INDEX is not serialized with concurrent DML (#29235 not backported) #32244.
- Recheck skipped historical metadata (
TableExist), stale writer plans, and restore/clone boundaries only where evidence supports a reachable failure.
Local controls passed on both exact revisions: ordinary DML, INSERT SELECT, supported ODKU, REPLACE, DELETE, rollback/duplicate failure, repeated unrelated COPY ALTER in a transaction, LOAD DATA INLINE, clone/data branch, clone failure rollback, and prepared DML after index creation/rebuild. Two-CN held-writer handoffs and cross-CN prepared INSERT also passed. These small controls are not a full concurrency/crash/large-load proof.
No root cause is assigned to the remaining missing-only cohort. Required next evidence is historical deployment/version and DDL/migration history, not another count-only scan.
Activity
Fix transaction delete visibility during clone materialization (#32268)
XuPeng-SH commentedon Nov 6, 2026
已合并修复的范围补充:本调查总项继续保留研发,不因关联 PR 合入而转为整体 QA 验收。
04b3cf3e8532ea0f69d5f30bace366c87558b925,覆盖 [Bug]: COPY ALTER of a composite primary-key type leaves stale secondary-index references and misses rows #32056 的逻辑复合 PK 成员识别及多 ALTER 子句 PK 影响累计。[Bug]: COPY ALTER of a composite primary-key type leaves stale secondary-index references and misses rows #32056 已单独交 QA;这不证明历史 missing-only cohort 的起因。4ffcfba267fee3e6d89e445b962d05b99655fe9c,在 clone 重写前应用事务局部 delete,覆盖 [Bug]: DELETE/UPDATE followed by COPY ALTER in one transaction leaves stale secondary-index entries #32247 的同事务 DELETE/UPDATE 后 COPY ALTER 旧项复活;[Bug]: DELETE/UPDATE followed by COPY ALTER in one transaction leaves stale secondary-index entries #32247 已单独交 QA。PR 明确不修复历史损坏,也未解释本总项的缺失来源。仍未完成的是历史部署 commit/image 与 DDL/事务时序、第一代不一致快照/源 clone,以及有证据支持的 metadata/stale-plan/restore/clone 分支调查。人为删除 hidden entry 后 COPY 保留缺口仅证明传播,不证明来源;旧行缺失与 stale/orphan 反例应继续区分。保持当前负责人,不改标签或关闭 issue;本条不新增自动 backport 要求,也不把两个子问题的转测当作总项完成。