feat(compression): allow configuring the Kopia compression policy - #189
Open
gabriele-wolfox wants to merge 1 commit into
Open
feat(compression): allow configuring the Kopia compression policy#189gabriele-wolfox wants to merge 1 commit into
gabriele-wolfox wants to merge 1 commit into
Conversation
Kopia repositories were created without a compression policy, so base backup data was stored uncompressed. Allow users to configure a compression policy repository-wide on the Server (applied to the global Kopia policy at server start) and per-cluster on the PluginConfiguration (applied to the cluster's own source, overriding the global policy). Both tier1 and tier2 are covered: tier1 is set through the Kopia server during the backup, while tier2 travels over gRPC and is applied by the backup consumer before the relay. The policy exposes the compression algorithm plus the optional minSize and maxSize bounds (in bytes) that restrict which files are compressed. Kopia's only-compress and never-compress extension lists are left out on purpose: they select files by extension, which does not fit a PostgreSQL data directory (relation files are numeric and carry no meaningful extension), and WAL files are compressed on a separate path regardless. Closes #126 Assisted-by: Claude Signed-off-by: Gabriele Quaresima <gabriele.quaresima@enterprisedb.com>
gabriele-wolfox
force-pushed
the
dev/126
branch
from
August 27, 2026 15:00
af52daa to
5f9adbe
Compare
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.
What
Kopia repositories were created without a compression policy, so base backup
data was stored uncompressed. This lets users configure Kopia compression for
base backups, both globally and per cluster.
Configuration
Compression can be set at two levels, following Kopia's policy inheritance
(a per-cluster policy overrides the global one for that cluster's source):
Server, underspec.tier1.compressionand
spec.tier2.compression. Applied to Kopia's global policy when theserver starts.
PluginConfiguration, underspec.tier1.compressionand
spec.tier2.compression. Applied to the cluster's own source.Each policy exposes:
algorithm: any Kopia compressor (e.g.zstd,s2-default,gzip) ornoneto disable compression.minSize/maxSize(optional, bytes): restrict compression to files withina size range.
Both tier1 and tier2 are covered. Compression takes effect on the next backup;
existing backups are not recompressed.
Example:
Out of scope
Kopia's
only-compress/never-compressextension lists are not exposed:they select files by extension, which does not fit a PostgreSQL data directory
(relation files are numeric), and WAL files are compressed separately.
Testing
A new e2e (
compression_test.go) sets a global policy on theServerand adifferent per-cluster policy on the
PluginConfiguration, runs a backup, andasserts via
kopia policy showthat both the--globalanduser@hostpolicies carry the expected algorithm and
minSizeon tier1 and tier2. Docs,CRDs, Helm chart, and generated API reference are updated.
Closes #126
Assisted-by: Claude