Skip to content

Commit

Permalink
Merge branch 'users/padgupta/optimize_stringallocations_clusternodes'…
Browse files Browse the repository at this point in the history
… of https://github.com/microsoft/garnet into users/padgupta/optimize_stringallocations_clusternodes
  • Loading branch information
vazois committed Mar 7, 2025
2 parents 2f726d9 + 6bacd6f commit a498ef4
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 11 deletions.
2 changes: 1 addition & 1 deletion Version.props
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project>
<!-- VersionPrefix property for builds and packages -->
<PropertyGroup>
<VersionPrefix>1.0.58</VersionPrefix>
<VersionPrefix>1.0.59</VersionPrefix>
</PropertyGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,8 @@ internal OperationStatus InternalDelete<TInput, TOutput, TContext, TSessionFunct
case LatchDestination.Retry:
goto LatchRelease;
case LatchDestination.CreateNewRecord:
if (stackCtx.recSrc.HasMainLogSrc)
srcRecordInfo = ref stackCtx.recSrc.GetInfo();
goto CreateNewRecord;
default:
Debug.Assert(latchDestination == LatchDestination.NormalProcessing, "Unknown latchDestination value; expected NormalProcessing");
Expand Down Expand Up @@ -176,7 +178,7 @@ internal OperationStatus InternalDelete<TInput, TOutput, TContext, TSessionFunct
// Could not delete in place for some reason - create new record.
goto CreateNewRecord;
}
else if (stackCtx.recSrc.LogicalAddress >= hlogBase.HeadAddress)
else if (stackCtx.recSrc.HasMainLogSrc)
{
// If we already have a deleted record, there's nothing to do.
srcRecordInfo = ref stackCtx.recSrc.GetInfo();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,10 +92,10 @@ internal OperationStatus InternalRMW<TInput, TOutput, TContext, TSessionFunction
case LatchDestination.Retry:
goto LatchRelease;
case LatchDestination.CreateNewRecord:
if (stackCtx.recSrc.LogicalAddress >= hlogBase.HeadAddress)
if (stackCtx.recSrc.HasMainLogSrc)
srcRecordInfo = ref stackCtx.recSrc.GetInfo();

goto CreateNewRecord;

default:
Debug.Assert(latchDestination == LatchDestination.NormalProcessing, "Unknown latchDestination value; expected NormalProcessing");
break;
Expand Down Expand Up @@ -163,7 +163,7 @@ internal OperationStatus InternalRMW<TInput, TOutput, TContext, TSessionFunction
status = OperationStatus.RETRY_LATER;
goto LatchRelease;
}
if (stackCtx.recSrc.LogicalAddress >= hlogBase.HeadAddress)
if (stackCtx.recSrc.HasMainLogSrc)
{
// Safe Read-Only Region: CopyUpdate to create a record in the mutable region.
srcRecordInfo = ref stackCtx.recSrc.GetInfo();
Expand Down Expand Up @@ -325,7 +325,7 @@ private LatchDestination CheckCPRConsistencyRMW(Phase phase, ref OperationStackC
if (IsRecordVersionNew(stackCtx.recSrc.LogicalAddress))
break; // Normal Processing; V+1 thread encountered a record in V+1

if (stackCtx.recSrc.LogicalAddress >= hlogBase.HeadAddress)
if (stackCtx.recSrc.HasMainLogSrc)
return LatchDestination.CreateNewRecord; // Record is in memory so force creation of a (V+1) record
break; // Normal Processing; the record is below HeadAddress so the operation will go pending

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,10 @@ internal OperationStatus InternalUpsert<TInput, TOutput, TContext, TSessionFunct
case LatchDestination.Retry:
goto LatchRelease;
case LatchDestination.CreateNewRecord:
if (stackCtx.recSrc.LogicalAddress >= hlogBase.HeadAddress)
if (stackCtx.recSrc.HasMainLogSrc)
srcRecordInfo = ref stackCtx.recSrc.GetInfo();

goto CreateNewRecord;

default:
Debug.Assert(latchDestination == LatchDestination.NormalProcessing, "Unknown latchDestination value; expected NormalProcessing");
break;
Expand Down Expand Up @@ -142,11 +142,10 @@ internal OperationStatus InternalUpsert<TInput, TOutput, TContext, TSessionFunct
// ConcurrentWriter failed (e.g. insufficient space, another thread set Tombstone, etc). Write a new record, but track that we have to seal and unlock this one.
goto CreateNewRecord;
}
if (stackCtx.recSrc.LogicalAddress >= hlogBase.HeadAddress)
if (stackCtx.recSrc.HasMainLogSrc)
{
// Safe Read-Only Region: Create a record in the mutable region, but set srcRecordInfo in case we are eliding.
if (stackCtx.recSrc.HasMainLogSrc)
srcRecordInfo = ref stackCtx.recSrc.GetInfo();
srcRecordInfo = ref stackCtx.recSrc.GetInfo();
goto CreateNewRecord;
}

Expand Down

0 comments on commit a498ef4

Please sign in to comment.