Repository navigation
fix: a tier's billing minimum is not a reason to refuse a write - #242
Merged
Merged
Conversation
A mount on STANDARD_IA, ONEZONE_IA, or GLACIER_IR could not create anything. mkdir failed, touch failed, and so did writing any file under 128 KiB. AWS's per-tier minimum object size is a billing floor: S3 stores a zero-byte STANDARD_IA object and bills it as 128 KiB. TierValidator.ValidateWrite enforced it as an API restriction, and PutObject calls it before anything else. Both ways this filesystem brings a name into existence land under the floor — Mkdir writes a zero-byte marker so an empty directory is distinguishable from a prefix that never existed, and Create plus a small write flushes a small object. The three tiers the cost documentation recommends were the three a filesystem could not be used on. It warns now, carrying the size written and the size billed, which is the actionable fact: a tier that bills every object as 128 KiB costs more than STANDARD for a workload of small files, and nothing downstream would say so. tier_constraints.min_object_size still refuses. An operator who sets it has asked for a floor that is not AWS's, and a policy someone chose is the only kind worth enforcing. The sharp edge that leaves — setting it to the tier's own published number reinstates the old gate exactly, zero-byte markers included — is tested rather than left to be rediscovered. Pinned at both layers, because the gate is enforced two below the operation that trips it. The validator's tests assert the zero-byte write is accepted and that the warning names both sizes; a test in internal/fuse drives real Mkdir and Create against a real endpoint on every tier with a minimum, read from StorageTiers so a class that gains one later is covered without an edit. Only that second layer establishes that a mkdir is a zero-byte PUT, which is the step that turned a billing hint into an unusable mount. Both verified by mutation: restoring the hard gate fails 12 assertions at the validator and every mkdir at the mount; removing the warning while keeping the accept fails 12. Also records, where adapter.go explains why TierConstraints is left unmapped, that MinObjectSize is now the one field in it that can refuse a write — so if it is ever mapped from config it has to stay unset by default. Closes #154
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #154.
A mount on
STANDARD_IA,ONEZONE_IA, orGLACIER_IRcould not create anything:mkdirfailed,touchfailed, and so did writing any file under 128 KiB.AWS's per-tier minimum object size is a billing floor — S3 stores a zero-byte
STANDARD_IAobject and bills it as 128 KiB.TierValidator.ValidateWriteenforced it as an API restriction, andPutObjectcalls it before anything else. Both of the ways this filesystem brings a name into existence go under that floor:Mkdirwrites a zero-byte marker object so an empty directory is distinguishable from a prefix that never existed, and aCreateplus a small write flushes a small object. So the three tiers most of the cost documentation recommends were the three a filesystem could not be used on, and an IA-tier integration test could not get past its own setup.What changed
STANDARDfor a workload of small files, and nothing downstream would have mentioned it.tier_constraints.min_object_sizestill refuses. An operator who sets it has asked for a floor that is not AWS's; a policy someone chose is the only kind worth enforcing. The refusal message says whose rule it is, so it does not send the reader to the AWS docs to find that S3 accepts the write.adapter.go's note on whyTierConstraintsis deliberately unmapped now records thatMinObjectSizeis the one field in it that can refuse a write, so if it is ever mapped it has to stay unset by default.ValidateSize, which the issue also names, does not exist. The other caller isBackend.ValidateObjectForTier, which delegates straight toValidateWriteand is therefore consistent by construction.Tests
Pinned at both layers, because the gate is enforced two below the operation that trips it:
internal/storage/s3/tier_min_size_test.go— a zero-byte write is accepted on every tier with a minimum, and the warning carries the written size, the billed size, the tier, and the key. A test that only checkserr == nilcannot tell "warned about the billing" from "said nothing", and saying nothing is the failure mode that matters: the write succeeds either way and the operator finds out from an invoice.internal/fuse/tier_min_size_test.go— realMkdirandCreatecalls through a go-fuse bridge against a real substrate endpoint, on every tier with a minimum, read fromStorageTiersso a class that gains one later is covered without editing the test. Only this layer establishes that amkdiris a zero-byte PUT, which is the step that turned a billing hint into an unusable mount.tier_test.go's "Standard-IA should reject objects smaller than 128KB" assertion is reversed, with the reason in place.Writing this surfaced a related property worth recording in the test:
touch falone cannot exercise a write gate at all. A file created and never written flushes throughFlusher.attemptAttrOnly, which finds no object to carry the metadata and deliberately stores nothing — so the FUSE-level test writes 9 bytes, and says why.Verified by mutation
Local checks
go build ./...,go vet ./...cleango test -race ./internal/... ./pkg/...— all passgolangci-lint run --new-from-merge-base=origin/main— 0 issuesinternal/storage/s382.4% (floor 81),internal/fuse66.2% (floor 59)