Skip to content

Commit

Permalink
fix(Dgraph): Don't store start_ts in postings. (#6206)
Browse files Browse the repository at this point in the history
Clear out the start_ts field in the postings of deltas before they are
marshalled to avoid storing that field in disk. This field is only meant
to be used during in-memory processing.

Related to https://discuss.dgraph.io/t/start-ts-not-being-cleared-before-postings-are-written-to-disk/9146

(cherry picked from commit fbbd731)
  • Loading branch information
martinmr committed Aug 17, 2020
1 parent 51a191f commit dd0f1f7
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions posting/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -526,9 +526,12 @@ func (l *List) addMutationInternal(ctx context.Context, txn *Txn, t *pb.Directed

// getMutation returns a marshaled version of posting list mutation stored internally.
func (l *List) getMutation(startTs uint64) []byte {
l.RLock()
defer l.RUnlock()
l.Lock()
defer l.Unlock()
if pl, ok := l.mutationMap[startTs]; ok {
for _, p := range pl.GetPostings() {
p.StartTs = 0
}
data, err := pl.Marshal()
x.Check(err)
return data
Expand Down Expand Up @@ -596,6 +599,7 @@ func (l *List) pickPostings(readTs uint64) (uint64, []*pb.Posting) {
deleteBelowTs = effectiveTs
continue
}
mpost.StartTs = startTs
posts = append(posts, mpost)
}
}
Expand Down

0 comments on commit dd0f1f7

Please sign in to comment.