dgraph-io / dgraph-io/badger

Zstd Compression Levels Can't Be Changed Across Different `badger.Open()` Calls

Open
#2,178 3 comments 0 reactions 0 assignees View on GitHub

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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.