From 74327613aca056f76da21b2e421b1196d02f84f5 Mon Sep 17 00:00:00 2001 From: Badrish Chandramouli Date: Thu, 26 Dec 2019 18:54:03 -0800 Subject: [PATCH] FasterLog iterator fixes. (#222) Use requestedCompletedUntilAddress correctly. Expose recovered iterators to user. --- cs/src/core/Index/FasterLog/FasterLog.cs | 6 +++++- cs/src/core/Index/FasterLog/FasterLogIterator.cs | 2 +- cs/src/core/Index/FasterLog/FasterLogRecoveryInfo.cs | 4 ++-- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/cs/src/core/Index/FasterLog/FasterLog.cs b/cs/src/core/Index/FasterLog/FasterLog.cs index f8994a962..832a73b75 100644 --- a/cs/src/core/Index/FasterLog/FasterLog.cs +++ b/cs/src/core/Index/FasterLog/FasterLog.cs @@ -25,7 +25,6 @@ public class FasterLog : IDisposable private readonly GetMemory getMemory; private readonly int headerSize; private readonly LogChecksumType logChecksum; - private readonly Dictionary RecoveredIterators; private TaskCompletionSource commitTcs = new TaskCompletionSource(TaskCreationOptions.RunContinuationsAsynchronously); @@ -44,6 +43,11 @@ private TaskCompletionSource commitTcs /// public long FlushedUntilAddress => allocator.FlushedUntilAddress; + /// + /// Dictionary of recovered iterators and their committed until addresses + /// + public readonly Dictionary RecoveredIterators; + /// /// Log committed until address /// diff --git a/cs/src/core/Index/FasterLog/FasterLogIterator.cs b/cs/src/core/Index/FasterLog/FasterLogIterator.cs index 8efb1d3fd..d729ca0f2 100644 --- a/cs/src/core/Index/FasterLog/FasterLogIterator.cs +++ b/cs/src/core/Index/FasterLog/FasterLogIterator.cs @@ -31,7 +31,7 @@ public class FasterLogScanIterator : IDisposable private readonly GetMemory getMemory; private readonly int headerSize; private bool disposed = false; - private long requestedCompletedUntilAddress; + internal long requestedCompletedUntilAddress; /// /// Next address diff --git a/cs/src/core/Index/FasterLog/FasterLogRecoveryInfo.cs b/cs/src/core/Index/FasterLog/FasterLogRecoveryInfo.cs index 829beece2..9a2b9f71b 100644 --- a/cs/src/core/Index/FasterLog/FasterLogRecoveryInfo.cs +++ b/cs/src/core/Index/FasterLog/FasterLogRecoveryInfo.cs @@ -147,7 +147,7 @@ public void SnapshotIterators(ConcurrentDictionary { foreach (var kvp in Iterators) { - persistedIterators[kvp.Key].CompletedUntilAddress = kvp.Value; + persistedIterators[kvp.Key].UpdateCompletedUntilAddress(kvp.Value); } } }