Skip to content

Commit

Permalink
Fix to not read back the invalid header of page 0
Browse files Browse the repository at this point in the history
  • Loading branch information
badrishc committed Apr 5, 2019
1 parent eff004d commit 7b900f9
Showing 1 changed file with 14 additions and 11 deletions.
25 changes: 14 additions & 11 deletions cs/src/core/Allocator/GenericAllocator.cs
Expand Up @@ -294,17 +294,20 @@ protected override void ClearPage(long page)

if (aligned_start < start && (KeyHasObjects() || ValueHasObjects()))
{
// Get the overlapping HLOG from disk as we wrote it with
// object pointers previously. This avoids object reserialization
PageAsyncReadResult<Empty> result =
new PageAsyncReadResult<Empty>
{
handle = new CountdownEvent(1)
};
device.ReadAsync(alignedDestinationAddress + (ulong)aligned_start, (IntPtr)buffer.aligned_pointer + aligned_start,
(uint)sectorSize, AsyncReadPageCallback, result);
result.handle.Wait();

// Do not read back the invalid header of page 0
if ((flushPage > 0) || (start > GetFirstValidLogicalAddress(flushPage)))
{
// Get the overlapping HLOG from disk as we wrote it with
// object pointers previously. This avoids object reserialization
PageAsyncReadResult<Empty> result =
new PageAsyncReadResult<Empty>
{
handle = new CountdownEvent(1)
};
device.ReadAsync(alignedDestinationAddress + (ulong)aligned_start, (IntPtr)buffer.aligned_pointer + aligned_start,
(uint)sectorSize, AsyncReadPageCallback, result);
result.handle.Wait();
}
fixed (RecordInfo* pin = &src[0].info)
{
Buffer.MemoryCopy((void*)((long)Unsafe.AsPointer(ref src[0]) + start), buffer.aligned_pointer + start,
Expand Down

0 comments on commit 7b900f9

Please sign in to comment.