Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(Dgraph): add flag to set up compression in zero. #6338

Merged
merged 2 commits into from
Sep 1, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion dgraph/cmd/zero/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,8 @@ instances to achieve high-availability.
flag.String("badger.vlog", "mmap",
"[mmap, disk] Specifies how Badger Value log is stored for the write-ahead log directory "+
"log directory. mmap consumes more RAM, but provides better performance.")
flag.Int("badger.compression_level", 3,
"The compression level for Badger. A higher value uses more resources.")
}

func setupListener(addr string, port int, kind string) (listener net.Listener, err error) {
Expand Down Expand Up @@ -268,7 +270,12 @@ func run() {
WithIndexCacheSize(indexCacheSz).
WithLoadBloomsOnOpen(false)

kvOpt.ZSTDCompressionLevel = 3
compression_level := Zero.Conf.GetInt("badger.compression_level")
if compression_level > 0 {
// By default, compression is disabled in badger.
kvOpt.Compression = bopt.ZSTD
kvOpt.ZSTDCompressionLevel = compression_level
}

// Set loading mode options.
switch Zero.Conf.GetString("badger.tables") {
Expand Down