Skip to content

Commit

Permalink
Set zstd-fastest as a default metadata compressor
Browse files Browse the repository at this point in the history
Signed-off-by: Prasad Ghangal <[email protected]>
  • Loading branch information
PrasadG193 committed Jul 23, 2024
1 parent 0aff735 commit 502ac87
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 10 deletions.
5 changes: 4 additions & 1 deletion repo/content/content_manager_lock_free.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,10 @@ func (sm *SharedManager) maybeCompressAndEncryptDataForPacking(data gather.Bytes

// If the content is prefixed (which represents Kopia's own metadata as opposed to user data),
// and we're on V2 format or greater, enable internal compression even when not requested.
if contentID.HasPrefix() && comp == NoCompression && mp.IndexVersion >= index.Version2 {
// TODO(prasad): Get rid of complete block once metadata compression setting is implemented for
// all the prefixes
// For now, exclude this for `k` prefixed metadata.
if contentID.HasPrefix() && contentID.Prefix() != "k" && comp == NoCompression && mp.IndexVersion >= index.Version2 {
// 'zstd-fastest' has a good mix of being fast, low memory usage and high compression for JSON.
comp = compression.HeaderZstdFastest
}
Expand Down
22 changes: 13 additions & 9 deletions snapshot/policy/policy_tree.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ var (
defaultCompressionPolicy = CompressionPolicy{
CompressorName: "none",
}
defaultMetadataCompressionPolicy = MetadataCompressionPolicy{
CompressorName: "zstd-fastest",
}

defaultSplitterPolicy = SplitterPolicy{}

Expand Down Expand Up @@ -71,15 +74,16 @@ var (

// DefaultPolicy is a default policy returned by policy tree in absence of other policies.
DefaultPolicy = &Policy{
FilesPolicy: defaultFilesPolicy,
RetentionPolicy: defaultRetentionPolicy,
CompressionPolicy: defaultCompressionPolicy,
ErrorHandlingPolicy: defaultErrorHandlingPolicy,
SchedulingPolicy: defaultSchedulingPolicy,
LoggingPolicy: defaultLoggingPolicy,
Actions: defaultActionsPolicy,
OSSnapshotPolicy: defaultOSSnapshotPolicy,
UploadPolicy: defaultUploadPolicy,
FilesPolicy: defaultFilesPolicy,
RetentionPolicy: defaultRetentionPolicy,
CompressionPolicy: defaultCompressionPolicy,
MetadataCompressionPolicy: defaultMetadataCompressionPolicy,
ErrorHandlingPolicy: defaultErrorHandlingPolicy,
SchedulingPolicy: defaultSchedulingPolicy,
LoggingPolicy: defaultLoggingPolicy,
Actions: defaultActionsPolicy,
OSSnapshotPolicy: defaultOSSnapshotPolicy,
UploadPolicy: defaultUploadPolicy,
}

// DefaultDefinition provides the Definition for the default policy.
Expand Down

0 comments on commit 502ac87

Please sign in to comment.