Zstd Compression Levels Can't Be Changed Across Different `badger.Open()` Calls
Open
Nobody has claimed this yet.
Stale
- Dominant language
- Go
- Stars
- 15.8k
- Forks
- 1.3k
- Avg merge
- 2m
- Merged PRs (30d)
- 1
Description
Because the Zstd encoder is initialized only once for the whole program different compression level options (e.g. 1 or 19) aren't respected across different badger instances.
To Reproduce
badgerOptions := badger.DefaultOptions(db1)
badgerOptions = badgerOptions.WithCompression(options.ZSTD)
badgerOptions = badgerOptions.WithZSTDCompressionLevel(1)
db, _ := badger.Open(badgerOptions)
[...]
badgerOptions = badger.DefaultOptions(db2)
badgerOptions = badgerOptions.WithCompression(options.ZSTD)
badgerOptions = badgerOptions.WithZSTDCompressionLevel(19)
db, _ = badger.Open(badgerOptions) // This db instance will also have compression level 1
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the linked initialization in y/zstd.go and trace how badger.Open applies compression options. Reproduce the issue by opening two databases with ZSTD levels 1 and 19, then add regression coverage showing that each instance honors its configured level.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- databases
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 55/100