Skip to content

Commit

Permalink
chore: Update Badger to release/v3.2011 and Ristretto to latest maste…
Browse files Browse the repository at this point in the history
…r (DGRAPH-2630) (#6853)

* Update Badger to release/v3.2011

* Update badger options

* Run go mod tidy

* Update Ristretto

* Update badger

* free up allocators from allocatorPool

* Fix Trie tests

Co-authored-by: NamanJain8 <[email protected]>
Co-authored-by: Ahsan Barkati <[email protected]>
  • Loading branch information
3 people authored Nov 8, 2020
1 parent c714c31 commit 3b9dd3b
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 14 deletions.
2 changes: 2 additions & 0 deletions dgraph/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,8 @@ func main() {

// Run the program.
cmd.Execute()
// Free up allocators from alloctors from allocatorPool.
z.Done()

ticker.Stop()
fmt.Printf("Allocated Bytes at program end: %s\n", humanize.Bytes(uint64(z.NumAllocBytes())))
Expand Down
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@ 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.20201023122926-2b71a94d1f03
github.com/dgraph-io/badger/v2 v2.0.1-rc1.0.20201106140743-6c074551f8f5
github.com/dgraph-io/dgo/v200 v200.0.0-20200805103119-a3544c464dd6
github.com/dgraph-io/gqlgen v0.13.2
github.com/dgraph-io/gqlparser/v2 v2.1.1
github.com/dgraph-io/graphql-transport-ws v0.0.0-20200916064635-48589439591b
github.com/dgraph-io/ristretto v0.0.4-0.20201028045312-0eff948d52ac
github.com/dgraph-io/ristretto v0.0.4-0.20201105000107-750f5be31aad
github.com/dgrijalva/jwt-go v3.2.0+incompatible
github.com/dgrijalva/jwt-go/v4 v4.0.0-preview1
github.com/dgryski/go-farm v0.0.0-20200201041132-a6ae2369ad13
Expand Down
10 changes: 4 additions & 6 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,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.20201023122926-2b71a94d1f03 h1:8LV0DyKZuYz2eEgMFa/xDpdsocGXb+TS3QRA/YR4TTw=
github.com/dgraph-io/badger/v2 v2.0.1-rc1.0.20201023122926-2b71a94d1f03/go.mod h1:n/u2cnSaDlwS/fTbAjpr793z2mKHDU1N5N27QCyLea4=
github.com/dgraph-io/badger/v2 v2.0.1-rc1.0.20201106140743-6c074551f8f5 h1:8m4WAJ/Z1gvTzDVg8EmEy2NJgCCBQFMrvB1PWQjS/RU=
github.com/dgraph-io/badger/v2 v2.0.1-rc1.0.20201106140743-6c074551f8f5/go.mod h1:AyKZ2teZKQkxJ6+u2Sl/gFKqV30G0kiAixdw8slZAdY=
github.com/dgraph-io/dgo/v200 v200.0.0-20200805103119-a3544c464dd6 h1:toHzMCdCUgYsjM0cW9+wafnKFXfp1HizIJUyzihN+vk=
github.com/dgraph-io/dgo/v200 v200.0.0-20200805103119-a3544c464dd6/go.mod h1:rHa+h3kI4M8ASOirxyIyNeXBfHFgeskVUum2OrDMN3U=
github.com/dgraph-io/gqlgen v0.13.2 h1:TNhndk+eHKj5qE7BenKKSYdSIdOGhLqxR1rCiMso9KM=
Expand All @@ -90,10 +90,8 @@ github.com/dgraph-io/gqlparser/v2 v2.1.1 h1:OBGI6VR+WcegjDB3JdNPMpKpEtITHWzgmiCX
github.com/dgraph-io/gqlparser/v2 v2.1.1/go.mod h1:MYS4jppjyx8b9tuUtjV7jU1UFZK6P9fvO8TsIsQtRKU=
github.com/dgraph-io/graphql-transport-ws v0.0.0-20200916064635-48589439591b h1:PDEhlwHpkEQ5WBfOOKZCNZTXFDGyCEWTYDhxGQbyIpk=
github.com/dgraph-io/graphql-transport-ws v0.0.0-20200916064635-48589439591b/go.mod h1:7z3c/5w0sMYYZF5bHsrh8IH4fKwG5O5Y70cPH1ZLLRQ=
github.com/dgraph-io/ristretto v0.0.4-0.20201022105248-f32a01612740 h1:TzbxnxH3PoFUWx5024RX1+uqLnUVbfdHANjrHMb5Xnc=
github.com/dgraph-io/ristretto v0.0.4-0.20201022105248-f32a01612740/go.mod h1:bDI4cDaalvYSji3vBVDKrn9ouDZrwN974u8ZO/AhYXs=
github.com/dgraph-io/ristretto v0.0.4-0.20201028045312-0eff948d52ac h1:vQVQkNho3qVZrVueqoefGZLZgl2imLY2xMbf8LGpr+s=
github.com/dgraph-io/ristretto v0.0.4-0.20201028045312-0eff948d52ac/go.mod h1:bDI4cDaalvYSji3vBVDKrn9ouDZrwN974u8ZO/AhYXs=
github.com/dgraph-io/ristretto v0.0.4-0.20201105000107-750f5be31aad h1:BN2A+lqBwLx57/l1MUv3iKLIY8XddNkZg2zZN/BFM1I=
github.com/dgraph-io/ristretto v0.0.4-0.20201105000107-750f5be31aad/go.mod h1:bDI4cDaalvYSji3vBVDKrn9ouDZrwN974u8ZO/AhYXs=
github.com/dgrijalva/jwt-go v3.2.0+incompatible h1:7qlOGliEKZXTDg6OTjfoBKDXWrumCAMpl/TFQ4/5kLM=
github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ=
github.com/dgrijalva/jwt-go/v4 v4.0.0-preview1 h1:CaO/zOnF8VvUfEbhRatPcwKVWamvbYd8tQGRWacE9kU=
Expand Down
3 changes: 1 addition & 2 deletions posting/index.go
Original file line number Diff line number Diff line change
Expand Up @@ -574,8 +574,7 @@ func (r *rebuilder) Run(ctx context.Context) error {
WithSyncWrites(false).
WithNumVersionsToKeep(math.MaxInt32).
WithLogger(&x.ToGlog{}).
WithCompression(options.None).
WithLogRotatesToFlush(10)
WithCompression(options.None)

// Set cache if we have encryption.
if len(x.WorkerConfig.EncryptionKey) > 0 {
Expand Down
2 changes: 1 addition & 1 deletion query/outputnode.go
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ func (enc *encoder) setScalarVal(fj fastJsonNode, sv []byte) error {

// Also increase curSize.
enc.curSize += uint64(len(sv))
if size := enc.alloc.Size() + enc.curSize; size > maxEncodedSize {
if size := uint64(enc.alloc.Size()) + enc.curSize; size > maxEncodedSize {
return fmt.Errorf("estimated response size: %d is bigger than threshold: %d",
size, maxEncodedSize)
}
Expand Down
2 changes: 1 addition & 1 deletion worker/draft.go
Original file line number Diff line number Diff line change
Expand Up @@ -1346,7 +1346,7 @@ func (n *node) calculateTabletSizes() {
glog.V(3).Info("Skipping table not owned by one predicate")
}
previousLeft = left.Attr
previousSize = int64(tinfo.EstimatedSz)
previousSize = int64(tinfo.OnDiskSize)
}
// The last table has not been counted. Assign it to the predicate at the left of the table.
updateSize(previousLeft, previousSize)
Expand Down
6 changes: 4 additions & 2 deletions xidmap/trie.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,11 @@ type Trie struct {
func NewTrie() *Trie {
buf, err := z.NewBufferWith(32<<20, math.MaxUint32, z.UseMmap)
x.Check(err)
ro := buf.AllocateOffset(nodeSz)
// Add additional 8 bytes at the start, because offset=0 is used for checking non-existing node.
// Therefore we can't keep root at 0 offset.
ro := buf.AllocateOffset(nodeSz + 8)
return &Trie{
root: uint32(ro),
root: uint32(ro + 8),
buf: buf,
}
}
Expand Down

0 comments on commit 3b9dd3b

Please sign in to comment.