Skip to content

SeaweedFS is a distributed storage system for object storage (S3), file systems, Iceberg table buckets, and Lance vector buckets, designed to handle billions of files with O(1) disk access and effortless horizontal scaling.

weed volume: only store compressed data if compression is effective

Chris Lu94302935b2d2
diff --git a/weed/storage/needle_parse_multipart.go b/weed/storage/needle_parse_multipart.go
index e8d57ee38a..3dba81fcff 100644
--- a/weed/storage/needle_parse_multipart.go
+++ b/weed/storage/needle_parse_multipart.go
@@ -88,10 +88,12 @@ func parseMultipart(r *http.Request) (
}
isGzipped = true
} else if operation.IsGzippable(ext, mtype, data) {
- if data, e = operation.GzipData(data); e != nil {
- return
+ if compressedData, err := operation.GzipData(data); err == nil {
+ if len(data) > len(compressedData) {
+ data = compressedData
+ isGzipped = true
+ }
}
- isGzipped = true
}
}