Skip to content

Commit

Permalink
fixed stuff for ongoing transactions
Browse files Browse the repository at this point in the history
  • Loading branch information
Harshil goel committed Jul 25, 2024
1 parent c7ec011 commit d8cef2a
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions posting/lists.go
Original file line number Diff line number Diff line change
Expand Up @@ -340,12 +340,32 @@ func (lc *LocalCache) GetSinglePosting(key []byte) (*pb.PostingList, error) {
return nil
}

getList := func() *List {
lc.RLock()
defer lc.RUnlock()

return lc.plists[string(key)]
}

getPostingFromList := func() *pb.PostingList {
l := getList()
if l != nil {
return l.mutationMap[lc.startTs]
}
return nil
}

getPostings := func() (*pb.PostingList, error) {
pl := getDeltas()
if pl != nil {
return pl, nil
}

pl = getPostingFromList()
if pl != nil {
return pl, nil
}

pl = &pb.PostingList{}
txn := pstore.NewTransactionAt(lc.startTs, false)
item, err := txn.Get(key)
Expand Down

0 comments on commit d8cef2a

Please sign in to comment.