diff --git a/cs/src/core/Index/FasterLog/FasterLog.cs b/cs/src/core/Index/FasterLog/FasterLog.cs index 99a3536db..d74fa4b72 100644 --- a/cs/src/core/Index/FasterLog/FasterLog.cs +++ b/cs/src/core/Index/FasterLog/FasterLog.cs @@ -900,8 +900,7 @@ public async ValueTask ReadRecordLengthAsync(long address, CancellationToke allocator.AsyncReadRecordToMemory(address, headerSize, AsyncGetHeaderOnlyFromDiskCallback, ref ctx); } epoch.Suspend(); - await ctx.completedRead.WaitAsync(token).ConfigureAwait(false); - + await ctx.completedRead.WaitAsync(token).ConfigureAwait(false); return GetRecordLengthAndFree(ctx.record); } @@ -1320,10 +1319,7 @@ private int GetRecordLengthAndFree(SectorAlignedMemory record) var ptr = record.GetValidPointer(); length = GetLength(ptr); - if (!VerifyChecksum(ptr, length)) - { - throw new FasterException("Checksum failed for read"); - } + // forego checksum verification since record may not be read in full by AsyncGetHeaderOnlyFromDiskCallback() } record.Return(); diff --git a/cs/src/core/Index/FasterLog/FasterLogIterator.cs b/cs/src/core/Index/FasterLog/FasterLogIterator.cs index 77395d25e..1f46467d3 100644 --- a/cs/src/core/Index/FasterLog/FasterLogIterator.cs +++ b/cs/src/core/Index/FasterLog/FasterLogIterator.cs @@ -299,10 +299,13 @@ public void CompleteUntil(long address) /// /// /// - public async ValueTask CompleteUntilRecordAtAsync(long recordStartAddress, CancellationToken token = default) + /// The actual completion address (end address of the record) + public async ValueTask CompleteUntilRecordAtAsync(long recordStartAddress, CancellationToken token = default) { int len = await fasterLog.ReadRecordLengthAsync(recordStartAddress, token: token); - CompleteUntil(recordStartAddress + headerSize + len); + long endAddress = recordStartAddress + headerSize + Align(len); + CompleteUntil(endAddress); + return endAddress; } internal void UpdateCompletedUntilAddress(long address)