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 Dec 16, 2021
2 parents c4e3718 + 104e844 commit f7c513b
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions cs/src/core/Allocator/GenericAllocator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -419,6 +419,7 @@ private void WriteAsync<TContext>(long flushPage, ulong alignedDestinationAddres

for (int i=start/recordSize; i<end/recordSize; i++)
{
long endPosition = 0;
if (!src[i].info.Invalid)
{
if (KeyHasObjects())
Expand All @@ -429,6 +430,7 @@ private void WriteAsync<TContext>(long flushPage, ulong alignedDestinationAddres
key_address->Address = pos;
key_address->Size = (int)(ms.Position - pos);
addr.Add((long)key_address);
endPosition = pos + key_address->Size;
}

if (ValueHasObjects() && !src[i].info.Tombstone)
Expand All @@ -439,10 +441,11 @@ private void WriteAsync<TContext>(long flushPage, ulong alignedDestinationAddres
value_address->Address = pos;
value_address->Size = (int)(ms.Position - pos);
addr.Add((long)value_address);
endPosition = pos + value_address->Size;
}
}

if (ms.Position > ObjectBlockSize || i == (end / recordSize) - 1)
if (endPosition > ObjectBlockSize || i == (end / recordSize) - 1)
{
var memoryStreamLength = (int)ms.Position;

Expand Down Expand Up @@ -841,8 +844,9 @@ public void GetObjectInfo(byte* raw, ref long ptr, long untilptr, int objectBloc
{
long minObjAddress = long.MaxValue;
long maxObjAddress = long.MinValue;
bool done = false;

while (ptr < untilptr)
while (!done && (ptr < untilptr))
{
ref Record<Key, Value> record = ref Unsafe.AsRef<Record<Key, Value>>(raw + ptr);

Expand All @@ -853,15 +857,13 @@ public void GetObjectInfo(byte* raw, ref long ptr, long untilptr, int objectBloc
var key_addr = GetKeyAddressInfo((long)raw + ptr);
var addr = key_addr->Address;

// If object pointer is greater than kObjectSize from starting object pointer
if (minObjAddress != long.MaxValue && (addr - minObjAddress > objectBlockSize))
{
break;
}

if (addr < minObjAddress) minObjAddress = addr;
addr += key_addr->Size;
if (addr > maxObjAddress) maxObjAddress = addr;

// If object pointer is greater than kObjectSize from starting object pointer
if (minObjAddress != long.MaxValue && (addr - minObjAddress > objectBlockSize))
done = true;
}


Expand All @@ -870,15 +872,13 @@ public void GetObjectInfo(byte* raw, ref long ptr, long untilptr, int objectBloc
var value_addr = GetValueAddressInfo((long)raw + ptr);
var addr = value_addr->Address;

// If object pointer is greater than kObjectSize from starting object pointer
if (minObjAddress != long.MaxValue && (addr - minObjAddress > objectBlockSize))
{
break;
}

if (addr < minObjAddress) minObjAddress = addr;
addr += value_addr->Size;
if (addr > maxObjAddress) maxObjAddress = addr;

// If object pointer is greater than kObjectSize from starting object pointer
if (minObjAddress != long.MaxValue && (addr - minObjAddress > objectBlockSize))
done = true;
}
}
ptr += GetRecordSize(ptr).Item2;
Expand Down

0 comments on commit f7c513b

Please sign in to comment.