Skip to content

Commit 130015c

Browse files
fix feedback
1 parent f1c61b1 commit 130015c

File tree

1 file changed

+9
-8
lines changed
  • libs/storage/Tsavorite/cs/src/core/Index/Tsavorite/Implementation

1 file changed

+9
-8
lines changed

libs/storage/Tsavorite/cs/src/core/Index/Tsavorite/Implementation/InternalRMW.cs

+9-8
Original file line numberDiff line numberDiff line change
@@ -379,7 +379,7 @@ private OperationStatus CreateNewRecordRMW<TInput, TOutput, TContext, TSessionFu
379379
where TSessionFunctionsWrapper : ISessionFunctionsWrapper<TKey, TValue, TInput, TOutput, TContext, TStoreFunctions, TAllocator>
380380
{
381381
bool forExpiration = false;
382-
bool skipTombstoneAddition = true;
382+
bool addTombstone = false;
383383

384384
RetryNow:
385385

@@ -416,6 +416,7 @@ private OperationStatus CreateNewRecordRMW<TInput, TOutput, TContext, TSessionFu
416416
if (allocOptions.ElideSourceRecord)
417417
{
418418
srcRecordInfo.SetTombstone();
419+
srcRecordInfo.SetDirtyAndModified();
419420
var oldRecordLengths = GetRecordLengths(stackCtx.recSrc.PhysicalAddress, ref hlog.GetValue(stackCtx.recSrc.PhysicalAddress), ref srcRecordInfo);
420421
// Elide from hei, and try to either do in-chain tombstoning or free list transfer.
421422
HandleRecordElision<TInput, TOutput, TContext, TSessionFunctionsWrapper>(
@@ -424,7 +425,7 @@ private OperationStatus CreateNewRecordRMW<TInput, TOutput, TContext, TSessionFu
424425
return OperationStatusUtils.AdvancedOpCode(OperationStatus.SUCCESS, StatusCode.Found | StatusCode.Expired);
425426
}
426427
// otherwise we shall continue down the tombstoning path
427-
skipTombstoneAddition = false;
428+
addTombstone = true;
428429
}
429430
else
430431
return OperationStatus.SUCCESS;
@@ -440,7 +441,7 @@ private OperationStatus CreateNewRecordRMW<TInput, TOutput, TContext, TSessionFu
440441

441442
// Allocate and initialize the new record
442443
int actualSize; int allocatedSize; int keySize;
443-
if (skipTombstoneAddition)
444+
if (!addTombstone)
444445
{
445446
(actualSize, allocatedSize, keySize) = doingCU ?
446447
stackCtx.recSrc.AllocatorBase._wrapper.GetRMWCopyDestinationRecordSize(ref key, ref input, ref value, ref srcRecordInfo, sessionFunctions) :
@@ -485,7 +486,7 @@ private OperationStatus CreateNewRecordRMW<TInput, TOutput, TContext, TSessionFu
485486
return OperationStatus.NOTFOUND | (forExpiration ? OperationStatus.EXPIRED : OperationStatus.NOTFOUND);
486487
}
487488
}
488-
else if (skipTombstoneAddition)
489+
else if (!addTombstone)
489490
{
490491
if (srcRecordInfo.ETag)
491492
newRecordInfo.SetHasETag();
@@ -514,9 +515,9 @@ private OperationStatus CreateNewRecordRMW<TInput, TOutput, TContext, TSessionFu
514515
}
515516
if (rmwInfo.Action == RMWAction.ExpireAndStop)
516517
{
517-
Debug.Assert(skipTombstoneAddition, "Should not have gone down RCU if NCU had already requested tombstoning." +
518+
Debug.Assert(!addTombstone, "Should not have gone down RCU if NCU had already requested tombstoning." +
518519
"This block should only handle expiration/tombstoning via RCU.");
519-
skipTombstoneAddition = false;
520+
addTombstone = true;
520521
newRecordInfo.SetDirtyAndModified();
521522
newRecordInfo.SetTombstone();
522523
status = OperationStatusUtils.AdvancedOpCode(OperationStatus.SUCCESS, StatusCode.CreatedRecord | StatusCode.Expired);
@@ -548,7 +549,7 @@ private OperationStatus CreateNewRecordRMW<TInput, TOutput, TContext, TSessionFu
548549
}
549550
else
550551
{
551-
Debug.Assert(!skipTombstoneAddition, "This block should only be handling tombstoning requests by NCU where the previous record was not elidable.");
552+
Debug.Assert(!addTombstone, "This block should only be handling tombstoning requests by NCU where the previous record was not elidable.");
552553
newRecordInfo.SetDirtyAndModified();
553554
newRecordInfo.SetTombstone();
554555
status = OperationStatusUtils.AdvancedOpCode(OperationStatus.SUCCESS, StatusCode.CreatedRecord | StatusCode.Expired);
@@ -573,7 +574,7 @@ private OperationStatus CreateNewRecordRMW<TInput, TOutput, TContext, TSessionFu
573574
else
574575
{
575576
// Else it was a CopyUpdater so call PCU if tombstoning has not been requested by NCU or CU
576-
if (skipTombstoneAddition && !sessionFunctions.PostCopyUpdater(ref key, ref input, ref value, ref hlog.GetValue(newPhysicalAddress), ref output, ref rmwInfo, ref newRecordInfo))
577+
if (!addTombstone && !sessionFunctions.PostCopyUpdater(ref key, ref input, ref value, ref hlog.GetValue(newPhysicalAddress), ref output, ref rmwInfo, ref newRecordInfo))
577578
{
578579
if (rmwInfo.Action == RMWAction.ExpireAndStop)
579580
{

0 commit comments

Comments
 (0)