From 802a2f2f070d257f88c38baea6fd9394b862eb71 Mon Sep 17 00:00:00 2001 From: Martin Martinez Rivera Date: Fri, 28 Aug 2020 08:25:45 -0700 Subject: [PATCH] fix(Dgraph): Don't store start_ts in postings. (#6206) (#6214) 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 fbbd7315b8bf76609ede13a3fe4abbee5c4bde41) --- posting/list.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/posting/list.go b/posting/list.go index 5c841971afa..6b51b18d73e 100644 --- a/posting/list.go +++ b/posting/list.go @@ -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 @@ -596,6 +599,7 @@ func (l *List) pickPostings(readTs uint64) (uint64, []*pb.Posting) { deleteBelowTs = effectiveTs continue } + mpost.StartTs = startTs posts = append(posts, mpost) } }