Skip to content

fix: distinguish durable pipeline termination from queue delivery - #29549

Merged
XuPeng-SH merged 3 commits into
matrixorigin:mainfrom
XuPeng-SH:codex/fix-29492
Oct 1, 2026
Merged

XuPeng-SH merged 3 commits into
matrixorigin:mainfrom
XuPeng-SH:codex/fix-29492

Conversation

@XuPeng-SH

Copy link
Copy Markdown
Contributor

What type of PR is this?

  • BUG
  • Improvement
  • API-change
  • Documentation
  • Feature
  • Test and CI
  • Code Refactoring

Which issue(s) this PR fixes:

Fixes #29492

What this PR does / why we need it:

Terminal cleanup confused an unsuccessful channel enqueue with an unsuccessful
terminal publication. The edge had already recorded the fatal cause and closed
Done, and receivers could recover the terminal from durable edge state. Full
channels and End after cancellation therefore produced misleading timeout=30s
warnings and abnormal-cleanup metrics despite nonblocking publication.

Use PipelineEdge's existing terminal state as the single owner of cleanup
publication. PublishTerminal returns the effective terminal and whether durable
publication is satisfied; existing Try/Send boolean behavior is preserved.
Connector, Dispatch and remote-notify cleanup use that result. Remove duplicated
terminal logic, ineffective enqueue retries, fallback sends and cleanup timers.

Normal End preserves queued data and deferred spool reclamation. Error/Abort and
End superseded by a fatal terminal abort with the original cause; allocation
account finalization still waits for consumer quiescence. Missing edges/channels
remain diagnosed, without calling a nonblocking failure a timeout. Dispatch
reuses the existing resolver to prefer substantive errors over synthetic delivery
fallout. No wire, stored-data, catalog or mixed-upgrade mechanism changes.

Validation

  • Identical pre/post white-box probe: the unfixed production source recorded
    three abnormal-cleanup events for an already durable cancellation, in 0.00s;
    fixed source recorded zero. Permanent assertions extend existing full-queue,
    original-cause and spool-reclamation fixtures instead of retaining the probe.
  • Publication tests cover full/available queues, partial multi-sender End,
    Error/Abort first-cause preservation, duplicates, graceful completion, invalid
    input and reuse. Missing-register tests require diagnostics and reclamation.
  • Normal and race suites: process, connector, dispatch, compile and pipeline.
    Focused lifecycle regressions additionally pass 100 race repetitions each.
  • Real SQL test on an owned three-CN embedded cluster: 24,576 persisted rows,
    a successful percentile spill control (SpillRows=49152), server KILL QUERY
    at an observable execution barrier with live remote senders, expected
    cancellation, sender/FIN lifecycle gauges returning to zero, unchanged cleanup
    failure counters, and exact percentile results on every CN. Test body 18.97s.
  • Incremental vet-all and configured golangci-lint checks.

The canceled black-box query is deliberately gated before aggregation; the
successful spill control is not evidence that cancellation itself reached spill.
Strict full-channel causality is proved by component tests. This is not a claim
of reproducing the original TKE 10M-row scale or proving a historical memory leak.
The reported 30s was a configured value, not a measured cleanup delay.

Engineering and performance

No new state machine, stored state, retry policy or production test hook. The
production delta is a net reduction; normal data forwarding is unchanged and
cleanup removes timers, retry bookkeeping and false warning/metric work. Tests
reuse existing component fixtures; the separate SQL fixture is isolated because
it explicitly requires three CNs and forced remote placement.

Design and final overall review: gpt-6.1-sol / xhigh. CI remains pending; local
validation is reported separately and no CI wait is implied.

@qodo-code-review

Copy link
Copy Markdown

Qodo reviews are paused for this user.

Troubleshooting steps vary by plan Learn more →

On a Teams plan?
Reviews resume once this user has a paid seat and their Git account is linked in Qodo.
Link Git account →

Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center?
These require an Enterprise plan - Contact us
Contact us →

@XuPeng-SH XuPeng-SH left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

代码评审结论:当前 head 99c372f 未发现阻塞问题;建议无阻塞。

  • PipelineEdge 继续作为终止状态的唯一所有者;PublishTerminal 将持久终止状态与队列投递结果分开,既有 Try/Send 布尔语义保持不变。
  • Connector、Dispatch 和 remote-notify 清理共用该终止状态及既有接收/错误选择路径。Dispatch 的多接收者失败场景复用现有错误解析器,保留真实错误原因。没有增加新的状态机或数据路径状态。
  • 失败、满队列、部分 End、重复终止、首错保留、spool/account 回收及复用均有组件验证;三 CN SQL 取消验证检查远端 sender/stream 收敛和后续查询。生产代码净减,测试扩展复用既有组件 fixture。

限制:SQL 取消测试在聚合前设 barrier,因此不证明被取消查询本身发生 spill;也没有复现原 TKE 1000 万行规模,或证明历史内存泄漏。CI 尚有检查运行中,本评审未等待 CI。

这是 PR 作者提交的 COMMENT review,不是 GitHub APPROVE。

@XuPeng-SH
XuPeng-SH merged commit 152a1c4 into matrixorigin:main Oct 1, 2026
2 of 5 checks passed
@XuPeng-SH
XuPeng-SH deleted the codex/fix-29492 branch October 1, 2026 13:41

This branch was previously deployed

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

Labels

kind/bug Something isn't working kind/enhancement size/L Denotes a PR that changes [500,999] lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: multi-CN percentile cancellation connector cleanup times out

2 participants