Skip to content

Commit

Permalink
FasterLog iterator fixes. (#222)
Browse files Browse the repository at this point in the history
Use requestedCompletedUntilAddress correctly.
Expose recovered iterators to user.
  • Loading branch information
badrishc authored Dec 27, 2019
1 parent e616292 commit 7432761
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
6 changes: 5 additions & 1 deletion cs/src/core/Index/FasterLog/FasterLog.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ public class FasterLog : IDisposable
private readonly GetMemory getMemory;
private readonly int headerSize;
private readonly LogChecksumType logChecksum;
private readonly Dictionary<string, long> RecoveredIterators;
private TaskCompletionSource<LinkedCommitInfo> commitTcs
= new TaskCompletionSource<LinkedCommitInfo>(TaskCreationOptions.RunContinuationsAsynchronously);

Expand All @@ -44,6 +43,11 @@ private TaskCompletionSource<LinkedCommitInfo> commitTcs
/// </summary>
public long FlushedUntilAddress => allocator.FlushedUntilAddress;

/// <summary>
/// Dictionary of recovered iterators and their committed until addresses
/// </summary>
public readonly Dictionary<string, long> RecoveredIterators;

/// <summary>
/// Log committed until address
/// </summary>
Expand Down
2 changes: 1 addition & 1 deletion cs/src/core/Index/FasterLog/FasterLogIterator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

/// <summary>
/// Next address
Expand Down
4 changes: 2 additions & 2 deletions cs/src/core/Index/FasterLog/FasterLogRecoveryInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ public void SnapshotIterators(ConcurrentDictionary<string, FasterLogScanIterator

foreach (var kvp in persistedIterators)
{
Iterators.Add(kvp.Key, kvp.Value.CompletedUntilAddress);
Iterators.Add(kvp.Key, kvp.Value.requestedCompletedUntilAddress);
}
}
}
Expand All @@ -162,7 +162,7 @@ public void CommitIterators(ConcurrentDictionary<string, FasterLogScanIterator>
{
foreach (var kvp in Iterators)
{
persistedIterators[kvp.Key].CompletedUntilAddress = kvp.Value;
persistedIterators[kvp.Key].UpdateCompletedUntilAddress(kvp.Value);
}
}
}
Expand Down

0 comments on commit 7432761

Please sign in to comment.