Repository navigation
fix(frontend): surface data branch file finalization errors - #26505
Conversation
aeb72e2 to
d7a02bf
Compare
|
Investigated the failed Ubuntu/x86 UT job from run 30617011418. The PR changes only |
|
Investigated the second Ubuntu/x86 UT failure (job 91130900423). It is again outside this PR: the failed packages were |
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? |
XuPeng-SH
left a comment
There was a problem hiding this comment.
Approved exact head d7a02bfaa1a976c996766a6862a7d236e31826a6.
No blocking findings. I reviewed the complete finalization closure for both mutable and streaming file-service paths: final write/close errors reach the SQL caller before the success row, early errors are joined with finalizer errors, finalization remains single-owner, and partial-output cleanup runs only after the active writer has terminated.
Local verification passed: all 9 new/modified exact tests were enumerated; each measured T=0s with B=30s and passed independently under -race -count=100; full pkg/frontend passed under race and non-race; build, vet, and diff checks passed. Current CI is green and GitHub reports the PR mergeable.
Merge Queue Status
This pull request spent 17 minutes 51 seconds in the queue, with no time running CI. Waiting for
All conditions
ReasonPull request #26505 has been dequeued Pull request from fork cannot be queued. This pull request comes from a fork, and Mergify needs the author's permission to update its branch.
Failing checks:
HintYou should look at the reason for the failure and decide if the pull request needs to be fixed or if you want to requeue it. Tick the box to put this pull request back in the merge queue (same as
|
…igin#26505) ## What type of PR is this? - [ ] API-change - [x] BUG - [ ] Improvement - [ ] Documentation - [ ] Feature - [ ] Test and CI - [ ] Code Refactoring ## Which issue(s) this PR fixes: Fixes matrixorigin#26054 ## What this PR does / why we need it: ### Root cause `DATA BRANCH DIFF ... OUTPUT FILE` treated successful producer-side appends as a completed file write. In the streaming path, `FileService.Write` ran in a worker and its final result was consumed only by a no-result `release` callback. A file service could therefore consume the entire pipe, let every `writeFile` call succeed, and then return an error that the SQL statement could not observe. The mutable path similarly discarded the final `Mutator.Close` error. In both cases the success row was added before deferred finalization ran. ### Changes - Make the common file-output finalizer return an error. - Await and return the worker's final `FileService.Write` result in the non-mutable path. - Return the final `Mutator.Close` result in the mutable path. - Explicitly finalize the output before adding the success result row, and retain deferred finalization for early-error paths. - Join an early statement error with any concurrent finalization error instead of discarding either one. - Finalize the writer before deleting partial output so cleanup cannot race an active stream. - Add focused tests for a file service that consumes the complete stream before failing, SQL-level error/result-row/cleanup behavior, mutable close failure propagation, success, immediate write failure, and setup failures. No public API, SQL syntax, output format, or configuration behavior changes. ### Tests Pre-fix reproduction on `main` used a package-level file service wrapper that fully consumed each `ReaderForWrite` before returning `mock late write failure`. In 3/3 runs, both `BEGIN` and `COMMIT` writes returned nil, and the no-result release callback was the only observer of the failure. Post-fix exhaustive verification on `main@84f0d11`: - CGo-configured `go build -mod=readonly ./pkg/frontend` - CGo-configured `go vet -mod=readonly ./pkg/frontend` - Focused output-file regression set, `-count=3` (9 exact tests) - `.agents/skills/mo-dev/scripts/mo-cgo-test -count=1 -timeout=20m ./pkg/frontend` (PASS, 24.471s) - Race selection was enumerated and contained all 7 new/modified behavioral tests. - Race measurements were `T=0s` to `0.04s`; with `B=30s`, the adaptive rule selected `N=100` for every test. - Each selected exact test passed independently with `-race -count=100`. - `.agents/skills/mo-dev/scripts/mo-cgo-test -race -count=1 -timeout=20m ./pkg/frontend` (PASS, 37.818s) - `git diff --check origin/main...HEAD` Rebase verification on `main@0b8b53d`: - Focused output-file finalization set, `-count=3` (8 exact tests) - `.agents/skills/mo-dev/scripts/mo-cgo-test ./pkg/frontend -count=1` (PASS, 33.817s) - CGo-configured `go build -mod=readonly ./pkg/frontend` - CGo-configured `go vet -mod=readonly ./pkg/frontend` - `git diff --check origin/main...HEAD` - `git range-diff` confirmed the rebase preserved the patch exactly. BVT is not appropriate for this regression because the required boundary is a deterministic post-consumption `FileService.Write` or `Mutator.Close` fault, which the SQL BVT harness cannot inject. The package-level tests cover both file-service implementations and the SQL result-row boundary directly. ### CI follow-up Two attempt-1 Ubuntu/x86 UT failures were proven unrelated to this PR; in both jobs, `pkg/frontend` passed and the failures were in packages outside this two-file diff. The first failure exposed ISCP, embedded-cluster heartbeat, and lockservice signatures: the previously unreported ISCP cases were filed as matrixorigin#26517, while existing matrixorigin#26374 and matrixorigin#26441 / matrixorigin#26448 cover the other signatures. After rebasing, a second failure exposed current-main embedded-cluster heartbeat/reset cases and was filed as matrixorigin#26522. Per CI policy, the failed jobs for the current-head workflow were rerun exactly once; attempt 2 passed. ### Residual risks No known correctness gap remains in final write/close error propagation. Partial-output deletion retains the existing best-effort cleanup contract: this change guarantees cleanup is invoked after writer termination, but a backend `Delete` failure remains secondary to the original output failure and is not returned separately. Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
…igin#26505) ## What type of PR is this? - [ ] API-change - [x] BUG - [ ] Improvement - [ ] Documentation - [ ] Feature - [ ] Test and CI - [ ] Code Refactoring ## Which issue(s) this PR fixes: Fixes matrixorigin#26054 ## What this PR does / why we need it: ### Root cause `DATA BRANCH DIFF ... OUTPUT FILE` treated successful producer-side appends as a completed file write. In the streaming path, `FileService.Write` ran in a worker and its final result was consumed only by a no-result `release` callback. A file service could therefore consume the entire pipe, let every `writeFile` call succeed, and then return an error that the SQL statement could not observe. The mutable path similarly discarded the final `Mutator.Close` error. In both cases the success row was added before deferred finalization ran. ### Changes - Make the common file-output finalizer return an error. - Await and return the worker's final `FileService.Write` result in the non-mutable path. - Return the final `Mutator.Close` result in the mutable path. - Explicitly finalize the output before adding the success result row, and retain deferred finalization for early-error paths. - Join an early statement error with any concurrent finalization error instead of discarding either one. - Finalize the writer before deleting partial output so cleanup cannot race an active stream. - Add focused tests for a file service that consumes the complete stream before failing, SQL-level error/result-row/cleanup behavior, mutable close failure propagation, success, immediate write failure, and setup failures. No public API, SQL syntax, output format, or configuration behavior changes. ### Tests Pre-fix reproduction on `main` used a package-level file service wrapper that fully consumed each `ReaderForWrite` before returning `mock late write failure`. In 3/3 runs, both `BEGIN` and `COMMIT` writes returned nil, and the no-result release callback was the only observer of the failure. Post-fix exhaustive verification on `main@84f0d11`: - CGo-configured `go build -mod=readonly ./pkg/frontend` - CGo-configured `go vet -mod=readonly ./pkg/frontend` - Focused output-file regression set, `-count=3` (9 exact tests) - `.agents/skills/mo-dev/scripts/mo-cgo-test -count=1 -timeout=20m ./pkg/frontend` (PASS, 24.471s) - Race selection was enumerated and contained all 7 new/modified behavioral tests. - Race measurements were `T=0s` to `0.04s`; with `B=30s`, the adaptive rule selected `N=100` for every test. - Each selected exact test passed independently with `-race -count=100`. - `.agents/skills/mo-dev/scripts/mo-cgo-test -race -count=1 -timeout=20m ./pkg/frontend` (PASS, 37.818s) - `git diff --check origin/main...HEAD` Rebase verification on `main@0b8b53d`: - Focused output-file finalization set, `-count=3` (8 exact tests) - `.agents/skills/mo-dev/scripts/mo-cgo-test ./pkg/frontend -count=1` (PASS, 33.817s) - CGo-configured `go build -mod=readonly ./pkg/frontend` - CGo-configured `go vet -mod=readonly ./pkg/frontend` - `git diff --check origin/main...HEAD` - `git range-diff` confirmed the rebase preserved the patch exactly. BVT is not appropriate for this regression because the required boundary is a deterministic post-consumption `FileService.Write` or `Mutator.Close` fault, which the SQL BVT harness cannot inject. The package-level tests cover both file-service implementations and the SQL result-row boundary directly. ### CI follow-up Two attempt-1 Ubuntu/x86 UT failures were proven unrelated to this PR; in both jobs, `pkg/frontend` passed and the failures were in packages outside this two-file diff. The first failure exposed ISCP, embedded-cluster heartbeat, and lockservice signatures: the previously unreported ISCP cases were filed as matrixorigin#26517, while existing matrixorigin#26374 and matrixorigin#26441 / matrixorigin#26448 cover the other signatures. After rebasing, a second failure exposed current-main embedded-cluster heartbeat/reset cases and was filed as matrixorigin#26522. Per CI policy, the failed jobs for the current-head workflow were rerun exactly once; attempt 2 passed. ### Residual risks No known correctness gap remains in final write/close error propagation. Partial-output deletion retains the existing best-effort cleanup contract: this change guarantees cleanup is invoked after writer termination, but a backend `Delete` failure remains secondary to the original output failure and is not returned separately. Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
…igin#26505) ## What type of PR is this? - [ ] API-change - [x] BUG - [ ] Improvement - [ ] Documentation - [ ] Feature - [ ] Test and CI - [ ] Code Refactoring ## Which issue(s) this PR fixes: Fixes matrixorigin#26054 ## What this PR does / why we need it: ### Root cause `DATA BRANCH DIFF ... OUTPUT FILE` treated successful producer-side appends as a completed file write. In the streaming path, `FileService.Write` ran in a worker and its final result was consumed only by a no-result `release` callback. A file service could therefore consume the entire pipe, let every `writeFile` call succeed, and then return an error that the SQL statement could not observe. The mutable path similarly discarded the final `Mutator.Close` error. In both cases the success row was added before deferred finalization ran. ### Changes - Make the common file-output finalizer return an error. - Await and return the worker's final `FileService.Write` result in the non-mutable path. - Return the final `Mutator.Close` result in the mutable path. - Explicitly finalize the output before adding the success result row, and retain deferred finalization for early-error paths. - Join an early statement error with any concurrent finalization error instead of discarding either one. - Finalize the writer before deleting partial output so cleanup cannot race an active stream. - Add focused tests for a file service that consumes the complete stream before failing, SQL-level error/result-row/cleanup behavior, mutable close failure propagation, success, immediate write failure, and setup failures. No public API, SQL syntax, output format, or configuration behavior changes. ### Tests Pre-fix reproduction on `main` used a package-level file service wrapper that fully consumed each `ReaderForWrite` before returning `mock late write failure`. In 3/3 runs, both `BEGIN` and `COMMIT` writes returned nil, and the no-result release callback was the only observer of the failure. Post-fix exhaustive verification on `main@84f0d11`: - CGo-configured `go build -mod=readonly ./pkg/frontend` - CGo-configured `go vet -mod=readonly ./pkg/frontend` - Focused output-file regression set, `-count=3` (9 exact tests) - `.agents/skills/mo-dev/scripts/mo-cgo-test -count=1 -timeout=20m ./pkg/frontend` (PASS, 24.471s) - Race selection was enumerated and contained all 7 new/modified behavioral tests. - Race measurements were `T=0s` to `0.04s`; with `B=30s`, the adaptive rule selected `N=100` for every test. - Each selected exact test passed independently with `-race -count=100`. - `.agents/skills/mo-dev/scripts/mo-cgo-test -race -count=1 -timeout=20m ./pkg/frontend` (PASS, 37.818s) - `git diff --check origin/main...HEAD` Rebase verification on `main@0b8b53d`: - Focused output-file finalization set, `-count=3` (8 exact tests) - `.agents/skills/mo-dev/scripts/mo-cgo-test ./pkg/frontend -count=1` (PASS, 33.817s) - CGo-configured `go build -mod=readonly ./pkg/frontend` - CGo-configured `go vet -mod=readonly ./pkg/frontend` - `git diff --check origin/main...HEAD` - `git range-diff` confirmed the rebase preserved the patch exactly. BVT is not appropriate for this regression because the required boundary is a deterministic post-consumption `FileService.Write` or `Mutator.Close` fault, which the SQL BVT harness cannot inject. The package-level tests cover both file-service implementations and the SQL result-row boundary directly. ### CI follow-up Two attempt-1 Ubuntu/x86 UT failures were proven unrelated to this PR; in both jobs, `pkg/frontend` passed and the failures were in packages outside this two-file diff. The first failure exposed ISCP, embedded-cluster heartbeat, and lockservice signatures: the previously unreported ISCP cases were filed as matrixorigin#26517, while existing matrixorigin#26374 and matrixorigin#26441 / matrixorigin#26448 cover the other signatures. After rebasing, a second failure exposed current-main embedded-cluster heartbeat/reset cases and was filed as matrixorigin#26522. Per CI policy, the failed jobs for the current-head workflow were rerun exactly once; attempt 2 passed. ### Residual risks No known correctness gap remains in final write/close error propagation. Partial-output deletion retains the existing best-effort cleanup contract: this change guarantees cleanup is invoked after writer termination, but a backend `Delete` failure remains secondary to the original output failure and is not returned separately. Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
What type of PR is this?
Which issue(s) this PR fixes:
Fixes #26054
What this PR does / why we need it:
Root cause
DATA BRANCH DIFF ... OUTPUT FILEtreated successful producer-side appends as a completed file write. In the streaming path,FileService.Writeran in a worker and its final result was consumed only by a no-resultreleasecallback. A file service could therefore consume the entire pipe, let everywriteFilecall succeed, and then return an error that the SQL statement could not observe. The mutable path similarly discarded the finalMutator.Closeerror. In both cases the success row was added before deferred finalization ran.Changes
FileService.Writeresult in the non-mutable path.Mutator.Closeresult in the mutable path.No public API, SQL syntax, output format, or configuration behavior changes.
Tests
Pre-fix reproduction on
mainused a package-level file service wrapper that fully consumed eachReaderForWritebefore returningmock late write failure. In 3/3 runs, bothBEGINandCOMMITwrites returned nil, and the no-result release callback was the only observer of the failure.Post-fix exhaustive verification on
main@84f0d1116:go build -mod=readonly ./pkg/frontendgo vet -mod=readonly ./pkg/frontend-count=3(9 exact tests).agents/skills/mo-dev/scripts/mo-cgo-test -count=1 -timeout=20m ./pkg/frontend(PASS, 24.471s)T=0sto0.04s; withB=30s, the adaptive rule selectedN=100for every test.-race -count=100..agents/skills/mo-dev/scripts/mo-cgo-test -race -count=1 -timeout=20m ./pkg/frontend(PASS, 37.818s)git diff --check origin/main...HEADRebase verification on
main@0b8b53dff:-count=3(8 exact tests).agents/skills/mo-dev/scripts/mo-cgo-test ./pkg/frontend -count=1(PASS, 33.817s)go build -mod=readonly ./pkg/frontendgo vet -mod=readonly ./pkg/frontendgit diff --check origin/main...HEADgit range-diffconfirmed the rebase preserved the patch exactly.BVT is not appropriate for this regression because the required boundary is a deterministic post-consumption
FileService.WriteorMutator.Closefault, which the SQL BVT harness cannot inject. The package-level tests cover both file-service implementations and the SQL result-row boundary directly.CI follow-up
Two attempt-1 Ubuntu/x86 UT failures were proven unrelated to this PR; in both jobs,
pkg/frontendpassed and the failures were in packages outside this two-file diff. The first failure exposed ISCP, embedded-cluster heartbeat, and lockservice signatures: the previously unreported ISCP cases were filed as #26517, while existing #26374 and #26441 / #26448 cover the other signatures. After rebasing, a second failure exposed current-main embedded-cluster heartbeat/reset cases and was filed as #26522. Per CI policy, the failed jobs for the current-head workflow were rerun exactly once; attempt 2 passed.Residual risks
No known correctness gap remains in final write/close error propagation. Partial-output deletion retains the existing best-effort cleanup contract: this change guarantees cleanup is invoked after writer termination, but a backend
Deletefailure remains secondary to the original output failure and is not returned separately.