Skip to content

[Bug] PR #26727 (reduce redundant group-by hash keys) 导致 IVF VECTOR INDEX TEST 性能回归 2-5 倍 #26746

Closed

Description

@Ariznawlll

环境

Field Value
环境 TKE (3CN + 1DN)
Job IVF VECTOR INDEX TEST
成功 commit 2758eb1d3f81 (8/4)
失败 commit ab28d1b4ac41 (8/6)
两个 commit 之间 20 commits

问题

PR #26727 "perf: reduce redundant group-by hash keys" 引入后,IVF VECTOR INDEX TEST 性能下降 2-5 倍,导致 3 小时超时被取消。

性能对比

阶段 8/4 (旧) 8/6 (新) 差异
Phase 1 (inserts) 3.7 min 10 min 2.7x 慢
Phase 2 (updates) 17.7 min 22.9 min 1.3x 慢
Phase 3 (deletes) 3.5 min 3.3 min 差不多
Phase 4 (mixed) 18.3 min 3.3 min 5.6x 快
Phase 5 (mixed) 3.7 min 20 min (40/200 rounds) 5.4x 慢
Phase 6 (mixed) 11.3 min 未跑到 -
总计 58 min >97 min (未完成) >1.7x 慢

可疑 PR

#26727 "perf: reduce redundant group-by hash keys"

  • 改动: +2871/-1809
  • 修改文件: pkg/sql/colexec/group/*, pkg/sql/plan/group_by_hash_key.go, pkg/sql/plan/shuffle.go 等 25+ 文件
  • 目的: 优化 GROUP BY hash key,只 hash optimizer 认定的物理相等键
  • 实际效果: 性能回归 2-5 倍

Commit 链

Successful (8/4): 2758eb1d3f81 fix(plan): bind preceding CTEs in recursive members
  ↓ 20 commits
Failed (8/6): ab28d1b4ac41 perf: reduce redundant group-by hash keys  ← 可疑

影响

  • IVF VECTOR INDEX TEST 从 58 分钟变成 >97 分钟
  • 3 小时超时被取消(只跑了 40/200 rounds)
  • 之前 10 次全部超时失败,最后一次成功是 7/16

PR 标题是 "perf"(性能优化),但实际引入了严重性能回归。

Activity

  1. added
    kind/bug
    on Aug 6, 2026
  2. added theissue type on Aug 6, 2026
  3. added this to the MO-202608 milestone on Aug 6, 2026
  4. added
    severity/s0
    on Aug 6, 2026
  5. aptend commented on Aug 6, 2026

    @aptend
    Contributor

    Confirmed as a regression in the main daily IVF-vector job, rather than a regression introduced by #26727 itself.

    Evidence:

    • Good: main daily run 30932220005, commit 2758eb1d3f81, IVF job 92169050931.
    • Bad: main daily run 31027932135, commit ab28d1b4ac41, IVF job 92486091439.
    • The bad run emitted 387 pipeline batch drain delayed before terminal response warnings during the IVF scenarios. The delayed statements repeatedly spent about 30.03s in Exec.Run; the corresponding good-run window had none.
    • The server was waiting in pipelineBatchFlow.waitUntilDrained with one outstanding remote batch. On the client, both the connector receiverDone path and dispatch ExecStop path return before acknowledgeRemoteBatch, so the terminal response waits for the 30s drain timeout.

    This behavior comes from the remote-batch backpressure lifecycle added by #26711. The bounded-credit design is still correct; the missing case is a batch that has been received and intentionally discarded because the downstream operator has already stopped. That batch must release its credit before the graceful early return. Error/cancellation paths should continue to abort via stream teardown rather than send a success ACK.

    I also reproduced the protocol failure locally with a deterministic unit test: a sequenced remote batch followed by connector terminal state leaves pendingBatchAck == 7 instead of zero.

    I am preparing the minimal ACK-before-graceful-stop fix plus connector and dispatch regression coverage.

  6. aptend commented on Aug 6, 2026

    @aptend
    Contributor

    The fix is now up in #26751. It covers the connector, dispatch, and remote-notify graceful-stop paths while preserving the bounded-credit and error/cancellation semantics from #26711.

  7. assigned and unassigned on Aug 10, 2026
  8. Ariznawlll commented on Aug 12, 2026

    @Ariznawlll
    CollaboratorAuthor

    超时问题已解决

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

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions