Skip to content

Commit

Permalink
Optimized slice
Browse files Browse the repository at this point in the history
  • Loading branch information
sakno committed Jul 5, 2024
1 parent 70a8edf commit 65ec0ba
Showing 1 changed file with 3 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -477,13 +477,12 @@ internal void Initialize(long lastIndexHint)
fileOffset = LogEntryMetadata.GetEndOfLogEntry(metadataBuffer);
if (fileOffset <= 0L)
{
var stub = new LogEntryMetadata(default, 0L, previousEnd + LogEntryMetadata.Size, 0L);
stub.Format(metadataBuffer);
fileOffset = stub.End;
fileOffset = previousEnd + LogEntryMetadata.Size;
new LogEntryMetadata(default, 0L, fileOffset, 0L).Format(metadataBuffer);
}

writer.FilePosition = fileOffset;
metadataBuffer.CopyTo(metadataTable.Slice(footerOffset, LogEntryMetadata.Size));
metadataBuffer.CopyTo(metadataTable.Slice(footerOffset));
}
}
else
Expand Down

0 comments on commit 65ec0ba

Please sign in to comment.