Skip to content

Commit

Permalink
Merge branch 'master' into v2
Browse files Browse the repository at this point in the history
  • Loading branch information
badrishc authored Nov 23, 2021
2 parents fe10e51 + fccfbcf commit 283fad4
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
8 changes: 2 additions & 6 deletions cs/src/core/Index/FasterLog/FasterLog.cs
Original file line number Diff line number Diff line change
Expand Up @@ -976,8 +976,7 @@ public async ValueTask<int> 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);
}

Expand Down Expand Up @@ -1624,10 +1623,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();
Expand Down
7 changes: 5 additions & 2 deletions cs/src/core/Index/FasterLog/FasterLogIterator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -342,10 +342,13 @@ public void CompleteUntil(long address)
/// </summary>
/// <param name="recordStartAddress"></param>
/// <param name="token"></param>
public async ValueTask CompleteUntilRecordAtAsync(long recordStartAddress, CancellationToken token = default)
/// <returns>The actual completion address (end address of the record)</returns>
public async ValueTask<long> 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)
Expand Down

0 comments on commit 283fad4

Please sign in to comment.