Skip to content

[Bug]: committed tombstone matching may panic when NULL bitmap allocation fails #33243

Done

Description

@XuPeng-SH

Description

Matching a committed tombstone may panic when the candidate row-ID vector needs to allocate a NULL bitmap and its memory pool rejects the allocation. The workspace tombstone path is addressed by #33240. The committed tombstone paths need separate investigation and a fallible error path.

Evidence and possible impact

At revision 79b352e552fc7a40aa99ac54e9ca1e546e09f375:

  • txnTable.findDeletes scans committed tombstone objects after workspace filtering. It is reached by snapshot deduplication and primary-key lookup.
  • In-memory tombstone matching reaches indexwrapper.MutIndex.Contains, which calls containers.UpdateValue(..., nil, true, ...). GenericUpdateFixedValue invokes Nulls.Add, whose bitmap growth panics if allocation fails.
  • Persisted tombstone matching reaches baseObject.containsWithLoad and the contains callbacks in tables/functions.go, which mark matching row IDs through rowIDs.Update(..., nil, true). That update also reaches the infallible NULL bitmap operation.

A matching candidate with no allocated NULL word and insufficient pool headroom could therefore turn an allocation error into a panic during lookup or deduplication. Confirm the end-to-end trigger, error handling, and resource cleanup with deterministic fault injection.

This is a source-level finding. The exact committed-tombstone failure has not yet been reproduced by an executed fault-injection test. The workspace probe failure and its fix were verified separately in #33240.

Expected behavior

Allocation failure during committed tombstone filtering returns the original typed error to the operation and releases owned resources. Successful filtering and existing write-write conflict handling remain correct.

Suggested validation

  • Exercise real in-memory and persisted committed tombstones with a matching candidate whose NULL bitmap allocation is denied.
  • Check the error identity, cleanup, normal matching and non-matching controls, and write-write conflict behavior.
  • Cover partial filtering followed by an error, and verify callers do not mistake incomplete filtering for a definitive result.

Activity

  1. self-assigned this
    on Nov 25, 2026
  2. added a commit that references this issue on Nov 25, 2026
    0b641a6
  3. XuPeng-SH commented on Nov 25, 2026

    @XuPeng-SH
    ContributorAuthor

    转测:#33245 已合入 main 0b641a61f42ebfc53fd415ab68898cfc77682a2a。内存和持久化的已提交 tombstone 回传位图分配错误;意外扫描错误不发布部分过滤结果。作者的限额池测试报告旧版 panic、新版返回 ErrMPoolCapacity,包含正常匹配和写写冲突对照。本轮只核对报告,没有重跑。请以合入版分别验证两种 tombstone、部分过滤后失败、错误返回及资源释放;不涵盖 #33240 的 workspace/结果转换或 4.2。

  4. Ariznawlll commented on Nov 26, 2026

    @Ariznawlll
    Collaborator

    已完成 main 固定版本验收,结论:committed tombstone 匹配时 NULL bitmap 分配失败导致 panic 的问题已修复,可关闭本 Issue。

    版本与原始复现

    • 修复 PR:fix(tae): return tombstone bitmap allocation errors #33245;固定验收 merge:0b641a61f42ebfc53fd415ab68898cfc77682a2a。
    • 修复前对照:336486e1088480e3fdece0acef210811234d002a,仅加入定向故障注入测试,不加入产品修复。
    • 复现步骤:使用 1 MiB capped mpool,分别构造内存及持久化 committed tombstone,使匹配候选 RowID 需要扩展 NULL bitmap 时分配失败。
    • 实际输出:两条路径均复现 mpool physical capacity exceeded 引发的 panic。
    • 预期结果:返回原始 ErrMPoolCapacity,不发布部分候选结果,不增长池用量,并在资源恢复后可正常匹配。

    修复后实测

    • 八个定向测试普通及 -race 各三轮全部通过,覆盖内存/持久化 tombstone、miss、aborted match、部分过滤、write-write 冲突、错误原子性及资源释放;无 DATA RACE。
    • indexwrapper、tables、txn/txnimpl 相关包测试通过。
    • 固定版真实 MySQL 协议三轮 22/22 项断言通过,运行时 git_version() 已核实;主键写入、删除、重插、事务及失败后的行集健康对照正常。

    MOTR CI 状态

    范围说明

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

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions