Skip to content

Commit

Permalink
Fix calls to TraceBack to use returned addresses correctly (#781)
Browse files Browse the repository at this point in the history
* Fix calls to TraceBack to use returned addresses correctly

* Fix min index size, to allow checkpointing via direct file system call (512 byte sector size).
  • Loading branch information
badrishc authored Jan 16, 2023
1 parent 453221d commit 0b877df
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions cs/src/core/Index/Common/FasterKVSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -205,8 +205,8 @@ public override string ToString()
internal long GetIndexSizeCacheLines()
{
long adjustedSize = Utility.PreviousPowerOf2(IndexSize);
if (adjustedSize < 64)
throw new FasterException($"{nameof(IndexSize)} should be at least of size one cache line (64 bytes)");
if (adjustedSize < 512)
throw new FasterException($"{nameof(IndexSize)} should be at least of size 8 cache line (512 bytes)");
if (IndexSize != adjustedSize)
logger?.LogInformation($"Warning: using lower value {adjustedSize} instead of specified {IndexSize} for {nameof(IndexSize)}");
return adjustedSize / 64;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ internal Status InternalContainsKeyInMemory<Input, Output, Context, FasterSessio
if (recordInfo.Invalid || !comparer.Equals(ref key, ref hlog.GetKey(physicalAddress)))
{
logicalAddress = recordInfo.PreviousAddress;
TraceBackForKeyMatch(ref key, logicalAddress, fromAddress, out _, out logicalAddress);
TraceBackForKeyMatch(ref key, logicalAddress, fromAddress, out logicalAddress, out _);
}

if (logicalAddress < fromAddress)
Expand Down
2 changes: 1 addition & 1 deletion cs/src/core/Index/FASTER/Implementation/ContinuePending.cs
Original file line number Diff line number Diff line change
Expand Up @@ -406,7 +406,7 @@ internal OperationStatus InternalTryCopyToTail<Input, Output, Context, FasterSes
if (ri.Invalid || !comparer.Equals(ref key, ref hlog.GetKey(physicalAddress)))
{
logicalAddress = ri.PreviousAddress;
TraceBackForKeyMatch(ref key, logicalAddress, hlog.HeadAddress, out physicalAddress, out logicalAddress);
TraceBackForKeyMatch(ref key, logicalAddress, hlog.HeadAddress, out logicalAddress, out physicalAddress);
}

if (logicalAddress > untilLogicalAddress)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ internal OperationStatus InternalModifiedBitOperation(ref Key key, out RecordInf
if (recordInfo.Invalid || !comparer.Equals(ref key, ref hlog.GetKey(physicalAddress)))
{
logicalAddress = recordInfo.PreviousAddress;
TraceBackForKeyMatch(ref key, logicalAddress, hlog.HeadAddress, out physicalAddress, out logicalAddress);
TraceBackForKeyMatch(ref key, logicalAddress, hlog.HeadAddress, out logicalAddress, out physicalAddress);
}
}
#endregion
Expand Down
2 changes: 1 addition & 1 deletion cs/src/core/Index/FASTER/Implementation/ReadCache.cs
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ private bool EnsureNoMainLogRecordWasAddedDuringReadCacheInsert(ref Key key, Rec
// Someone added a new record in the splice region. It won't be readcache; that would've been added at tail. See if it's our key.
// We want this whether it's Tentative or not, so don't wait for Tentative.
var minAddress = untilLogicalAddress > hlog.HeadAddress ? untilLogicalAddress : hlog.HeadAddress;
if (TraceBackForKeyMatch(ref key, lowest_rcri.PreviousAddress, minAddress + 1, out _, out long prevAddress, waitForTentative: false))
if (TraceBackForKeyMatch(ref key, lowest_rcri.PreviousAddress, minAddress + 1, out long prevAddress, out _, waitForTentative: false))
success = false;
else if (prevAddress > untilLogicalAddress && prevAddress < hlog.HeadAddress)
{
Expand Down

0 comments on commit 0b877df

Please sign in to comment.