A number of fixes related to #3332 #3338
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Consider what happens when we have the following collapsibility changes, all occurring at the same time
t
:where
NC
indicates a non-collapsible segment andC
a collapsible segment.Segment #1
, we create a checkpoint at timet
containing all ofSegment #1
. We then create a new segment,Segment #2
, which has initially one point.Segment #2
ends immediately (remember that all the transitions are at timet
), so it is left with a single point, and we createSegment #3
, which has initially one point.Then
Segment #3
ends immediately and the story continues differently depending on the version of the code:t
and fail aCHECK
in theCheckpointer
class.t
, but we createSegment #4
. SoSegment #3
is not collapsible, but it doesn't have a checkpoint either, and we are unable to reconstruct it. That's the crash observed in #3332.t
, we don't createSegment #4
, and we destroySegment #3
, so that any future collapsible point gets appended toSegment #2
. The hope is that this preserves the following invariants: (1) a collapsible segment always follows a checkpoint (2) segments alternate in collapsibility.I believe that this fixes #3332 but I don't have a way to check for sure.