Skip to content

Commit

Permalink
fix(Dgraph): add flag to set up compression in zero. (#6338)
Browse files Browse the repository at this point in the history
  • Loading branch information
martinmr authored Sep 1, 2020
1 parent 0b8681c commit 254bd29
Showing 1 changed file with 8 additions and 1 deletion.
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

0 comments on commit 254bd29

Please sign in to comment.