Skip to content

[Bug]: EXPLAIN ANALYZE FORCE EXECUTE fails on prepared plan snapshot binding #29509

Closed

Description

@XuPeng-SH

Bug

EXPLAIN ANALYZE FORCE EXECUTE fails with an internal reused-plan snapshot error on current main (a36da7f72d), including for a prepared statement with no parameters. Ordinary EXPLAIN FORCE EXECUTE and direct EXPLAIN ANALYZE SELECT both work. This blocks measurement of the actual prepared execution plan while investigating pushdown regressions.

Reproduction

CREATE TABLE t (id BIGINT PRIMARY KEY);
INSERT INTO t VALUES (1);
PREPARE p FROM 'SELECT COUNT(*) FROM t WHERE id=1';
EXPLAIN FORCE EXECUTE p;          -- succeeds
EXPLAIN ANALYZE FORCE EXECUTE p;  -- ERROR 20101 (HY000): internal error: reused plan generation is missing its snapshot binding
EXPLAIN ANALYZE SELECT COUNT(*) FROM t WHERE id=1; -- succeeds

The error occurs at pkg/frontend/computation_wrapper.go in reused plan generation. Please verify snapshot ownership when EXPLAIN ANALYZE executes a prepared plan, and cover normal, parameterized, cached/reused and FORCE paths.

Found during QA of #29462; independent of #29505 and #29506.

Activity

  1. self-assigned this
    on Sep 29, 2026
  2. added
    kind/bug
    severity/s0
    on Sep 29, 2026
  3. added a commit that references this issue on Sep 30, 2026
    3d22228
  4. Ariznawlll commented on Oct 2, 2026

    @Ariznawlll
    Collaborator

    测试版本

    • 分支:main
    • Commit:d50a2d475a406829f67127fef7b2ad4abc1c1d3d
    • 部署方式:本地全新单 CN mo-service,独立数据目录;MySQL 文本协议与 server-side PREPARE
    • 测试日期:2026-10-02

    原问题验证

    按 issue 原始语义在上述 commit 重新执行并重复 3 次。EXPLAIN FORCE EXECUTE 与 EXPLAIN ANALYZE FORCE EXECUTE 均成功,并显示实际 filter。

    Happy Path 覆盖

    覆盖普通 EXPLAIN、FORCE、ANALYZE FORCE 和参数重绑。

    Unhappy Path 覆盖

    覆盖 NULL、类型变化及执行后再次 explain;无 stale plan/panic。

    白盒验证

    关联修复 #29508 已进入当前 main。同时将本 issue 的可公开观察契约固化为独立回归,避免只依赖实现细节或共享测试间接判断。

    回归测试

    测试证据

    • 精确测试版本:d50a2d475a406829f67127fef7b2ad4abc1c1d3d
    • 当前结果:EXPLAIN FORCE EXECUTE 与 EXPLAIN ANALYZE FORCE EXECUTE 均成功,并显示实际 filter。
    • 回归代码与 golden result 已提交到 MOTR #209;本地全量 14_issue_regression 中观察到的旧 GOROOT/历史 golden/并发锁冲突属于既有无关失败,以上新增用例单独重跑均稳定通过。

    测试结论

    测试通过。

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

Metadata

Metadata

Assignees

Labels

kind/bugseverity/s0

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions