Skip to content

Commit

Permalink
Fix latching logic to work uniformly for normal and relaxed CPR. (#260)
Browse files Browse the repository at this point in the history
Fix latching logic to work uniformly for normal and relaxed CPR.
Eliminated code redundancy for continue RMW.
  • Loading branch information
badrishc authored Apr 9, 2020
1 parent a0ec4aa commit 54b92c9
Show file tree
Hide file tree
Showing 4 changed files with 524 additions and 841 deletions.
10 changes: 5 additions & 5 deletions cs/src/core/ClientSession/FASTERAsync.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,21 +47,21 @@ internal async ValueTask CompletePendingAsync(ClientSession<Key, Value, Input, O

await clientSession.ctx.prevCtx.pendingReads.WaitEmptyAsync();

await CompleteIOPendingRequestsAsync(clientSession.ctx.prevCtx, clientSession.ctx, clientSession, token);
await InternalCompletePendingRequestsAsync(clientSession.ctx.prevCtx, clientSession.ctx, clientSession, token);
Debug.Assert(clientSession.ctx.prevCtx.ioPendingRequests.Count == 0);

if (clientSession.ctx.prevCtx.retryRequests.Count > 0)
{
CompleteRetryRequests(clientSession.ctx.prevCtx, clientSession.ctx, clientSession);
InternalCompleteRetryRequests(clientSession.ctx.prevCtx, clientSession.ctx, clientSession);
}

done &= (clientSession.ctx.prevCtx.HasNoPendingRequests);
}
}
#endregion

await CompleteIOPendingRequestsAsync(clientSession.ctx, clientSession.ctx, clientSession, token);
CompleteRetryRequests(clientSession.ctx, clientSession.ctx, clientSession);
await InternalCompletePendingRequestsAsync(clientSession.ctx, clientSession.ctx, clientSession, token);
InternalCompleteRetryRequests(clientSession.ctx, clientSession.ctx, clientSession);

Debug.Assert(clientSession.ctx.HasNoPendingRequests);

Expand Down Expand Up @@ -108,7 +108,7 @@ internal ReadAsyncInternal(FasterKV<Key, Value, Input, Output, Context, Function
{
Debug.Assert(_fasterKV.RelaxedCPR);

_result = _fasterKV.InternalCompleteIOPendingReadRequestsAsync(
_result = _fasterKV.InternalCompletePendingReadRequestAsync(
_clientSession.ctx, _clientSession.ctx, _diskRequest, _pendingContext);
}
finally
Expand Down
3 changes: 2 additions & 1 deletion cs/src/core/Index/Common/Contexts.cs
Original file line number Diff line number Diff line change
Expand Up @@ -72,19 +72,20 @@ internal struct PendingContext
{
// User provided information
internal OperationType type;

internal IHeapContainer<Key> key;
internal IHeapContainer<Value> value;
internal Input input;
internal Output output;
internal Context userContext;


// Some additional information about the previous attempt
internal long id;
internal int version;
internal long logicalAddress;
internal long serialNum;
internal HashBucketEntry entry;
internal LatchOperation heldLatch;

public void Dispose()
{
Expand Down
Loading

0 comments on commit 54b92c9

Please sign in to comment.