Skip to content

Commit

Permalink
fix(dgraph): Panic because of nil map in groups.go (dgraph-io#5999)
Browse files Browse the repository at this point in the history
* Initialize delta.GroupChecksums if nil

delta.GroupChecksums is nil at this point in the code, so copying keys to this map causes the code to panic

* Address review comments

Remove if nil check

* fix CI; move map make to for loop since delta is assigned a struct from the deltaCh
  • Loading branch information
rahulgurnani authored and dna2github committed Jul 18, 2020
1 parent 594adb9 commit 8be1ce2
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions worker/groups.go
Expand Up @@ -953,6 +953,9 @@ func (g *groupi) processOracleDeltaStream() {
return
}
batch++
if delta.GroupChecksums == nil {
delta.GroupChecksums = make(map[uint32]uint64)
}
delta.Txns = append(delta.Txns, more.Txns...)
delta.MaxAssigned = x.Max(delta.MaxAssigned, more.MaxAssigned)
for gid, checksum := range more.GroupChecksums {
Expand Down

0 comments on commit 8be1ce2

Please sign in to comment.