Repository navigation
test(fileservice): release disk cache read vector - #27830
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? |
d8817a4 to
f1dcd3c
Compare
XuPeng-SH
left a comment
There was a problem hiding this comment.
Reviewed exact head 17dd11d411d4f447ce0f15071bf216c438403963. Q1 is now closed: the test registers the caller-owned IOVector.Release immediately after vector construction, so successful allocator-backed reads are released, while failed reads remain safe because prepareData clears its release callback after its error cleanup. There is one effective release on the exercised path, no new wait/growth edge, and the read/reindex/generation oracles are unchanged. Exact-head CI plus the checked-allocator sequence and focused race evidence are sufficient. No production, performance, compatibility, or test-quality blocker found.
Merge Queue Status
This pull request spent 22 minutes 10 seconds in the queue, with no time running CI. Waiting for
All conditions
ReasonPull request #27830 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
|
## 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: Related to matrixorigin#27829 ## What this PR does / why we need it: ### Root cause `DiskCache.Read` successfully reads data into an allocator-backed `IOVector` entry. `IOEntry.prepareData` retains the allocated buffer after a successful read for the caller to own and release; the read path's deferred cleanup only handles errors. `DiskCache.Read` does not own or release the caller's vector. `TestDiskCacheCurrentReaderReindexesUntrackedPath` asserted the read and reindex behavior but never released its vector, so checked-allocator finalization later reported `missing free` in a subsequent test. ### Changes - Register `defer vector.Release()` immediately after constructing the vector in `TestDiskCacheCurrentReaderReindexesUntrackedPath`. - Keep the existing read, reindex, file-presence, and generation-cleanup assertions unchanged. - No production code, allocator behavior, or public/database behavior changes. The cleanup is registered before the read, so it also runs when the read fails or an assertion aborts the test. ### Issue-to-test proof - Before the change, the exact coverage-style command with `MO_MALLOC_DEBUG=1`, running `TestDiskCacheCurrentReaderReindexesUntrackedPath` followed by `TestDiskCacheAsyncSetFileFinalizeErrorIsFailOpenAndObservable`, reproduced the checked-allocator `missing free` panic from `IOEntry.prepareData`. - After the change, the same command passed for 20 repetitions, including the target test and the immediately following test. - The target test remains the focused regression case: it reads through the current disk-cache reader, verifies reindexing of the untracked path, and now proves deterministic release of the returned allocator-backed data. - BVT is not applicable because this is an internal Go resource-lifecycle defect with no SQL, protocol, or user-visible syntax behavior. ### Tests run The focused validation listed below was rerun after rebasing onto `origin/main` at `1a4f656bb2b5b7f2fb1a6d951c4806ce7d124ba5`; the current PR head is `17dd11d411`, the PR diff remains one line, and the rebase had no conflicts. Passed: - `MO_MALLOC_DEBUG=1 .agents/skills/mo-dev/scripts/mo-cgo-test -vet=off -short -tags matrixone_test -covermode=set -count=20 -timeout=120s -run '^(TestDiskCacheCurrentReaderReindexesUntrackedPath|TestDiskCacheAsyncSetFileFinalizeErrorIsFailOpenAndObservable)$' ./pkg/fileservice` - `... -race -count=100 -timeout=240s -run '^TestDiskCacheCurrentReaderReindexesUntrackedPath$' ./pkg/fileservice` - `... -short -tags matrixone_test -count=1 -timeout=600s -json -run '^(TestDiskCache|TestIOEntry)' ./pkg/fileservice` - `go vet -mod=readonly -tags matrixone_test ./pkg/fileservice` - `gofmt -d pkg/fileservice/disk_cache_lifecycle_test.go` - `git diff --check` The exact target selection was also verified with `-list`, and the post-rebase target passed with the repository coverage flags. The full `./pkg/fileservice` package run was attempted. Its only failure was `TestMinioSDK/file_service/basic`, which returned `Access Denied.` from the local MinIO test service; the changed test and the focused DiskCache/IOEntry suite passed. This environment-specific service failure is unrelated to the vector cleanup. ### Residual risks The change is test-only and has no production execution or compatibility risk. The remaining validation limitation is the local MinIO authentication failure described above; the checked-allocator reproduction, focused coverage-style sequence, and race stress are green. Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
## 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: Related to matrixorigin#27829 ## What this PR does / why we need it: ### Root cause `DiskCache.Read` successfully reads data into an allocator-backed `IOVector` entry. `IOEntry.prepareData` retains the allocated buffer after a successful read for the caller to own and release; the read path's deferred cleanup only handles errors. `DiskCache.Read` does not own or release the caller's vector. `TestDiskCacheCurrentReaderReindexesUntrackedPath` asserted the read and reindex behavior but never released its vector, so checked-allocator finalization later reported `missing free` in a subsequent test. ### Changes - Register `defer vector.Release()` immediately after constructing the vector in `TestDiskCacheCurrentReaderReindexesUntrackedPath`. - Keep the existing read, reindex, file-presence, and generation-cleanup assertions unchanged. - No production code, allocator behavior, or public/database behavior changes. The cleanup is registered before the read, so it also runs when the read fails or an assertion aborts the test. ### Issue-to-test proof - Before the change, the exact coverage-style command with `MO_MALLOC_DEBUG=1`, running `TestDiskCacheCurrentReaderReindexesUntrackedPath` followed by `TestDiskCacheAsyncSetFileFinalizeErrorIsFailOpenAndObservable`, reproduced the checked-allocator `missing free` panic from `IOEntry.prepareData`. - After the change, the same command passed for 20 repetitions, including the target test and the immediately following test. - The target test remains the focused regression case: it reads through the current disk-cache reader, verifies reindexing of the untracked path, and now proves deterministic release of the returned allocator-backed data. - BVT is not applicable because this is an internal Go resource-lifecycle defect with no SQL, protocol, or user-visible syntax behavior. ### Tests run The focused validation listed below was rerun after rebasing onto `origin/main` at `1a4f656bb2b5b7f2fb1a6d951c4806ce7d124ba5`; the current PR head is `17dd11d411`, the PR diff remains one line, and the rebase had no conflicts. Passed: - `MO_MALLOC_DEBUG=1 .agents/skills/mo-dev/scripts/mo-cgo-test -vet=off -short -tags matrixone_test -covermode=set -count=20 -timeout=120s -run '^(TestDiskCacheCurrentReaderReindexesUntrackedPath|TestDiskCacheAsyncSetFileFinalizeErrorIsFailOpenAndObservable)$' ./pkg/fileservice` - `... -race -count=100 -timeout=240s -run '^TestDiskCacheCurrentReaderReindexesUntrackedPath$' ./pkg/fileservice` - `... -short -tags matrixone_test -count=1 -timeout=600s -json -run '^(TestDiskCache|TestIOEntry)' ./pkg/fileservice` - `go vet -mod=readonly -tags matrixone_test ./pkg/fileservice` - `gofmt -d pkg/fileservice/disk_cache_lifecycle_test.go` - `git diff --check` The exact target selection was also verified with `-list`, and the post-rebase target passed with the repository coverage flags. The full `./pkg/fileservice` package run was attempted. Its only failure was `TestMinioSDK/file_service/basic`, which returned `Access Denied.` from the local MinIO test service; the changed test and the focused DiskCache/IOEntry suite passed. This environment-specific service failure is unrelated to the vector cleanup. ### Residual risks The change is test-only and has no production execution or compatibility risk. The remaining validation limitation is the local MinIO authentication failure described above; the checked-allocator reproduction, focused coverage-style sequence, and race stress are green. Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
## 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: Related to matrixorigin#27829 ## What this PR does / why we need it: ### Root cause `DiskCache.Read` successfully reads data into an allocator-backed `IOVector` entry. `IOEntry.prepareData` retains the allocated buffer after a successful read for the caller to own and release; the read path's deferred cleanup only handles errors. `DiskCache.Read` does not own or release the caller's vector. `TestDiskCacheCurrentReaderReindexesUntrackedPath` asserted the read and reindex behavior but never released its vector, so checked-allocator finalization later reported `missing free` in a subsequent test. ### Changes - Register `defer vector.Release()` immediately after constructing the vector in `TestDiskCacheCurrentReaderReindexesUntrackedPath`. - Keep the existing read, reindex, file-presence, and generation-cleanup assertions unchanged. - No production code, allocator behavior, or public/database behavior changes. The cleanup is registered before the read, so it also runs when the read fails or an assertion aborts the test. ### Issue-to-test proof - Before the change, the exact coverage-style command with `MO_MALLOC_DEBUG=1`, running `TestDiskCacheCurrentReaderReindexesUntrackedPath` followed by `TestDiskCacheAsyncSetFileFinalizeErrorIsFailOpenAndObservable`, reproduced the checked-allocator `missing free` panic from `IOEntry.prepareData`. - After the change, the same command passed for 20 repetitions, including the target test and the immediately following test. - The target test remains the focused regression case: it reads through the current disk-cache reader, verifies reindexing of the untracked path, and now proves deterministic release of the returned allocator-backed data. - BVT is not applicable because this is an internal Go resource-lifecycle defect with no SQL, protocol, or user-visible syntax behavior. ### Tests run The focused validation listed below was rerun after rebasing onto `origin/main` at `1a4f656bb2b5b7f2fb1a6d951c4806ce7d124ba5`; the current PR head is `17dd11d411`, the PR diff remains one line, and the rebase had no conflicts. Passed: - `MO_MALLOC_DEBUG=1 .agents/skills/mo-dev/scripts/mo-cgo-test -vet=off -short -tags matrixone_test -covermode=set -count=20 -timeout=120s -run '^(TestDiskCacheCurrentReaderReindexesUntrackedPath|TestDiskCacheAsyncSetFileFinalizeErrorIsFailOpenAndObservable)$' ./pkg/fileservice` - `... -race -count=100 -timeout=240s -run '^TestDiskCacheCurrentReaderReindexesUntrackedPath$' ./pkg/fileservice` - `... -short -tags matrixone_test -count=1 -timeout=600s -json -run '^(TestDiskCache|TestIOEntry)' ./pkg/fileservice` - `go vet -mod=readonly -tags matrixone_test ./pkg/fileservice` - `gofmt -d pkg/fileservice/disk_cache_lifecycle_test.go` - `git diff --check` The exact target selection was also verified with `-list`, and the post-rebase target passed with the repository coverage flags. The full `./pkg/fileservice` package run was attempted. Its only failure was `TestMinioSDK/file_service/basic`, which returned `Access Denied.` from the local MinIO test service; the changed test and the focused DiskCache/IOEntry suite passed. This environment-specific service failure is unrelated to the vector cleanup. ### Residual risks The change is test-only and has no production execution or compatibility risk. The remaining validation limitation is the local MinIO authentication failure described above; the checked-allocator reproduction, focused coverage-style sequence, and race stress are green. Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
What type of PR is this?
Which issue(s) this PR fixes:
Related to #27829
What this PR does / why we need it:
Root cause
DiskCache.Readsuccessfully reads data into an allocator-backedIOVectorentry.IOEntry.prepareDataretains the allocated buffer after a successful read for the caller to own and release; the read path's deferred cleanup only handles errors.DiskCache.Readdoes not own or release the caller's vector.TestDiskCacheCurrentReaderReindexesUntrackedPathasserted the read and reindex behavior but never released its vector, so checked-allocator finalization later reportedmissing freein a subsequent test.Changes
defer vector.Release()immediately after constructing the vector inTestDiskCacheCurrentReaderReindexesUntrackedPath.The cleanup is registered before the read, so it also runs when the read fails or an assertion aborts the test.
Issue-to-test proof
MO_MALLOC_DEBUG=1, runningTestDiskCacheCurrentReaderReindexesUntrackedPathfollowed byTestDiskCacheAsyncSetFileFinalizeErrorIsFailOpenAndObservable, reproduced the checked-allocatormissing freepanic fromIOEntry.prepareData.Tests run
The focused validation listed below was rerun after rebasing onto
origin/mainat1a4f656bb2b5b7f2fb1a6d951c4806ce7d124ba5; the current PR head is17dd11d411, the PR diff remains one line, and the rebase had no conflicts.Passed:
MO_MALLOC_DEBUG=1 .agents/skills/mo-dev/scripts/mo-cgo-test -vet=off -short -tags matrixone_test -covermode=set -count=20 -timeout=120s -run '^(TestDiskCacheCurrentReaderReindexesUntrackedPath|TestDiskCacheAsyncSetFileFinalizeErrorIsFailOpenAndObservable)$' ./pkg/fileservice... -race -count=100 -timeout=240s -run '^TestDiskCacheCurrentReaderReindexesUntrackedPath$' ./pkg/fileservice... -short -tags matrixone_test -count=1 -timeout=600s -json -run '^(TestDiskCache|TestIOEntry)' ./pkg/fileservicego vet -mod=readonly -tags matrixone_test ./pkg/fileservicegofmt -d pkg/fileservice/disk_cache_lifecycle_test.gogit diff --checkThe exact target selection was also verified with
-list, and the post-rebase target passed with the repository coverage flags.The full
./pkg/fileservicepackage run was attempted. Its only failure wasTestMinioSDK/file_service/basic, which returnedAccess Denied.from the local MinIO test service; the changed test and the focused DiskCache/IOEntry suite passed. This environment-specific service failure is unrelated to the vector cleanup.Residual risks
The change is test-only and has no production execution or compatibility risk. The remaining validation limitation is the local MinIO authentication failure described above; the checked-allocator reproduction, focused coverage-style sequence, and race stress are green.