Repository navigation
Description
Summary
buildS3Config feeds the write-buffer compression settings into the S3 object
compression config. They are two unrelated features with different defaults, so every mount
silently compresses S3 objects with gzip level 6 instead of the intended zstd level 3.
Background
internal/adapter/adapter.go buildS3Config:
Compression: s3.CompressionConfig{
Enabled: a.config.WriteBuffer.Compression.Enabled,
Algorithm: a.config.WriteBuffer.Compression.Algorithm,
Level: a.config.WriteBuffer.Compression.Level,
MinSize: a.config.WriteBuffer.Compression.MinSize,
},WriteBuffer.Compression defaults in internal/config/config.go to gzip / level 6 / 1KB —
tuned for buffering writes in memory. s3.NewDefaultConfig intends something quite
different for objects at rest:
Compression: CompressionConfig{
Enabled: true,
Algorithm: "zstd",
Level: 3, // fast level with good ratio (~60% savings for text/JSON)
MinSize: "4KB", // skip compression for tiny objects
},Consequences: objects are stored gzip instead of zstd, at a slower level with a worse ratio,
and the 1KB floor means tiny objects get compressed when the S3 path deliberately skips
them. Changing write-buffer tuning also silently changes the on-disk format of stored
objects, which is not a relationship anyone would expect.
Implementation
Add a dedicated Storage.S3.Compression section to internal/config/config.go, defaulting
to zstd / 3 / 4KB to match s3.NewDefaultConfig. Map that through buildS3Config and leave
WriteBuffer.Compression untouched for its own purpose.
Document the split in configs/example.yaml so the two sections are visibly distinct.
Worth calling out in the changelog: mounts that relied on the accidental gzip behavior will
begin writing zstd. Reads are unaffected — GetObject dispatches on the stored
Content-Encoding per object, so existing gzip objects continue to decompress correctly.
There is no migration.
Acceptance Criteria
-
Storage.S3.Compressionexists and defaults to zstd / level 3 / 4KB -
buildS3Config()yields zstd/3/4KB, not gzip/6/1KB - Changing
WriteBuffer.Compressionno longer affects the S3 object compression config - Previously-written gzip objects still read back correctly
-
configs/example.yamldocuments both sections and the difference between them -
go test -race ./internal/adapter/... ./internal/config/...passes
Dependencies
None. Should land together with the parallel-read plumbing issue — both rewrite
buildS3Config.
Activity