Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[C#] Misc v2 fixes #675

Merged
merged 7 commits into from
Mar 10, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion cs/src/core/Async/RMWAsync.cs
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,6 @@ private Status CallInternalRMW<Input, Output, Context>(IFasterSession<Key, Value
flushEvent = hlog.FlushEvent;
internalStatus = InternalRMW(ref key, ref input, ref output, ref context, ref pcontext, fasterSession, currentCtx, serialNo);
} while (internalStatus == OperationStatus.RETRY_NOW || internalStatus == OperationStatus.RETRY_LATER);
pcontext.HasExpiration = false;

if (OperationStatusUtils.TryConvertToStatusCode(internalStatus, out Status status))
return status;
Expand Down
2 changes: 1 addition & 1 deletion cs/src/core/ClientSession/ClientSession.cs
Original file line number Diff line number Diff line change
Expand Up @@ -888,7 +888,7 @@ public bool ConcurrentReaderLock(ref Key key, ref Input input, ref Value value,
try
{
lockFailed = false;
return _clientSession.functions.ConcurrentReader(ref key, ref input, ref value, ref dst, ref readInfo);
return ConcurrentReaderNoLock(ref key, ref input, ref value, ref dst, ref recordInfo, ref readInfo);
}
finally
{
Expand Down
4 changes: 2 additions & 2 deletions cs/src/core/ClientSession/UnsafeContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -394,7 +394,7 @@ public bool ConcurrentReader(ref Key key, ref Input input, ref Value value, ref
{
lockFailed = false;
return this.DisableLocking
? _clientSession.functions.ConcurrentReader(ref key, ref input, ref value, ref dst, ref readInfo)
? ConcurrentReaderNoLock(ref key, ref input, ref value, ref dst, ref recordInfo, ref readInfo)
: ConcurrentReaderLock(ref key, ref input, ref value, ref dst, ref recordInfo, ref readInfo, out lockFailed);
}

Expand All @@ -417,7 +417,7 @@ public bool ConcurrentReaderLock(ref Key key, ref Input input, ref Value value,
try
{
lockFailed = false;
return _clientSession.functions.ConcurrentReader(ref key, ref input, ref value, ref dst, ref readInfo);
return ConcurrentReaderNoLock(ref key, ref input, ref value, ref dst, ref recordInfo, ref readInfo);
}
finally
{
Expand Down
7 changes: 0 additions & 7 deletions cs/src/core/Index/Common/Contexts.cs
Original file line number Diff line number Diff line change
Expand Up @@ -204,13 +204,6 @@ internal bool HasPrevHighestKeyHashAddress
set => operationFlags = value ? (ushort)(operationFlags | kHasPrevHighestKeyHashAddress) : (ushort)(operationFlags & ~kHasPrevHighestKeyHashAddress);
}

// Carries the Expired flag across RETRY_NOW
internal bool HasExpiration
{
get => (operationFlags & kHasExpiration) != 0;
set => operationFlags = value ? (ushort)(operationFlags | kHasExpiration) : (ushort)(operationFlags & ~kHasExpiration);
}

public void Dispose()
{
key?.Dispose();
Expand Down
430 changes: 154 additions & 276 deletions cs/src/core/Index/FASTER/FASTERImpl.cs

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions cs/src/core/VarLen/SpanByte.cs
Original file line number Diff line number Diff line change
Expand Up @@ -360,6 +360,7 @@ public bool TryCopyTo(ref SpanByte dst)
/// <param name="dst"></param>
public void CopyTo(ref SpanByte dst)
{
dst.UnmarkExtraMetadata();
dst.ExtraMetadata = ExtraMetadata;
AsReadOnlySpan().CopyTo(dst.AsSpan());
}
Expand Down
9 changes: 6 additions & 3 deletions cs/test/ExpirationTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ public override bool NeedInitialUpdate(ref int key, ref ExpirationInput input, r
{
// Reject the update-in-original-record
output.result = ExpirationResult.DeletedThenUpdateRejected;
return false;
// return false;
}
return output.result == ExpirationResult.DeletedThenUpdateRejected;
case TestOp.DeleteIfValueEqualsThenUpdate:
Expand Down Expand Up @@ -331,6 +331,7 @@ public override bool CopyUpdater(ref int key, ref ExpirationInput input, ref VLV
public override bool InitialUpdater(ref int key, ref ExpirationInput input, ref VLValue value, ref ExpirationOutput output, ref RMWInfo rmwInfo)
{
output.AddFunc(Funcs.InitialUpdater);
value.length = 2;
value.field1 = input.value;

// If InPlaceUpdater returned Delete, let the caller know both operations happened. Similarly, we may be
Expand Down Expand Up @@ -894,7 +895,7 @@ public void DeleteThenUpdateTest([Values] FlushMode flushMode, [Values] KeyEqual
bool isEqual = keyEquality == KeyEquality.Equal;
TestOp testOp = isEqual ? TestOp.DeleteIfValueEqualsThenUpdate : TestOp.DeleteIfValueNotEqualsThenUpdate;
var key = ModifyKey;
Status expectedFoundRmwStatus = flushMode == FlushMode.NoFlush ? new(StatusCode.Expired | StatusCode.InPlaceUpdatedRecord) : new(StatusCode.Expired | StatusCode.CreatedRecord);
Status expectedFoundRmwStatus = flushMode == FlushMode.NoFlush ? new(StatusCode.Expired | StatusCode.InPlaceUpdatedRecord) : new(StatusCode.NotFound | StatusCode.Expired | StatusCode.CreatedRecord);

VerifyKeyNotCreated(testOp, flushMode);
session.ctx.phase = phase;
Expand Down Expand Up @@ -941,7 +942,9 @@ public void DeleteThenInsertTest([Values] FlushMode flushMode, [Values] KeyEqual
bool isEqual = keyEquality == KeyEquality.Equal;
TestOp testOp = isEqual ? TestOp.DeleteIfValueEqualsThenInsert : TestOp.DeleteIfValueNotEqualsThenInsert;
var key = ModifyKey;
Status expectedFoundRmwStatus = new(StatusCode.Expired | StatusCode.CreatedRecord);
Status expectedFoundRmwStatus = flushMode == FlushMode.NoFlush ?
new(StatusCode.InPlaceUpdatedRecord | StatusCode.Expired ) :
new(StatusCode.NotFound | StatusCode.Expired | StatusCode.CreatedRecord);

VerifyKeyNotCreated(testOp, flushMode);
session.ctx.phase = phase;
Expand Down