Skip to content

Commit 7873f04

Browse files
authored
Initialize posting list in moveToNextPart (#6560)
If `deleteBelowTs` is not zero `it.uidPosting` won't be intialized in `pitr.inti(). This could cause panic when we are doing `pitr.posting()`. Our assumption was that `piter.valdi()` would return false in such cases. This assumption might not always be true. If `it.uids` is empty, we try to move to next valid part of the list. In the function `moveToNextPart` we are intitializing many components of pIterator but not `uidPosting`. If `it.uids` is filled here, `piter.valid()` would become true and we would end up into a panic at `pitr.posting()`
1 parent 4a67f04 commit 7873f04

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

posting/list.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,7 @@ func (it *pIterator) moveToNextPart() error {
184184
}
185185
it.plist = plist
186186

187+
it.uidPosting = &pb.Posting{}
187188
it.dec = &codec.Decoder{Pack: it.plist.Pack}
188189
// codec.SeekCurrent makes sure we skip returning afterUid during seek.
189190
it.uids = it.dec.Seek(it.afterUid, codec.SeekCurrent)

0 commit comments

Comments
 (0)