From 0b877df02d9e885300ddb73a0c309910f969942e Mon Sep 17 00:00:00 2001 From: Badrish Chandramouli Date: Mon, 16 Jan 2023 12:25:10 -0800 Subject: [PATCH] Fix calls to TraceBack to use returned addresses correctly (#781) * 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). --- cs/src/core/Index/Common/FasterKVSettings.cs | 4 ++-- .../core/Index/FASTER/Implementation/ContainsKeyInMemory.cs | 2 +- cs/src/core/Index/FASTER/Implementation/ContinuePending.cs | 2 +- .../core/Index/FASTER/Implementation/ModifiedBitOperation.cs | 2 +- cs/src/core/Index/FASTER/Implementation/ReadCache.cs | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/cs/src/core/Index/Common/FasterKVSettings.cs b/cs/src/core/Index/Common/FasterKVSettings.cs index 990422d52..f91750398 100644 --- a/cs/src/core/Index/Common/FasterKVSettings.cs +++ b/cs/src/core/Index/Common/FasterKVSettings.cs @@ -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; diff --git a/cs/src/core/Index/FASTER/Implementation/ContainsKeyInMemory.cs b/cs/src/core/Index/FASTER/Implementation/ContainsKeyInMemory.cs index cd6eaca4a..264c5f32d 100644 --- a/cs/src/core/Index/FASTER/Implementation/ContainsKeyInMemory.cs +++ b/cs/src/core/Index/FASTER/Implementation/ContainsKeyInMemory.cs @@ -37,7 +37,7 @@ internal Status InternalContainsKeyInMemory untilLogicalAddress) diff --git a/cs/src/core/Index/FASTER/Implementation/ModifiedBitOperation.cs b/cs/src/core/Index/FASTER/Implementation/ModifiedBitOperation.cs index b5bec8fa6..b4e8edfd1 100644 --- a/cs/src/core/Index/FASTER/Implementation/ModifiedBitOperation.cs +++ b/cs/src/core/Index/FASTER/Implementation/ModifiedBitOperation.cs @@ -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 diff --git a/cs/src/core/Index/FASTER/Implementation/ReadCache.cs b/cs/src/core/Index/FASTER/Implementation/ReadCache.cs index 20ac7a0f5..58ed6ed14 100644 --- a/cs/src/core/Index/FASTER/Implementation/ReadCache.cs +++ b/cs/src/core/Index/FASTER/Implementation/ReadCache.cs @@ -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) {