feat(backup): 新增 zstd 压缩选项#89
Merged
Merged
Conversation
备份压缩在 gzip 之外新增 zstd:相近 CPU 开销下提供更高压缩率与显著更快的解压, 适合大体量备份的存储与恢复提速。 - pkg/compress:ZstdFile / UnzstdFile(基于已有依赖 klauspost/compress,往返单测) - Master 与 Agent 的压缩/解压路径均按后缀(.gz/.zst)分流,集群一致 - 任务校验放行 compression=zstd;前端压缩策略下拉与标签新增 Zstd go test ./... 全绿;tsc --noEmit 通过。
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.
背景
此前备份压缩仅有 gzip。zstd 在相近 CPU 开销下提供更高压缩率与显著更快的解压,是现代备份工具的标配压缩算法——对大体量备份意味着更省存储、更快恢复。
实现
pkg/compress:新增ZstdFile/UnzstdFile,复用项目已有依赖github.com/klauspost/compress(纯 Go,原为间接依赖,现提升为直接依赖),含往返单测。backup_execution_service压缩、execution_helpers解压)与 Agent(executor压缩与恢复解压)均按文件后缀(.gz/.zst)分流,集群与单机行为一致。compression放行zstd(原gzip none→gzip zstd none)。Zstd。测试
ZstdFile → UnzstdFile往返单测(含删除原文件后校验内容一致)go test ./...19 包全绿;tsc --noEmit通过向后兼容:既有 gzip/none 备份不受影响;恢复按归档后缀自动选择解压方式。