Repository navigation
fix: snapshot async execution plans - #26177
Merged
XuPeng-SH merged 5 commits intoJul 26, 2026
Merged
Conversation
Qodo reviews are paused for this user.Troubleshooting steps vary by plan Learn more → On a Teams plan? Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center? |
Contributor
Author
|
@LeftHandCold @gouhongshen please help to review |
XuPeng-SH
commented
Jul 25, 2026
XuPeng-SH
left a comment
Contributor
Author
There was a problem hiding this comment.
这轮按 correctness / 功能闭环 / unhappy path 做了复核,当前没有看到阻塞合入的问题。
重点看了异步 exec plan 导出链路:本次改动在保留 ExplainData 前先把 PhyPlan、OperatorStats 和 BackgroundQueries 从可变执行态里 detach 出来,能够覆盖 prepared reset / source reuse / sanitize 不应反写 source 这几个关键场景;新增测试也把 shared-node alias、引用断开和快照稳定性补齐了。
补充说明:当前账号是该 PR 作者账号,GitHub 不允许对自己的 PR 执行 approve,所以这里只能留下 comment 结论。
VioletQwQ-0
pushed a commit
to VioletQwQ-0/matrixone
that referenced
this pull request
Sep 17, 2026
## What type of PR is this? - [ ] API-change - [x] BUG - [ ] Improvement - [ ] Documentation - [ ] Feature - [x] Test and CI - [ ] Code Refactoring ## Which issue(s) this PR fixes: Fixes matrixorigin#26175 ## What this PR does / why we need it: The asynchronous JSON-plan exporter previously retained references into a completed execution generation. A prepared-plan reset/reuse could mutate those references before the asynchronous sanitizer or serializer consumed them, resulting in stale data, data races, or a panic. This PR snapshots `PhyPlan` synchronously before reuse. The clone preserves intentional physical-plan DAG sharing while detaching all mutable execution-owned state: scopes, receivers, sources, operators, operator-stat maps, and background-query protobufs. To prevent future fields from reopening the bug class, the tests now: - assert the reference-bearing schema of every cloned type explicitly; - populate every mutable fixture field; - prove that a shallow copy is detected as aliased while `CloneForExport` has no mutable aliases; - cover prepared reset/reuse and sanitizer isolation. Verification: - targeted `-race -count=10` tests for the snapshot/reset/sanitizer paths; - complete UT for `pkg/sql/models`, `pkg/vm/process`, and `pkg/frontend`; - `go vet` and `go build` for the affected packages; - clone benchmark: a 1000-operator plan completes in about 0.34 ms locally.
VioletQwQ-0
pushed a commit
to VioletQwQ-0/matrixone
that referenced
this pull request
Sep 17, 2026
## What type of PR is this? - [ ] API-change - [x] BUG - [ ] Improvement - [ ] Documentation - [ ] Feature - [x] Test and CI - [ ] Code Refactoring ## Which issue(s) this PR fixes: Fixes matrixorigin#26175 ## What this PR does / why we need it: The asynchronous JSON-plan exporter previously retained references into a completed execution generation. A prepared-plan reset/reuse could mutate those references before the asynchronous sanitizer or serializer consumed them, resulting in stale data, data races, or a panic. This PR snapshots `PhyPlan` synchronously before reuse. The clone preserves intentional physical-plan DAG sharing while detaching all mutable execution-owned state: scopes, receivers, sources, operators, operator-stat maps, and background-query protobufs. To prevent future fields from reopening the bug class, the tests now: - assert the reference-bearing schema of every cloned type explicitly; - populate every mutable fixture field; - prove that a shallow copy is detected as aliased while `CloneForExport` has no mutable aliases; - cover prepared reset/reuse and sanitizer isolation. Verification: - targeted `-race -count=10` tests for the snapshot/reset/sanitizer paths; - complete UT for `pkg/sql/models`, `pkg/vm/process`, and `pkg/frontend`; - `go vet` and `go build` for the affected packages; - clone benchmark: a 1000-operator plan completes in about 0.34 ms locally.
VioletQwQ-0
pushed a commit
to VioletQwQ-0/matrixone
that referenced
this pull request
Sep 17, 2026
## What type of PR is this? - [ ] API-change - [x] BUG - [ ] Improvement - [ ] Documentation - [ ] Feature - [x] Test and CI - [ ] Code Refactoring ## Which issue(s) this PR fixes: Fixes matrixorigin#26175 ## What this PR does / why we need it: The asynchronous JSON-plan exporter previously retained references into a completed execution generation. A prepared-plan reset/reuse could mutate those references before the asynchronous sanitizer or serializer consumed them, resulting in stale data, data races, or a panic. This PR snapshots `PhyPlan` synchronously before reuse. The clone preserves intentional physical-plan DAG sharing while detaching all mutable execution-owned state: scopes, receivers, sources, operators, operator-stat maps, and background-query protobufs. To prevent future fields from reopening the bug class, the tests now: - assert the reference-bearing schema of every cloned type explicitly; - populate every mutable fixture field; - prove that a shallow copy is detected as aliased while `CloneForExport` has no mutable aliases; - cover prepared reset/reuse and sanitizer isolation. Verification: - targeted `-race -count=10` tests for the snapshot/reset/sanitizer paths; - complete UT for `pkg/sql/models`, `pkg/vm/process`, and `pkg/frontend`; - `go vet` and `go build` for the affected packages; - clone benchmark: a 1000-operator plan completes in about 0.34 ms locally.
This branch was previously deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What type of PR is this?
Which issue(s) this PR fixes:
Fixes #26175
What this PR does / why we need it:
The asynchronous JSON-plan exporter previously retained references into a completed execution generation. A prepared-plan reset/reuse could mutate those references before the asynchronous sanitizer or serializer consumed them, resulting in stale data, data races, or a panic.
This PR snapshots
PhyPlansynchronously before reuse. The clone preserves intentional physical-plan DAG sharing while detaching all mutable execution-owned state: scopes, receivers, sources, operators, operator-stat maps, and background-query protobufs.To prevent future fields from reopening the bug class, the tests now:
CloneForExporthas no mutable aliases;Verification:
-race -count=10tests for the snapshot/reset/sanitizer paths;pkg/sql/models,pkg/vm/process, andpkg/frontend;go vetandgo buildfor the affected packages;