Skip to content

Commit

Permalink
Update badger 06/09/2020 (#5616)
Browse files Browse the repository at this point in the history
This PR updates badger. The important changes are
```
KeepL0InMemory -> Set to false (badger default)
DetectConflicts -> Set to false
```

Co-authored-by: Joaquin Menchaca <joaquin@dgraph.io>
Co-authored-by: Ibrahim Jarif <ibrahim@dgraph.io>
  • Loading branch information
3 people authored Jun 15, 2020
1 parent 9fd70f1 commit a374a1a
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ require (
github.com/blevesearch/segment v0.0.0-20160915185041-762005e7a34f // indirect
github.com/blevesearch/snowballstem v0.0.0-20180110192139-26b06a2c243d // indirect
github.com/codahale/hdrhistogram v0.0.0-20161010025455-3a0bb77429bd
github.com/dgraph-io/badger/v2 v2.0.1-rc1.0.20200528205344-e7b6e76f96e8
github.com/dgraph-io/badger/v2 v2.0.1-rc1.0.20200609141616-14386ac9b764
github.com/dgraph-io/dgo/v2 v2.2.1-0.20200319183917-53c7d5bc32a7
github.com/dgraph-io/ristretto v0.0.2-0.20200115201040-8f368f2f2ab3
github.com/dgrijalva/jwt-go v3.2.0+incompatible
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,8 @@ github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/dgraph-io/badger v1.6.0 h1:DshxFxZWXUcO0xX476VJC07Xsr6ZCBVRHKZ93Oh7Evo=
github.com/dgraph-io/badger v1.6.0/go.mod h1:zwt7syl517jmP8s94KqSxTlM6IMsdhYy6psNgSztDR4=
github.com/dgraph-io/badger/v2 v2.0.1-rc1.0.20200528205344-e7b6e76f96e8 h1:TDpSSjrjipVJHEpcimd7uRYqiIeMc1LsM7p2tgEl+s8=
github.com/dgraph-io/badger/v2 v2.0.1-rc1.0.20200528205344-e7b6e76f96e8/go.mod h1:3KY8+bsP8wI0OEnQJAKpd4wIJW/Mm32yw2j/9FUVnIM=
github.com/dgraph-io/badger/v2 v2.0.1-rc1.0.20200609141616-14386ac9b764 h1:cWmYs+E7F/w4KWIkVrV3VLUJkqolRa7y5G2LLMPQVQs=
github.com/dgraph-io/badger/v2 v2.0.1-rc1.0.20200609141616-14386ac9b764/go.mod h1:3KY8+bsP8wI0OEnQJAKpd4wIJW/Mm32yw2j/9FUVnIM=
github.com/dgraph-io/dgo/v2 v2.2.1-0.20200319183917-53c7d5bc32a7 h1:9oFXHEReyRIB291rbdGwRk1PYegGO2XBtZ8muXPKqPA=
github.com/dgraph-io/dgo/v2 v2.2.1-0.20200319183917-53c7d5bc32a7/go.mod h1:LJCkLxm5fUMcU+yb8gHFjHt7ChgNuz3YnQQ6MQkmscI=
github.com/dgraph-io/ristretto v0.0.2-0.20200115201040-8f368f2f2ab3 h1:MQLRM35Pp0yAyBYksjbj1nZI/w6eyRY/mWoM1sFf4kU=
Expand Down
10 changes: 9 additions & 1 deletion worker/server_state.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,20 @@ func InitServerState() {
}

func setBadgerOptions(opt badger.Options) badger.Options {
opt = opt.WithSyncWrites(false).WithTruncate(true).WithLogger(&x.ToGlog{}).
opt = opt.WithSyncWrites(false).
WithTruncate(true).
WithLogger(&x.ToGlog{}).
WithEncryptionKey(enc.ReadEncryptionKeyFile(Config.BadgerKeyFile))

// Do not load bloom filters on DB open.
opt.LoadBloomsOnOpen = false

// Disable conflict detection in badger. Alpha runs in managed mode and
// perform its own conflict detection so we don't need badger's conflict
// detection. Using badger's conflict detection uses memory which can be
// saved by disabling it.
opt.DetectConflicts = false

glog.Infof("Setting Badger Compression Level: %d", Config.BadgerCompressionLevel)
// Default value of badgerCompressionLevel is 3 so compression will always
// be enabled, unless it is explicitly disabled by setting the value to 0.
Expand Down

0 comments on commit a374a1a

Please sign in to comment.