Skip to content

Commit

Permalink
update comment
Browse files Browse the repository at this point in the history
  • Loading branch information
shaan1337 committed Apr 18, 2023
1 parent 8452c90 commit 3ea99e7
Showing 1 changed file with 9 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -261,9 +261,15 @@ public class Buffer {
break;

case DiscardDecision.AlreadyDiscarded:
// this event has already been deleted from the chunks but not from the index (by the old scavenger)
// to be on the safe side, we move the discard point forward only if all events before it
// have been or will be discarded
// this event has already been deleted from the chunks but not from the index.
// we move the discard point forward only if all events before it have been or will be discarded for the following reasons:
//
// i) usually, there should be no gaps between the event numbers of a stream but this property is not guaranteed
// with the previous scavenger. if it happens that this event was in a stream gap and we always moved the discard point
// forward, we would end up deleting all the events that were present before the gap.
//
// ii) we do our best to delete stale entries from the index

if (allDiscardedSoFar)
discardPoint = DiscardPoint.DiscardIncluding(eventInfo.EventNumber);
break;
Expand Down

0 comments on commit 3ea99e7

Please sign in to comment.