Skip to content

Commit

Permalink
Fill metadata table with stub entries if they are zeroed on the disk (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
sakno committed Jul 5, 2024
1 parent 38e8395 commit 70a8edf
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down

0 comments on commit 70a8edf

Please sign in to comment.