fix: ListObjects should return NoSuchBucket for prefix on missing bucket#37
fix: ListObjects should return NoSuchBucket for prefix on missing bucket#37ycjlin wants to merge 1 commit into
Conversation
ListObjects on a non-existent bucket returned an empty result instead of NoSuchBucket whenever the request hit one of listPath's storage-bypassing shortcuts - most visibly a slash-only prefix such as Prefix="/". AWS S3 returns NoSuchBucket regardless of the prefix/marker/max-keys supplied. This regressed in 80ca120 ("remove checkBucketExist check entirely to avoid fan-out calls"), which dropped the bucket existence check from checkListObjsArgs. The normal listing path still surfaces a missing bucket via the per-set listing (errVolumeNotFound), but the early-return shortcuts in listPath (slash-only prefix, zero limit, marker outside the prefix) return io.EOF before any set is consulted, masking the missing bucket as an empty listing. Verify bucket existence (via the existing GetBucketInfo, matching the pattern already used by ListMultipartUploads) only on those shortcut paths, so the hot listing path keeps avoiding the fan-out. Fixes pgsty#32 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
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:
|
Community Contribution License
All community contributions in this pull request are licensed to the project maintainers
under the terms of the Apache 2 license.
By creating this pull request I represent that I have the right to license the
contributions to the project maintainers under the Apache 2 license.
Description
ListObjects on a non-existent bucket returned an empty result instead of NoSuchBucket whenever the request hit one of listPath's storage-bypassing shortcuts - most visibly a slash-only prefix such as Prefix="/". AWS S3 returns NoSuchBucket regardless of the prefix/marker/max-keys supplied.
This regressed in 80ca120 ("remove checkBucketExist check entirely to avoid fan-out calls"), which dropped the bucket existence check from checkListObjsArgs. The normal listing path still surfaces a missing bucket via the per-set listing (errVolumeNotFound), but the early-return shortcuts in listPath (slash-only prefix, zero limit, marker outside the prefix) return io.EOF before any set is consulted, masking the missing bucket as an empty listing.
Verify bucket existence (via the existing GetBucketInfo, matching the pattern already used by ListMultipartUploads) only on those shortcut paths, so the hot listing path keeps avoiding the fan-out.
Motivation and Context
Fixes #32
How to test this PR?
Just run the tests
Types of changes
Checklist: