@@ -379,7 +379,7 @@ private OperationStatus CreateNewRecordRMW<TInput, TOutput, TContext, TSessionFu
379
379
where TSessionFunctionsWrapper : ISessionFunctionsWrapper < TKey , TValue , TInput , TOutput , TContext , TStoreFunctions , TAllocator >
380
380
{
381
381
bool forExpiration = false ;
382
- bool skipTombstoneAddition = true ;
382
+ bool addTombstone = false ;
383
383
384
384
RetryNow :
385
385
@@ -416,6 +416,7 @@ private OperationStatus CreateNewRecordRMW<TInput, TOutput, TContext, TSessionFu
416
416
if ( allocOptions . ElideSourceRecord )
417
417
{
418
418
srcRecordInfo . SetTombstone ( ) ;
419
+ srcRecordInfo . SetDirtyAndModified ( ) ;
419
420
var oldRecordLengths = GetRecordLengths ( stackCtx . recSrc . PhysicalAddress , ref hlog . GetValue ( stackCtx . recSrc . PhysicalAddress ) , ref srcRecordInfo ) ;
420
421
// Elide from hei, and try to either do in-chain tombstoning or free list transfer.
421
422
HandleRecordElision < TInput , TOutput , TContext , TSessionFunctionsWrapper > (
@@ -424,7 +425,7 @@ private OperationStatus CreateNewRecordRMW<TInput, TOutput, TContext, TSessionFu
424
425
return OperationStatusUtils . AdvancedOpCode ( OperationStatus . SUCCESS , StatusCode . Found | StatusCode . Expired ) ;
425
426
}
426
427
// otherwise we shall continue down the tombstoning path
427
- skipTombstoneAddition = false ;
428
+ addTombstone = true ;
428
429
}
429
430
else
430
431
return OperationStatus . SUCCESS ;
@@ -440,7 +441,7 @@ private OperationStatus CreateNewRecordRMW<TInput, TOutput, TContext, TSessionFu
440
441
441
442
// Allocate and initialize the new record
442
443
int actualSize ; int allocatedSize ; int keySize ;
443
- if ( skipTombstoneAddition )
444
+ if ( ! addTombstone )
444
445
{
445
446
( actualSize , allocatedSize , keySize ) = doingCU ?
446
447
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
485
486
return OperationStatus . NOTFOUND | ( forExpiration ? OperationStatus . EXPIRED : OperationStatus . NOTFOUND ) ;
486
487
}
487
488
}
488
- else if ( skipTombstoneAddition )
489
+ else if ( ! addTombstone )
489
490
{
490
491
if ( srcRecordInfo . ETag )
491
492
newRecordInfo . SetHasETag ( ) ;
@@ -514,9 +515,9 @@ private OperationStatus CreateNewRecordRMW<TInput, TOutput, TContext, TSessionFu
514
515
}
515
516
if ( rmwInfo . Action == RMWAction . ExpireAndStop )
516
517
{
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." +
518
519
"This block should only handle expiration/tombstoning via RCU." ) ;
519
- skipTombstoneAddition = false ;
520
+ addTombstone = true ;
520
521
newRecordInfo . SetDirtyAndModified ( ) ;
521
522
newRecordInfo . SetTombstone ( ) ;
522
523
status = OperationStatusUtils . AdvancedOpCode ( OperationStatus . SUCCESS , StatusCode . CreatedRecord | StatusCode . Expired ) ;
@@ -548,7 +549,7 @@ private OperationStatus CreateNewRecordRMW<TInput, TOutput, TContext, TSessionFu
548
549
}
549
550
else
550
551
{
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." ) ;
552
553
newRecordInfo . SetDirtyAndModified ( ) ;
553
554
newRecordInfo . SetTombstone ( ) ;
554
555
status = OperationStatusUtils . AdvancedOpCode ( OperationStatus . SUCCESS , StatusCode . CreatedRecord | StatusCode . Expired ) ;
@@ -573,7 +574,7 @@ private OperationStatus CreateNewRecordRMW<TInput, TOutput, TContext, TSessionFu
573
574
else
574
575
{
575
576
// 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 ) )
577
578
{
578
579
if ( rmwInfo . Action == RMWAction . ExpireAndStop )
579
580
{
0 commit comments