Skip to content

Commit

Permalink
Fasterlog lowmem (#178)
Browse files Browse the repository at this point in the history
Adding support for low memory footprint (4 pages)
Added support for odd-sized payloads in presence of holes in log
Fixed concurrency issue that occurs with low num of pages
Improved max throughput by eliminating a 10ms sleep in BlockAllocate
Misc cleanup of logic to track flush and close addresses in log
  • Loading branch information
badrishc authored Sep 26, 2019
1 parent ddcc338 commit 2cd85e3
Show file tree
Hide file tree
Showing 10 changed files with 196 additions and 203 deletions.
16 changes: 14 additions & 2 deletions cs/playground/FasterLogSample/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ static void AppendThread()
while (true)
{
log.Append(entry);

// We also support a Span-based version of Append

// We also support TryAppend to allow throttling/back-off:
Expand Down Expand Up @@ -84,7 +84,7 @@ static void ScanThread()
Thread.Sleep(1000);
if (!result.SequenceEqual(entrySpan))
{
throw new Exception("Invalid entry found");
throw new Exception("Invalid entry found at offset " + FindDiff(result, entrySpan));
}

if (r.Next(100) < 10)
Expand All @@ -99,6 +99,18 @@ static void ScanThread()
}
}

static int FindDiff(Span<byte> b1, Span<byte> b2)
{
for (int i=0; i<b1.Length; i++)
{
if (b1[i] != b2[i])
{
return i;
}
}
return 0;
}

static void Main(string[] args)
{
var device = Devices.CreateLogDevice("D:\\logs\\hlog.log");
Expand Down
Loading

0 comments on commit 2cd85e3

Please sign in to comment.