From dc4bc1d556dab79071ae3f534de4d3db959d4724 Mon Sep 17 00:00:00 2001 From: asolodov Date: Tue, 16 Apr 2024 17:43:02 +0300 Subject: [PATCH] [C#] Fix commit record pointer offset calculation (#912) Co-authored-by: Alexander Solodov --- cs/src/core/FasterLog/FasterLogIterator.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cs/src/core/FasterLog/FasterLogIterator.cs b/cs/src/core/FasterLog/FasterLogIterator.cs index ffbed9ba3..49b75e9f3 100644 --- a/cs/src/core/FasterLog/FasterLogIterator.cs +++ b/cs/src/core/FasterLog/FasterLogIterator.cs @@ -379,7 +379,7 @@ public unsafe bool GetNext(MemoryPool pool, out IMemoryOwner entry, if (isCommitRecord) { FasterLogRecoveryInfo info = new(); - info.Initialize(new BinaryReader(new UnmanagedMemoryStream((byte *)physicalAddress, entryLength))); + info.Initialize(new BinaryReader(new UnmanagedMemoryStream((byte*) (headerSize + physicalAddress), entryLength))); if (info.CommitNum != long.MaxValue) continue; // Otherwise, no more entries @@ -442,7 +442,7 @@ public unsafe bool TryConsumeNext(T consumer) where T : ILogEntryConsumer if (isCommitRecord) { FasterLogRecoveryInfo info = new(); - info.Initialize(new BinaryReader(new UnmanagedMemoryStream((byte *)physicalAddress, entryLength))); + info.Initialize(new BinaryReader(new UnmanagedMemoryStream((byte*) (headerSize + physicalAddress), entryLength))); if (info.CommitNum != long.MaxValue) continue; // Otherwise, no more entries