fix: ListObjects should return NoSuchBucket for prefix on missing bucket - #37
Conversation
|
Thanks for the PR. I looked into the history behind this behavior. The relevant upstream change is Because of that, I am concerned about reintroducing bucket existence checks too broadly. Moving the check back into the generic ListObjects argument path would effectively undo the upstream optimization and could bring back the same scalability issue. This PR is much narrower than a full revert, but it is still a user-visible behavior change: some ListObjects calls against a non-existent bucket would change from an empty result to |
|
I understand your concern but:
|
|
Thanks for the fix and the accompanying test. Review is queued right after the RELEASE.2026-08-06 cut: server-visible behavior was deliberately frozen while that release went through acceptance, and this touches the metacache listing path, which deserves an unhurried review rather than a release-eve merge. Follow-up here shortly. |
ListObjects shortcuts can return EOF before consulting storage, causing missing buckets to appear as empty listings. Verify bucket existence only on those shortcuts so the normal listing path retains the upstream fan-out optimization. Cover ListObjects, ListObjectsV2, and ListObjectVersions at the object layer and verify HTTP 404 NoSuchBucket responses. Fixes pgsty#32 Co-authored-by: Jason Lin <jason@JasondeMacBook-Air.local> Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Signed-off-by: Feng Ruohang <rh@vonng.com>
f96e477 to
e9c5340
Compare
Vonng
left a comment
There was a problem hiding this comment.
Approved on exact head e9c5340 after local implementation review, independent Claude Fable Max adversarial review, and green DCO, VulnCheck, and all six Go CI jobs. The compatibility fix is intentionally limited to the three storage-bypassing list shortcuts; the normal listing hot path remains unchanged. The cluster-wide GetBucketInfo cost on shortcut traffic is documented and accepted.
Contribution licensing
This maintainer-submitted revision is licensed inbound=outbound under the repository AGPL-3.0-or-later terms and carries a matching DCO sign-off. It preserves Jason Lin as a co-author of the original contribution.
Problem
ListObjectson a missing bucket can return an empty 200 instead ofNoSuchBucketwhenlistPathexits before consulting storage. The affected shortcuts are:/;max-keys=0;The regression came from upstream
80ca12008/ minio#18917, which removed generic bucket-existence checks to avoid cluster-wideGetBucketInfofan-out. Normal listing still discovers a missing bucket through storage, but these shortcuts never reach that path.Fixes #32.
Implementation
Verify bucket existence only immediately before the three storage-bypassing EOF returns. An existing bucket keeps the original empty-list result; a missing bucket reaches the existing 404
NoSuchBucketmapping. The normal listing hot path remains unchanged.This deliberately does not restore the generic existence check or add a cache.
GetBucketInfofans out to peers and disks, so only shortcut traffic pays that cost.Tests
The updated revision covers
ListObjects,ListObjectsV2, andListObjectVersionsfor:HTTP tests verify signed V1, V2, and version-list requests return status 404 with XML code
NoSuchBucket.Local verification on exact head
e9c5340be:go test ./cmd -count=1;CGO_ENABLED=0 go build ./...;go vet ./...;A separate local Claude Code Fable Max adversarial review returned GO with no mandatory pre-merge change.
Compatibility and performance
This restores AWS S3 behavior and the behavior before
80ca12008. Clients that relied on the incorrect empty 200 will now receive 404. Shortcut calls are more expensive because they performGetBucketInfo; normal listings do not. Large-cluster shortcut frequency and tail latency remain post-merge observability items, not reasons to reintroduce a generic check.Checklist
80ca12008)pgsty/silo.pgsty.com