Skip to content

test(fileservice): release disk cache read vector - #27830

Merged
XuPeng-SH merged 2 commits into
matrixorigin:mainfrom
gouhongshen:agent/issue-27829-dff4d20c
Aug 29, 2026
Merged

XuPeng-SH merged 2 commits into
matrixorigin:mainfrom
gouhongshen:agent/issue-27829-dff4d20c

Conversation

@gouhongshen

@gouhongshen gouhongshen commented Aug 29, 2026 •

Copy link
Copy Markdown
Contributor

What type of PR is this?

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

Which issue(s) this PR fixes:

Related to #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.

@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

Choose a reason for hiding this comment

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

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.

@mergify mergify Bot added the queued label Aug 29, 2026
@mergify

mergify Bot commented Aug 29, 2026 •

Copy link
Copy Markdown
Contributor

Merge Queue Status

  • ✅ Entered queue — 2026-08-29 07:20 UTC · Rule: main · triggered by rule Automatic queue on approval for main
  • 🟠 Checks running · in-place
  • 🚫 Left the queue — 2026-08-29 07:42 UTC · at 4468f0bafa7180c77702d518f0a16d607e244438

This pull request spent 22 minutes 10 seconds in the queue, with no time running CI.

Waiting for
  • any of: [🛡 GitHub branch protection]
    • check-neutral = Matrixone CI / UT Test on Ubuntu/x86
    • check-skipped = Matrixone CI / UT Test on Ubuntu/x86
    • check-success = Matrixone CI / UT Test on Ubuntu/x86
  • any of: [🛡 GitHub branch protection]
    • check-neutral = Matrixone CI / SCA Test on Linux/arm64
    • check-skipped = Matrixone CI / SCA Test on Linux/arm64
    • check-success = Matrixone CI / SCA Test on Linux/arm64
  • any of: [🛡 GitHub branch protection]
    • check-neutral = Matrixone Compose CI / multi cn e2e bvt test docker compose(PROXY)
    • check-skipped = Matrixone Compose CI / multi cn e2e bvt test docker compose(PROXY)
    • check-success = Matrixone Compose CI / multi cn e2e bvt test docker compose(PROXY)
  • any of: [🛡 GitHub branch protection]
    • check-neutral = Matrixone Utils CI / Coverage
    • check-skipped = Matrixone Utils CI / Coverage
    • check-success = Matrixone Utils CI / Coverage
  • any of: [🛡 GitHub branch protection]
    • check-neutral = Matrixone UT Coverage / UT Coverage on Ubuntu/x86
    • check-skipped = Matrixone UT Coverage / UT Coverage on Ubuntu/x86
    • check-success = Matrixone UT Coverage / UT Coverage on Ubuntu/x86
  • any of: [🛡 GitHub branch protection]
    • check-neutral = Matrixone Standlone CI / multi CN e2e BVT Test on Linux/x64(COMPOSE, PESSIMISTIC)
    • check-skipped = Matrixone Standlone CI / multi CN e2e BVT Test on Linux/x64(COMPOSE, PESSIMISTIC)
    • check-success = Matrixone Standlone CI / multi CN e2e BVT Test on Linux/x64(COMPOSE, PESSIMISTIC)
All conditions
  • any of [🛡 GitHub branch protection]:
    • check-neutral = Matrixone CI / UT Test on Ubuntu/x86
    • check-skipped = Matrixone CI / UT Test on Ubuntu/x86
    • check-success = Matrixone CI / UT Test on Ubuntu/x86
  • any of [🛡 GitHub branch protection]:
    • check-neutral = Matrixone CI / SCA Test on Linux/arm64
    • check-skipped = Matrixone CI / SCA Test on Linux/arm64
    • check-success = Matrixone CI / SCA Test on Linux/arm64
  • any of [🛡 GitHub branch protection]:
    • check-neutral = Matrixone Compose CI / multi cn e2e bvt test docker compose(PROXY)
    • check-skipped = Matrixone Compose CI / multi cn e2e bvt test docker compose(PROXY)
    • check-success = Matrixone Compose CI / multi cn e2e bvt test docker compose(PROXY)
  • any of [🛡 GitHub branch protection]:
    • check-neutral = Matrixone Utils CI / Coverage
    • check-skipped = Matrixone Utils CI / Coverage
    • check-success = Matrixone Utils CI / Coverage
  • any of [🛡 GitHub branch protection]:
    • check-neutral = Matrixone UT Coverage / UT Coverage on Ubuntu/x86
    • check-skipped = Matrixone UT Coverage / UT Coverage on Ubuntu/x86
    • check-success = Matrixone UT Coverage / UT Coverage on Ubuntu/x86
  • any of [🛡 GitHub branch protection]:
    • check-neutral = Matrixone Standlone CI / multi CN e2e BVT Test on Linux/x64(COMPOSE, PESSIMISTIC)
    • check-skipped = Matrixone Standlone CI / multi CN e2e BVT Test on Linux/x64(COMPOSE, PESSIMISTIC)
    • check-success = Matrixone Standlone CI / multi CN e2e BVT Test on Linux/x64(COMPOSE, PESSIMISTIC)
  • #review-threads-unresolved = 0 [🛡 GitHub branch protection]
  • github-review-approved [🛡 GitHub branch protection]

Reason

Pull 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.

The author needs to enable "Allow edits from maintainers" on this pull request.

Failing checks:

Hint

You 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.
If you do update this pull request, it will automatically be requeued once the queue conditions match again.
If you think this was a flaky issue instead, you can requeue the pull request, without updating it, by posting a @mergifyio queue comment.

Tick the box to put this pull request back in the merge queue (same as @mergifyio queue).

  • Requeue this pull request

@XuPeng-SH
XuPeng-SH merged commit 88be4ef into matrixorigin:main Aug 29, 2026
24 of 25 checks passed
@mergify mergify Bot added dequeued and removed queued labels Aug 29, 2026
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:

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>
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:

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>
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:

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>

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/test-ci size/XS Denotes a PR that changes [1, 9] lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants