From 53297ce7748bff0b65157709c2f2bb3e283eca30 Mon Sep 17 00:00:00 2001 From: Badrish Chandramouli Date: Sat, 21 Jan 2023 01:07:09 +0000 Subject: [PATCH] Fix ContinuePending RI, mark source RI correctly on lock transfer (#787) * Fix ContinuePending RI bits * Fix inaccurate skipping of "marking source record invalid" --- .../FASTER/Implementation/ContinuePending.cs | 15 ++++++++++++--- .../Index/FASTER/Implementation/RecordSource.cs | 3 ++- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/cs/src/core/Index/FASTER/Implementation/ContinuePending.cs b/cs/src/core/Index/FASTER/Implementation/ContinuePending.cs index 19c584cca..b0083c12b 100644 --- a/cs/src/core/Index/FASTER/Implementation/ContinuePending.cs +++ b/cs/src/core/Index/FASTER/Implementation/ContinuePending.cs @@ -38,7 +38,11 @@ internal OperationStatus InternalContinuePendingRead { ref RecordInfo srcRecordInfo = ref hlog.GetInfoFromBytePointer(request.record.GetValidPointer()); - Debug.Assert(!srcRecordInfo.IsIntermediate, "Should always retrieve a non-Tentative, non-Sealed record from disk"); + // We ignore locks and temp bits for disk images + srcRecordInfo.ClearLocks(); + srcRecordInfo.Tentative = false; + srcRecordInfo.Unseal(); + // Debug.Assert(!srcRecordInfo.IsIntermediate, "Should always retrieve a non-Tentative, non-Sealed record from disk"); if (request.logicalAddress >= hlog.BeginAddress) { @@ -170,8 +174,13 @@ internal OperationStatus InternalContinuePendingRMW stackCtx = new(comparer.GetHashCode64(ref key)); OperationStatus status; diff --git a/cs/src/core/Index/FASTER/Implementation/RecordSource.cs b/cs/src/core/Index/FASTER/Implementation/RecordSource.cs index 93db4e09c..f2b90c240 100644 --- a/cs/src/core/Index/FASTER/Implementation/RecordSource.cs +++ b/cs/src/core/Index/FASTER/Implementation/RecordSource.cs @@ -115,8 +115,9 @@ internal void Set(long latestLogicalAddress, AllocatorBase srcLog) internal void MarkSourceRecordAfterSuccessfulCopyUpdate(FasterSession fasterSession, ref RecordInfo srcRecordInfo) where FasterSession : IFasterSession { - if (this.HasInMemorySrc && this.LogicalAddress >= this.Log.HeadAddress) + if (this.HasInMemorySrc) { + // Record is guaranteed to be in memory at this point, regardless of HeadAddress if (this.HasReadCacheSrc) { // If the record was evicted, it won't be accessed, so we do not need to worry about setting it invalid.