Skip to content

Commit

Permalink
Collect object log offsets (as part of recovery info) only after flus…
Browse files Browse the repository at this point in the history
…hes are complete.
  • Loading branch information
badrishc committed Jan 17, 2020
1 parent 0615c73 commit 1c1c659
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions cs/src/core/Index/Recovery/Checkpoint.cs
Original file line number Diff line number Diff line change
Expand Up @@ -244,13 +244,6 @@ private bool GlobalMoveToNextState(SystemState currentState, SystemState nextSta
_hybridLogCheckpoint.info.headAddress = hlog.HeadAddress;
_hybridLogCheckpoint.info.beginAddress = hlog.BeginAddress;

var seg = hlog.GetSegmentOffsets();
if (seg != null)
{
_hybridLogCheckpoint.info.objectLogSegmentOffsets = new long[seg.Length];
Array.Copy(seg, _hybridLogCheckpoint.info.objectLogSegmentOffsets, seg.Length);
}

if (FoldOverSnapshot)
{
hlog.ShiftReadOnlyToTail(out long tailAddress, out _hybridLogCheckpoint.flushedSemaphore);
Expand Down Expand Up @@ -289,6 +282,15 @@ private bool GlobalMoveToNextState(SystemState currentState, SystemState nextSta
}
case Phase.PERSISTENCE_CALLBACK:
{
// Collect object log offsets only after flushes
// are completed
var seg = hlog.GetSegmentOffsets();
if (seg != null)
{
_hybridLogCheckpoint.info.objectLogSegmentOffsets = new long[seg.Length];
Array.Copy(seg, _hybridLogCheckpoint.info.objectLogSegmentOffsets, seg.Length);
}

if (_activeSessions != null)
{
// write dormant sessions to checkpoint
Expand Down

0 comments on commit 1c1c659

Please sign in to comment.