diff --git a/src/cluster/DotNext.Net.Cluster/Net/Cluster/Consensus/Raft/PersistentState.Partition.cs b/src/cluster/DotNext.Net.Cluster/Net/Cluster/Consensus/Raft/PersistentState.Partition.cs index 4ab08dfb8..a711c4aec 100644 --- a/src/cluster/DotNext.Net.Cluster/Net/Cluster/Consensus/Raft/PersistentState.Partition.cs +++ b/src/cluster/DotNext.Net.Cluster/Net/Cluster/Consensus/Raft/PersistentState.Partition.cs @@ -473,9 +473,14 @@ internal void Initialize(long lastIndexHint) if (count < LogEntryMetadata.Size) break; + var previousEnd = fileOffset; fileOffset = LogEntryMetadata.GetEndOfLogEntry(metadataBuffer); if (fileOffset <= 0L) - break; + { + var stub = new LogEntryMetadata(default, 0L, previousEnd + LogEntryMetadata.Size, 0L); + stub.Format(metadataBuffer); + fileOffset = stub.End; + } writer.FilePosition = fileOffset; metadataBuffer.CopyTo(metadataTable.Slice(footerOffset, LogEntryMetadata.Size));