diff --git a/cs/src/core/Index/Common/Contexts.cs b/cs/src/core/Index/Common/Contexts.cs index 350710178..8c03df6db 100644 --- a/cs/src/core/Index/Common/Contexts.cs +++ b/cs/src/core/Index/Common/Contexts.cs @@ -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(); @@ -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);