Skip to content

[Bug]: Backport ENUM/SET DELETE key handling to 4.2 to stop silently skipped DELETEs #33080

Done

Description

@LeftHandCold

Existing report and main fix

#29188 tracked the same DELETE failure on main and is closed after #29198. The failing secondary ENUM index path remains reproducible on 4.2. This issue tracks the 4.2 backport and its acceptance.

Affected versions

  • 4.2-dev release candidate 6c05e42f9f660a207077b050b8ec285ccf3f8103
  • Published Linux x86_64 v4.2.8-hotfix-20261119, 5c16f56639acfc07ded01831c49c9bdec8e61125
  • The original 4.2.8 GA qualification also found the target row still readable after DELETE and restart on a composite ENUM index fixture.

Minimal reproduction

CREATE DATABASE enum_secondary_delete_42;
USE enum_secondary_delete_42;
CREATE TABLE t (id INT PRIMARY KEY, e ENUM('red','green','blue'), KEY ix(e));
INSERT INTO t VALUES (2,'green');
DELETE FROM t WHERE id=2;
SELECT id,e FROM t WHERE id=2;

Expected: DELETE affects one row and the SELECT returns zero rows.

Actual: DELETE returns success with zero affected rows and the SELECT returns (2,'green'). With a composite index KEY ix(tag,e), the same symptom persisted after flushing the table and reading it from the other CN. The candidate's controls with an integer indexed column, or an ENUM column outside the index, deleted exactly one row.

Planner evidence and intended backport

On the candidate, EXPLAIN DELETE shows the base-table lookup and a hidden-index INNER JOIN with __mo_index_idx_col = serial_full(t.e, t.id). #29188 documents the storage/display mismatch: DELETE supplies the displayed label for the join while INSERT serialized the typed ordinal. Main's fix is #29198, commit 1a24bdbc7f. Port the relevant typed-expression handling to 4.2's DELETE binder.

Verify affected rows as well as the base-row and index lookup after commit. Cover single-column and composite non-unique indexes, and check the ENUM primary/unique and SET cases documented in #29188 alongside the proposed backport.

Activity

  1. added
    kind/bug
    on Nov 23, 2026
  2. self-assigned this
    on Nov 23, 2026
  3. added a commit that references this issue on Nov 25, 2026
    5fe5d2a
  4. XuPeng-SH commented on Nov 25, 2026

    @XuPeng-SH
    Contributor

    转测:#33152 已合入 4.2-dev,merge SHA 5fe5d2a54a101e5a143ce70bd9ca91ab0506ae36。最终 16fd99fa 的 CI Required、x86 UT、覆盖率和多 CN BVT 通过。独立复审通过有符号浮点零重复键、ENUM/SET 表示、公开序列化和 UPDATE owner 冲突的定向用例;本轮未自行重跑。

    请在合并版本复验原 DELETE(单列、复合索引及 FLUSH 后异 CN 观察),兼查影响行数、主表与隐藏索引一致性及 UPDATE 改主键。历史索引/恢复应按批准的停机隔离、盘点、重建和校验规程单独核验,不能视作原生历史 PITR 已通过。#33258 是发布候选也存在的复合索引 SELECT 路径问题,另单跟踪,不将它算作此次 DELETE/UPDATE 修复。

  5. Ariznawlll commented on Nov 26, 2026

    @Ariznawlll
    Collaborator

    已完成 4.2-dev 固定版本验收,结论:ENUM/SET 二级索引表 DELETE 被静默跳过的问题已修复,可关闭本 Issue。

    版本与原始复现

    • 修复 PR:[4.2-dev] fix: align ENUM/SET secondary-index key encoding #33152,merge 5fe5d2a54a101e5a143ce70bd9ca91ab0506ae36。
    • 固定验收实例:8a273a0f81eda0290d431e54f7a0befe3bb752ec(同时包含 [4.2-dev] fix: support ENUM and YEAR in serial_extract #33260);真实连接的 git_version() 已核实。
    • 修复前对照:21f38a48f7b7a0e3c89f9194f71f5691e5148b75。
    • 复现步骤:分别建立带 ENUM、SET 二级索引的表,插入两行后执行 DELETE FROM ... WHERE id=2,检查影响行数并回读目标行。
    • 实际输出:连续三轮均复现 DELETE 返回 0 影响行且目标行仍存在;整数索引健康对照每轮均删除 1 行。
    • 预期结果:目标行删除成功、影响行数为 1,回读不存在。

    修复后实测

    MOTR CI 状态

    • 回归已提交至 matrixorigin/motr PR Fix bug of merge empty batch #353,head 3d085c8fb810453989044720dcb120e0f9bc46cc。
    • 截至评论时,其余 11 项检查已成功,latest-42-dual-cn 仍在运行;未将双 CN CI 计为通过,也未等待其全绿后关闭。

    范围说明

    • 已通过:上述修复前复现、固定版协议、白盒普通/race 及本地 MOTR。
    • 产品复测未通过项:无。
    • 未验收:MOTR 双 CN 最终状态、main/其他 release、生产发布、历史数据升级、PITR、备份恢复及停机重建。本地协议连接不是跨 CN。
  6. LeftHandCold commented on Dec 2, 2026

    @LeftHandCold
    CollaboratorAuthor

    Additional release qualification on one (ENUM, INT) secondary index. Using a v4.2.9 data directory, the table populated before ADD INDEX and flush had DELETE-by-PK affect one row on v4.2.9 but zero rows on the upgraded build before index rebuild. A control table whose index existed before insert showed zero on v4.2.9 and one after upgrade. The comparison rolled the DELETE transactions back to keep the original rows available.

    On the upgraded binary a DROP/ADD rebuild restored deletion on the affected sample. Rolling that rebuilt data directory back to v4.2.9 then produced zero affected rows on both samples. This is concrete coverage of the offline index migration and rollback boundary in docs/cn/enum_set_index_upgrade_42.md; the sample covers the tested ENUM layout.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

kind/bug

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions