Skip to content

Commit

Permalink
allow reading v4 checkpoints with current version (#896)
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastianburckhardt authored Feb 29, 2024
1 parent 0116754 commit 2ed1d26
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions cs/src/core/Index/Common/Contexts.cs
Original file line number Diff line number Diff line change
Expand Up @@ -437,7 +437,9 @@ public void Initialize(StreamReader reader)
string value = reader.ReadLine();
var cversion = int.Parse(value);

if (cversion != CheckpointVersion)
bool translateV4toV5 = (cversion == 4 && CheckpointVersion == 5);

if (cversion != CheckpointVersion && !translateV4toV5)
throw new FasterException($"Invalid checkpoint version {cversion} encountered, current version is {CheckpointVersion}, cannot recover with this checkpoint");

value = reader.ReadLine();
Expand All @@ -458,8 +460,15 @@ public void Initialize(StreamReader reader)
value = reader.ReadLine();
flushedLogicalAddress = long.Parse(value);

value = reader.ReadLine();
snapshotStartFlushedLogicalAddress = long.Parse(value);
if (!translateV4toV5)
{
value = reader.ReadLine();
snapshotStartFlushedLogicalAddress = long.Parse(value);
}
else
{
snapshotStartFlushedLogicalAddress = flushedLogicalAddress;
}

value = reader.ReadLine();
startLogicalAddress = long.Parse(value);
Expand Down

0 comments on commit 2ed1d26

Please sign in to comment.