Repository navigation
fix(fileservice): preserve errors and cache merge ordering - #25659
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? |
XuPeng-SH
left a comment
There was a problem hiding this comment.
The production fixes look sound, but the S3 merger regression test does not make the old ordering race deterministic as claimed. The waiter handshake only proves that the second read has entered ioMerger.Merge; after done() closes the channel, the waiter is merely runnable, and the leader can still execute the cache-update defers before the scheduler runs it. I kept the new test unchanged, reverted only finishMerge back to the old defer done(), and the test still passed 100/100 times with GOMAXPROCS=1 and 100/100 times with GOMAXPROCS=8. Therefore this test is green on the buggy ordering and does not protect the fix. Please add a controlled barrier/hook around cache update versus merger completion (or an equivalent deterministic mechanism), and verify that the test is reliably red with the old ordering and green with the new ordering. The disk-object and LocalFS error-path changes and tests otherwise look good.
XuPeng-SH
left a comment
There was a problem hiding this comment.
Approved. The previous review blocker is resolved.
The rewritten S3 merger regression is now deterministic: on the current head it passed 20/20 under the race detector; after temporarily restoring only the old defer done() ordering, it failed 20/20 at the IsMerging assertion while the cache update was blocked. Restoring the PR implementation returned it to green. The production defer order keeps the merge active through synchronous cache updates and releases waiters on every return/error path.
The LocalFS non-ENOENT handling is correct. Disk-object writes now close and remove the temp file across copy, size, sync, close, mkdir, and rename failures while preserving cleanup errors; Delete remains idempotent for missing keys and aggregates real removal failures.
Verified locally: full pkg/fileservice tests, targeted race tests with -count=20, go build, go vet, and git diff --check. All GitHub CI checks are green.
Merge Queue Status
This pull request spent 7 minutes 38 seconds in the queue, with no time running CI. ReasonThe pull request can't be updated
HintYou should update or rebase your pull request manually. If you do, this pull request will automatically be requeued once the queue conditions match again. Tick the box to put this pull request back in the merge queue (same as
|
…gin#25659) ## 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: issue matrixorigin#25550 issue matrixorigin#25602 issue matrixorigin#25603 ## What this PR does / why we need it: This change closes three related fileservice error-path gaps: - delay the S3 I/O-merger completion signal until deferred cache updates finish, so waiters observe the leader's cached data instead of issuing duplicate object reads; - return non-`ENOENT` errors from `LocalFS.StatFile` instead of dereferencing a nil `FileInfo` after `os.Stat` fails; - close and remove `.mofstemp` files on every failed disk-object write, propagate cleanup failures, and report real delete failures while keeping missing-object deletes idempotent. The merger regression test now uses a blocked leader and an observed waiter handshake, making the original ordering race deterministic. Disk and local filesystem tests cover copy failure, size mismatch, delete failure, and `ENOTDIR`. Tested with: `go test -count=1 ./pkg/fileservice` `go test -race -count=20 ./pkg/fileservice -run '^(TestLocalFSStatFileReturnsNonNotExistError|TestDiskObjectStorageWriteFailureRemovesTempFile|TestDiskObjectStorageSizeMismatchRemovesTempFile|TestDiskObjectStorageDeleteReturnsRemovalError|TestS3FSIOMerger)$'` `go vet ./pkg/fileservice` --------- Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
…gin#25659) ## 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: issue matrixorigin#25550 issue matrixorigin#25602 issue matrixorigin#25603 ## What this PR does / why we need it: This change closes three related fileservice error-path gaps: - delay the S3 I/O-merger completion signal until deferred cache updates finish, so waiters observe the leader's cached data instead of issuing duplicate object reads; - return non-`ENOENT` errors from `LocalFS.StatFile` instead of dereferencing a nil `FileInfo` after `os.Stat` fails; - close and remove `.mofstemp` files on every failed disk-object write, propagate cleanup failures, and report real delete failures while keeping missing-object deletes idempotent. The merger regression test now uses a blocked leader and an observed waiter handshake, making the original ordering race deterministic. Disk and local filesystem tests cover copy failure, size mismatch, delete failure, and `ENOTDIR`. Tested with: `go test -count=1 ./pkg/fileservice` `go test -race -count=20 ./pkg/fileservice -run '^(TestLocalFSStatFileReturnsNonNotExistError|TestDiskObjectStorageWriteFailureRemovesTempFile|TestDiskObjectStorageSizeMismatchRemovesTempFile|TestDiskObjectStorageDeleteReturnsRemovalError|TestS3FSIOMerger)$'` `go vet ./pkg/fileservice` --------- Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
…gin#25659) ## 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: issue matrixorigin#25550 issue matrixorigin#25602 issue matrixorigin#25603 ## What this PR does / why we need it: This change closes three related fileservice error-path gaps: - delay the S3 I/O-merger completion signal until deferred cache updates finish, so waiters observe the leader's cached data instead of issuing duplicate object reads; - return non-`ENOENT` errors from `LocalFS.StatFile` instead of dereferencing a nil `FileInfo` after `os.Stat` fails; - close and remove `.mofstemp` files on every failed disk-object write, propagate cleanup failures, and report real delete failures while keeping missing-object deletes idempotent. The merger regression test now uses a blocked leader and an observed waiter handshake, making the original ordering race deterministic. Disk and local filesystem tests cover copy failure, size mismatch, delete failure, and `ENOTDIR`. Tested with: `go test -count=1 ./pkg/fileservice` `go test -race -count=20 ./pkg/fileservice -run '^(TestLocalFSStatFileReturnsNonNotExistError|TestDiskObjectStorageWriteFailureRemovesTempFile|TestDiskObjectStorageSizeMismatchRemovesTempFile|TestDiskObjectStorageDeleteReturnsRemovalError|TestS3FSIOMerger)$'` `go vet ./pkg/fileservice` --------- Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
What type of PR is this?
Which issue(s) this PR fixes:
issue #25550
issue #25602
issue #25603
What this PR does / why we need it:
This change closes three related fileservice error-path gaps:
ENOENTerrors fromLocalFS.StatFileinstead of dereferencing a nilFileInfoafteros.Statfails;.mofstempfiles on every failed disk-object write, propagate cleanup failures, and report real delete failures while keeping missing-object deletes idempotent.The merger regression test now uses a blocked leader and an observed waiter handshake, making the original ordering race deterministic. Disk and local filesystem tests cover copy failure, size mismatch, delete failure, and
ENOTDIR.Tested with:
go test -count=1 ./pkg/fileservicego test -race -count=20 ./pkg/fileservice -run '^(TestLocalFSStatFileReturnsNonNotExistError|TestDiskObjectStorageWriteFailureRemovesTempFile|TestDiskObjectStorageSizeMismatchRemovesTempFile|TestDiskObjectStorageDeleteReturnsRemovalError|TestS3FSIOMerger)$'go vet ./pkg/fileservice