populateDeleteAll() returns the deleteAllMarker under readTs. It also finds out and sets the global deleteAllMarker in hopes to cache it and use it later if required.
(readTs uint64)
| 238 | // populateDeleteAll() returns the deleteAllMarker under readTs. It also finds out and sets the global deleteAllMarker |
| 239 | // in hopes to cache it and use it later if required. |
| 240 | func (mm *MutableLayer) populateDeleteAll(readTs uint64) uint64 { |
| 241 | if mm == nil { |
| 242 | return 0 |
| 243 | } |
| 244 | if mm.deleteAllMarker != math.MaxUint64 { |
| 245 | if readTs >= mm.deleteAllMarker { |
| 246 | return mm.deleteAllMarker |
| 247 | } |
| 248 | // I need to calculate deleteAllMarker again. I can't use the one from cache |
| 249 | } |
| 250 | deleteAllMarker := uint64(0) |
| 251 | deleteAllMarkerBelowTs := uint64(0) |
| 252 | mm.iterateCommittedEntries(func(ts uint64, pl *pb.PostingList) { |
| 253 | for _, pl := range pl.Postings { |
| 254 | if hasDeleteAll(pl) { |
| 255 | deleteAllMarker = x.Max(deleteAllMarker, ts) |
| 256 | if ts <= readTs { |
| 257 | deleteAllMarkerBelowTs = x.Max(deleteAllMarkerBelowTs, ts) |
| 258 | } |
| 259 | } |
| 260 | } |
| 261 | }) |
| 262 | |
| 263 | mm.deleteAllMarker = deleteAllMarker |
| 264 | return deleteAllMarkerBelowTs |
| 265 | } |
| 266 | |
| 267 | // iterateCommittedEntries is an internal function that's used to calculate delete all marker and iterate. No other |
| 268 | // function should use this. They should use .iterate() instead. |