Skip to content

Commit

Permalink
Initialize posting list in moveToNextPart (#6560)
Browse files Browse the repository at this point in the history
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()`
  • Loading branch information
animesh2049 committed Sep 24, 2020
1 parent 4a67f04 commit 7873f04
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions posting/list.go
Expand Up @@ -184,6 +184,7 @@ func (it *pIterator) moveToNextPart() error {
}
it.plist = plist

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

0 comments on commit 7873f04

Please sign in to comment.