From c4db89d6641bba6443e1145b747409537447cc4a Mon Sep 17 00:00:00 2001 From: Ted Hart <15467143+TedHartMS@users.noreply.github.com> Date: Wed, 29 May 2024 15:01:06 -0700 Subject: [PATCH] More cleanup of no-longer-needed code (#423) * More cleanup of unused code: fields in PendingContext, LatchDestination.CreatePendingContext * WIP removing SerialNo, ResumeSession, etc. * A few fixes for serialNo removal from API * Finish removal of session recovery and related cleanup * Fix loading of earlier Checkpoints * 'format' fixes --- .../Functions/MainStore/CallbackMethods.cs | 5 - .../Functions/ObjectStore/CallbackMethods.cs | 5 - .../Storage/Session/MainStore/MainStoreOps.cs | 2 +- .../cs/benchmark/FixedLenYcsbBenchmark.cs | 20 +- .../Tsavorite/cs/benchmark/Functions.cs | 6 - .../cs/benchmark/SpanByteYcsbBenchmark.cs | 20 +- .../cs/src/core/Allocator/AllocatorScan.cs | 8 +- .../cs/src/core/Async/DeleteAsync.cs | 8 +- .../Tsavorite/cs/src/core/Async/RMWAsync.cs | 12 +- .../Tsavorite/cs/src/core/Async/ReadAsync.cs | 21 +- .../cs/src/core/Async/UpsertAsync.cs | 8 +- .../cs/src/core/ClientSession/BasicContext.cs | 252 +++++++-------- .../src/core/ClientSession/ClientSession.cs | 304 ++++++++---------- .../ClientSession/ClientSessionBuilder.cs | 50 --- .../core/ClientSession/ITsavoriteContext.cs | 189 ++++------- .../src/core/ClientSession/LockableContext.cs | 276 ++++++++-------- .../ClientSession/LockableUnsafeContext.cs | 268 +++++++-------- .../src/core/ClientSession/UnsafeContext.cs | 268 +++++++-------- .../core/Compaction/ICompactionFunctions.cs | 2 +- .../core/Compaction/LogCompactionFunctions.cs | 2 - .../core/Compaction/TsavoriteCompaction.cs | 2 +- .../cs/src/core/Index/Common/Contexts.cs | 108 +------ .../core/Index/Interfaces/FunctionsBase.cs | 2 - .../src/core/Index/Interfaces/IFunctions.cs | 10 - .../Index/Interfaces/ITsavoriteSession.cs | 1 - .../Index/Interfaces/NullTsavoriteSession.cs | 4 - .../cs/src/core/Index/Recovery/Recovery.cs | 16 +- .../HybridLogCheckpointTask.cs | 21 +- .../Synchronization/TsavoriteStateMachine.cs | 59 ---- .../VersionChangeStateMachine.cs | 7 +- .../Implementation/ConditionalCopyToTail.cs | 13 +- .../Implementation/ContinuePending.cs | 8 +- .../Implementation/EpochOperations.cs | 2 - .../Implementation/HandleOperationStatus.cs | 1 - .../Index/Tsavorite/Implementation/Helpers.cs | 1 - .../Implementation/InternalDelete.cs | 14 +- .../Tsavorite/Implementation/InternalRMW.cs | 14 +- .../Tsavorite/Implementation/InternalRead.cs | 22 +- .../Implementation/InternalUpsert.cs | 12 +- .../cs/src/core/Index/Tsavorite/Tsavorite.cs | 103 ++---- .../core/Index/Tsavorite/TsavoriteThread.cs | 60 +--- .../src/core/Index/Tsavorite/WriteReason.cs | 2 +- .../cs/test/AsyncLargeObjectTests.cs | 4 +- libs/storage/Tsavorite/cs/test/AsyncTests.cs | 152 --------- .../Tsavorite/cs/test/BasicStorageTests.cs | 6 +- libs/storage/Tsavorite/cs/test/BasicTests.cs | 153 +++------ .../cs/test/BlittableLogCompactionTests.cs | 26 +- .../cs/test/BlittableLogScanTests.cs | 4 +- .../Tsavorite/cs/test/ExpirationTests.cs | 4 +- .../cs/test/GenericByteArrayTests.cs | 4 +- .../cs/test/GenericDiskDeleteTests.cs | 36 +-- .../cs/test/GenericLogCompactionTests.cs | 26 +- .../Tsavorite/cs/test/GenericLogScanTests.cs | 4 +- .../Tsavorite/cs/test/GenericStringTests.cs | 4 +- .../Tsavorite/cs/test/LargeObjectTests.cs | 4 +- .../cs/test/LockableUnsafeContextTests.cs | 6 +- libs/storage/Tsavorite/cs/test/MiscTests.cs | 14 +- .../Tsavorite/cs/test/NativeReadCacheTests.cs | 38 +-- .../Tsavorite/cs/test/NeedCopyUpdateTests.cs | 6 +- .../Tsavorite/cs/test/ObjectReadCacheTests.cs | 26 +- .../Tsavorite/cs/test/ObjectRecoveryTest.cs | 50 +-- .../Tsavorite/cs/test/ObjectRecoveryTest2.cs | 8 +- .../Tsavorite/cs/test/ObjectRecoveryTest3.cs | 8 +- libs/storage/Tsavorite/cs/test/ObjectTests.cs | 22 +- .../Tsavorite/cs/test/ReadAddressTests.cs | 32 +- .../Tsavorite/cs/test/RecoverContinueTests.cs | 201 ------------ .../Tsavorite/cs/test/RecoveryChecks.cs | 8 - .../Tsavorite/cs/test/RecoveryTests.cs | 46 +-- .../storage/Tsavorite/cs/test/SessionTests.cs | 34 +- .../Tsavorite/cs/test/SharedDirectoryTests.cs | 35 +- .../Tsavorite/cs/test/SimpleAsyncTests.cs | 12 +- .../Tsavorite/cs/test/SimpleRecoveryTest.cs | 20 +- .../Tsavorite/cs/test/SingleWriterTests.cs | 2 +- .../Tsavorite/cs/test/SpanByteTests.cs | 2 +- .../cs/test/SpanByteVLVectorTests.cs | 8 +- .../cs/test/StateMachineBarrierTests.cs | 50 +-- .../Tsavorite/cs/test/StateMachineTests.cs | 145 +-------- .../Tsavorite/cs/test/UnsafeContextTests.cs | 109 +++---- 78 files changed, 1113 insertions(+), 2404 deletions(-) delete mode 100644 libs/storage/Tsavorite/cs/test/AsyncTests.cs delete mode 100644 libs/storage/Tsavorite/cs/test/RecoverContinueTests.cs diff --git a/libs/server/Storage/Functions/MainStore/CallbackMethods.cs b/libs/server/Storage/Functions/MainStore/CallbackMethods.cs index 97afadf492..01b2891531 100644 --- a/libs/server/Storage/Functions/MainStore/CallbackMethods.cs +++ b/libs/server/Storage/Functions/MainStore/CallbackMethods.cs @@ -19,10 +19,5 @@ public void ReadCompletionCallback(ref SpanByte key, ref SpanByte input, ref Spa public void RMWCompletionCallback(ref SpanByte key, ref SpanByte input, ref SpanByteAndMemory output, long ctx, Status status, RecordMetadata recordMetadata) { } - - /// - public void CheckpointCompletionCallback(int sessionID, string sessionName, CommitPoint commitPoint) - { - } } } \ No newline at end of file diff --git a/libs/server/Storage/Functions/ObjectStore/CallbackMethods.cs b/libs/server/Storage/Functions/ObjectStore/CallbackMethods.cs index 6fe8bde205..ce471143f0 100644 --- a/libs/server/Storage/Functions/ObjectStore/CallbackMethods.cs +++ b/libs/server/Storage/Functions/ObjectStore/CallbackMethods.cs @@ -19,10 +19,5 @@ public void ReadCompletionCallback(ref byte[] key, ref SpanByte input, ref Garne public void RMWCompletionCallback(ref byte[] key, ref SpanByte input, ref GarnetObjectStoreOutput output, long ctx, Status status, RecordMetadata recordMetadata) { } - - /// - public void CheckpointCompletionCallback(int sessionID, string sessionName, CommitPoint commitPoint) - { - } } } \ No newline at end of file diff --git a/libs/server/Storage/Session/MainStore/MainStoreOps.cs b/libs/server/Storage/Session/MainStore/MainStoreOps.cs index de79ae37d2..9fd6840967 100644 --- a/libs/server/Storage/Session/MainStore/MainStoreOps.cs +++ b/libs/server/Storage/Session/MainStore/MainStoreOps.cs @@ -44,7 +44,7 @@ public unsafe GarnetStatus ReadWithUnsafeContext(ArgSlice key, ref Spa long ctx = default; epochChanged = false; - var status = context.Read(ref _key, ref Unsafe.AsRef(in input), ref output, ctx, 0); + var status = context.Read(ref _key, ref Unsafe.AsRef(in input), ref output, ctx); if (status.IsPending) { diff --git a/libs/storage/Tsavorite/cs/benchmark/FixedLenYcsbBenchmark.cs b/libs/storage/Tsavorite/cs/benchmark/FixedLenYcsbBenchmark.cs index 4059ed8025..115df8cafd 100644 --- a/libs/storage/Tsavorite/cs/benchmark/FixedLenYcsbBenchmark.cs +++ b/libs/storage/Tsavorite/cs/benchmark/FixedLenYcsbBenchmark.cs @@ -166,23 +166,23 @@ private void RunYcsbUnsafeContext(int thread_idx) int r = (int)rng.Generate(100); // rng.Next() is not inclusive of the upper bound so this will be <= 99 if (r < readPercent) { - uContext.Read(ref txn_keys_[idx], ref input, ref output, Empty.Default, 1); + uContext.Read(ref txn_keys_[idx], ref input, ref output, Empty.Default); ++reads_done; continue; } if (r < upsertPercent) { - uContext.Upsert(ref txn_keys_[idx], ref value, Empty.Default, 1); + uContext.Upsert(ref txn_keys_[idx], ref value, Empty.Default); ++writes_done; continue; } if (r < rmwPercent) { - uContext.RMW(ref txn_keys_[idx], ref input_[idx & 0x7], Empty.Default, 1); + uContext.RMW(ref txn_keys_[idx], ref input_[idx & 0x7], Empty.Default); ++writes_done; continue; } - uContext.Delete(ref txn_keys_[idx], Empty.Default, 1); + uContext.Delete(ref txn_keys_[idx], Empty.Default); ++deletes_done; } @@ -265,23 +265,23 @@ private void RunYcsbSafeContext(int thread_idx) int r = (int)rng.Generate(100); // rng.Next() is not inclusive of the upper bound so this will be <= 99 if (r < readPercent) { - session.Read(ref txn_keys_[idx], ref input, ref output, Empty.Default, 1); + session.Read(ref txn_keys_[idx], ref input, ref output, Empty.Default); ++reads_done; continue; } if (r < upsertPercent) { - session.Upsert(ref txn_keys_[idx], ref value, Empty.Default, 1); + session.Upsert(ref txn_keys_[idx], ref value, Empty.Default); ++writes_done; continue; } if (r < rmwPercent) { - session.RMW(ref txn_keys_[idx], ref input_[idx & 0x7], Empty.Default, 1); + session.RMW(ref txn_keys_[idx], ref input_[idx & 0x7], Empty.Default); ++writes_done; continue; } - session.Delete(ref txn_keys_[idx], Empty.Default, 1); + session.Delete(ref txn_keys_[idx], Empty.Default); ++deletes_done; } } @@ -465,7 +465,7 @@ private void SetupYcsbUnsafeContext(int thread_idx) } } - uContext.Upsert(ref init_keys_[idx], ref value, Empty.Default, 1); + uContext.Upsert(ref init_keys_[idx], ref value, Empty.Default); } #if DASHBOARD count += (int)kChunkSize; @@ -522,7 +522,7 @@ private void SetupYcsbSafeContext(int thread_idx) } } - session.Upsert(ref init_keys_[idx], ref value, Empty.Default, 1); + session.Upsert(ref init_keys_[idx], ref value, Empty.Default); } } diff --git a/libs/storage/Tsavorite/cs/benchmark/Functions.cs b/libs/storage/Tsavorite/cs/benchmark/Functions.cs index ddd2c7a21e..df16f88372 100644 --- a/libs/storage/Tsavorite/cs/benchmark/Functions.cs +++ b/libs/storage/Tsavorite/cs/benchmark/Functions.cs @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -using System.Diagnostics; using System.Runtime.CompilerServices; using Tsavorite.core; @@ -17,11 +16,6 @@ public void ReadCompletionCallback(ref Key key, ref Input input, ref Output outp { } - public void CheckpointCompletionCallback(int sessionID, string sessionName, CommitPoint commitPoint) - { - Debug.WriteLine($"Session {sessionID} ({(sessionName ?? "null")}) reports persistence until {commitPoint.UntilSerialNo}"); - } - // Read functions [MethodImpl(MethodImplOptions.AggressiveInlining)] public bool SingleReader(ref Key key, ref Input input, ref Value value, ref Output dst, ref ReadInfo readInfo) diff --git a/libs/storage/Tsavorite/cs/benchmark/SpanByteYcsbBenchmark.cs b/libs/storage/Tsavorite/cs/benchmark/SpanByteYcsbBenchmark.cs index b8c7c40b2b..9665084c79 100644 --- a/libs/storage/Tsavorite/cs/benchmark/SpanByteYcsbBenchmark.cs +++ b/libs/storage/Tsavorite/cs/benchmark/SpanByteYcsbBenchmark.cs @@ -179,23 +179,23 @@ private void RunYcsbUnsafeContext(int thread_idx) int r = (int)rng.Generate(100); // rng.Next() is not inclusive of the upper bound so this will be <= 99 if (r < readPercent) { - uContext.Read(ref SpanByte.Reinterpret(ref txn_keys_[idx]), ref _input, ref _output, Empty.Default, 1); + uContext.Read(ref SpanByte.Reinterpret(ref txn_keys_[idx]), ref _input, ref _output, Empty.Default); ++reads_done; continue; } if (r < upsertPercent) { - uContext.Upsert(ref SpanByte.Reinterpret(ref txn_keys_[idx]), ref _value, Empty.Default, 1); + uContext.Upsert(ref SpanByte.Reinterpret(ref txn_keys_[idx]), ref _value, Empty.Default); ++writes_done; continue; } if (r < rmwPercent) { - uContext.RMW(ref SpanByte.Reinterpret(ref txn_keys_[idx]), ref _input, Empty.Default, 1); + uContext.RMW(ref SpanByte.Reinterpret(ref txn_keys_[idx]), ref _input, Empty.Default); ++writes_done; continue; } - uContext.Delete(ref SpanByte.Reinterpret(ref txn_keys_[idx]), Empty.Default, 1); + uContext.Delete(ref SpanByte.Reinterpret(ref txn_keys_[idx]), Empty.Default); ++deletes_done; } @@ -293,23 +293,23 @@ private void RunYcsbSafeContext(int thread_idx) int r = (int)rng.Generate(100); // rng.Next() is not inclusive of the upper bound so this will be <= 99 if (r < readPercent) { - session.Read(ref SpanByte.Reinterpret(ref txn_keys_[idx]), ref _input, ref _output, Empty.Default, 1); + session.Read(ref SpanByte.Reinterpret(ref txn_keys_[idx]), ref _input, ref _output, Empty.Default); ++reads_done; continue; } if (r < upsertPercent) { - session.Upsert(ref SpanByte.Reinterpret(ref txn_keys_[idx]), ref _value, Empty.Default, 1); + session.Upsert(ref SpanByte.Reinterpret(ref txn_keys_[idx]), ref _value, Empty.Default); ++writes_done; continue; } if (r < rmwPercent) { - session.RMW(ref SpanByte.Reinterpret(ref txn_keys_[idx]), ref _input, Empty.Default, 1); + session.RMW(ref SpanByte.Reinterpret(ref txn_keys_[idx]), ref _input, Empty.Default); ++writes_done; continue; } - session.Delete(ref SpanByte.Reinterpret(ref txn_keys_[idx]), Empty.Default, 1); + session.Delete(ref SpanByte.Reinterpret(ref txn_keys_[idx]), Empty.Default); ++deletes_done; } @@ -514,7 +514,7 @@ private void SetupYcsbUnsafeContext(int thread_idx) } } - uContext.Upsert(ref SpanByte.Reinterpret(ref init_keys_[idx]), ref _value, Empty.Default, 1); + uContext.Upsert(ref SpanByte.Reinterpret(ref init_keys_[idx]), ref _value, Empty.Default); } #if DASHBOARD count += (int)kChunkSize; @@ -572,7 +572,7 @@ private void SetupYcsbSafeContext(int thread_idx) } } - session.Upsert(ref SpanByte.Reinterpret(ref init_keys_[idx]), ref _value, Empty.Default, 1); + session.Upsert(ref SpanByte.Reinterpret(ref init_keys_[idx]), ref _value, Empty.Default); } } diff --git a/libs/storage/Tsavorite/cs/src/core/Allocator/AllocatorScan.cs b/libs/storage/Tsavorite/cs/src/core/Allocator/AllocatorScan.cs index 4446b53015..84bbd9120d 100644 --- a/libs/storage/Tsavorite/cs/src/core/Allocator/AllocatorScan.cs +++ b/libs/storage/Tsavorite/cs/src/core/Allocator/AllocatorScan.cs @@ -280,7 +280,7 @@ internal Status ConditionalScanPush(Ts if (needIO) { // A more recent version of the key was not (yet) found and we need another IO to continue searching. - internalStatus = PrepareIOForConditionalScan(tsavoriteSession, ref pendingContext, ref key, ref input, ref value, ref output, default, 0L, + internalStatus = PrepareIOForConditionalScan(tsavoriteSession, ref pendingContext, ref key, ref input, ref value, ref output, default, ref stackCtx, minAddress, scanCursorState); } else @@ -308,13 +308,13 @@ internal Status ConditionalScanPush(Ts [MethodImpl(MethodImplOptions.AggressiveInlining)] internal static OperationStatus PrepareIOForConditionalScan(TsavoriteSession tsavoriteSession, ref TsavoriteKV.PendingContext pendingContext, - ref Key key, ref Input input, ref Value value, ref Output output, Context userContext, long lsn, + ref Key key, ref Input input, ref Value value, ref Output output, Context userContext, ref OperationStackContext stackCtx, long minAddress, ScanCursorState scanCursorState) where TsavoriteSession : ITsavoriteSession { // WriteReason is not surfaced for this operation, so pick anything. var status = tsavoriteSession.Store.PrepareIOForConditionalOperation(tsavoriteSession, ref pendingContext, ref key, ref input, ref value, ref output, - userContext, lsn, ref stackCtx, minAddress, WriteReason.Compaction, OperationType.CONDITIONAL_SCAN_PUSH); + userContext, ref stackCtx, minAddress, WriteReason.Compaction, OperationType.CONDITIONAL_SCAN_PUSH); pendingContext.scanCursorState = scanCursorState; return status; } @@ -345,8 +345,6 @@ public void PostInitialUpdater(ref Key key, ref Input input, ref Value value, re public void RMWCompletionCallback(ref Key key, ref Input input, ref Output output, Empty ctx, Status status, RecordMetadata recordMetadata) { } - public void CheckpointCompletionCallback(int sessionID, string sessionName, CommitPoint commitPoint) { } - public int GetRMWModifiedValueLength(ref Value value, ref Input input) => 0; public int GetRMWInitialValueLength(ref Input input) => 0; diff --git a/libs/storage/Tsavorite/cs/src/core/Async/DeleteAsync.cs b/libs/storage/Tsavorite/cs/src/core/Async/DeleteAsync.cs index 03f2f437be..9b9eb8a855 100644 --- a/libs/storage/Tsavorite/cs/src/core/Async/DeleteAsync.cs +++ b/libs/storage/Tsavorite/cs/src/core/Async/DeleteAsync.cs @@ -32,7 +32,7 @@ public Status DoFastOperation(TsavoriteKV tsavoriteKV, ref PendingCo var keyHash = deleteOptions.KeyHash ?? tsavoriteKV.comparer.GetHashCode64(ref key); do { - internalStatus = tsavoriteKV.InternalDelete(ref key, keyHash, ref pendingContext.userContext, ref pendingContext, tsavoriteSession, pendingContext.serialNum); + internalStatus = tsavoriteKV.InternalDelete(ref key, keyHash, ref pendingContext.userContext, ref pendingContext, tsavoriteSession); } while (tsavoriteKV.HandleImmediateRetryStatus(internalStatus, tsavoriteSession, ref pendingContext)); output = default; return TranslateStatus(internalStatus); @@ -85,7 +85,7 @@ public ValueTask> CompleteAsync(Cancel [MethodImpl(MethodImplOptions.AggressiveInlining)] internal ValueTask> DeleteAsync(TsavoriteSession tsavoriteSession, - ref Key key, ref DeleteOptions deleteOptions, Context userContext, long serialNo, CancellationToken token = default) + ref Key key, ref DeleteOptions deleteOptions, Context userContext, CancellationToken token = default) where TsavoriteSession : ITsavoriteSession { var pcontext = new PendingContext { IsAsync = true }; @@ -97,7 +97,7 @@ internal ValueTask> DeleteAsync> DeleteAsync= tsavoriteSession.Ctx.serialNum, "Operation serial numbers must be non-decreasing"); - tsavoriteSession.Ctx.serialNum = serialNo; tsavoriteSession.UnsafeSuspendThread(); } diff --git a/libs/storage/Tsavorite/cs/src/core/Async/RMWAsync.cs b/libs/storage/Tsavorite/cs/src/core/Async/RMWAsync.cs index 61c32b345d..b5c925d1c8 100644 --- a/libs/storage/Tsavorite/cs/src/core/Async/RMWAsync.cs +++ b/libs/storage/Tsavorite/cs/src/core/Async/RMWAsync.cs @@ -32,7 +32,7 @@ public Status DoFastOperation(TsavoriteKV tsavoriteKV, ref PendingCo Status status = !diskRequest.IsDefault() ? tsavoriteKV.InternalCompletePendingRequestFromContext(tsavoriteSession, diskRequest, ref pendingContext, out AsyncIOContext newDiskRequest) : tsavoriteKV.CallInternalRMW(tsavoriteSession, ref pendingContext, ref pendingContext.key.Get(), ref pendingContext.input.Get(), ref pendingContext.output, ref rmwOptions, - pendingContext.userContext, pendingContext.serialNum, out newDiskRequest); + pendingContext.userContext, out newDiskRequest); output = pendingContext.output; diskRequest = newDiskRequest; return status; @@ -111,7 +111,7 @@ public ValueTask> CompleteAsync(Cancella [MethodImpl(MethodImplOptions.AggressiveInlining)] internal ValueTask> RmwAsync(TsavoriteSession tsavoriteSession, - ref Key key, ref Input input, ref RMWOptions rmwOptions, Context context, long serialNo, CancellationToken token = default) + ref Key key, ref Input input, ref RMWOptions rmwOptions, Context context, CancellationToken token = default) where TsavoriteSession : ITsavoriteSession { var pcontext = new PendingContext { IsAsync = true }; @@ -121,14 +121,12 @@ internal ValueTask> RmwAsync>(new RmwAsyncResult(status, output, new RecordMetadata(pcontext.recordInfo, pcontext.logicalAddress))); } finally { - Debug.Assert(serialNo >= tsavoriteSession.Ctx.serialNum, "Operation serial numbers must be non-decreasing"); - tsavoriteSession.Ctx.serialNum = serialNo; tsavoriteSession.UnsafeSuspendThread(); } @@ -137,12 +135,12 @@ internal ValueTask> RmwAsync(ITsavoriteSession tsavoriteSession, ref PendingContext pcontext, - ref Key key, ref Input input, ref Output output, ref RMWOptions rmwOptions, Context context, long serialNo, out AsyncIOContext diskRequest) + ref Key key, ref Input input, ref Output output, ref RMWOptions rmwOptions, Context context, out AsyncIOContext diskRequest) { OperationStatus internalStatus; var keyHash = rmwOptions.KeyHash ?? comparer.GetHashCode64(ref key); do - internalStatus = InternalRMW(ref key, keyHash, ref input, ref output, ref context, ref pcontext, tsavoriteSession, serialNo); + internalStatus = InternalRMW(ref key, keyHash, ref input, ref output, ref context, ref pcontext, tsavoriteSession); while (HandleImmediateRetryStatus(internalStatus, tsavoriteSession, ref pcontext)); return HandleOperationStatus(tsavoriteSession.Ctx, ref pcontext, internalStatus, out diskRequest); diff --git a/libs/storage/Tsavorite/cs/src/core/Async/ReadAsync.cs b/libs/storage/Tsavorite/cs/src/core/Async/ReadAsync.cs index 66fb1111a2..606fc8f8a4 100644 --- a/libs/storage/Tsavorite/cs/src/core/Async/ReadAsync.cs +++ b/libs/storage/Tsavorite/cs/src/core/Async/ReadAsync.cs @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -using System.Diagnostics; using System.Runtime.CompilerServices; using System.Runtime.ExceptionServices; using System.Threading; @@ -34,7 +33,7 @@ public Status DoFastOperation(TsavoriteKV tsavoriteKV, ref PendingCo Status status = !diskRequest.IsDefault() ? tsavoriteKV.InternalCompletePendingRequestFromContext(tsavoriteSession, diskRequest, ref pendingContext, out var newDiskRequest) : tsavoriteKV.CallInternalRead(tsavoriteSession, ref pendingContext, readAtAddress, ref pendingContext.key.Get(), ref pendingContext.input.Get(), ref pendingContext.output, - ref readOptions, pendingContext.userContext, pendingContext.serialNum, out newDiskRequest); + ref readOptions, pendingContext.userContext, out newDiskRequest); output = pendingContext.output; diskRequest = newDiskRequest; return status; @@ -105,7 +104,7 @@ internal ReadAsyncResult(TsavoriteKV tsavoriteKV, ITsavoriteSession< [MethodImpl(MethodImplOptions.AggressiveInlining)] internal ValueTask> ReadAsync(ITsavoriteSession tsavoriteSession, - ref Key key, ref Input input, ref ReadOptions readOptions, Context context, long serialNo, CancellationToken token, bool noKey = false) + ref Key key, ref Input input, ref ReadOptions readOptions, Context context, CancellationToken token, bool noKey = false) { var pcontext = new PendingContext(tsavoriteSession.Ctx.ReadCopyOptions, ref readOptions, isAsync: true, noKey: noKey); var diskRequest = default(AsyncIOContext); @@ -114,14 +113,12 @@ internal ValueTask> ReadAsync>(new ReadAsyncResult(status, output, new RecordMetadata(pcontext.recordInfo, pcontext.logicalAddress))); } finally { - Debug.Assert(serialNo >= tsavoriteSession.Ctx.serialNum, "Operation serial numbers must be non-decreasing"); - tsavoriteSession.Ctx.serialNum = serialNo; tsavoriteSession.UnsafeSuspendThread(); } @@ -130,7 +127,7 @@ internal ValueTask> ReadAsync> ReadAtAddressAsync(ITsavoriteSession tsavoriteSession, - long readAtAddress, ref Key key, ref Input input, ref ReadOptions readOptions, Context context, long serialNo, CancellationToken token, bool noKey = false) + long readAtAddress, ref Key key, ref Input input, ref ReadOptions readOptions, Context context, CancellationToken token, bool noKey = false) { var pcontext = new PendingContext(tsavoriteSession.Ctx.ReadCopyOptions, ref readOptions, isAsync: true, noKey: noKey); var diskRequest = default(AsyncIOContext); @@ -139,14 +136,12 @@ internal ValueTask> ReadAtAddressAsync>(new ReadAsyncResult(status, output, new RecordMetadata(pcontext.recordInfo, pcontext.logicalAddress))); } finally { - Debug.Assert(serialNo >= tsavoriteSession.Ctx.serialNum, "Operation serial numbers must be non-decreasing"); - tsavoriteSession.Ctx.serialNum = serialNo; tsavoriteSession.UnsafeSuspendThread(); } @@ -155,7 +150,7 @@ internal ValueTask> ReadAtAddressAsync(ITsavoriteSession tsavoriteSession, - ref PendingContext pcontext, long readAtAddress, ref Key key, ref Input input, ref Output output, ref ReadOptions readOptions, Context context, long serialNo, + ref PendingContext pcontext, long readAtAddress, ref Key key, ref Input input, ref Output output, ref ReadOptions readOptions, Context context, out AsyncIOContext diskRequest) { OperationStatus internalStatus; @@ -163,9 +158,9 @@ private Status CallInternalRead(ITsavoriteSession tsavoriteKV, ref PendingCo do { internalStatus = tsavoriteKV.InternalUpsert(ref key, keyHash, ref pendingContext.input.Get(), ref pendingContext.value.Get(), ref output, - ref pendingContext.userContext, ref pendingContext, tsavoriteSession, pendingContext.serialNum); + ref pendingContext.userContext, ref pendingContext, tsavoriteSession); } while (tsavoriteKV.HandleImmediateRetryStatus(internalStatus, tsavoriteSession, ref pendingContext)); return TranslateStatus(internalStatus); } @@ -110,7 +110,7 @@ public ValueTask> CompleteAsync(Cance [MethodImpl(MethodImplOptions.AggressiveInlining)] internal ValueTask> UpsertAsync(TsavoriteSession tsavoriteSession, - ref Key key, ref Input input, ref Value value, ref UpsertOptions upsertOptions, Context userContext, long serialNo, CancellationToken token = default) + ref Key key, ref Input input, ref Value value, ref UpsertOptions upsertOptions, Context userContext, CancellationToken token = default) where TsavoriteSession : ITsavoriteSession { var pcontext = new PendingContext { IsAsync = true }; @@ -123,7 +123,7 @@ internal ValueTask> UpsertAsync> UpsertAsync= tsavoriteSession.Ctx.serialNum, "Operation serial numbers must be non-decreasing"); - tsavoriteSession.Ctx.serialNum = serialNo; tsavoriteSession.UnsafeSuspendThread(); } diff --git a/libs/storage/Tsavorite/cs/src/core/ClientSession/BasicContext.cs b/libs/storage/Tsavorite/cs/src/core/ClientSession/BasicContext.cs index 539f66a396..edc34587b7 100644 --- a/libs/storage/Tsavorite/cs/src/core/ClientSession/BasicContext.cs +++ b/libs/storage/Tsavorite/cs/src/core/ClientSession/BasicContext.cs @@ -59,318 +59,318 @@ public ValueTask> Co /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public Status Read(ref Key key, ref Input input, ref Output output, Context userContext = default, long serialNo = 0) - => clientSession.Read(ref key, ref input, ref output, userContext, serialNo); + public Status Read(ref Key key, ref Input input, ref Output output, Context userContext = default) + => clientSession.Read(ref key, ref input, ref output, userContext); /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public Status Read(ref Key key, ref Input input, ref Output output, ref ReadOptions readOptions, Context userContext = default, long serialNo = 0) - => clientSession.Read(ref key, ref input, ref output, ref readOptions, userContext, serialNo); + public Status Read(ref Key key, ref Input input, ref Output output, ref ReadOptions readOptions, Context userContext = default) + => clientSession.Read(ref key, ref input, ref output, ref readOptions, userContext); /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public Status Read(Key key, Input input, out Output output, Context userContext = default, long serialNo = 0) - => clientSession.Read(key, input, out output, userContext, serialNo); + public Status Read(Key key, Input input, out Output output, Context userContext = default) + => clientSession.Read(key, input, out output, userContext); /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public Status Read(Key key, Input input, out Output output, ref ReadOptions readOptions, Context userContext = default, long serialNo = 0) - => clientSession.Read(key, input, out output, ref readOptions, userContext, serialNo); + public Status Read(Key key, Input input, out Output output, ref ReadOptions readOptions, Context userContext = default) + => clientSession.Read(key, input, out output, ref readOptions, userContext); /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public Status Read(ref Key key, ref Output output, Context userContext = default, long serialNo = 0) - => clientSession.Read(ref key, ref output, userContext, serialNo); + public Status Read(ref Key key, ref Output output, Context userContext = default) + => clientSession.Read(ref key, ref output, userContext); /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public Status Read(ref Key key, ref Output output, ref ReadOptions readOptions, Context userContext = default, long serialNo = 0) - => clientSession.Read(ref key, ref output, ref readOptions, userContext, serialNo); + public Status Read(ref Key key, ref Output output, ref ReadOptions readOptions, Context userContext = default) + => clientSession.Read(ref key, ref output, ref readOptions, userContext); /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public Status Read(Key key, out Output output, Context userContext = default, long serialNo = 0) - => clientSession.Read(key, out output, userContext, serialNo); + public Status Read(Key key, out Output output, Context userContext = default) + => clientSession.Read(key, out output, userContext); /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public Status Read(Key key, out Output output, ref ReadOptions readOptions, Context userContext = default, long serialNo = 0) - => clientSession.Read(key, out output, ref readOptions, userContext, serialNo); + public Status Read(Key key, out Output output, ref ReadOptions readOptions, Context userContext = default) + => clientSession.Read(key, out output, ref readOptions, userContext); /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public (Status status, Output output) Read(Key key, Context userContext = default, long serialNo = 0) - => clientSession.Read(key, userContext, serialNo); + public (Status status, Output output) Read(Key key, Context userContext = default) + => clientSession.Read(key, userContext); /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public (Status status, Output output) Read(Key key, ref ReadOptions readOptions, Context userContext = default, long serialNo = 0) - => clientSession.Read(key, ref readOptions, userContext, serialNo); + public (Status status, Output output) Read(Key key, ref ReadOptions readOptions, Context userContext = default) + => clientSession.Read(key, ref readOptions, userContext); /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public Status Read(ref Key key, ref Input input, ref Output output, ref ReadOptions readOptions, out RecordMetadata recordMetadata, Context userContext = default, long serialNo = 0) - => clientSession.Read(ref key, ref input, ref output, ref readOptions, out recordMetadata, userContext, serialNo); + public Status Read(ref Key key, ref Input input, ref Output output, ref ReadOptions readOptions, out RecordMetadata recordMetadata, Context userContext = default) + => clientSession.Read(ref key, ref input, ref output, ref readOptions, out recordMetadata, userContext); /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public Status ReadAtAddress(long address, ref Input input, ref Output output, ref ReadOptions readOptions, out RecordMetadata recordMetadata, Context userContext = default, long serialNo = 0) - => clientSession.ReadAtAddress(address, ref input, ref output, ref readOptions, out recordMetadata, userContext, serialNo); + public Status ReadAtAddress(long address, ref Input input, ref Output output, ref ReadOptions readOptions, out RecordMetadata recordMetadata, Context userContext = default) + => clientSession.ReadAtAddress(address, ref input, ref output, ref readOptions, out recordMetadata, userContext); /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public Status ReadAtAddress(long address, ref Key key, ref Input input, ref Output output, ref ReadOptions readOptions, out RecordMetadata recordMetadata, Context userContext = default, long serialNo = 0) - => clientSession.ReadAtAddress(address, ref key, ref input, ref output, ref readOptions, out recordMetadata, userContext, serialNo); + public Status ReadAtAddress(long address, ref Key key, ref Input input, ref Output output, ref ReadOptions readOptions, out RecordMetadata recordMetadata, Context userContext = default) + => clientSession.ReadAtAddress(address, ref key, ref input, ref output, ref readOptions, out recordMetadata, userContext); /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ValueTask.ReadAsyncResult> ReadAsync(ref Key key, ref Input input, Context userContext = default, long serialNo = 0, CancellationToken cancellationToken = default) - => clientSession.ReadAsync(ref key, ref input, userContext, serialNo, cancellationToken); + public ValueTask.ReadAsyncResult> ReadAsync(ref Key key, ref Input input, Context userContext = default, CancellationToken cancellationToken = default) + => clientSession.ReadAsync(ref key, ref input, userContext, cancellationToken); /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ValueTask.ReadAsyncResult> ReadAsync(Key key, Input input, Context context = default, long serialNo = 0, CancellationToken token = default) - => clientSession.ReadAsync(key, input, context, serialNo, token); + public ValueTask.ReadAsyncResult> ReadAsync(Key key, Input input, Context context = default, CancellationToken token = default) + => clientSession.ReadAsync(key, input, context, token); /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ValueTask.ReadAsyncResult> ReadAsync(Key key, Input input, ref ReadOptions readOptions, Context context = default, long serialNo = 0, CancellationToken token = default) - => clientSession.ReadAsync(key, input, ref readOptions, context, serialNo, token); + public ValueTask.ReadAsyncResult> ReadAsync(Key key, Input input, ref ReadOptions readOptions, Context context = default, CancellationToken token = default) + => clientSession.ReadAsync(key, input, ref readOptions, context, token); /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ValueTask.ReadAsyncResult> ReadAsync(ref Key key, Context userContext = default, long serialNo = 0, CancellationToken token = default) - => clientSession.ReadAsync(ref key, userContext, serialNo, token); + public ValueTask.ReadAsyncResult> ReadAsync(ref Key key, Context userContext = default, CancellationToken token = default) + => clientSession.ReadAsync(ref key, userContext, token); /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ValueTask.ReadAsyncResult> ReadAsync(ref Key key, ref ReadOptions readOptions, Context userContext = default, long serialNo = 0, CancellationToken token = default) - => clientSession.ReadAsync(ref key, ref readOptions, userContext, serialNo, token); + public ValueTask.ReadAsyncResult> ReadAsync(ref Key key, ref ReadOptions readOptions, Context userContext = default, CancellationToken token = default) + => clientSession.ReadAsync(ref key, ref readOptions, userContext, token); /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ValueTask.ReadAsyncResult> ReadAsync(Key key, Context context = default, long serialNo = 0, CancellationToken token = default) - => clientSession.ReadAsync(key, context, serialNo, token); + public ValueTask.ReadAsyncResult> ReadAsync(Key key, Context context = default, CancellationToken token = default) + => clientSession.ReadAsync(key, context, token); /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ValueTask.ReadAsyncResult> ReadAsync(Key key, ref ReadOptions readOptions, Context context = default, long serialNo = 0, CancellationToken token = default) - => clientSession.ReadAsync(key, ref readOptions, context, serialNo, token); + public ValueTask.ReadAsyncResult> ReadAsync(Key key, ref ReadOptions readOptions, Context context = default, CancellationToken token = default) + => clientSession.ReadAsync(key, ref readOptions, context, token); /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ValueTask.ReadAsyncResult> ReadAsync(ref Key key, ref Input input, ref ReadOptions readOptions, Context userContext = default, long serialNo = 0, CancellationToken cancellationToken = default) - => clientSession.ReadAsync(ref key, ref input, ref readOptions, userContext, serialNo, cancellationToken); + public ValueTask.ReadAsyncResult> ReadAsync(ref Key key, ref Input input, ref ReadOptions readOptions, Context userContext = default, CancellationToken cancellationToken = default) + => clientSession.ReadAsync(ref key, ref input, ref readOptions, userContext, cancellationToken); /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ValueTask.ReadAsyncResult> ReadAtAddressAsync(long address, ref Input input, ref ReadOptions readOptions, Context userContext = default, long serialNo = 0, CancellationToken cancellationToken = default) - => clientSession.ReadAtAddressAsync(address, ref input, ref readOptions, userContext, serialNo, cancellationToken); + public ValueTask.ReadAsyncResult> ReadAtAddressAsync(long address, ref Input input, ref ReadOptions readOptions, Context userContext = default, CancellationToken cancellationToken = default) + => clientSession.ReadAtAddressAsync(address, ref input, ref readOptions, userContext, cancellationToken); /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ValueTask.ReadAsyncResult> ReadAtAddressAsync(long address, ref Key key, ref Input input, ref ReadOptions readOptions, Context userContext = default, long serialNo = 0, CancellationToken cancellationToken = default) - => clientSession.ReadAtAddressAsync(address, ref key, ref input, ref readOptions, userContext, serialNo, cancellationToken); + public ValueTask.ReadAsyncResult> ReadAtAddressAsync(long address, ref Key key, ref Input input, ref ReadOptions readOptions, Context userContext = default, CancellationToken cancellationToken = default) + => clientSession.ReadAtAddressAsync(address, ref key, ref input, ref readOptions, userContext, cancellationToken); /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public Status Upsert(ref Key key, ref Value desiredValue, Context userContext = default, long serialNo = 0) - => clientSession.Upsert(ref key, ref desiredValue, userContext, serialNo); + public Status Upsert(ref Key key, ref Value desiredValue, Context userContext = default) + => clientSession.Upsert(ref key, ref desiredValue, userContext); /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public Status Upsert(ref Key key, ref Value desiredValue, ref UpsertOptions upsertOptions, Context userContext = default, long serialNo = 0) - => clientSession.Upsert(ref key, ref desiredValue, ref upsertOptions, userContext, serialNo); + public Status Upsert(ref Key key, ref Value desiredValue, ref UpsertOptions upsertOptions, Context userContext = default) + => clientSession.Upsert(ref key, ref desiredValue, ref upsertOptions, userContext); /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public Status Upsert(ref Key key, ref Input input, ref Value desiredValue, ref Output output, Context userContext = default, long serialNo = 0) - => clientSession.Upsert(ref key, ref input, ref desiredValue, ref output, userContext, serialNo); + public Status Upsert(ref Key key, ref Input input, ref Value desiredValue, ref Output output, Context userContext = default) + => clientSession.Upsert(ref key, ref input, ref desiredValue, ref output, userContext); /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public Status Upsert(ref Key key, ref Input input, ref Value desiredValue, ref Output output, ref UpsertOptions upsertOptions, Context userContext = default, long serialNo = 0) - => clientSession.Upsert(ref key, ref input, ref desiredValue, ref output, ref upsertOptions, userContext, serialNo); + public Status Upsert(ref Key key, ref Input input, ref Value desiredValue, ref Output output, ref UpsertOptions upsertOptions, Context userContext = default) + => clientSession.Upsert(ref key, ref input, ref desiredValue, ref output, ref upsertOptions, userContext); /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public Status Upsert(ref Key key, ref Input input, ref Value desiredValue, ref Output output, out RecordMetadata recordMetadata, Context userContext = default, long serialNo = 0) - => clientSession.Upsert(ref key, ref input, ref desiredValue, ref output, out recordMetadata, userContext, serialNo); + public Status Upsert(ref Key key, ref Input input, ref Value desiredValue, ref Output output, out RecordMetadata recordMetadata, Context userContext = default) + => clientSession.Upsert(ref key, ref input, ref desiredValue, ref output, out recordMetadata, userContext); /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public Status Upsert(ref Key key, ref Input input, ref Value desiredValue, ref Output output, ref UpsertOptions upsertOptions, out RecordMetadata recordMetadata, Context userContext = default, long serialNo = 0) - => clientSession.Upsert(ref key, ref input, ref desiredValue, ref output, ref upsertOptions, out recordMetadata, userContext, serialNo); + public Status Upsert(ref Key key, ref Input input, ref Value desiredValue, ref Output output, ref UpsertOptions upsertOptions, out RecordMetadata recordMetadata, Context userContext = default) + => clientSession.Upsert(ref key, ref input, ref desiredValue, ref output, ref upsertOptions, out recordMetadata, userContext); /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public Status Upsert(Key key, Value desiredValue, Context userContext = default, long serialNo = 0) - => clientSession.Upsert(key, desiredValue, userContext, serialNo); + public Status Upsert(Key key, Value desiredValue, Context userContext = default) + => clientSession.Upsert(key, desiredValue, userContext); /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public Status Upsert(Key key, Value desiredValue, ref UpsertOptions upsertOptions, Context userContext = default, long serialNo = 0) - => clientSession.Upsert(key, desiredValue, ref upsertOptions, userContext, serialNo); + public Status Upsert(Key key, Value desiredValue, ref UpsertOptions upsertOptions, Context userContext = default) + => clientSession.Upsert(key, desiredValue, ref upsertOptions, userContext); /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public Status Upsert(Key key, Input input, Value desiredValue, ref Output output, Context userContext = default, long serialNo = 0) - => clientSession.Upsert(key, input, desiredValue, ref output, userContext, serialNo); + public Status Upsert(Key key, Input input, Value desiredValue, ref Output output, Context userContext = default) + => clientSession.Upsert(key, input, desiredValue, ref output, userContext); /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public Status Upsert(Key key, Input input, Value desiredValue, ref Output output, ref UpsertOptions upsertOptions, Context userContext = default, long serialNo = 0) - => clientSession.Upsert(ref key, ref input, ref desiredValue, ref output, ref upsertOptions, userContext, serialNo); + public Status Upsert(Key key, Input input, Value desiredValue, ref Output output, ref UpsertOptions upsertOptions, Context userContext = default) + => clientSession.Upsert(ref key, ref input, ref desiredValue, ref output, ref upsertOptions, userContext); /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ValueTask.UpsertAsyncResult> UpsertAsync(ref Key key, ref Value desiredValue, Context userContext = default, long serialNo = 0, CancellationToken token = default) - => clientSession.UpsertAsync(ref key, ref desiredValue, userContext, serialNo, token); + public ValueTask.UpsertAsyncResult> UpsertAsync(ref Key key, ref Value desiredValue, Context userContext = default, CancellationToken token = default) + => clientSession.UpsertAsync(ref key, ref desiredValue, userContext, token); /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ValueTask.UpsertAsyncResult> UpsertAsync(ref Key key, ref Value desiredValue, ref UpsertOptions upsertOptions, Context userContext = default, long serialNo = 0, CancellationToken token = default) - => clientSession.UpsertAsync(ref key, ref desiredValue, ref upsertOptions, userContext, serialNo, token); + public ValueTask.UpsertAsyncResult> UpsertAsync(ref Key key, ref Value desiredValue, ref UpsertOptions upsertOptions, Context userContext = default, CancellationToken token = default) + => clientSession.UpsertAsync(ref key, ref desiredValue, ref upsertOptions, userContext, token); /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ValueTask.UpsertAsyncResult> UpsertAsync(ref Key key, ref Input input, ref Value desiredValue, ref UpsertOptions upsertOptions, Context userContext = default, long serialNo = 0, CancellationToken token = default) - => clientSession.UpsertAsync(ref key, ref input, ref desiredValue, ref upsertOptions, userContext, serialNo, token); + public ValueTask.UpsertAsyncResult> UpsertAsync(ref Key key, ref Input input, ref Value desiredValue, ref UpsertOptions upsertOptions, Context userContext = default, CancellationToken token = default) + => clientSession.UpsertAsync(ref key, ref input, ref desiredValue, ref upsertOptions, userContext, token); /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ValueTask.UpsertAsyncResult> UpsertAsync(ref Key key, ref Input input, ref Value desiredValue, Context userContext = default, long serialNo = 0, CancellationToken token = default) - => clientSession.UpsertAsync(ref key, ref input, ref desiredValue, userContext, serialNo, token); + public ValueTask.UpsertAsyncResult> UpsertAsync(ref Key key, ref Input input, ref Value desiredValue, Context userContext = default, CancellationToken token = default) + => clientSession.UpsertAsync(ref key, ref input, ref desiredValue, userContext, token); /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ValueTask.UpsertAsyncResult> UpsertAsync(Key key, Value desiredValue, Context userContext = default, long serialNo = 0, CancellationToken token = default) - => clientSession.UpsertAsync(key, desiredValue, userContext, serialNo, token); + public ValueTask.UpsertAsyncResult> UpsertAsync(Key key, Value desiredValue, Context userContext = default, CancellationToken token = default) + => clientSession.UpsertAsync(key, desiredValue, userContext, token); /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ValueTask.UpsertAsyncResult> UpsertAsync(Key key, Value desiredValue, ref UpsertOptions upsertOptions, Context userContext = default, long serialNo = 0, CancellationToken token = default) - => clientSession.UpsertAsync(key, desiredValue, ref upsertOptions, userContext, serialNo, token); + public ValueTask.UpsertAsyncResult> UpsertAsync(Key key, Value desiredValue, ref UpsertOptions upsertOptions, Context userContext = default, CancellationToken token = default) + => clientSession.UpsertAsync(key, desiredValue, ref upsertOptions, userContext, token); /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ValueTask.UpsertAsyncResult> UpsertAsync(Key key, Input input, Value desiredValue, Context userContext = default, long serialNo = 0, CancellationToken token = default) - => clientSession.UpsertAsync(key, input, desiredValue, userContext, serialNo, token); + public ValueTask.UpsertAsyncResult> UpsertAsync(Key key, Input input, Value desiredValue, Context userContext = default, CancellationToken token = default) + => clientSession.UpsertAsync(key, input, desiredValue, userContext, token); /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ValueTask.UpsertAsyncResult> UpsertAsync(Key key, Input input, Value desiredValue, ref UpsertOptions upsertOptions, Context userContext = default, long serialNo = 0, CancellationToken token = default) - => clientSession.UpsertAsync(key, input, desiredValue, ref upsertOptions, userContext, serialNo, token); + public ValueTask.UpsertAsyncResult> UpsertAsync(Key key, Input input, Value desiredValue, ref UpsertOptions upsertOptions, Context userContext = default, CancellationToken token = default) + => clientSession.UpsertAsync(key, input, desiredValue, ref upsertOptions, userContext, token); /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public Status RMW(ref Key key, ref Input input, ref Output output, Context userContext = default, long serialNo = 0) - => clientSession.RMW(ref key, ref input, ref output, userContext, serialNo); + public Status RMW(ref Key key, ref Input input, ref Output output, Context userContext = default) + => clientSession.RMW(ref key, ref input, ref output, userContext); /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public Status RMW(ref Key key, ref Input input, ref Output output, ref RMWOptions rmwOptions, Context userContext = default, long serialNo = 0) - => clientSession.RMW(ref key, ref input, ref output, ref rmwOptions, userContext, serialNo); + public Status RMW(ref Key key, ref Input input, ref Output output, ref RMWOptions rmwOptions, Context userContext = default) + => clientSession.RMW(ref key, ref input, ref output, ref rmwOptions, userContext); /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public Status RMW(ref Key key, ref Input input, ref Output output, ref RMWOptions rmwOptions, out RecordMetadata recordMetadata, Context userContext = default, long serialNo = 0) - => clientSession.RMW(ref key, ref input, ref output, ref rmwOptions, out recordMetadata, userContext, serialNo); + public Status RMW(ref Key key, ref Input input, ref Output output, ref RMWOptions rmwOptions, out RecordMetadata recordMetadata, Context userContext = default) + => clientSession.RMW(ref key, ref input, ref output, ref rmwOptions, out recordMetadata, userContext); /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public Status RMW(ref Key key, ref Input input, ref Output output, out RecordMetadata recordMetadata, Context userContext = default, long serialNo = 0) - => clientSession.RMW(ref key, ref input, ref output, out recordMetadata, userContext, serialNo); + public Status RMW(ref Key key, ref Input input, ref Output output, out RecordMetadata recordMetadata, Context userContext = default) + => clientSession.RMW(ref key, ref input, ref output, out recordMetadata, userContext); /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public Status RMW(Key key, Input input, out Output output, Context userContext = default, long serialNo = 0) - => clientSession.RMW(key, input, out output, userContext, serialNo); + public Status RMW(Key key, Input input, out Output output, Context userContext = default) + => clientSession.RMW(key, input, out output, userContext); /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public Status RMW(Key key, Input input, out Output output, ref RMWOptions rmwOptions, Context userContext = default, long serialNo = 0) - => clientSession.RMW(key, input, out output, ref rmwOptions, userContext, serialNo); + public Status RMW(Key key, Input input, out Output output, ref RMWOptions rmwOptions, Context userContext = default) + => clientSession.RMW(key, input, out output, ref rmwOptions, userContext); /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public Status RMW(ref Key key, ref Input input, Context userContext = default, long serialNo = 0) - => clientSession.RMW(ref key, ref input, userContext, serialNo); + public Status RMW(ref Key key, ref Input input, Context userContext = default) + => clientSession.RMW(ref key, ref input, userContext); /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public Status RMW(ref Key key, ref Input input, ref RMWOptions rmwOptions, Context userContext = default, long serialNo = 0) - => clientSession.RMW(ref key, ref input, ref rmwOptions, userContext, serialNo); + public Status RMW(ref Key key, ref Input input, ref RMWOptions rmwOptions, Context userContext = default) + => clientSession.RMW(ref key, ref input, ref rmwOptions, userContext); /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public Status RMW(Key key, Input input, Context userContext = default, long serialNo = 0) - => clientSession.RMW(key, input, userContext, serialNo); + public Status RMW(Key key, Input input, Context userContext = default) + => clientSession.RMW(key, input, userContext); /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public Status RMW(Key key, Input input, ref RMWOptions rmwOptions, Context userContext = default, long serialNo = 0) - => clientSession.RMW(key, input, ref rmwOptions, userContext, serialNo); + public Status RMW(Key key, Input input, ref RMWOptions rmwOptions, Context userContext = default) + => clientSession.RMW(key, input, ref rmwOptions, userContext); /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ValueTask.RmwAsyncResult> RMWAsync(ref Key key, ref Input input, Context context = default, long serialNo = 0, CancellationToken token = default) - => clientSession.RMWAsync(ref key, ref input, context, serialNo, token); + public ValueTask.RmwAsyncResult> RMWAsync(ref Key key, ref Input input, Context context = default, CancellationToken token = default) + => clientSession.RMWAsync(ref key, ref input, context, token); /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ValueTask.RmwAsyncResult> RMWAsync(ref Key key, ref Input input, ref RMWOptions rmwOptions, Context context = default, long serialNo = 0, CancellationToken token = default) - => clientSession.RMWAsync(ref key, ref input, ref rmwOptions, context, serialNo, token); + public ValueTask.RmwAsyncResult> RMWAsync(ref Key key, ref Input input, ref RMWOptions rmwOptions, Context context = default, CancellationToken token = default) + => clientSession.RMWAsync(ref key, ref input, ref rmwOptions, context, token); /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ValueTask.RmwAsyncResult> RMWAsync(Key key, Input input, Context context = default, long serialNo = 0, CancellationToken token = default) - => clientSession.RMWAsync(key, input, context, serialNo, token); + public ValueTask.RmwAsyncResult> RMWAsync(Key key, Input input, Context context = default, CancellationToken token = default) + => clientSession.RMWAsync(key, input, context, token); /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ValueTask.RmwAsyncResult> RMWAsync(Key key, Input input, ref RMWOptions rmwOptions, Context context = default, long serialNo = 0, CancellationToken token = default) - => clientSession.RMWAsync(key, input, ref rmwOptions, context, serialNo, token); + public ValueTask.RmwAsyncResult> RMWAsync(Key key, Input input, ref RMWOptions rmwOptions, Context context = default, CancellationToken token = default) + => clientSession.RMWAsync(key, input, ref rmwOptions, context, token); /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public Status Delete(ref Key key, Context userContext = default, long serialNo = 0) - => clientSession.Delete(ref key, userContext, serialNo); + public Status Delete(ref Key key, Context userContext = default) + => clientSession.Delete(ref key, userContext); /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public Status Delete(ref Key key, ref DeleteOptions deleteOptions, Context userContext = default, long serialNo = 0) - => clientSession.Delete(ref key, ref deleteOptions, userContext, serialNo); + public Status Delete(ref Key key, ref DeleteOptions deleteOptions, Context userContext = default) + => clientSession.Delete(ref key, ref deleteOptions, userContext); /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public Status Delete(Key key, Context userContext = default, long serialNo = 0) - => clientSession.Delete(key, userContext, serialNo); + public Status Delete(Key key, Context userContext = default) + => clientSession.Delete(key, userContext); /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public Status Delete(Key key, ref DeleteOptions deleteOptions, Context userContext = default, long serialNo = 0) - => clientSession.Delete(key, ref deleteOptions, userContext, serialNo); + public Status Delete(Key key, ref DeleteOptions deleteOptions, Context userContext = default) + => clientSession.Delete(key, ref deleteOptions, userContext); /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ValueTask.DeleteAsyncResult> DeleteAsync(ref Key key, Context userContext = default, long serialNo = 0, CancellationToken token = default) - => clientSession.DeleteAsync(ref key, userContext, serialNo, token); + public ValueTask.DeleteAsyncResult> DeleteAsync(ref Key key, Context userContext = default, CancellationToken token = default) + => clientSession.DeleteAsync(ref key, userContext, token); /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ValueTask.DeleteAsyncResult> DeleteAsync(ref Key key, ref DeleteOptions deleteOptions, Context userContext = default, long serialNo = 0, CancellationToken token = default) - => clientSession.DeleteAsync(ref key, ref deleteOptions, userContext, serialNo, token); + public ValueTask.DeleteAsyncResult> DeleteAsync(ref Key key, ref DeleteOptions deleteOptions, Context userContext = default, CancellationToken token = default) + => clientSession.DeleteAsync(ref key, ref deleteOptions, userContext, token); /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ValueTask.DeleteAsyncResult> DeleteAsync(Key key, Context userContext = default, long serialNo = 0, CancellationToken token = default) - => clientSession.DeleteAsync(key, userContext, serialNo, token); + public ValueTask.DeleteAsyncResult> DeleteAsync(Key key, Context userContext = default, CancellationToken token = default) + => clientSession.DeleteAsync(key, userContext, token); /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ValueTask.DeleteAsyncResult> DeleteAsync(Key key, ref DeleteOptions deleteOptions, Context userContext = default, long serialNo = 0, CancellationToken token = default) - => clientSession.DeleteAsync(key, ref deleteOptions, userContext, serialNo, token); + public ValueTask.DeleteAsyncResult> DeleteAsync(Key key, ref DeleteOptions deleteOptions, Context userContext = default, CancellationToken token = default) + => clientSession.DeleteAsync(key, ref deleteOptions, userContext, token); /// [MethodImpl(MethodImplOptions.AggressiveInlining)] diff --git a/libs/storage/Tsavorite/cs/src/core/ClientSession/ClientSession.cs b/libs/storage/Tsavorite/cs/src/core/ClientSession/ClientSession.cs index 70e75fb95c..f7bca30d10 100644 --- a/libs/storage/Tsavorite/cs/src/core/ClientSession/ClientSession.cs +++ b/libs/storage/Tsavorite/cs/src/core/ClientSession/ClientSession.cs @@ -25,7 +25,6 @@ public sealed class ClientSession internal readonly TsavoriteKV store; internal readonly TsavoriteKV.TsavoriteExecutionContext ctx; - internal CommitPoint LatestCommitPoint; internal readonly Functions functions; @@ -122,7 +121,6 @@ internal ClientSession( this.store = store; this.ctx = ctx; this.functions = functions; - LatestCommitPoint = new CommitPoint { UntilSerialNo = -1, ExcludedSerialNos = null }; TsavoriteSession = new InternalTsavoriteSession(this); } @@ -131,21 +129,6 @@ internal ClientSession( /// public int ID { get { return ctx.sessionID; } } - /// - /// Get session name - /// - public string Name { get { return ctx.sessionName; } } - - /// - /// Next sequential serial no for session (current serial no + 1) - /// - public long NextSerialNo => ctx.serialNum + 1; - - /// - /// Current serial no for session - /// - public long SerialNo => ctx.serialNum; - /// /// Current version number of the session /// @@ -207,12 +190,12 @@ public LockableContext LockableCo /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public Status Read(ref Key key, ref Input input, ref Output output, Context userContext = default, long serialNo = 0) + public Status Read(ref Key key, ref Input input, ref Output output, Context userContext = default) { UnsafeResumeThread(); try { - return store.ContextRead(ref key, ref input, ref output, userContext, TsavoriteSession, serialNo); + return store.ContextRead(ref key, ref input, ref output, userContext, TsavoriteSession); } finally { @@ -222,85 +205,85 @@ public Status Read(ref Key key, ref Input input, ref Output output, Context user /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public Status Read(ref Key key, ref Input input, ref Output output, ref ReadOptions readOptions, Context userContext = default, long serialNo = 0) - => Read(ref key, ref input, ref output, ref readOptions, out _, userContext, serialNo); + public Status Read(ref Key key, ref Input input, ref Output output, ref ReadOptions readOptions, Context userContext = default) + => Read(ref key, ref input, ref output, ref readOptions, out _, userContext); /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public Status Read(Key key, Input input, out Output output, Context userContext = default, long serialNo = 0) + public Status Read(Key key, Input input, out Output output, Context userContext = default) { output = default; - return Read(ref key, ref input, ref output, userContext, serialNo); + return Read(ref key, ref input, ref output, userContext); } /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public Status Read(Key key, Input input, out Output output, ref ReadOptions readOptions, Context userContext = default, long serialNo = 0) + public Status Read(Key key, Input input, out Output output, ref ReadOptions readOptions, Context userContext = default) { output = default; - return Read(ref key, ref input, ref output, ref readOptions, userContext, serialNo); + return Read(ref key, ref input, ref output, ref readOptions, userContext); } /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public Status Read(ref Key key, ref Output output, Context userContext = default, long serialNo = 0) + public Status Read(ref Key key, ref Output output, Context userContext = default) { Input input = default; - return Read(ref key, ref input, ref output, userContext, serialNo); + return Read(ref key, ref input, ref output, userContext); } /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public Status Read(ref Key key, ref Output output, ref ReadOptions readOptions, Context userContext = default, long serialNo = 0) + public Status Read(ref Key key, ref Output output, ref ReadOptions readOptions, Context userContext = default) { Input input = default; - return Read(ref key, ref input, ref output, ref readOptions, userContext, serialNo); + return Read(ref key, ref input, ref output, ref readOptions, userContext); } /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public Status Read(Key key, out Output output, Context userContext = default, long serialNo = 0) + public Status Read(Key key, out Output output, Context userContext = default) { Input input = default; output = default; - return Read(ref key, ref input, ref output, userContext, serialNo); + return Read(ref key, ref input, ref output, userContext); } /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public Status Read(Key key, out Output output, ref ReadOptions readOptions, Context userContext = default, long serialNo = 0) + public Status Read(Key key, out Output output, ref ReadOptions readOptions, Context userContext = default) { Input input = default; output = default; - return Read(ref key, ref input, ref output, ref readOptions, userContext, serialNo); + return Read(ref key, ref input, ref output, ref readOptions, userContext); } /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public (Status status, Output output) Read(Key key, Context userContext = default, long serialNo = 0) + public (Status status, Output output) Read(Key key, Context userContext = default) { Input input = default; Output output = default; - return (Read(ref key, ref input, ref output, userContext, serialNo), output); + return (Read(ref key, ref input, ref output, userContext), output); } /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public (Status status, Output output) Read(Key key, ref ReadOptions readOptions, Context userContext = default, long serialNo = 0) + public (Status status, Output output) Read(Key key, ref ReadOptions readOptions, Context userContext = default) { Input input = default; Output output = default; - return (Read(ref key, ref input, ref output, ref readOptions, userContext, serialNo), output); + return (Read(ref key, ref input, ref output, ref readOptions, userContext), output); } /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public Status Read(ref Key key, ref Input input, ref Output output, ref ReadOptions readOptions, out RecordMetadata recordMetadata, Context userContext = default, long serialNo = 0) + public Status Read(ref Key key, ref Input input, ref Output output, ref ReadOptions readOptions, out RecordMetadata recordMetadata, Context userContext = default) { UnsafeResumeThread(); try { - return store.ContextRead(ref key, ref input, ref output, ref readOptions, out recordMetadata, userContext, TsavoriteSession, serialNo); + return store.ContextRead(ref key, ref input, ref output, ref readOptions, out recordMetadata, userContext, TsavoriteSession); } finally { @@ -310,12 +293,12 @@ public Status Read(ref Key key, ref Input input, ref Output output, ref ReadOpti /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public Status ReadAtAddress(long address, ref Input input, ref Output output, ref ReadOptions readOptions, out RecordMetadata recordMetadata, Context userContext = default, long serialNo = 0) + public Status ReadAtAddress(long address, ref Input input, ref Output output, ref ReadOptions readOptions, out RecordMetadata recordMetadata, Context userContext = default) { UnsafeResumeThread(); try { - return store.ContextReadAtAddress(address, ref input, ref output, ref readOptions, out recordMetadata, userContext, serialNo, TsavoriteSession); + return store.ContextReadAtAddress(address, ref input, ref output, ref readOptions, out recordMetadata, userContext, TsavoriteSession); } finally { @@ -325,12 +308,12 @@ public Status ReadAtAddress(long address, ref Input input, ref Output output, re /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public Status ReadAtAddress(long address, ref Key key, ref Input input, ref Output output, ref ReadOptions readOptions, out RecordMetadata recordMetadata, Context userContext = default, long serialNo = 0) + public Status ReadAtAddress(long address, ref Key key, ref Input input, ref Output output, ref ReadOptions readOptions, out RecordMetadata recordMetadata, Context userContext = default) { UnsafeResumeThread(); try { - return store.ContextReadAtAddress(address, ref key, ref input, ref output, ref readOptions, out recordMetadata, userContext, serialNo, TsavoriteSession); + return store.ContextReadAtAddress(address, ref key, ref input, ref output, ref readOptions, out recordMetadata, userContext, TsavoriteSession); } finally { @@ -340,103 +323,103 @@ public Status ReadAtAddress(long address, ref Key key, ref Input input, ref Outp /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ValueTask.ReadAsyncResult> ReadAsync(ref Key key, ref Input input, Context userContext = default, long serialNo = 0, CancellationToken cancellationToken = default) + public ValueTask.ReadAsyncResult> ReadAsync(ref Key key, ref Input input, Context userContext = default, CancellationToken cancellationToken = default) { ReadOptions readOptions = default; - return store.ReadAsync(TsavoriteSession, ref key, ref input, ref readOptions, userContext, serialNo, cancellationToken); + return store.ReadAsync(TsavoriteSession, ref key, ref input, ref readOptions, userContext, cancellationToken); } /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ValueTask.ReadAsyncResult> ReadAsync(ref Key key, ref Input input, ref ReadOptions readOptions, Context userContext = default, long serialNo = 0, CancellationToken cancellationToken = default) - => store.ReadAsync(TsavoriteSession, ref key, ref input, ref readOptions, userContext, serialNo, cancellationToken); + public ValueTask.ReadAsyncResult> ReadAsync(ref Key key, ref Input input, ref ReadOptions readOptions, Context userContext = default, CancellationToken cancellationToken = default) + => store.ReadAsync(TsavoriteSession, ref key, ref input, ref readOptions, userContext, cancellationToken); /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ValueTask.ReadAsyncResult> ReadAsync(Key key, Input input, Context context = default, long serialNo = 0, CancellationToken token = default) - => ReadAsync(ref key, ref input, context, serialNo, token); + public ValueTask.ReadAsyncResult> ReadAsync(Key key, Input input, Context context = default, CancellationToken token = default) + => ReadAsync(ref key, ref input, context, token); /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ValueTask.ReadAsyncResult> ReadAsync(Key key, Input input, ref ReadOptions readOptions, Context context = default, long serialNo = 0, CancellationToken token = default) - => store.ReadAsync(TsavoriteSession, ref key, ref input, ref readOptions, context, serialNo, token); + public ValueTask.ReadAsyncResult> ReadAsync(Key key, Input input, ref ReadOptions readOptions, Context context = default, CancellationToken token = default) + => store.ReadAsync(TsavoriteSession, ref key, ref input, ref readOptions, context, token); /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ValueTask.ReadAsyncResult> ReadAsync(ref Key key, Context userContext = default, long serialNo = 0, CancellationToken token = default) + public ValueTask.ReadAsyncResult> ReadAsync(ref Key key, Context userContext = default, CancellationToken token = default) { ReadOptions readOptions = default; - return ReadAsync(ref key, ref readOptions, userContext, serialNo, token); + return ReadAsync(ref key, ref readOptions, userContext, token); } /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ValueTask.ReadAsyncResult> ReadAsync(ref Key key, ref ReadOptions readOptions, Context userContext = default, long serialNo = 0, CancellationToken token = default) + public ValueTask.ReadAsyncResult> ReadAsync(ref Key key, ref ReadOptions readOptions, Context userContext = default, CancellationToken token = default) { Input input = default; - return store.ReadAsync(TsavoriteSession, ref key, ref input, ref readOptions, userContext, serialNo, token); + return store.ReadAsync(TsavoriteSession, ref key, ref input, ref readOptions, userContext, token); } /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ValueTask.ReadAsyncResult> ReadAsync(Key key, Context context = default, long serialNo = 0, CancellationToken token = default) - => ReadAsync(ref key, context, serialNo, token); + public ValueTask.ReadAsyncResult> ReadAsync(Key key, Context context = default, CancellationToken token = default) + => ReadAsync(ref key, context, token); /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ValueTask.ReadAsyncResult> ReadAsync(Key key, ref ReadOptions readOptions, Context context = default, long serialNo = 0, CancellationToken token = default) - => ReadAsync(ref key, ref readOptions, context, serialNo, token); + public ValueTask.ReadAsyncResult> ReadAsync(Key key, ref ReadOptions readOptions, Context context = default, CancellationToken token = default) + => ReadAsync(ref key, ref readOptions, context, token); /// [MethodImpl(MethodImplOptions.AggressiveInlining)] public ValueTask.ReadAsyncResult> ReadAtAddressAsync(long address, ref Input input, ref ReadOptions readOptions, - Context userContext = default, long serialNo = 0, CancellationToken cancellationToken = default) + Context userContext = default, CancellationToken cancellationToken = default) { Key key = default; - return store.ReadAtAddressAsync(TsavoriteSession, address, ref key, ref input, ref readOptions, userContext, serialNo, cancellationToken, noKey: true); + return store.ReadAtAddressAsync(TsavoriteSession, address, ref key, ref input, ref readOptions, userContext, cancellationToken, noKey: true); } /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ValueTask.ReadAsyncResult> ReadAtAddressAsync(long address, ref Key key, ref Input input, ref ReadOptions readOptions, Context userContext = default, long serialNo = 0, CancellationToken cancellationToken = default) - => store.ReadAtAddressAsync(TsavoriteSession, address, ref key, ref input, ref readOptions, userContext, serialNo, cancellationToken, noKey: false); + public ValueTask.ReadAsyncResult> ReadAtAddressAsync(long address, ref Key key, ref Input input, ref ReadOptions readOptions, Context userContext = default, CancellationToken cancellationToken = default) + => store.ReadAtAddressAsync(TsavoriteSession, address, ref key, ref input, ref readOptions, userContext, cancellationToken, noKey: false); /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public Status Upsert(ref Key key, ref Value desiredValue, Context userContext = default, long serialNo = 0) + public Status Upsert(ref Key key, ref Value desiredValue, Context userContext = default) { Input input = default; Output output = default; - return Upsert(ref key, store.comparer.GetHashCode64(ref key), ref input, ref desiredValue, ref output, userContext, serialNo); + return Upsert(ref key, store.comparer.GetHashCode64(ref key), ref input, ref desiredValue, ref output, userContext); } /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public Status Upsert(ref Key key, ref Value desiredValue, ref UpsertOptions upsertOptions, Context userContext = default, long serialNo = 0) + public Status Upsert(ref Key key, ref Value desiredValue, ref UpsertOptions upsertOptions, Context userContext = default) { Input input = default; Output output = default; - return Upsert(ref key, upsertOptions.KeyHash ?? store.comparer.GetHashCode64(ref key), ref input, ref desiredValue, ref output, userContext, serialNo); + return Upsert(ref key, upsertOptions.KeyHash ?? store.comparer.GetHashCode64(ref key), ref input, ref desiredValue, ref output, userContext); } /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public Status Upsert(ref Key key, ref Input input, ref Value desiredValue, ref Output output, Context userContext = default, long serialNo = 0) - => Upsert(ref key, store.comparer.GetHashCode64(ref key), ref input, ref desiredValue, ref output, userContext, serialNo); + public Status Upsert(ref Key key, ref Input input, ref Value desiredValue, ref Output output, Context userContext = default) + => Upsert(ref key, store.comparer.GetHashCode64(ref key), ref input, ref desiredValue, ref output, userContext); /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public Status Upsert(ref Key key, ref Input input, ref Value desiredValue, ref Output output, ref UpsertOptions upsertOptions, Context userContext = default, long serialNo = 0) - => Upsert(ref key, upsertOptions.KeyHash ?? store.comparer.GetHashCode64(ref key), ref input, ref desiredValue, ref output, userContext, serialNo); + public Status Upsert(ref Key key, ref Input input, ref Value desiredValue, ref Output output, ref UpsertOptions upsertOptions, Context userContext = default) + => Upsert(ref key, upsertOptions.KeyHash ?? store.comparer.GetHashCode64(ref key), ref input, ref desiredValue, ref output, userContext); /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - private Status Upsert(ref Key key, long keyHash, ref Input input, ref Value desiredValue, ref Output output, Context userContext = default, long serialNo = 0) + private Status Upsert(ref Key key, long keyHash, ref Input input, ref Value desiredValue, ref Output output, Context userContext = default) { UnsafeResumeThread(); try { - return store.ContextUpsert(ref key, keyHash, ref input, ref desiredValue, ref output, userContext, TsavoriteSession, serialNo); + return store.ContextUpsert(ref key, keyHash, ref input, ref desiredValue, ref output, userContext, TsavoriteSession); } finally { @@ -446,22 +429,22 @@ private Status Upsert(ref Key key, long keyHash, ref Input input, ref Value desi /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public Status Upsert(ref Key key, ref Input input, ref Value desiredValue, ref Output output, out RecordMetadata recordMetadata, Context userContext = default, long serialNo = 0) - => Upsert(ref key, store.comparer.GetHashCode64(ref key), ref input, ref desiredValue, ref output, out recordMetadata, userContext, serialNo); + public Status Upsert(ref Key key, ref Input input, ref Value desiredValue, ref Output output, out RecordMetadata recordMetadata, Context userContext = default) + => Upsert(ref key, store.comparer.GetHashCode64(ref key), ref input, ref desiredValue, ref output, out recordMetadata, userContext); /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public Status Upsert(ref Key key, ref Input input, ref Value desiredValue, ref Output output, ref UpsertOptions upsertOptions, out RecordMetadata recordMetadata, Context userContext = default, long serialNo = 0) - => Upsert(ref key, upsertOptions.KeyHash ?? store.comparer.GetHashCode64(ref key), ref input, ref desiredValue, ref output, out recordMetadata, userContext, serialNo); + public Status Upsert(ref Key key, ref Input input, ref Value desiredValue, ref Output output, ref UpsertOptions upsertOptions, out RecordMetadata recordMetadata, Context userContext = default) + => Upsert(ref key, upsertOptions.KeyHash ?? store.comparer.GetHashCode64(ref key), ref input, ref desiredValue, ref output, out recordMetadata, userContext); /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - private Status Upsert(ref Key key, long keyHash, ref Input input, ref Value desiredValue, ref Output output, out RecordMetadata recordMetadata, Context userContext = default, long serialNo = 0) + private Status Upsert(ref Key key, long keyHash, ref Input input, ref Value desiredValue, ref Output output, out RecordMetadata recordMetadata, Context userContext = default) { UnsafeResumeThread(); try { - return store.ContextUpsert(ref key, keyHash, ref input, ref desiredValue, ref output, out recordMetadata, userContext, TsavoriteSession, serialNo); + return store.ContextUpsert(ref key, keyHash, ref input, ref desiredValue, ref output, out recordMetadata, userContext, TsavoriteSession); } finally { @@ -471,102 +454,102 @@ private Status Upsert(ref Key key, long keyHash, ref Input input, ref Value desi /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public Status Upsert(Key key, Value desiredValue, Context userContext = default, long serialNo = 0) - => Upsert(ref key, ref desiredValue, userContext, serialNo); + public Status Upsert(Key key, Value desiredValue, Context userContext = default) + => Upsert(ref key, ref desiredValue, userContext); /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public Status Upsert(Key key, Value desiredValue, ref UpsertOptions upsertOptions, Context userContext = default, long serialNo = 0) - => Upsert(ref key, ref desiredValue, ref upsertOptions, userContext, serialNo); + public Status Upsert(Key key, Value desiredValue, ref UpsertOptions upsertOptions, Context userContext = default) + => Upsert(ref key, ref desiredValue, ref upsertOptions, userContext); /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public Status Upsert(Key key, Input input, Value desiredValue, ref Output output, Context userContext = default, long serialNo = 0) - => Upsert(ref key, ref input, ref desiredValue, ref output, userContext, serialNo); + public Status Upsert(Key key, Input input, Value desiredValue, ref Output output, Context userContext = default) + => Upsert(ref key, ref input, ref desiredValue, ref output, userContext); /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public Status Upsert(Key key, Input input, Value desiredValue, ref Output output, ref UpsertOptions upsertOptions, Context userContext = default, long serialNo = 0) - => Upsert(ref key, ref input, ref desiredValue, ref output, ref upsertOptions, userContext, serialNo); + public Status Upsert(Key key, Input input, Value desiredValue, ref Output output, ref UpsertOptions upsertOptions, Context userContext = default) + => Upsert(ref key, ref input, ref desiredValue, ref output, ref upsertOptions, userContext); /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ValueTask.UpsertAsyncResult> UpsertAsync(ref Key key, ref Value desiredValue, Context userContext = default, long serialNo = 0, CancellationToken token = default) + public ValueTask.UpsertAsyncResult> UpsertAsync(ref Key key, ref Value desiredValue, Context userContext = default, CancellationToken token = default) { Input input = default; - return UpsertAsync(ref key, ref input, ref desiredValue, userContext, serialNo, token); + return UpsertAsync(ref key, ref input, ref desiredValue, userContext, token); } /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ValueTask.UpsertAsyncResult> UpsertAsync(ref Key key, ref Value desiredValue, ref UpsertOptions upsertOptions, Context userContext = default, long serialNo = 0, CancellationToken token = default) + public ValueTask.UpsertAsyncResult> UpsertAsync(ref Key key, ref Value desiredValue, ref UpsertOptions upsertOptions, Context userContext = default, CancellationToken token = default) { Input input = default; - return UpsertAsync(ref key, ref input, ref desiredValue, ref upsertOptions, userContext, serialNo, token); + return UpsertAsync(ref key, ref input, ref desiredValue, ref upsertOptions, userContext, token); } /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ValueTask.UpsertAsyncResult> UpsertAsync(ref Key key, ref Input input, ref Value desiredValue, Context userContext = default, long serialNo = 0, CancellationToken token = default) + public ValueTask.UpsertAsyncResult> UpsertAsync(ref Key key, ref Input input, ref Value desiredValue, Context userContext = default, CancellationToken token = default) { UpsertOptions upsertOptions = default; - return UpsertAsync(ref key, ref input, ref desiredValue, ref upsertOptions, userContext, serialNo, token); + return UpsertAsync(ref key, ref input, ref desiredValue, ref upsertOptions, userContext, token); } /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ValueTask.UpsertAsyncResult> UpsertAsync(ref Key key, ref Input input, ref Value desiredValue, ref UpsertOptions upsertOptions, Context userContext = default, long serialNo = 0, CancellationToken token = default) - => store.UpsertAsync(TsavoriteSession, ref key, ref input, ref desiredValue, ref upsertOptions, userContext, serialNo, token); + public ValueTask.UpsertAsyncResult> UpsertAsync(ref Key key, ref Input input, ref Value desiredValue, ref UpsertOptions upsertOptions, Context userContext = default, CancellationToken token = default) + => store.UpsertAsync(TsavoriteSession, ref key, ref input, ref desiredValue, ref upsertOptions, userContext, token); /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ValueTask.UpsertAsyncResult> UpsertAsync(Key key, Value desiredValue, Context userContext = default, long serialNo = 0, CancellationToken token = default) - => UpsertAsync(ref key, ref desiredValue, userContext, serialNo, token); + public ValueTask.UpsertAsyncResult> UpsertAsync(Key key, Value desiredValue, Context userContext = default, CancellationToken token = default) + => UpsertAsync(ref key, ref desiredValue, userContext, token); /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ValueTask.UpsertAsyncResult> UpsertAsync(Key key, Value desiredValue, ref UpsertOptions upsertOptions, Context userContext = default, long serialNo = 0, CancellationToken token = default) - => UpsertAsync(ref key, ref desiredValue, ref upsertOptions, userContext, serialNo, token); + public ValueTask.UpsertAsyncResult> UpsertAsync(Key key, Value desiredValue, ref UpsertOptions upsertOptions, Context userContext = default, CancellationToken token = default) + => UpsertAsync(ref key, ref desiredValue, ref upsertOptions, userContext, token); /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ValueTask.UpsertAsyncResult> UpsertAsync(Key key, Input input, Value desiredValue, Context userContext = default, long serialNo = 0, CancellationToken token = default) - => UpsertAsync(ref key, ref input, ref desiredValue, userContext, serialNo, token); + public ValueTask.UpsertAsyncResult> UpsertAsync(Key key, Input input, Value desiredValue, Context userContext = default, CancellationToken token = default) + => UpsertAsync(ref key, ref input, ref desiredValue, userContext, token); /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ValueTask.UpsertAsyncResult> UpsertAsync(Key key, Input input, Value desiredValue, ref UpsertOptions upsertOptions, Context userContext = default, long serialNo = 0, CancellationToken token = default) - => UpsertAsync(ref key, ref input, ref desiredValue, ref upsertOptions, userContext, serialNo, token); + public ValueTask.UpsertAsyncResult> UpsertAsync(Key key, Input input, Value desiredValue, ref UpsertOptions upsertOptions, Context userContext = default, CancellationToken token = default) + => UpsertAsync(ref key, ref input, ref desiredValue, ref upsertOptions, userContext, token); /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public Status RMW(ref Key key, ref Input input, ref Output output, Context userContext = default, long serialNo = 0) - => RMW(ref key, store.comparer.GetHashCode64(ref key), ref input, ref output, out _, userContext, serialNo); + public Status RMW(ref Key key, ref Input input, ref Output output, Context userContext = default) + => RMW(ref key, store.comparer.GetHashCode64(ref key), ref input, ref output, out _, userContext); /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public Status RMW(ref Key key, ref Input input, ref Output output, ref RMWOptions rmwOptions, Context userContext = default, long serialNo = 0) - => RMW(ref key, rmwOptions.KeyHash ?? store.comparer.GetHashCode64(ref key), ref input, ref output, out _, userContext, serialNo); + public Status RMW(ref Key key, ref Input input, ref Output output, ref RMWOptions rmwOptions, Context userContext = default) + => RMW(ref key, rmwOptions.KeyHash ?? store.comparer.GetHashCode64(ref key), ref input, ref output, out _, userContext); /// - public Status RMW(ref Key key, ref Input input, ref Output output, out RecordMetadata recordMetadata, Context userContext = default, long serialNo = 0) - => RMW(ref key, store.comparer.GetHashCode64(ref key), ref input, ref output, out recordMetadata, userContext, serialNo); + public Status RMW(ref Key key, ref Input input, ref Output output, out RecordMetadata recordMetadata, Context userContext = default) + => RMW(ref key, store.comparer.GetHashCode64(ref key), ref input, ref output, out recordMetadata, userContext); /// - public Status RMW(ref Key key, ref Input input, ref Output output, ref RMWOptions rmwOptions, out RecordMetadata recordMetadata, Context userContext = default, long serialNo = 0) + public Status RMW(ref Key key, ref Input input, ref Output output, ref RMWOptions rmwOptions, out RecordMetadata recordMetadata, Context userContext = default) { var keyHash = rmwOptions.KeyHash ?? store.comparer.GetHashCode64(ref key); - return RMW(ref key, keyHash, ref input, ref output, out recordMetadata, userContext, serialNo); + return RMW(ref key, keyHash, ref input, ref output, out recordMetadata, userContext); } /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - private Status RMW(ref Key key, long keyHash, ref Input input, ref Output output, out RecordMetadata recordMetadata, Context userContext = default, long serialNo = 0) + private Status RMW(ref Key key, long keyHash, ref Input input, ref Output output, out RecordMetadata recordMetadata, Context userContext = default) { UnsafeResumeThread(); try { - return store.ContextRMW(ref key, keyHash, ref input, ref output, out recordMetadata, userContext, TsavoriteSession, serialNo); + return store.ContextRMW(ref key, keyHash, ref input, ref output, out recordMetadata, userContext, TsavoriteSession); } finally { @@ -576,87 +559,87 @@ private Status RMW(ref Key key, long keyHash, ref Input input, ref Output output /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public Status RMW(Key key, Input input, out Output output, Context userContext = default, long serialNo = 0) + public Status RMW(Key key, Input input, out Output output, Context userContext = default) { output = default; - return RMW(ref key, ref input, ref output, userContext, serialNo); + return RMW(ref key, ref input, ref output, userContext); } /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public Status RMW(Key key, Input input, out Output output, ref RMWOptions rmwOptions, Context userContext = default, long serialNo = 0) + public Status RMW(Key key, Input input, out Output output, ref RMWOptions rmwOptions, Context userContext = default) { output = default; - return RMW(ref key, ref input, ref output, ref rmwOptions, userContext, serialNo); + return RMW(ref key, ref input, ref output, ref rmwOptions, userContext); } /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public Status RMW(ref Key key, ref Input input, Context userContext = default, long serialNo = 0) + public Status RMW(ref Key key, ref Input input, Context userContext = default) { Output output = default; - return RMW(ref key, ref input, ref output, userContext, serialNo); + return RMW(ref key, ref input, ref output, userContext); } /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public Status RMW(ref Key key, ref Input input, ref RMWOptions rmwOptions, Context userContext = default, long serialNo = 0) + public Status RMW(ref Key key, ref Input input, ref RMWOptions rmwOptions, Context userContext = default) { Output output = default; - return RMW(ref key, ref input, ref output, ref rmwOptions, userContext, serialNo); + return RMW(ref key, ref input, ref output, ref rmwOptions, userContext); } /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public Status RMW(Key key, Input input, Context userContext = default, long serialNo = 0) - => RMW(ref key, ref input, userContext, serialNo); + public Status RMW(Key key, Input input, Context userContext = default) + => RMW(ref key, ref input, userContext); /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public Status RMW(Key key, Input input, ref RMWOptions rmwOptions, Context userContext = default, long serialNo = 0) - => RMW(ref key, ref input, ref rmwOptions, userContext, serialNo); + public Status RMW(Key key, Input input, ref RMWOptions rmwOptions, Context userContext = default) + => RMW(ref key, ref input, ref rmwOptions, userContext); /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ValueTask.RmwAsyncResult> RMWAsync(ref Key key, ref Input input, Context context = default, long serialNo = 0, CancellationToken token = default) + public ValueTask.RmwAsyncResult> RMWAsync(ref Key key, ref Input input, Context context = default, CancellationToken token = default) { RMWOptions rmwOptions = default; - return store.RmwAsync(TsavoriteSession, ref key, ref input, ref rmwOptions, context, serialNo, token); + return store.RmwAsync(TsavoriteSession, ref key, ref input, ref rmwOptions, context, token); } /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ValueTask.RmwAsyncResult> RMWAsync(ref Key key, ref Input input, ref RMWOptions rmwOptions, Context context = default, long serialNo = 0, CancellationToken token = default) - => store.RmwAsync(TsavoriteSession, ref key, ref input, ref rmwOptions, context, serialNo, token); + public ValueTask.RmwAsyncResult> RMWAsync(ref Key key, ref Input input, ref RMWOptions rmwOptions, Context context = default, CancellationToken token = default) + => store.RmwAsync(TsavoriteSession, ref key, ref input, ref rmwOptions, context, token); /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ValueTask.RmwAsyncResult> RMWAsync(Key key, Input input, Context context = default, long serialNo = 0, CancellationToken token = default) - => RMWAsync(ref key, ref input, context, serialNo, token); + public ValueTask.RmwAsyncResult> RMWAsync(Key key, Input input, Context context = default, CancellationToken token = default) + => RMWAsync(ref key, ref input, context, token); /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ValueTask.RmwAsyncResult> RMWAsync(Key key, Input input, ref RMWOptions rmwOptions, Context context = default, long serialNo = 0, CancellationToken token = default) - => RMWAsync(ref key, ref input, ref rmwOptions, context, serialNo, token); + public ValueTask.RmwAsyncResult> RMWAsync(Key key, Input input, ref RMWOptions rmwOptions, Context context = default, CancellationToken token = default) + => RMWAsync(ref key, ref input, ref rmwOptions, context, token); /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public Status Delete(ref Key key, Context userContext = default, long serialNo = 0) - => Delete(ref key, store.comparer.GetHashCode64(ref key), userContext, serialNo); + public Status Delete(ref Key key, Context userContext = default) + => Delete(ref key, store.comparer.GetHashCode64(ref key), userContext); /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public Status Delete(ref Key key, ref DeleteOptions deleteOptions, Context userContext = default, long serialNo = 0) - => Delete(ref key, deleteOptions.KeyHash ?? store.comparer.GetHashCode64(ref key), userContext, serialNo); + public Status Delete(ref Key key, ref DeleteOptions deleteOptions, Context userContext = default) + => Delete(ref key, deleteOptions.KeyHash ?? store.comparer.GetHashCode64(ref key), userContext); /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public Status Delete(ref Key key, long keyHash, Context userContext = default, long serialNo = 0) + private Status Delete(ref Key key, long keyHash, Context userContext = default) { UnsafeResumeThread(); try { - return store.ContextDelete(ref key, keyHash, userContext, TsavoriteSession, serialNo); + return store.ContextDelete(ref key, keyHash, userContext, TsavoriteSession); } finally { @@ -666,36 +649,36 @@ public Status Delete(ref Key key, long keyHash, Context userContext = default, l /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public Status Delete(Key key, Context userContext = default, long serialNo = 0) - => Delete(ref key, userContext, serialNo); + public Status Delete(Key key, Context userContext = default) + => Delete(ref key, userContext); /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public Status Delete(Key key, ref DeleteOptions deleteOptions, Context userContext = default, long serialNo = 0) - => Delete(ref key, ref deleteOptions, userContext, serialNo); + public Status Delete(Key key, ref DeleteOptions deleteOptions, Context userContext = default) + => Delete(ref key, ref deleteOptions, userContext); /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ValueTask.DeleteAsyncResult> DeleteAsync(ref Key key, Context userContext = default, long serialNo = 0, CancellationToken token = default) + public ValueTask.DeleteAsyncResult> DeleteAsync(ref Key key, Context userContext = default, CancellationToken token = default) { DeleteOptions deleteOptions = default; - return store.DeleteAsync(TsavoriteSession, ref key, ref deleteOptions, userContext, serialNo, token); + return store.DeleteAsync(TsavoriteSession, ref key, ref deleteOptions, userContext, token); } /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ValueTask.DeleteAsyncResult> DeleteAsync(ref Key key, ref DeleteOptions deleteOptions, Context userContext = default, long serialNo = 0, CancellationToken token = default) - => store.DeleteAsync(TsavoriteSession, ref key, ref deleteOptions, userContext, serialNo, token); + public ValueTask.DeleteAsyncResult> DeleteAsync(ref Key key, ref DeleteOptions deleteOptions, Context userContext = default, CancellationToken token = default) + => store.DeleteAsync(TsavoriteSession, ref key, ref deleteOptions, userContext, token); /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ValueTask.DeleteAsyncResult> DeleteAsync(Key key, Context userContext = default, long serialNo = 0, CancellationToken token = default) - => DeleteAsync(ref key, userContext, serialNo, token); + public ValueTask.DeleteAsyncResult> DeleteAsync(Key key, Context userContext = default, CancellationToken token = default) + => DeleteAsync(ref key, userContext, token); /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ValueTask.DeleteAsyncResult> DeleteAsync(Key key, ref DeleteOptions deleteOptions, Context userContext = default, long serialNo = 0, CancellationToken token = default) - => DeleteAsync(ref key, ref deleteOptions, userContext, serialNo, token); + public ValueTask.DeleteAsyncResult> DeleteAsync(Key key, ref DeleteOptions deleteOptions, Context userContext = default, CancellationToken token = default) + => DeleteAsync(ref key, ref deleteOptions, userContext, token); /// public void Refresh() @@ -908,19 +891,12 @@ public async ValueTask WaitForCommitAsync(CancellationToken token = default) await CompletePendingAsync(token: token).ConfigureAwait(false); var task = store.CheckpointTask; - CommitPoint localCommitPoint = LatestCommitPoint; - if (localCommitPoint.UntilSerialNo >= ctx.serialNum && localCommitPoint.ExcludedSerialNos?.Count == 0) - return; while (true) { - await task.WithCancellationAsync(token).ConfigureAwait(false); + _ = await task.WithCancellationAsync(token).ConfigureAwait(false); Refresh(); - task = store.CheckpointTask; - localCommitPoint = LatestCommitPoint; - if (localCommitPoint.UntilSerialNo >= ctx.serialNum && localCommitPoint.ExcludedSerialNos?.Count == 0) - break; } } @@ -1104,7 +1080,7 @@ internal void UnsafeSuspendThread() void IClientSession.AtomicSwitch(long version) { - TsavoriteKV.AtomicSwitch(ctx, ctx.prevCtx, version, store._hybridLogCheckpoint.info.checkpointTokens); + TsavoriteKV.AtomicSwitch(ctx, ctx.prevCtx, version); } /// @@ -1301,14 +1277,6 @@ public void DisposeForRevivification(ref Key key, ref Value value, int newKeySiz => _clientSession.functions.DisposeForRevivification(ref key, ref value, newKeySize); #endregion IFunctions - Dispose - #region IFunctions - Checkpointing - public void CheckpointCompletionCallback(int sessionID, string sessionName, CommitPoint commitPoint) - { - _clientSession.functions.CheckpointCompletionCallback(sessionID, sessionName, commitPoint); - _clientSession.LatestCommitPoint = commitPoint; - } - #endregion IFunctions - Checkpointing - #region Transient locking [MethodImpl(MethodImplOptions.AggressiveInlining)] public bool TryLockTransientExclusive(ref Key key, ref OperationStackContext stackCtx) diff --git a/libs/storage/Tsavorite/cs/src/core/ClientSession/ClientSessionBuilder.cs b/libs/storage/Tsavorite/cs/src/core/ClientSession/ClientSessionBuilder.cs index e93367e879..1b2a527bfe 100644 --- a/libs/storage/Tsavorite/cs/src/core/ClientSession/ClientSessionBuilder.cs +++ b/libs/storage/Tsavorite/cs/src/core/ClientSession/ClientSessionBuilder.cs @@ -26,8 +26,6 @@ public ClientSession NewSession(); @@ -49,54 +47,6 @@ public ClientSession NewSession - /// Resume (continue) prior client session with Tsavorite; used during recovery from failure. - /// - /// Callback functions - /// Name of previous session to resume - /// Prior commit point of durability for session - /// for this session; override those specified at TsavoriteKV level, and may be overridden on individual Read operations - /// Session instance - internal ClientSession ResumeSession(Functions functions, string sessionName, out CommitPoint commitPoint, - ReadCopyOptions readCopyOptions = default) - where Functions : IFunctions - { - // Map from sessionName to sessionID and call through - if (_recoveredSessionNameMap == null || !_recoveredSessionNameMap.TryRemove(sessionName, out int sessionID)) - throw new TsavoriteException($"Unable to find session named {sessionName} to recover"); - return ResumeSession(functions, sessionID, out commitPoint, readCopyOptions); - } - - /// - /// Resume (continue) prior client session with Tsavorite; used during recovery from failure. - /// - /// Callback functions - /// ID of previous session to resume - /// Prior commit point of durability for session - /// for this session; override those specified at TsavoriteKV level, and may be overridden on individual Read operations - /// Session instance - internal ClientSession ResumeSession(Functions functions, int sessionID, out CommitPoint commitPoint, - ReadCopyOptions readCopyOptions = default) - where Functions : IFunctions - { - if (functions == null) - throw new ArgumentNullException(nameof(functions)); - - string sessionName; - (sessionName, commitPoint) = InternalContinue(sessionID, out var ctx); - if (commitPoint.UntilSerialNo == -1) - throw new Exception($"Unable to find session {sessionID} to recover"); - ctx.MergeReadCopyOptions(ReadCopyOptions, readCopyOptions); - - var session = new ClientSession(this, ctx, functions); - - if (_activeSessions == null) - Interlocked.CompareExchange(ref _activeSessions, new Dictionary(), null); - lock (_activeSessions) - _activeSessions.Add(sessionID, new SessionInfo { sessionName = sessionName, session = session, isActive = true }); - return session; - } - /// /// Dispose session with Tsavorite /// diff --git a/libs/storage/Tsavorite/cs/src/core/ClientSession/ITsavoriteContext.cs b/libs/storage/Tsavorite/cs/src/core/ClientSession/ITsavoriteContext.cs index 3b524f32bd..2f2c5157cd 100644 --- a/libs/storage/Tsavorite/cs/src/core/ClientSession/ITsavoriteContext.cs +++ b/libs/storage/Tsavorite/cs/src/core/ClientSession/ITsavoriteContext.cs @@ -71,9 +71,8 @@ public interface ITsavoriteContext : ITsavor /// Input to help extract the retrieved value into /// The location to place the retrieved value /// User application context passed in case the read goes pending due to IO - /// The serial number of the operation (used in recovery) /// is populated by the implementation - Status Read(ref Key key, ref Input input, ref Output output, Context userContext = default, long serialNo = 0); + Status Read(ref Key key, ref Input input, ref Output output, Context userContext = default); /// /// Read operation @@ -83,9 +82,8 @@ public interface ITsavoriteContext : ITsavor /// The location to place the retrieved value /// Contains options controlling the Read operation /// User application context passed in case the read goes pending due to IO - /// The serial number of the operation (used in recovery) /// is populated by the implementation - Status Read(ref Key key, ref Input input, ref Output output, ref ReadOptions readOptions, Context userContext = default, long serialNo = 0); + Status Read(ref Key key, ref Input input, ref Output output, ref ReadOptions readOptions, Context userContext = default); /// /// Read operation @@ -94,9 +92,8 @@ public interface ITsavoriteContext : ITsavor /// Input to help extract the retrieved value into /// The location to place the retrieved value /// User application context passed in case the read goes pending due to IO - /// The serial number of the operation (used in recovery) /// is populated by the implementation - Status Read(Key key, Input input, out Output output, Context userContext = default, long serialNo = 0); + Status Read(Key key, Input input, out Output output, Context userContext = default); /// /// Read operation @@ -106,9 +103,8 @@ public interface ITsavoriteContext : ITsavor /// The location to place the retrieved value /// Contains options controlling the Read operation /// User application context passed in case the read goes pending due to IO - /// The serial number of the operation (used in recovery) /// is populated by the implementation - Status Read(Key key, Input input, out Output output, ref ReadOptions readOptions, Context userContext = default, long serialNo = 0); + Status Read(Key key, Input input, out Output output, ref ReadOptions readOptions, Context userContext = default); /// /// Read operation @@ -116,9 +112,8 @@ public interface ITsavoriteContext : ITsavor /// The key to look up /// The location to place the retrieved value /// User application context passed in case the read goes pending due to IO - /// The serial number of the operation (used in recovery) /// is populated by the implementation - Status Read(ref Key key, ref Output output, Context userContext = default, long serialNo = 0); + Status Read(ref Key key, ref Output output, Context userContext = default); /// /// Read operation @@ -127,9 +122,8 @@ public interface ITsavoriteContext : ITsavor /// The location to place the retrieved value /// Contains options controlling the Read operation /// User application context passed in case the read goes pending due to IO - /// The serial number of the operation (used in recovery) /// is populated by the implementation - Status Read(ref Key key, ref Output output, ref ReadOptions readOptions, Context userContext = default, long serialNo = 0); + Status Read(ref Key key, ref Output output, ref ReadOptions readOptions, Context userContext = default); /// /// Read operation @@ -137,9 +131,8 @@ public interface ITsavoriteContext : ITsavor /// /// /// - /// /// - Status Read(Key key, out Output output, Context userContext = default, long serialNo = 0); + Status Read(Key key, out Output output, Context userContext = default); /// /// Read operation @@ -148,18 +141,16 @@ public interface ITsavoriteContext : ITsavor /// /// Contains options controlling the Read operation /// - /// /// - Status Read(Key key, out Output output, ref ReadOptions readOptions, Context userContext = default, long serialNo = 0); + Status Read(Key key, out Output output, ref ReadOptions readOptions, Context userContext = default); /// /// Read operation /// /// /// - /// /// - public (Status status, Output output) Read(Key key, Context userContext = default, long serialNo = 0); + public (Status status, Output output) Read(Key key, Context userContext = default); /// /// Read operation @@ -167,9 +158,8 @@ public interface ITsavoriteContext : ITsavor /// /// Contains options controlling the Read operation /// - /// /// - public (Status status, Output output) Read(Key key, ref ReadOptions readOptions, Context userContext = default, long serialNo = 0); + public (Status status, Output output) Read(Key key, ref ReadOptions readOptions, Context userContext = default); /// /// Read operation that accepts a ref argument to start the lookup at instead of starting at the hash table entry for , @@ -188,9 +178,8 @@ public interface ITsavoriteContext : ITsavor /// /// /// User application context passed in case the read goes pending due to IO - /// The serial number of the operation (used in recovery) /// is populated by the implementation - Status Read(ref Key key, ref Input input, ref Output output, ref ReadOptions readOptions, out RecordMetadata recordMetadata, Context userContext = default, long serialNo = 0); + Status Read(ref Key key, ref Input input, ref Output output, ref ReadOptions readOptions, out RecordMetadata recordMetadata, Context userContext = default); /// /// Read operation that accepts an address to lookup at, instead of a key. @@ -201,9 +190,8 @@ public interface ITsavoriteContext : ITsavor /// Contains options controlling the Read operation, including the address to read at in StartAddress /// On output, receives metadata about the record /// User application context passed in case the read goes pending due to IO - /// The serial number of the operation (used in recovery) /// is populated by the implementation; this should store the key if it needs it - Status ReadAtAddress(long address, ref Input input, ref Output output, ref ReadOptions readOptions, out RecordMetadata recordMetadata, Context userContext = default, long serialNo = 0); + Status ReadAtAddress(long address, ref Input input, ref Output output, ref ReadOptions readOptions, out RecordMetadata recordMetadata, Context userContext = default); /// /// Read operation that accepts an address to lookup at, and a key to optimize locking. @@ -215,9 +203,8 @@ public interface ITsavoriteContext : ITsavor /// Contains options controlling the Read operation, including the address to read at in StartAddress /// On output, receives metadata about the record /// User application context passed in case the read goes pending due to IO - /// The serial number of the operation (used in recovery) /// is populated by the implementation; this should store the key if it needs it - Status ReadAtAddress(long address, ref Key key, ref Input input, ref Output output, ref ReadOptions readOptions, out RecordMetadata recordMetadata, Context userContext = default, long serialNo = 0); + Status ReadAtAddress(long address, ref Key key, ref Input input, ref Output output, ref ReadOptions readOptions, out RecordMetadata recordMetadata, Context userContext = default); /// /// Async read operation. May return uncommitted results; to ensure reading of committed results, complete the read and then call WaitForCommitAsync. @@ -225,7 +212,6 @@ public interface ITsavoriteContext : ITsavor /// The key to look up /// Input to help extract the retrieved value into output /// User application context passed in case the read goes pending due to IO - /// The serial number of the operation (used in recovery) /// Token to cancel the operation /// wrapping /// The caller must await the return value to obtain the result, then call one of @@ -235,7 +221,7 @@ public interface ITsavoriteContext : ITsavor /// /// to complete the read operation and obtain the result status, the output that is populated by the /// implementation, and optionally a copy of the header for the retrieved record - ValueTask.ReadAsyncResult> ReadAsync(ref Key key, ref Input input, Context userContext = default, long serialNo = 0, CancellationToken cancellationToken = default); + ValueTask.ReadAsyncResult> ReadAsync(ref Key key, ref Input input, Context userContext = default, CancellationToken cancellationToken = default); /// /// Async read operation, may return uncommitted result @@ -244,7 +230,6 @@ public interface ITsavoriteContext : ITsavor /// /// /// - /// /// /// wrapping /// The caller must await the return value to obtain the result, then call one of @@ -254,7 +239,7 @@ public interface ITsavoriteContext : ITsavor /// /// to complete the read operation and obtain the result status, the output that is populated by the /// implementation, and optionally a copy of the header for the retrieved record - ValueTask.ReadAsyncResult> ReadAsync(Key key, Input input, Context context = default, long serialNo = 0, CancellationToken token = default); + ValueTask.ReadAsyncResult> ReadAsync(Key key, Input input, Context context = default, CancellationToken token = default); /// /// Async read operation, may return uncommitted result @@ -264,7 +249,6 @@ public interface ITsavoriteContext : ITsavor /// /// /// - /// /// /// wrapping /// The caller must await the return value to obtain the result, then call one of @@ -274,7 +258,7 @@ public interface ITsavoriteContext : ITsavor /// /// to complete the read operation and obtain the result status, the output that is populated by the /// implementation, and optionally a copy of the header for the retrieved record - ValueTask.ReadAsyncResult> ReadAsync(Key key, Input input, ref ReadOptions readOptions, Context context = default, long serialNo = 0, CancellationToken token = default); + ValueTask.ReadAsyncResult> ReadAsync(Key key, Input input, ref ReadOptions readOptions, Context context = default, CancellationToken token = default); /// /// Async read operation that accepts an address to start the lookup at instead of starting at the hash table entry for , @@ -285,7 +269,6 @@ public interface ITsavoriteContext : ITsavor /// Input to help extract the retrieved value into output /// Contains options controlling the Read operation /// User application context passed in case the read goes pending due to IO - /// The serial number of the operation (used in recovery) /// Token to cancel the operation /// wrapping /// The caller must await the return value to obtain the result, then call one of @@ -297,14 +280,13 @@ public interface ITsavoriteContext : ITsavor /// implementation, and optionally a copy of the header for the retrieved record /// ValueTask.ReadAsyncResult> ReadAsync(ref Key key, ref Input input, ref ReadOptions readOptions, - Context userContext = default, long serialNo = 0, CancellationToken cancellationToken = default); + Context userContext = default, CancellationToken cancellationToken = default); /// /// Async read operation. May return uncommitted results; to ensure reading of committed results, complete the read and then call WaitForCommitAsync. /// /// The key to look up /// User application context passed in case the read goes pending due to IO - /// The serial number of the operation (used in recovery) /// Token to cancel the operation /// wrapping /// The caller must await the return value to obtain the result, then call one of @@ -314,7 +296,7 @@ ValueTask.ReadAsyncResult> ReadA /// /// to complete the read operation and obtain the result status, the output that is populated by the /// implementation, and optionally a copy of the header for the retrieved record - ValueTask.ReadAsyncResult> ReadAsync(ref Key key, Context userContext = default, long serialNo = 0, CancellationToken token = default); + ValueTask.ReadAsyncResult> ReadAsync(ref Key key, Context userContext = default, CancellationToken token = default); /// /// Async read operation. May return uncommitted results; to ensure reading of committed results, complete the read and then call WaitForCommitAsync. @@ -322,7 +304,6 @@ ValueTask.ReadAsyncResult> ReadA /// The key to look up /// Contains options controlling the Read operation /// User application context passed in case the read goes pending due to IO - /// The serial number of the operation (used in recovery) /// Token to cancel the operation /// wrapping /// The caller must await the return value to obtain the result, then call one of @@ -332,7 +313,7 @@ ValueTask.ReadAsyncResult> ReadA /// /// to complete the read operation and obtain the result status, the output that is populated by the /// implementation, and optionally a copy of the header for the retrieved record - ValueTask.ReadAsyncResult> ReadAsync(ref Key key, ref ReadOptions readOptions, Context userContext = default, long serialNo = 0, CancellationToken token = default); + ValueTask.ReadAsyncResult> ReadAsync(ref Key key, ref ReadOptions readOptions, Context userContext = default, CancellationToken token = default); /// /// Async read operation, may return uncommitted result @@ -340,7 +321,6 @@ ValueTask.ReadAsyncResult> ReadA /// /// /// - /// /// /// wrapping /// The caller must await the return value to obtain the result, then call one of @@ -350,7 +330,7 @@ ValueTask.ReadAsyncResult> ReadA /// /// to complete the read operation and obtain the result status, the output that is populated by the /// implementation, and optionally a copy of the header for the retrieved record - ValueTask.ReadAsyncResult> ReadAsync(Key key, Context context = default, long serialNo = 0, CancellationToken token = default); + ValueTask.ReadAsyncResult> ReadAsync(Key key, Context context = default, CancellationToken token = default); /// /// Async read operation, may return uncommitted result @@ -359,7 +339,6 @@ ValueTask.ReadAsyncResult> ReadA /// /// Contains options controlling the Read operation /// - /// /// /// wrapping /// The caller must await the return value to obtain the result, then call one of @@ -369,7 +348,7 @@ ValueTask.ReadAsyncResult> ReadA /// /// to complete the read operation and obtain the result status, the output that is populated by the /// implementation, and optionally a copy of the header for the retrieved record - ValueTask.ReadAsyncResult> ReadAsync(Key key, ref ReadOptions readOptions, Context context = default, long serialNo = 0, CancellationToken token = default); + ValueTask.ReadAsyncResult> ReadAsync(Key key, ref ReadOptions readOptions, Context context = default, CancellationToken token = default); /// /// Async Read operation that accepts an address argument to lookup at, instead of a key. @@ -378,7 +357,6 @@ ValueTask.ReadAsyncResult> ReadA /// Input to help extract the retrieved value into output /// Contains options controlling the Read operation, including the address to read at in StartAddress /// User application context passed in case the read goes pending due to IO - /// The serial number of the operation (used in recovery) /// Token to cancel the operation /// wrapping /// The caller must await the return value to obtain the result, then call one of @@ -389,7 +367,7 @@ ValueTask.ReadAsyncResult> ReadA /// to complete the read operation and obtain the result status, the output that is populated by the /// implementation, and optionally a copy of the header for the retrieved record ValueTask.ReadAsyncResult> ReadAtAddressAsync(long address, ref Input input, ref ReadOptions readOptions, - Context userContext = default, long serialNo = 0, CancellationToken cancellationToken = default); + Context userContext = default, CancellationToken cancellationToken = default); /// /// Async Read operation that accepts an address argument to lookup at, and a key to optimize locking. @@ -399,7 +377,6 @@ ValueTask.ReadAsyncResult> ReadA /// Input to help extract the retrieved value into output /// Contains options controlling the Read operation, including the address to read at in StartAddress /// User application context passed in case the read goes pending due to IO - /// The serial number of the operation (used in recovery) /// Token to cancel the operation /// wrapping /// The caller must await the return value to obtain the result, then call one of @@ -410,7 +387,7 @@ ValueTask.ReadAsyncResult> ReadA /// to complete the read operation and obtain the result status, the output that is populated by the /// implementation, and optionally a copy of the header for the retrieved record ValueTask.ReadAsyncResult> ReadAtAddressAsync(long address, ref Key key, ref Input input, ref ReadOptions readOptions, - Context userContext = default, long serialNo = 0, CancellationToken cancellationToken = default); + Context userContext = default, CancellationToken cancellationToken = default); /// /// Upsert operation @@ -418,9 +395,8 @@ ValueTask.ReadAsyncResult> ReadA /// /// /// - /// /// - Status Upsert(ref Key key, ref Value desiredValue, Context userContext = default, long serialNo = 0); + Status Upsert(ref Key key, ref Value desiredValue, Context userContext = default); /// /// Upsert operation @@ -429,9 +405,8 @@ ValueTask.ReadAsyncResult> ReadA /// /// /// - /// /// - Status Upsert(ref Key key, ref Value desiredValue, ref UpsertOptions upsertOptions, Context userContext = default, long serialNo = 0); + Status Upsert(ref Key key, ref Value desiredValue, ref UpsertOptions upsertOptions, Context userContext = default); /// /// Upsert operation @@ -441,9 +416,8 @@ ValueTask.ReadAsyncResult> ReadA /// /// /// - /// /// - Status Upsert(ref Key key, ref Input input, ref Value desiredValue, ref Output output, Context userContext = default, long serialNo = 0); + Status Upsert(ref Key key, ref Input input, ref Value desiredValue, ref Output output, Context userContext = default); /// /// Upsert operation @@ -454,9 +428,8 @@ ValueTask.ReadAsyncResult> ReadA /// /// /// - /// /// - Status Upsert(ref Key key, ref Input input, ref Value desiredValue, ref Output output, ref UpsertOptions upsertOptions, Context userContext = default, long serialNo = 0); + Status Upsert(ref Key key, ref Input input, ref Value desiredValue, ref Output output, ref UpsertOptions upsertOptions, Context userContext = default); /// /// Upsert operation @@ -467,9 +440,8 @@ ValueTask.ReadAsyncResult> ReadA /// /// /// - /// /// - Status Upsert(ref Key key, ref Input input, ref Value desiredValue, ref Output output, out RecordMetadata recordMetadata, Context userContext = default, long serialNo = 0); + Status Upsert(ref Key key, ref Input input, ref Value desiredValue, ref Output output, out RecordMetadata recordMetadata, Context userContext = default); /// /// Upsert operation @@ -481,9 +453,8 @@ ValueTask.ReadAsyncResult> ReadA /// /// /// - /// /// - Status Upsert(ref Key key, ref Input input, ref Value desiredValue, ref Output output, ref UpsertOptions upsertOptions, out RecordMetadata recordMetadata, Context userContext = default, long serialNo = 0); + Status Upsert(ref Key key, ref Input input, ref Value desiredValue, ref Output output, ref UpsertOptions upsertOptions, out RecordMetadata recordMetadata, Context userContext = default); /// /// Upsert operation @@ -491,9 +462,8 @@ ValueTask.ReadAsyncResult> ReadA /// /// /// - /// /// - Status Upsert(Key key, Value desiredValue, Context userContext = default, long serialNo = 0); + Status Upsert(Key key, Value desiredValue, Context userContext = default); /// /// Upsert operation @@ -502,9 +472,8 @@ ValueTask.ReadAsyncResult> ReadA /// /// /// - /// /// - Status Upsert(Key key, Value desiredValue, ref UpsertOptions upsertOptions, Context userContext = default, long serialNo = 0); + Status Upsert(Key key, Value desiredValue, ref UpsertOptions upsertOptions, Context userContext = default); /// /// Upsert operation @@ -514,9 +483,8 @@ ValueTask.ReadAsyncResult> ReadA /// /// /// - /// /// - Status Upsert(Key key, Input input, Value desiredValue, ref Output output, Context userContext = default, long serialNo = 0); + Status Upsert(Key key, Input input, Value desiredValue, ref Output output, Context userContext = default); /// /// Upsert operation @@ -527,9 +495,8 @@ ValueTask.ReadAsyncResult> ReadA /// /// /// - /// /// - Status Upsert(Key key, Input input, Value desiredValue, ref Output output, ref UpsertOptions upsertOptions, Context userContext = default, long serialNo = 0); + Status Upsert(Key key, Input input, Value desiredValue, ref Output output, ref UpsertOptions upsertOptions, Context userContext = default); /// /// Async Upsert operation @@ -538,7 +505,6 @@ ValueTask.ReadAsyncResult> ReadA /// /// /// - /// /// /// ValueTask wrapping /// The caller must await the return value to obtain the result, then call one of @@ -547,7 +513,7 @@ ValueTask.ReadAsyncResult> ReadA /// result = await result. while result.Status is /// /// to complete the Upsert operation. Failure to complete the operation will result in leaked allocations. - ValueTask.UpsertAsyncResult> UpsertAsync(ref Key key, ref Value desiredValue, Context userContext = default, long serialNo = 0, CancellationToken token = default); + ValueTask.UpsertAsyncResult> UpsertAsync(ref Key key, ref Value desiredValue, Context userContext = default, CancellationToken token = default); /// /// Async Upsert operation @@ -557,7 +523,6 @@ ValueTask.ReadAsyncResult> ReadA /// /// /// - /// /// /// ValueTask wrapping /// The caller must await the return value to obtain the result, then call one of @@ -566,7 +531,7 @@ ValueTask.ReadAsyncResult> ReadA /// result = await result. while result.Status is /// /// to complete the Upsert operation. Failure to complete the operation will result in leaked allocations. - ValueTask.UpsertAsyncResult> UpsertAsync(ref Key key, ref Value desiredValue, ref UpsertOptions upsertOptions, Context userContext = default, long serialNo = 0, CancellationToken token = default); + ValueTask.UpsertAsyncResult> UpsertAsync(ref Key key, ref Value desiredValue, ref UpsertOptions upsertOptions, Context userContext = default, CancellationToken token = default); /// /// Async Upsert operation @@ -576,7 +541,6 @@ ValueTask.ReadAsyncResult> ReadA /// /// /// - /// /// /// ValueTask wrapping /// The caller must await the return value to obtain the result, then call one of @@ -585,7 +549,7 @@ ValueTask.ReadAsyncResult> ReadA /// result = await result. while result.Status is /// /// to complete the Upsert operation. Failure to complete the operation will result in leaked allocations. - ValueTask.UpsertAsyncResult> UpsertAsync(ref Key key, ref Input input, ref Value desiredValue, Context userContext = default, long serialNo = 0, CancellationToken token = default); + ValueTask.UpsertAsyncResult> UpsertAsync(ref Key key, ref Input input, ref Value desiredValue, Context userContext = default, CancellationToken token = default); /// /// Async Upsert operation @@ -596,7 +560,6 @@ ValueTask.ReadAsyncResult> ReadA /// /// /// - /// /// /// ValueTask wrapping /// The caller must await the return value to obtain the result, then call one of @@ -605,7 +568,7 @@ ValueTask.ReadAsyncResult> ReadA /// result = await result. while result.Status is /// /// to complete the Upsert operation. Failure to complete the operation will result in leaked allocations. - ValueTask.UpsertAsyncResult> UpsertAsync(ref Key key, ref Input input, ref Value desiredValue, ref UpsertOptions upsertOptions, Context userContext = default, long serialNo = 0, CancellationToken token = default); + ValueTask.UpsertAsyncResult> UpsertAsync(ref Key key, ref Input input, ref Value desiredValue, ref UpsertOptions upsertOptions, Context userContext = default, CancellationToken token = default); /// /// Async Upsert operation @@ -614,7 +577,6 @@ ValueTask.ReadAsyncResult> ReadA /// /// /// - /// /// /// ValueTask wrapping the asyncResult of the operation /// The caller must await the return value to obtain the result, then call one of @@ -623,7 +585,7 @@ ValueTask.ReadAsyncResult> ReadA /// result = await result. while result.Status is /// /// to complete the Upsert operation. Failure to complete the operation will result in leaked allocations. - ValueTask.UpsertAsyncResult> UpsertAsync(Key key, Value desiredValue, Context userContext = default, long serialNo = 0, CancellationToken token = default); + ValueTask.UpsertAsyncResult> UpsertAsync(Key key, Value desiredValue, Context userContext = default, CancellationToken token = default); /// /// Async Upsert operation @@ -633,7 +595,6 @@ ValueTask.ReadAsyncResult> ReadA /// /// /// - /// /// /// ValueTask wrapping the asyncResult of the operation /// The caller must await the return value to obtain the result, then call one of @@ -642,7 +603,7 @@ ValueTask.ReadAsyncResult> ReadA /// result = await result. while result.Status is /// /// to complete the Upsert operation. Failure to complete the operation will result in leaked allocations. - ValueTask.UpsertAsyncResult> UpsertAsync(Key key, Value desiredValue, ref UpsertOptions upsertOptions, Context userContext = default, long serialNo = 0, CancellationToken token = default); + ValueTask.UpsertAsyncResult> UpsertAsync(Key key, Value desiredValue, ref UpsertOptions upsertOptions, Context userContext = default, CancellationToken token = default); /// /// Async Upsert operation @@ -652,7 +613,6 @@ ValueTask.ReadAsyncResult> ReadA /// /// /// - /// /// /// ValueTask wrapping the asyncResult of the operation /// The caller must await the return value to obtain the result, then call one of @@ -661,7 +621,7 @@ ValueTask.ReadAsyncResult> ReadA /// result = await result. while result.Status is /// /// to complete the Upsert operation. Failure to complete the operation will result in leaked allocations. - ValueTask.UpsertAsyncResult> UpsertAsync(Key key, Input input, Value desiredValue, Context userContext = default, long serialNo = 0, CancellationToken token = default); + ValueTask.UpsertAsyncResult> UpsertAsync(Key key, Input input, Value desiredValue, Context userContext = default, CancellationToken token = default); /// /// Async Upsert operation @@ -672,7 +632,6 @@ ValueTask.ReadAsyncResult> ReadA /// /// /// - /// /// /// ValueTask wrapping the asyncResult of the operation /// The caller must await the return value to obtain the result, then call one of @@ -681,7 +640,7 @@ ValueTask.ReadAsyncResult> ReadA /// result = await result. while result.Status is /// /// to complete the Upsert operation. Failure to complete the operation will result in leaked allocations. - ValueTask.UpsertAsyncResult> UpsertAsync(Key key, Input input, Value desiredValue, ref UpsertOptions upsertOptions, Context userContext = default, long serialNo = 0, CancellationToken token = default); + ValueTask.UpsertAsyncResult> UpsertAsync(Key key, Input input, Value desiredValue, ref UpsertOptions upsertOptions, Context userContext = default, CancellationToken token = default); /// /// RMW operation @@ -690,9 +649,8 @@ ValueTask.ReadAsyncResult> ReadA /// /// /// - /// /// - Status RMW(ref Key key, ref Input input, ref Output output, Context userContext = default, long serialNo = 0); + Status RMW(ref Key key, ref Input input, ref Output output, Context userContext = default); /// /// RMW operation @@ -702,9 +660,8 @@ ValueTask.ReadAsyncResult> ReadA /// /// /// - /// /// - Status RMW(ref Key key, ref Input input, ref Output output, ref RMWOptions rmwOptions, Context userContext = default, long serialNo = 0); + Status RMW(ref Key key, ref Input input, ref Output output, ref RMWOptions rmwOptions, Context userContext = default); /// /// RMW operation @@ -714,9 +671,8 @@ ValueTask.ReadAsyncResult> ReadA /// /// /// - /// /// - Status RMW(ref Key key, ref Input input, ref Output output, out RecordMetadata recordMetadata, Context userContext = default, long serialNo = 0); + Status RMW(ref Key key, ref Input input, ref Output output, out RecordMetadata recordMetadata, Context userContext = default); /// /// RMW operation @@ -727,9 +683,8 @@ ValueTask.ReadAsyncResult> ReadA /// /// /// - /// /// - Status RMW(ref Key key, ref Input input, ref Output output, ref RMWOptions rmwOptions, out RecordMetadata recordMetadata, Context userContext = default, long serialNo = 0); + Status RMW(ref Key key, ref Input input, ref Output output, ref RMWOptions rmwOptions, out RecordMetadata recordMetadata, Context userContext = default); /// /// RMW operation @@ -738,9 +693,8 @@ ValueTask.ReadAsyncResult> ReadA /// /// /// - /// /// - Status RMW(Key key, Input input, out Output output, Context userContext = default, long serialNo = 0); + Status RMW(Key key, Input input, out Output output, Context userContext = default); /// /// RMW operation @@ -750,9 +704,8 @@ ValueTask.ReadAsyncResult> ReadA /// /// /// - /// /// - Status RMW(Key key, Input input, out Output output, ref RMWOptions rmwOptions, Context userContext = default, long serialNo = 0); + Status RMW(Key key, Input input, out Output output, ref RMWOptions rmwOptions, Context userContext = default); /// /// RMW operation @@ -760,9 +713,8 @@ ValueTask.ReadAsyncResult> ReadA /// /// /// - /// /// - Status RMW(ref Key key, ref Input input, Context userContext = default, long serialNo = 0); + Status RMW(ref Key key, ref Input input, Context userContext = default); /// /// RMW operation @@ -771,9 +723,8 @@ ValueTask.ReadAsyncResult> ReadA /// /// /// - /// /// - Status RMW(ref Key key, ref Input input, ref RMWOptions rmwOptions, Context userContext = default, long serialNo = 0); + Status RMW(ref Key key, ref Input input, ref RMWOptions rmwOptions, Context userContext = default); /// /// RMW operation @@ -781,9 +732,8 @@ ValueTask.ReadAsyncResult> ReadA /// /// /// - /// /// - Status RMW(Key key, Input input, Context userContext = default, long serialNo = 0); + Status RMW(Key key, Input input, Context userContext = default); /// /// RMW operation @@ -792,9 +742,8 @@ ValueTask.ReadAsyncResult> ReadA /// /// /// - /// /// - Status RMW(Key key, Input input, ref RMWOptions rmwOptions, Context userContext = default, long serialNo = 0); + Status RMW(Key key, Input input, ref RMWOptions rmwOptions, Context userContext = default); /// /// Async RMW operation @@ -803,7 +752,6 @@ ValueTask.ReadAsyncResult> ReadA /// /// /// - /// /// /// The caller must await the return value to obtain the result, then call one of /// @@ -811,7 +759,7 @@ ValueTask.ReadAsyncResult> ReadA /// result = await result. while result.Status is /// /// to complete the Upsert operation. Failure to complete the operation will result in leaked allocations. - ValueTask.RmwAsyncResult> RMWAsync(ref Key key, ref Input input, Context context = default, long serialNo = 0, CancellationToken token = default); + ValueTask.RmwAsyncResult> RMWAsync(ref Key key, ref Input input, Context context = default, CancellationToken token = default); /// /// Async RMW operation @@ -821,7 +769,6 @@ ValueTask.ReadAsyncResult> ReadA /// /// /// - /// /// /// The caller must await the return value to obtain the result, then call one of /// @@ -829,7 +776,7 @@ ValueTask.ReadAsyncResult> ReadA /// result = await result. while result.Status is /// /// to complete the Upsert operation. Failure to complete the operation will result in leaked allocations. - ValueTask.RmwAsyncResult> RMWAsync(ref Key key, ref Input input, ref RMWOptions rmwOptions, Context context = default, long serialNo = 0, CancellationToken token = default); + ValueTask.RmwAsyncResult> RMWAsync(ref Key key, ref Input input, ref RMWOptions rmwOptions, Context context = default, CancellationToken token = default); /// /// Async RMW operation @@ -838,7 +785,6 @@ ValueTask.ReadAsyncResult> ReadA /// /// /// - /// /// /// The caller must await the return value to obtain the result, then call one of /// @@ -846,7 +792,7 @@ ValueTask.ReadAsyncResult> ReadA /// result = await result. while result.Status is /// /// to complete the Upsert operation. Failure to complete the operation will result in leaked allocations. - ValueTask.RmwAsyncResult> RMWAsync(Key key, Input input, Context context = default, long serialNo = 0, CancellationToken token = default); + ValueTask.RmwAsyncResult> RMWAsync(Key key, Input input, Context context = default, CancellationToken token = default); /// /// Async RMW operation @@ -856,7 +802,6 @@ ValueTask.ReadAsyncResult> ReadA /// /// /// - /// /// /// The caller must await the return value to obtain the result, then call one of /// @@ -864,16 +809,15 @@ ValueTask.ReadAsyncResult> ReadA /// result = await result. while result.Status is /// /// to complete the Upsert operation. Failure to complete the operation will result in leaked allocations. - ValueTask.RmwAsyncResult> RMWAsync(Key key, Input input, ref RMWOptions rmwOptions, Context context = default, long serialNo = 0, CancellationToken token = default); + ValueTask.RmwAsyncResult> RMWAsync(Key key, Input input, ref RMWOptions rmwOptions, Context context = default, CancellationToken token = default); /// /// Delete operation /// /// /// - /// /// - Status Delete(ref Key key, Context userContext = default, long serialNo = 0); + Status Delete(ref Key key, Context userContext = default); /// /// Delete operation @@ -881,18 +825,16 @@ ValueTask.ReadAsyncResult> ReadA /// /// /// - /// /// - Status Delete(ref Key key, ref DeleteOptions deleteOptions, Context userContext = default, long serialNo = 0); + Status Delete(ref Key key, ref DeleteOptions deleteOptions, Context userContext = default); /// /// Delete operation /// /// /// - /// /// - Status Delete(Key key, Context userContext = default, long serialNo = 0); + Status Delete(Key key, Context userContext = default); /// /// Delete operation @@ -900,9 +842,8 @@ ValueTask.ReadAsyncResult> ReadA /// /// /// - /// /// - Status Delete(Key key, ref DeleteOptions deleteOptions, Context userContext = default, long serialNo = 0); + Status Delete(Key key, ref DeleteOptions deleteOptions, Context userContext = default); /// /// Async Delete operation @@ -910,7 +851,6 @@ ValueTask.ReadAsyncResult> ReadA /// /// /// - /// /// /// The caller must await the return value to obtain the result, then call one of /// @@ -918,7 +858,7 @@ ValueTask.ReadAsyncResult> ReadA /// result = await result. while result.Status is /// /// to complete the Upsert operation. Failure to complete the operation will result in leaked allocations. - ValueTask.DeleteAsyncResult> DeleteAsync(ref Key key, Context userContext = default, long serialNo = 0, CancellationToken token = default); + ValueTask.DeleteAsyncResult> DeleteAsync(ref Key key, Context userContext = default, CancellationToken token = default); /// /// Async Delete operation @@ -927,7 +867,6 @@ ValueTask.ReadAsyncResult> ReadA /// /// /// - /// /// /// The caller must await the return value to obtain the result, then call one of /// @@ -935,7 +874,7 @@ ValueTask.ReadAsyncResult> ReadA /// result = await result. while result.Status is /// /// to complete the Upsert operation. Failure to complete the operation will result in leaked allocations. - ValueTask.DeleteAsyncResult> DeleteAsync(ref Key key, ref DeleteOptions deleteOptions, Context userContext = default, long serialNo = 0, CancellationToken token = default); + ValueTask.DeleteAsyncResult> DeleteAsync(ref Key key, ref DeleteOptions deleteOptions, Context userContext = default, CancellationToken token = default); /// /// Async Delete operation @@ -943,7 +882,6 @@ ValueTask.ReadAsyncResult> ReadA /// /// /// - /// /// /// The caller must await the return value to obtain the result, then call one of /// @@ -951,7 +889,7 @@ ValueTask.ReadAsyncResult> ReadA /// result = await result. while result.Status is /// /// to complete the Upsert operation. Failure to complete the operation will result in leaked allocations. - ValueTask.DeleteAsyncResult> DeleteAsync(Key key, Context userContext = default, long serialNo = 0, CancellationToken token = default); + ValueTask.DeleteAsyncResult> DeleteAsync(Key key, Context userContext = default, CancellationToken token = default); /// /// Async Delete operation @@ -960,7 +898,6 @@ ValueTask.ReadAsyncResult> ReadA /// /// /// - /// /// /// The caller must await the return value to obtain the result, then call one of /// @@ -968,7 +905,7 @@ ValueTask.ReadAsyncResult> ReadA /// result = await result. while result.Status is /// /// to complete the Upsert operation. Failure to complete the operation will result in leaked allocations. - ValueTask.DeleteAsyncResult> DeleteAsync(Key key, ref DeleteOptions deleteOptions, Context userContext = default, long serialNo = 0, CancellationToken token = default); + ValueTask.DeleteAsyncResult> DeleteAsync(Key key, ref DeleteOptions deleteOptions, Context userContext = default, CancellationToken token = default); /// /// Reset the modified bit of a record (for in memory records) diff --git a/libs/storage/Tsavorite/cs/src/core/ClientSession/LockableContext.cs b/libs/storage/Tsavorite/cs/src/core/ClientSession/LockableContext.cs index b51eb3277a..af1fb57c8e 100644 --- a/libs/storage/Tsavorite/cs/src/core/ClientSession/LockableContext.cs +++ b/libs/storage/Tsavorite/cs/src/core/ClientSession/LockableContext.cs @@ -403,13 +403,13 @@ public ValueTask> Co /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public Status Read(ref Key key, ref Input input, ref Output output, Context userContext = default, long serialNo = 0) + public Status Read(ref Key key, ref Input input, ref Output output, Context userContext = default) { Debug.Assert(!clientSession.store.epoch.ThisInstanceProtected()); clientSession.UnsafeResumeThread(); try { - return clientSession.store.ContextRead(ref key, ref input, ref output, userContext, TsavoriteSession, serialNo); + return clientSession.store.ContextRead(ref key, ref input, ref output, userContext, TsavoriteSession); } finally { @@ -419,86 +419,86 @@ public Status Read(ref Key key, ref Input input, ref Output output, Context user /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public Status Read(ref Key key, ref Input input, ref Output output, ref ReadOptions readOptions, Context userContext = default, long serialNo = 0) - => Read(ref key, ref input, ref output, ref readOptions, out _, userContext, serialNo); + public Status Read(ref Key key, ref Input input, ref Output output, ref ReadOptions readOptions, Context userContext = default) + => Read(ref key, ref input, ref output, ref readOptions, out _, userContext); /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public Status Read(Key key, Input input, out Output output, Context userContext = default, long serialNo = 0) + public Status Read(Key key, Input input, out Output output, Context userContext = default) { output = default; - return Read(ref key, ref input, ref output, userContext, serialNo); + return Read(ref key, ref input, ref output, userContext); } /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public Status Read(Key key, Input input, out Output output, ref ReadOptions readOptions, Context userContext = default, long serialNo = 0) + public Status Read(Key key, Input input, out Output output, ref ReadOptions readOptions, Context userContext = default) { output = default; - return Read(ref key, ref input, ref output, ref readOptions, userContext, serialNo); + return Read(ref key, ref input, ref output, ref readOptions, userContext); } /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public Status Read(ref Key key, ref Output output, Context userContext = default, long serialNo = 0) + public Status Read(ref Key key, ref Output output, Context userContext = default) { Input input = default; - return Read(ref key, ref input, ref output, userContext, serialNo); + return Read(ref key, ref input, ref output, userContext); } /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public Status Read(ref Key key, ref Output output, ref ReadOptions readOptions, Context userContext = default, long serialNo = 0) + public Status Read(ref Key key, ref Output output, ref ReadOptions readOptions, Context userContext = default) { Input input = default; - return Read(ref key, ref input, ref output, ref readOptions, userContext, serialNo); + return Read(ref key, ref input, ref output, ref readOptions, userContext); } /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public Status Read(Key key, out Output output, Context userContext = default, long serialNo = 0) + public Status Read(Key key, out Output output, Context userContext = default) { Input input = default; output = default; - return Read(ref key, ref input, ref output, userContext, serialNo); + return Read(ref key, ref input, ref output, userContext); } /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public Status Read(Key key, out Output output, ref ReadOptions readOptions, Context userContext = default, long serialNo = 0) + public Status Read(Key key, out Output output, ref ReadOptions readOptions, Context userContext = default) { Input input = default; output = default; - return Read(ref key, ref input, ref output, ref readOptions, userContext, serialNo); + return Read(ref key, ref input, ref output, ref readOptions, userContext); } /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public (Status status, Output output) Read(Key key, Context userContext = default, long serialNo = 0) + public (Status status, Output output) Read(Key key, Context userContext = default) { Input input = default; Output output = default; - return (Read(ref key, ref input, ref output, userContext, serialNo), output); + return (Read(ref key, ref input, ref output, userContext), output); } /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public (Status status, Output output) Read(Key key, ref ReadOptions readOptions, Context userContext = default, long serialNo = 0) + public (Status status, Output output) Read(Key key, ref ReadOptions readOptions, Context userContext = default) { Input input = default; Output output = default; - return (Read(ref key, ref input, ref output, ref readOptions, userContext, serialNo), output); + return (Read(ref key, ref input, ref output, ref readOptions, userContext), output); } /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public Status Read(ref Key key, ref Input input, ref Output output, ref ReadOptions readOptions, out RecordMetadata recordMetadata, Context userContext = default, long serialNo = 0) + public Status Read(ref Key key, ref Input input, ref Output output, ref ReadOptions readOptions, out RecordMetadata recordMetadata, Context userContext = default) { Debug.Assert(!clientSession.store.epoch.ThisInstanceProtected()); clientSession.UnsafeResumeThread(); try { - return clientSession.store.ContextRead(ref key, ref input, ref output, ref readOptions, out recordMetadata, userContext, TsavoriteSession, serialNo); + return clientSession.store.ContextRead(ref key, ref input, ref output, ref readOptions, out recordMetadata, userContext, TsavoriteSession); } finally { @@ -508,13 +508,13 @@ public Status Read(ref Key key, ref Input input, ref Output output, ref ReadOpti /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public Status ReadAtAddress(long address, ref Input input, ref Output output, ref ReadOptions readOptions, out RecordMetadata recordMetadata, Context userContext = default, long serialNo = 0) + public Status ReadAtAddress(long address, ref Input input, ref Output output, ref ReadOptions readOptions, out RecordMetadata recordMetadata, Context userContext = default) { Debug.Assert(!clientSession.store.epoch.ThisInstanceProtected()); clientSession.UnsafeResumeThread(); try { - return clientSession.store.ContextReadAtAddress(address, ref input, ref output, ref readOptions, out recordMetadata, userContext, serialNo, TsavoriteSession); + return clientSession.store.ContextReadAtAddress(address, ref input, ref output, ref readOptions, out recordMetadata, userContext, TsavoriteSession); } finally { @@ -524,13 +524,13 @@ public Status ReadAtAddress(long address, ref Input input, ref Output output, re /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public Status ReadAtAddress(long address, ref Key key, ref Input input, ref Output output, ref ReadOptions readOptions, out RecordMetadata recordMetadata, Context userContext = default, long serialNo = 0) + public Status ReadAtAddress(long address, ref Key key, ref Input input, ref Output output, ref ReadOptions readOptions, out RecordMetadata recordMetadata, Context userContext = default) { Debug.Assert(!clientSession.store.epoch.ThisInstanceProtected()); clientSession.UnsafeResumeThread(); try { - return clientSession.store.ContextReadAtAddress(address, ref key, ref input, ref output, ref readOptions, out recordMetadata, userContext, serialNo, TsavoriteSession); + return clientSession.store.ContextReadAtAddress(address, ref key, ref input, ref output, ref readOptions, out recordMetadata, userContext, TsavoriteSession); } finally { @@ -540,116 +540,116 @@ public Status ReadAtAddress(long address, ref Key key, ref Input input, ref Outp /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ValueTask.ReadAsyncResult> ReadAsync(ref Key key, ref Input input, Context userContext = default, long serialNo = 0, CancellationToken cancellationToken = default) + public ValueTask.ReadAsyncResult> ReadAsync(ref Key key, ref Input input, Context userContext = default, CancellationToken cancellationToken = default) { ReadOptions readOptions = default; - return ReadAsync(ref key, ref input, ref readOptions, userContext, serialNo, cancellationToken); + return ReadAsync(ref key, ref input, ref readOptions, userContext, cancellationToken); } /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ValueTask.ReadAsyncResult> ReadAsync(ref Key key, ref Input input, ref ReadOptions readOptions, Context userContext = default, long serialNo = 0, CancellationToken cancellationToken = default) + public ValueTask.ReadAsyncResult> ReadAsync(ref Key key, ref Input input, ref ReadOptions readOptions, Context userContext = default, CancellationToken cancellationToken = default) { Debug.Assert(!clientSession.store.epoch.ThisInstanceProtected()); - return clientSession.store.ReadAsync(TsavoriteSession, ref key, ref input, ref readOptions, userContext, serialNo, cancellationToken); + return clientSession.store.ReadAsync(TsavoriteSession, ref key, ref input, ref readOptions, userContext, cancellationToken); } /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ValueTask.ReadAsyncResult> ReadAsync(Key key, Input input, Context context = default, long serialNo = 0, CancellationToken token = default) + public ValueTask.ReadAsyncResult> ReadAsync(Key key, Input input, Context context = default, CancellationToken token = default) { ReadOptions readOptions = default; - return ReadAsync(ref key, ref input, ref readOptions, context, serialNo, token); + return ReadAsync(ref key, ref input, ref readOptions, context, token); } /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ValueTask.ReadAsyncResult> ReadAsync(Key key, Input input, ref ReadOptions readOptions, Context context = default, long serialNo = 0, CancellationToken token = default) - => ReadAsync(ref key, ref input, ref readOptions, context, serialNo, token); + public ValueTask.ReadAsyncResult> ReadAsync(Key key, Input input, ref ReadOptions readOptions, Context context = default, CancellationToken token = default) + => ReadAsync(ref key, ref input, ref readOptions, context, token); /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ValueTask.ReadAsyncResult> ReadAsync(ref Key key, Context userContext = default, long serialNo = 0, CancellationToken token = default) + public ValueTask.ReadAsyncResult> ReadAsync(ref Key key, Context userContext = default, CancellationToken token = default) { ReadOptions readOptions = default; - return ReadAsync(ref key, ref readOptions, userContext, serialNo, token); + return ReadAsync(ref key, ref readOptions, userContext, token); } /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ValueTask.ReadAsyncResult> ReadAsync(ref Key key, ref ReadOptions readOptions, Context userContext = default, long serialNo = 0, CancellationToken token = default) + public ValueTask.ReadAsyncResult> ReadAsync(ref Key key, ref ReadOptions readOptions, Context userContext = default, CancellationToken token = default) { Debug.Assert(!clientSession.store.epoch.ThisInstanceProtected()); Input input = default; - return clientSession.store.ReadAsync(TsavoriteSession, ref key, ref input, ref readOptions, userContext, serialNo, token); + return clientSession.store.ReadAsync(TsavoriteSession, ref key, ref input, ref readOptions, userContext, token); } /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ValueTask.ReadAsyncResult> ReadAsync(Key key, Context context = default, long serialNo = 0, CancellationToken token = default) - => ReadAsync(ref key, context, serialNo, token); + public ValueTask.ReadAsyncResult> ReadAsync(Key key, Context context = default, CancellationToken token = default) + => ReadAsync(ref key, context, token); /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ValueTask.ReadAsyncResult> ReadAsync(Key key, ref ReadOptions readOptions, Context context = default, long serialNo = 0, CancellationToken token = default) - => ReadAsync(ref key, ref readOptions, context, serialNo, token); + public ValueTask.ReadAsyncResult> ReadAsync(Key key, ref ReadOptions readOptions, Context context = default, CancellationToken token = default) + => ReadAsync(ref key, ref readOptions, context, token); /// [MethodImpl(MethodImplOptions.AggressiveInlining)] public ValueTask.ReadAsyncResult> ReadAtAddressAsync(long address, ref Input input, ref ReadOptions readOptions, - Context userContext = default, long serialNo = 0, CancellationToken cancellationToken = default) + Context userContext = default, CancellationToken cancellationToken = default) { Debug.Assert(!clientSession.store.epoch.ThisInstanceProtected()); Key key = default; - return clientSession.store.ReadAtAddressAsync(TsavoriteSession, address, ref key, ref input, ref readOptions, userContext, serialNo, cancellationToken, noKey: true); + return clientSession.store.ReadAtAddressAsync(TsavoriteSession, address, ref key, ref input, ref readOptions, userContext, cancellationToken, noKey: true); } /// [MethodImpl(MethodImplOptions.AggressiveInlining)] public ValueTask.ReadAsyncResult> ReadAtAddressAsync(long address, ref Key key, ref Input input, ref ReadOptions readOptions, - Context userContext = default, long serialNo = 0, CancellationToken cancellationToken = default) + Context userContext = default, CancellationToken cancellationToken = default) { Debug.Assert(!clientSession.store.epoch.ThisInstanceProtected()); - return clientSession.store.ReadAtAddressAsync(TsavoriteSession, address, ref key, ref input, ref readOptions, userContext, serialNo, cancellationToken, noKey: false); + return clientSession.store.ReadAtAddressAsync(TsavoriteSession, address, ref key, ref input, ref readOptions, userContext, cancellationToken, noKey: false); } /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public Status Upsert(ref Key key, ref Value desiredValue, Context userContext = default, long serialNo = 0) + public Status Upsert(ref Key key, ref Value desiredValue, Context userContext = default) { Input input = default; Output output = default; - return Upsert(ref key, clientSession.store.comparer.GetHashCode64(ref key), ref input, ref desiredValue, ref output, userContext, serialNo); + return Upsert(ref key, clientSession.store.comparer.GetHashCode64(ref key), ref input, ref desiredValue, ref output, userContext); } /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public Status Upsert(ref Key key, ref Value desiredValue, ref UpsertOptions upsertOptions, Context userContext = default, long serialNo = 0) + public Status Upsert(ref Key key, ref Value desiredValue, ref UpsertOptions upsertOptions, Context userContext = default) { Input input = default; Output output = default; - return Upsert(ref key, upsertOptions.KeyHash ?? clientSession.store.comparer.GetHashCode64(ref key), ref input, ref desiredValue, ref output, userContext, serialNo); + return Upsert(ref key, upsertOptions.KeyHash ?? clientSession.store.comparer.GetHashCode64(ref key), ref input, ref desiredValue, ref output, userContext); } /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public Status Upsert(ref Key key, ref Input input, ref Value desiredValue, ref Output output, Context userContext = default, long serialNo = 0) - => Upsert(ref key, clientSession.store.comparer.GetHashCode64(ref key), ref input, ref desiredValue, ref output, userContext, serialNo); + public Status Upsert(ref Key key, ref Input input, ref Value desiredValue, ref Output output, Context userContext = default) + => Upsert(ref key, clientSession.store.comparer.GetHashCode64(ref key), ref input, ref desiredValue, ref output, userContext); /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public Status Upsert(ref Key key, ref Input input, ref Value desiredValue, ref Output output, ref UpsertOptions upsertOptions, Context userContext = default, long serialNo = 0) - => Upsert(ref key, upsertOptions.KeyHash ?? clientSession.store.comparer.GetHashCode64(ref key), ref input, ref desiredValue, ref output, userContext, serialNo); + public Status Upsert(ref Key key, ref Input input, ref Value desiredValue, ref Output output, ref UpsertOptions upsertOptions, Context userContext = default) + => Upsert(ref key, upsertOptions.KeyHash ?? clientSession.store.comparer.GetHashCode64(ref key), ref input, ref desiredValue, ref output, userContext); /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - private Status Upsert(ref Key key, long keyHash, ref Input input, ref Value desiredValue, ref Output output, Context userContext = default, long serialNo = 0) + private Status Upsert(ref Key key, long keyHash, ref Input input, ref Value desiredValue, ref Output output, Context userContext = default) { Debug.Assert(!clientSession.store.epoch.ThisInstanceProtected()); clientSession.UnsafeResumeThread(); try { - return clientSession.store.ContextUpsert(ref key, keyHash, ref input, ref desiredValue, ref output, userContext, TsavoriteSession, serialNo); + return clientSession.store.ContextUpsert(ref key, keyHash, ref input, ref desiredValue, ref output, userContext, TsavoriteSession); } finally { @@ -659,23 +659,23 @@ private Status Upsert(ref Key key, long keyHash, ref Input input, ref Value desi /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public Status Upsert(ref Key key, ref Input input, ref Value desiredValue, ref Output output, out RecordMetadata recordMetadata, Context userContext = default, long serialNo = 0) - => Upsert(ref key, clientSession.store.comparer.GetHashCode64(ref key), ref input, ref desiredValue, ref output, out recordMetadata, userContext, serialNo); + public Status Upsert(ref Key key, ref Input input, ref Value desiredValue, ref Output output, out RecordMetadata recordMetadata, Context userContext = default) + => Upsert(ref key, clientSession.store.comparer.GetHashCode64(ref key), ref input, ref desiredValue, ref output, out recordMetadata, userContext); /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public Status Upsert(ref Key key, ref Input input, ref Value desiredValue, ref Output output, ref UpsertOptions upsertOptions, out RecordMetadata recordMetadata, Context userContext = default, long serialNo = 0) - => Upsert(ref key, upsertOptions.KeyHash ?? clientSession.store.comparer.GetHashCode64(ref key), ref input, ref desiredValue, ref output, out recordMetadata, userContext, serialNo); + public Status Upsert(ref Key key, ref Input input, ref Value desiredValue, ref Output output, ref UpsertOptions upsertOptions, out RecordMetadata recordMetadata, Context userContext = default) + => Upsert(ref key, upsertOptions.KeyHash ?? clientSession.store.comparer.GetHashCode64(ref key), ref input, ref desiredValue, ref output, out recordMetadata, userContext); /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - private Status Upsert(ref Key key, long keyHash, ref Input input, ref Value desiredValue, ref Output output, out RecordMetadata recordMetadata, Context userContext = default, long serialNo = 0) + private Status Upsert(ref Key key, long keyHash, ref Input input, ref Value desiredValue, ref Output output, out RecordMetadata recordMetadata, Context userContext = default) { Debug.Assert(!clientSession.store.epoch.ThisInstanceProtected()); clientSession.UnsafeResumeThread(); try { - return clientSession.store.ContextUpsert(ref key, keyHash, ref input, ref desiredValue, ref output, out recordMetadata, userContext, TsavoriteSession, serialNo); + return clientSession.store.ContextUpsert(ref key, keyHash, ref input, ref desiredValue, ref output, out recordMetadata, userContext, TsavoriteSession); } finally { @@ -685,105 +685,105 @@ private Status Upsert(ref Key key, long keyHash, ref Input input, ref Value desi /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public Status Upsert(Key key, Value desiredValue, Context userContext = default, long serialNo = 0) - => Upsert(ref key, ref desiredValue, userContext, serialNo); + public Status Upsert(Key key, Value desiredValue, Context userContext = default) + => Upsert(ref key, ref desiredValue, userContext); /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public Status Upsert(Key key, Value desiredValue, ref UpsertOptions upsertOptions, Context userContext = default, long serialNo = 0) - => Upsert(ref key, ref desiredValue, ref upsertOptions, userContext, serialNo); + public Status Upsert(Key key, Value desiredValue, ref UpsertOptions upsertOptions, Context userContext = default) + => Upsert(ref key, ref desiredValue, ref upsertOptions, userContext); /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public Status Upsert(Key key, Input input, Value desiredValue, ref Output output, Context userContext = default, long serialNo = 0) - => Upsert(ref key, ref input, ref desiredValue, ref output, userContext, serialNo); + public Status Upsert(Key key, Input input, Value desiredValue, ref Output output, Context userContext = default) + => Upsert(ref key, ref input, ref desiredValue, ref output, userContext); /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public Status Upsert(Key key, Input input, Value desiredValue, ref Output output, ref UpsertOptions upsertOptions, Context userContext = default, long serialNo = 0) - => Upsert(ref key, ref input, ref desiredValue, ref output, ref upsertOptions, userContext, serialNo); + public Status Upsert(Key key, Input input, Value desiredValue, ref Output output, ref UpsertOptions upsertOptions, Context userContext = default) + => Upsert(ref key, ref input, ref desiredValue, ref output, ref upsertOptions, userContext); /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ValueTask.UpsertAsyncResult> UpsertAsync(ref Key key, ref Value desiredValue, Context userContext = default, long serialNo = 0, CancellationToken token = default) + public ValueTask.UpsertAsyncResult> UpsertAsync(ref Key key, ref Value desiredValue, Context userContext = default, CancellationToken token = default) { Input input = default; - return UpsertAsync(ref key, ref input, ref desiredValue, userContext, serialNo, token); + return UpsertAsync(ref key, ref input, ref desiredValue, userContext, token); } /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ValueTask.UpsertAsyncResult> UpsertAsync(ref Key key, ref Value desiredValue, ref UpsertOptions upsertOptions, Context userContext = default, long serialNo = 0, CancellationToken token = default) + public ValueTask.UpsertAsyncResult> UpsertAsync(ref Key key, ref Value desiredValue, ref UpsertOptions upsertOptions, Context userContext = default, CancellationToken token = default) { Input input = default; - return UpsertAsync(ref key, ref input, ref desiredValue, ref upsertOptions, userContext, serialNo, token); + return UpsertAsync(ref key, ref input, ref desiredValue, ref upsertOptions, userContext, token); } /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ValueTask.UpsertAsyncResult> UpsertAsync(ref Key key, ref Input input, ref Value desiredValue, Context userContext = default, long serialNo = 0, CancellationToken token = default) + public ValueTask.UpsertAsyncResult> UpsertAsync(ref Key key, ref Input input, ref Value desiredValue, Context userContext = default, CancellationToken token = default) { UpsertOptions upsertOptions = default; - return UpsertAsync(ref key, ref input, ref desiredValue, ref upsertOptions, userContext, serialNo, token); + return UpsertAsync(ref key, ref input, ref desiredValue, ref upsertOptions, userContext, token); } /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ValueTask.UpsertAsyncResult> UpsertAsync(ref Key key, ref Input input, ref Value desiredValue, ref UpsertOptions upsertOptions, Context userContext = default, long serialNo = 0, CancellationToken token = default) + public ValueTask.UpsertAsyncResult> UpsertAsync(ref Key key, ref Input input, ref Value desiredValue, ref UpsertOptions upsertOptions, Context userContext = default, CancellationToken token = default) { Debug.Assert(!clientSession.store.epoch.ThisInstanceProtected()); - return clientSession.store.UpsertAsync(TsavoriteSession, ref key, ref input, ref desiredValue, ref upsertOptions, userContext, serialNo, token); + return clientSession.store.UpsertAsync(TsavoriteSession, ref key, ref input, ref desiredValue, ref upsertOptions, userContext, token); } /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ValueTask.UpsertAsyncResult> UpsertAsync(Key key, Value desiredValue, Context userContext = default, long serialNo = 0, CancellationToken token = default) - => UpsertAsync(ref key, ref desiredValue, userContext, serialNo, token); + public ValueTask.UpsertAsyncResult> UpsertAsync(Key key, Value desiredValue, Context userContext = default, CancellationToken token = default) + => UpsertAsync(ref key, ref desiredValue, userContext, token); /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ValueTask.UpsertAsyncResult> UpsertAsync(Key key, Value desiredValue, ref UpsertOptions upsertOptions, Context userContext = default, long serialNo = 0, CancellationToken token = default) - => UpsertAsync(ref key, ref desiredValue, ref upsertOptions, userContext, serialNo, token); + public ValueTask.UpsertAsyncResult> UpsertAsync(Key key, Value desiredValue, ref UpsertOptions upsertOptions, Context userContext = default, CancellationToken token = default) + => UpsertAsync(ref key, ref desiredValue, ref upsertOptions, userContext, token); /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ValueTask.UpsertAsyncResult> UpsertAsync(Key key, Input input, Value desiredValue, Context userContext = default, long serialNo = 0, CancellationToken token = default) - => UpsertAsync(ref key, ref input, ref desiredValue, userContext, serialNo, token); + public ValueTask.UpsertAsyncResult> UpsertAsync(Key key, Input input, Value desiredValue, Context userContext = default, CancellationToken token = default) + => UpsertAsync(ref key, ref input, ref desiredValue, userContext, token); /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ValueTask.UpsertAsyncResult> UpsertAsync(Key key, Input input, Value desiredValue, ref UpsertOptions upsertOptions, Context userContext = default, long serialNo = 0, CancellationToken token = default) - => UpsertAsync(ref key, ref input, ref desiredValue, ref upsertOptions, userContext, serialNo, token); + public ValueTask.UpsertAsyncResult> UpsertAsync(Key key, Input input, Value desiredValue, ref UpsertOptions upsertOptions, Context userContext = default, CancellationToken token = default) + => UpsertAsync(ref key, ref input, ref desiredValue, ref upsertOptions, userContext, token); /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public Status RMW(ref Key key, ref Input input, ref Output output, Context userContext = default, long serialNo = 0) - => RMW(ref key, ref input, ref output, out _, userContext, serialNo); + public Status RMW(ref Key key, ref Input input, ref Output output, Context userContext = default) + => RMW(ref key, ref input, ref output, out _, userContext); /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public Status RMW(ref Key key, ref Input input, ref Output output, ref RMWOptions rmwOptions, Context userContext = default, long serialNo = 0) - => RMW(ref key, rmwOptions.KeyHash ?? clientSession.store.comparer.GetHashCode64(ref key), ref input, ref output, out _, userContext, serialNo); + public Status RMW(ref Key key, ref Input input, ref Output output, ref RMWOptions rmwOptions, Context userContext = default) + => RMW(ref key, rmwOptions.KeyHash ?? clientSession.store.comparer.GetHashCode64(ref key), ref input, ref output, out _, userContext); /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public Status RMW(ref Key key, ref Input input, ref Output output, out RecordMetadata recordMetadata, Context userContext = default, long serialNo = 0) - => RMW(ref key, clientSession.store.comparer.GetHashCode64(ref key), ref input, ref output, out recordMetadata, userContext, serialNo); + public Status RMW(ref Key key, ref Input input, ref Output output, out RecordMetadata recordMetadata, Context userContext = default) + => RMW(ref key, clientSession.store.comparer.GetHashCode64(ref key), ref input, ref output, out recordMetadata, userContext); /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public Status RMW(ref Key key, ref Input input, ref Output output, ref RMWOptions rmwOptions, out RecordMetadata recordMetadata, Context userContext = default, long serialNo = 0) - => RMW(ref key, rmwOptions.KeyHash ?? clientSession.store.comparer.GetHashCode64(ref key), ref input, ref output, out recordMetadata, userContext, serialNo); + public Status RMW(ref Key key, ref Input input, ref Output output, ref RMWOptions rmwOptions, out RecordMetadata recordMetadata, Context userContext = default) + => RMW(ref key, rmwOptions.KeyHash ?? clientSession.store.comparer.GetHashCode64(ref key), ref input, ref output, out recordMetadata, userContext); /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public Status RMW(ref Key key, long keyHash, ref Input input, ref Output output, out RecordMetadata recordMetadata, Context userContext = default, long serialNo = 0) + private Status RMW(ref Key key, long keyHash, ref Input input, ref Output output, out RecordMetadata recordMetadata, Context userContext = default) { Debug.Assert(!clientSession.store.epoch.ThisInstanceProtected()); clientSession.UnsafeResumeThread(); try { - return clientSession.store.ContextRMW(ref key, keyHash, ref input, ref output, out recordMetadata, userContext, TsavoriteSession, serialNo); + return clientSession.store.ContextRMW(ref key, keyHash, ref input, ref output, out recordMetadata, userContext, TsavoriteSession); } finally { @@ -793,97 +793,97 @@ public Status RMW(ref Key key, long keyHash, ref Input input, ref Output output, /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public Status RMW(Key key, Input input, out Output output, Context userContext = default, long serialNo = 0) + public Status RMW(Key key, Input input, out Output output, Context userContext = default) { output = default; - return RMW(ref key, ref input, ref output, userContext, serialNo); + return RMW(ref key, ref input, ref output, userContext); } /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public Status RMW(Key key, Input input, out Output output, ref RMWOptions rmwOptions, Context userContext = default, long serialNo = 0) + public Status RMW(Key key, Input input, out Output output, ref RMWOptions rmwOptions, Context userContext = default) { output = default; - return RMW(ref key, ref input, ref output, ref rmwOptions, userContext, serialNo); + return RMW(ref key, ref input, ref output, ref rmwOptions, userContext); } /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public Status RMW(ref Key key, ref Input input, Context userContext = default, long serialNo = 0) + public Status RMW(ref Key key, ref Input input, Context userContext = default) { Output output = default; - return RMW(ref key, ref input, ref output, userContext, serialNo); + return RMW(ref key, ref input, ref output, userContext); } /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public Status RMW(ref Key key, ref Input input, ref RMWOptions rmwOptions, Context userContext = default, long serialNo = 0) + public Status RMW(ref Key key, ref Input input, ref RMWOptions rmwOptions, Context userContext = default) { Output output = default; - return RMW(ref key, ref input, ref output, ref rmwOptions, userContext, serialNo); + return RMW(ref key, ref input, ref output, ref rmwOptions, userContext); } /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public Status RMW(Key key, Input input, Context userContext = default, long serialNo = 0) + public Status RMW(Key key, Input input, Context userContext = default) { Output output = default; - return RMW(ref key, ref input, ref output, userContext, serialNo); + return RMW(ref key, ref input, ref output, userContext); } /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public Status RMW(Key key, Input input, ref RMWOptions rmwOptions, Context userContext = default, long serialNo = 0) + public Status RMW(Key key, Input input, ref RMWOptions rmwOptions, Context userContext = default) { Output output = default; - return RMW(ref key, ref input, ref output, ref rmwOptions, userContext, serialNo); + return RMW(ref key, ref input, ref output, ref rmwOptions, userContext); } /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ValueTask.RmwAsyncResult> RMWAsync(ref Key key, ref Input input, Context context = default, long serialNo = 0, CancellationToken token = default) + public ValueTask.RmwAsyncResult> RMWAsync(ref Key key, ref Input input, Context context = default, CancellationToken token = default) { RMWOptions rmwOptions = default; - return RMWAsync(ref key, ref input, ref rmwOptions, context, serialNo, token); + return RMWAsync(ref key, ref input, ref rmwOptions, context, token); } /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ValueTask.RmwAsyncResult> RMWAsync(ref Key key, ref Input input, ref RMWOptions rmwOptions, Context context = default, long serialNo = 0, CancellationToken token = default) + public ValueTask.RmwAsyncResult> RMWAsync(ref Key key, ref Input input, ref RMWOptions rmwOptions, Context context = default, CancellationToken token = default) { Debug.Assert(!clientSession.store.epoch.ThisInstanceProtected()); - return clientSession.store.RmwAsync(TsavoriteSession, ref key, ref input, ref rmwOptions, context, serialNo, token); + return clientSession.store.RmwAsync(TsavoriteSession, ref key, ref input, ref rmwOptions, context, token); } /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ValueTask.RmwAsyncResult> RMWAsync(Key key, Input input, Context context = default, long serialNo = 0, CancellationToken token = default) - => RMWAsync(ref key, ref input, context, serialNo, token); + public ValueTask.RmwAsyncResult> RMWAsync(Key key, Input input, Context context = default, CancellationToken token = default) + => RMWAsync(ref key, ref input, context, token); /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ValueTask.RmwAsyncResult> RMWAsync(Key key, Input input, ref RMWOptions rmwOptions, Context context = default, long serialNo = 0, CancellationToken token = default) - => RMWAsync(ref key, ref input, ref rmwOptions, context, serialNo, token); + public ValueTask.RmwAsyncResult> RMWAsync(Key key, Input input, ref RMWOptions rmwOptions, Context context = default, CancellationToken token = default) + => RMWAsync(ref key, ref input, ref rmwOptions, context, token); /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public Status Delete(ref Key key, Context userContext = default, long serialNo = 0) - => Delete(ref key, clientSession.store.comparer.GetHashCode64(ref key), userContext, serialNo); + public Status Delete(ref Key key, Context userContext = default) + => Delete(ref key, clientSession.store.comparer.GetHashCode64(ref key), userContext); /// /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public Status Delete(ref Key key, ref DeleteOptions deleteOptions, Context userContext = default, long serialNo = 0) - => Delete(ref key, deleteOptions.KeyHash ?? clientSession.store.comparer.GetHashCode64(ref key), userContext, serialNo); + public Status Delete(ref Key key, ref DeleteOptions deleteOptions, Context userContext = default) + => Delete(ref key, deleteOptions.KeyHash ?? clientSession.store.comparer.GetHashCode64(ref key), userContext); [MethodImpl(MethodImplOptions.AggressiveInlining)] - private Status Delete(ref Key key, long keyHash, Context userContext = default, long serialNo = 0) + private Status Delete(ref Key key, long keyHash, Context userContext = default) { Debug.Assert(!clientSession.store.epoch.ThisInstanceProtected()); clientSession.UnsafeResumeThread(); try { - return clientSession.store.ContextDelete(ref key, keyHash, userContext, TsavoriteSession, serialNo); + return clientSession.store.ContextDelete(ref key, keyHash, userContext, TsavoriteSession); } finally { @@ -893,39 +893,39 @@ private Status Delete(ref Key key, long keyHash, Context userContext = default, /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public Status Delete(Key key, Context userContext = default, long serialNo = 0) - => Delete(ref key, userContext, serialNo); + public Status Delete(Key key, Context userContext = default) + => Delete(ref key, userContext); /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public Status Delete(Key key, ref DeleteOptions deleteOptions, Context userContext = default, long serialNo = 0) - => Delete(ref key, ref deleteOptions, userContext, serialNo); + public Status Delete(Key key, ref DeleteOptions deleteOptions, Context userContext = default) + => Delete(ref key, ref deleteOptions, userContext); /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ValueTask.DeleteAsyncResult> DeleteAsync(ref Key key, Context userContext = default, long serialNo = 0, CancellationToken token = default) + public ValueTask.DeleteAsyncResult> DeleteAsync(ref Key key, Context userContext = default, CancellationToken token = default) { DeleteOptions deleteOptions = default; - return DeleteAsync(ref key, ref deleteOptions, userContext, serialNo, token); + return DeleteAsync(ref key, ref deleteOptions, userContext, token); } /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ValueTask.DeleteAsyncResult> DeleteAsync(ref Key key, ref DeleteOptions deleteOptions, Context userContext = default, long serialNo = 0, CancellationToken token = default) + public ValueTask.DeleteAsyncResult> DeleteAsync(ref Key key, ref DeleteOptions deleteOptions, Context userContext = default, CancellationToken token = default) { Debug.Assert(!clientSession.store.epoch.ThisInstanceProtected()); - return clientSession.store.DeleteAsync(TsavoriteSession, ref key, ref deleteOptions, userContext, serialNo, token); + return clientSession.store.DeleteAsync(TsavoriteSession, ref key, ref deleteOptions, userContext, token); } /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ValueTask.DeleteAsyncResult> DeleteAsync(Key key, Context userContext = default, long serialNo = 0, CancellationToken token = default) - => DeleteAsync(ref key, userContext, serialNo, token); + public ValueTask.DeleteAsyncResult> DeleteAsync(Key key, Context userContext = default, CancellationToken token = default) + => DeleteAsync(ref key, userContext, token); /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ValueTask.DeleteAsyncResult> DeleteAsync(Key key, ref DeleteOptions deleteOptions, Context userContext = default, long serialNo = 0, CancellationToken token = default) - => DeleteAsync(ref key, ref deleteOptions, userContext, serialNo, token); + public ValueTask.DeleteAsyncResult> DeleteAsync(Key key, ref DeleteOptions deleteOptions, Context userContext = default, CancellationToken token = default) + => DeleteAsync(ref key, ref deleteOptions, userContext, token); /// [MethodImpl(MethodImplOptions.AggressiveInlining)] @@ -1099,14 +1099,6 @@ public void DisposeForRevivification(ref Key key, ref Value value, int newKeySiz => _clientSession.functions.DisposeForRevivification(ref key, ref value, newKeySize); #endregion IFunctions - Dispose - #region IFunctions - Checkpointing - public void CheckpointCompletionCallback(int sessionID, string sessionName, CommitPoint commitPoint) - { - _clientSession.functions.CheckpointCompletionCallback(sessionID, sessionName, commitPoint); - _clientSession.LatestCommitPoint = commitPoint; - } - #endregion IFunctions - Checkpointing - #region Transient locking [MethodImpl(MethodImplOptions.AggressiveInlining)] public bool TryLockTransientExclusive(ref Key key, ref OperationStackContext stackCtx) diff --git a/libs/storage/Tsavorite/cs/src/core/ClientSession/LockableUnsafeContext.cs b/libs/storage/Tsavorite/cs/src/core/ClientSession/LockableUnsafeContext.cs index 45a6d2e644..e137445602 100644 --- a/libs/storage/Tsavorite/cs/src/core/ClientSession/LockableUnsafeContext.cs +++ b/libs/storage/Tsavorite/cs/src/core/ClientSession/LockableUnsafeContext.cs @@ -203,473 +203,473 @@ public ValueTask> Co /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public Status Read(ref Key key, ref Input input, ref Output output, Context userContext = default, long serialNo = 0) + public Status Read(ref Key key, ref Input input, ref Output output, Context userContext = default) { Debug.Assert(clientSession.store.epoch.ThisInstanceProtected()); - return clientSession.store.ContextRead(ref key, ref input, ref output, userContext, TsavoriteSession, serialNo); + return clientSession.store.ContextRead(ref key, ref input, ref output, userContext, TsavoriteSession); } /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public Status Read(ref Key key, ref Input input, ref Output output, ref ReadOptions readOptions, Context userContext = default, long serialNo = 0) + public Status Read(ref Key key, ref Input input, ref Output output, ref ReadOptions readOptions, Context userContext = default) { Debug.Assert(clientSession.store.epoch.ThisInstanceProtected()); - return clientSession.store.ContextRead(ref key, ref input, ref output, ref readOptions, out _, userContext, TsavoriteSession, serialNo); + return clientSession.store.ContextRead(ref key, ref input, ref output, ref readOptions, out _, userContext, TsavoriteSession); } /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public Status Read(Key key, Input input, out Output output, Context userContext = default, long serialNo = 0) + public Status Read(Key key, Input input, out Output output, Context userContext = default) { output = default; - return Read(ref key, ref input, ref output, userContext, serialNo); + return Read(ref key, ref input, ref output, userContext); } /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public Status Read(Key key, Input input, out Output output, ref ReadOptions readOptions, Context userContext = default, long serialNo = 0) + public Status Read(Key key, Input input, out Output output, ref ReadOptions readOptions, Context userContext = default) { output = default; - return Read(ref key, ref input, ref output, ref readOptions, userContext, serialNo); + return Read(ref key, ref input, ref output, ref readOptions, userContext); } /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public Status Read(ref Key key, ref Output output, Context userContext = default, long serialNo = 0) + public Status Read(ref Key key, ref Output output, Context userContext = default) { Input input = default; - return Read(ref key, ref input, ref output, userContext, serialNo); + return Read(ref key, ref input, ref output, userContext); } /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public Status Read(ref Key key, ref Output output, ref ReadOptions readOptions, Context userContext = default, long serialNo = 0) + public Status Read(ref Key key, ref Output output, ref ReadOptions readOptions, Context userContext = default) { Input input = default; - return Read(ref key, ref input, ref output, ref readOptions, userContext, serialNo); + return Read(ref key, ref input, ref output, ref readOptions, userContext); } /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public Status Read(Key key, out Output output, Context userContext = default, long serialNo = 0) + public Status Read(Key key, out Output output, Context userContext = default) { Input input = default; output = default; - return Read(ref key, ref input, ref output, userContext, serialNo); + return Read(ref key, ref input, ref output, userContext); } /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public Status Read(Key key, out Output output, ref ReadOptions readOptions, Context userContext = default, long serialNo = 0) + public Status Read(Key key, out Output output, ref ReadOptions readOptions, Context userContext = default) { Input input = default; output = default; - return Read(ref key, ref input, ref output, ref readOptions, userContext, serialNo); + return Read(ref key, ref input, ref output, ref readOptions, userContext); } /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public (Status status, Output output) Read(Key key, Context userContext = default, long serialNo = 0) + public (Status status, Output output) Read(Key key, Context userContext = default) { Input input = default; Output output = default; - return (Read(ref key, ref input, ref output, userContext, serialNo), output); + return (Read(ref key, ref input, ref output, userContext), output); } /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public (Status status, Output output) Read(Key key, ref ReadOptions readOptions, Context userContext = default, long serialNo = 0) + public (Status status, Output output) Read(Key key, ref ReadOptions readOptions, Context userContext = default) { Input input = default; Output output = default; - return (Read(ref key, ref input, ref output, ref readOptions, userContext, serialNo), output); + return (Read(ref key, ref input, ref output, ref readOptions, userContext), output); } /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public Status Read(ref Key key, ref Input input, ref Output output, ref ReadOptions readOptions, out RecordMetadata recordMetadata, Context userContext = default, long serialNo = 0) + public Status Read(ref Key key, ref Input input, ref Output output, ref ReadOptions readOptions, out RecordMetadata recordMetadata, Context userContext = default) { Debug.Assert(clientSession.store.epoch.ThisInstanceProtected()); - return clientSession.store.ContextRead(ref key, ref input, ref output, ref readOptions, out recordMetadata, userContext, TsavoriteSession, serialNo); + return clientSession.store.ContextRead(ref key, ref input, ref output, ref readOptions, out recordMetadata, userContext, TsavoriteSession); } /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public Status ReadAtAddress(long address, ref Input input, ref Output output, ref ReadOptions readOptions, out RecordMetadata recordMetadata, Context userContext = default, long serialNo = 0) + public Status ReadAtAddress(long address, ref Input input, ref Output output, ref ReadOptions readOptions, out RecordMetadata recordMetadata, Context userContext = default) { Debug.Assert(clientSession.store.epoch.ThisInstanceProtected()); - return clientSession.store.ContextReadAtAddress(address, ref input, ref output, ref readOptions, out recordMetadata, userContext, serialNo, TsavoriteSession); + return clientSession.store.ContextReadAtAddress(address, ref input, ref output, ref readOptions, out recordMetadata, userContext, TsavoriteSession); } /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public Status ReadAtAddress(long address, ref Key key, ref Input input, ref Output output, ref ReadOptions readOptions, out RecordMetadata recordMetadata, Context userContext = default, long serialNo = 0) + public Status ReadAtAddress(long address, ref Key key, ref Input input, ref Output output, ref ReadOptions readOptions, out RecordMetadata recordMetadata, Context userContext = default) { Debug.Assert(clientSession.store.epoch.ThisInstanceProtected()); - return clientSession.store.ContextReadAtAddress(address, ref key, ref input, ref output, ref readOptions, out recordMetadata, userContext, serialNo, TsavoriteSession); + return clientSession.store.ContextReadAtAddress(address, ref key, ref input, ref output, ref readOptions, out recordMetadata, userContext, TsavoriteSession); } /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ValueTask.ReadAsyncResult> ReadAsync(ref Key key, ref Input input, Context userContext = default, long serialNo = 0, CancellationToken cancellationToken = default) + public ValueTask.ReadAsyncResult> ReadAsync(ref Key key, ref Input input, Context userContext = default, CancellationToken cancellationToken = default) { ReadOptions readOptions = default; - return ReadAsync(ref key, ref input, ref readOptions, userContext, serialNo, cancellationToken); + return ReadAsync(ref key, ref input, ref readOptions, userContext, cancellationToken); } /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ValueTask.ReadAsyncResult> ReadAsync(ref Key key, ref Input input, ref ReadOptions readOptions, Context userContext = default, long serialNo = 0, CancellationToken cancellationToken = default) + public ValueTask.ReadAsyncResult> ReadAsync(ref Key key, ref Input input, ref ReadOptions readOptions, Context userContext = default, CancellationToken cancellationToken = default) { Debug.Assert(!clientSession.store.epoch.ThisInstanceProtected()); - return clientSession.store.ReadAsync(TsavoriteSession, ref key, ref input, ref readOptions, userContext, serialNo, cancellationToken); + return clientSession.store.ReadAsync(TsavoriteSession, ref key, ref input, ref readOptions, userContext, cancellationToken); } /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ValueTask.ReadAsyncResult> ReadAsync(Key key, Input input, Context context = default, long serialNo = 0, CancellationToken token = default) - => ReadAsync(ref key, ref input, context, serialNo, token); + public ValueTask.ReadAsyncResult> ReadAsync(Key key, Input input, Context context = default, CancellationToken token = default) + => ReadAsync(ref key, ref input, context, token); /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ValueTask.ReadAsyncResult> ReadAsync(Key key, Input input, ref ReadOptions readOptions, Context context = default, long serialNo = 0, CancellationToken token = default) + public ValueTask.ReadAsyncResult> ReadAsync(Key key, Input input, ref ReadOptions readOptions, Context context = default, CancellationToken token = default) { Debug.Assert(!clientSession.store.epoch.ThisInstanceProtected()); - return clientSession.store.ReadAsync(TsavoriteSession, ref key, ref input, ref readOptions, context, serialNo, token); + return clientSession.store.ReadAsync(TsavoriteSession, ref key, ref input, ref readOptions, context, token); } /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ValueTask.ReadAsyncResult> ReadAsync(ref Key key, Context userContext = default, long serialNo = 0, CancellationToken token = default) + public ValueTask.ReadAsyncResult> ReadAsync(ref Key key, Context userContext = default, CancellationToken token = default) { ReadOptions readOptions = default; - return ReadAsync(ref key, ref readOptions, userContext, serialNo, token); + return ReadAsync(ref key, ref readOptions, userContext, token); } /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ValueTask.ReadAsyncResult> ReadAsync(ref Key key, ref ReadOptions readOptions, Context userContext = default, long serialNo = 0, CancellationToken token = default) + public ValueTask.ReadAsyncResult> ReadAsync(ref Key key, ref ReadOptions readOptions, Context userContext = default, CancellationToken token = default) { Debug.Assert(!clientSession.store.epoch.ThisInstanceProtected()); Input input = default; - return clientSession.store.ReadAsync(TsavoriteSession, ref key, ref input, ref readOptions, userContext, serialNo, token); + return clientSession.store.ReadAsync(TsavoriteSession, ref key, ref input, ref readOptions, userContext, token); } /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ValueTask.ReadAsyncResult> ReadAsync(Key key, Context context = default, long serialNo = 0, CancellationToken token = default) - => ReadAsync(ref key, context, serialNo, token); + public ValueTask.ReadAsyncResult> ReadAsync(Key key, Context context = default, CancellationToken token = default) + => ReadAsync(ref key, context, token); /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ValueTask.ReadAsyncResult> ReadAsync(Key key, ref ReadOptions readOptions, Context context = default, long serialNo = 0, CancellationToken token = default) - => ReadAsync(ref key, ref readOptions, context, serialNo, token); + public ValueTask.ReadAsyncResult> ReadAsync(Key key, ref ReadOptions readOptions, Context context = default, CancellationToken token = default) + => ReadAsync(ref key, ref readOptions, context, token); /// [MethodImpl(MethodImplOptions.AggressiveInlining)] public ValueTask.ReadAsyncResult> ReadAtAddressAsync(long address, ref Input input, ref ReadOptions readOptions, - Context userContext = default, long serialNo = 0, CancellationToken cancellationToken = default) + Context userContext = default, CancellationToken cancellationToken = default) { Debug.Assert(!clientSession.store.epoch.ThisInstanceProtected()); Key key = default; - return clientSession.store.ReadAtAddressAsync(TsavoriteSession, address, ref key, ref input, ref readOptions, userContext, serialNo, cancellationToken, noKey: true); + return clientSession.store.ReadAtAddressAsync(TsavoriteSession, address, ref key, ref input, ref readOptions, userContext, cancellationToken, noKey: true); } /// [MethodImpl(MethodImplOptions.AggressiveInlining)] public ValueTask.ReadAsyncResult> ReadAtAddressAsync(long address, ref Key key, ref Input input, ref ReadOptions readOptions, - Context userContext = default, long serialNo = 0, CancellationToken cancellationToken = default) + Context userContext = default, CancellationToken cancellationToken = default) { Debug.Assert(!clientSession.store.epoch.ThisInstanceProtected()); - return clientSession.store.ReadAtAddressAsync(TsavoriteSession, address, ref key, ref input, ref readOptions, userContext, serialNo, cancellationToken, noKey: false); + return clientSession.store.ReadAtAddressAsync(TsavoriteSession, address, ref key, ref input, ref readOptions, userContext, cancellationToken, noKey: false); } /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public Status Upsert(ref Key key, ref Value desiredValue, Context userContext = default, long serialNo = 0) + public Status Upsert(ref Key key, ref Value desiredValue, Context userContext = default) { Input input = default; Output output = default; - return Upsert(ref key, clientSession.store.comparer.GetHashCode64(ref key), ref input, ref desiredValue, ref output, userContext, serialNo); + return Upsert(ref key, clientSession.store.comparer.GetHashCode64(ref key), ref input, ref desiredValue, ref output, userContext); } /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public Status Upsert(ref Key key, ref Value desiredValue, ref UpsertOptions upsertOptions, Context userContext = default, long serialNo = 0) + public Status Upsert(ref Key key, ref Value desiredValue, ref UpsertOptions upsertOptions, Context userContext = default) { Input input = default; Output output = default; - return Upsert(ref key, upsertOptions.KeyHash ?? clientSession.store.comparer.GetHashCode64(ref key), ref input, ref desiredValue, ref output, userContext, serialNo); + return Upsert(ref key, upsertOptions.KeyHash ?? clientSession.store.comparer.GetHashCode64(ref key), ref input, ref desiredValue, ref output, userContext); } /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public Status Upsert(ref Key key, ref Input input, ref Value desiredValue, ref Output output, Context userContext = default, long serialNo = 0) - => Upsert(ref key, clientSession.store.comparer.GetHashCode64(ref key), ref input, ref desiredValue, ref output, userContext, serialNo); + public Status Upsert(ref Key key, ref Input input, ref Value desiredValue, ref Output output, Context userContext = default) + => Upsert(ref key, clientSession.store.comparer.GetHashCode64(ref key), ref input, ref desiredValue, ref output, userContext); /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public Status Upsert(ref Key key, ref Input input, ref Value desiredValue, ref Output output, ref UpsertOptions upsertOptions, Context userContext = default, long serialNo = 0) - => Upsert(ref key, upsertOptions.KeyHash ?? clientSession.store.comparer.GetHashCode64(ref key), ref input, ref desiredValue, ref output, userContext, serialNo); + public Status Upsert(ref Key key, ref Input input, ref Value desiredValue, ref Output output, ref UpsertOptions upsertOptions, Context userContext = default) + => Upsert(ref key, upsertOptions.KeyHash ?? clientSession.store.comparer.GetHashCode64(ref key), ref input, ref desiredValue, ref output, userContext); /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - private Status Upsert(ref Key key, long keyHash, ref Input input, ref Value desiredValue, ref Output output, Context userContext = default, long serialNo = 0) + private Status Upsert(ref Key key, long keyHash, ref Input input, ref Value desiredValue, ref Output output, Context userContext = default) { Debug.Assert(clientSession.store.epoch.ThisInstanceProtected()); - return clientSession.store.ContextUpsert(ref key, keyHash, ref input, ref desiredValue, ref output, userContext, TsavoriteSession, serialNo); + return clientSession.store.ContextUpsert(ref key, keyHash, ref input, ref desiredValue, ref output, userContext, TsavoriteSession); } /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public Status Upsert(ref Key key, ref Input input, ref Value desiredValue, ref Output output, out RecordMetadata recordMetadata, Context userContext = default, long serialNo = 0) - => Upsert(ref key, clientSession.store.comparer.GetHashCode64(ref key), ref input, ref desiredValue, ref output, out recordMetadata, userContext, serialNo); + public Status Upsert(ref Key key, ref Input input, ref Value desiredValue, ref Output output, out RecordMetadata recordMetadata, Context userContext = default) + => Upsert(ref key, clientSession.store.comparer.GetHashCode64(ref key), ref input, ref desiredValue, ref output, out recordMetadata, userContext); /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public Status Upsert(ref Key key, ref Input input, ref Value desiredValue, ref Output output, ref UpsertOptions upsertOptions, out RecordMetadata recordMetadata, Context userContext = default, long serialNo = 0) - => Upsert(ref key, upsertOptions.KeyHash ?? clientSession.store.comparer.GetHashCode64(ref key), ref input, ref desiredValue, ref output, out recordMetadata, userContext, serialNo); + public Status Upsert(ref Key key, ref Input input, ref Value desiredValue, ref Output output, ref UpsertOptions upsertOptions, out RecordMetadata recordMetadata, Context userContext = default) + => Upsert(ref key, upsertOptions.KeyHash ?? clientSession.store.comparer.GetHashCode64(ref key), ref input, ref desiredValue, ref output, out recordMetadata, userContext); /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public Status Upsert(ref Key key, long keyHash, ref Input input, ref Value desiredValue, ref Output output, out RecordMetadata recordMetadata, Context userContext = default, long serialNo = 0) + public Status Upsert(ref Key key, long keyHash, ref Input input, ref Value desiredValue, ref Output output, out RecordMetadata recordMetadata, Context userContext = default) { Debug.Assert(clientSession.store.epoch.ThisInstanceProtected()); - return clientSession.store.ContextUpsert(ref key, keyHash, ref input, ref desiredValue, ref output, out recordMetadata, userContext, TsavoriteSession, serialNo); + return clientSession.store.ContextUpsert(ref key, keyHash, ref input, ref desiredValue, ref output, out recordMetadata, userContext, TsavoriteSession); } /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public Status Upsert(Key key, Value desiredValue, Context userContext = default, long serialNo = 0) - => Upsert(ref key, ref desiredValue, userContext, serialNo); + public Status Upsert(Key key, Value desiredValue, Context userContext = default) + => Upsert(ref key, ref desiredValue, userContext); /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public Status Upsert(Key key, Value desiredValue, ref UpsertOptions upsertOptions, Context userContext = default, long serialNo = 0) - => Upsert(ref key, ref desiredValue, ref upsertOptions, userContext, serialNo); + public Status Upsert(Key key, Value desiredValue, ref UpsertOptions upsertOptions, Context userContext = default) + => Upsert(ref key, ref desiredValue, ref upsertOptions, userContext); /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public Status Upsert(Key key, Input input, Value desiredValue, ref Output output, Context userContext = default, long serialNo = 0) - => Upsert(ref key, ref input, ref desiredValue, ref output, userContext, serialNo); + public Status Upsert(Key key, Input input, Value desiredValue, ref Output output, Context userContext = default) + => Upsert(ref key, ref input, ref desiredValue, ref output, userContext); /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public Status Upsert(Key key, Input input, Value desiredValue, ref Output output, ref UpsertOptions upsertOptions, Context userContext = default, long serialNo = 0) - => Upsert(ref key, ref input, ref desiredValue, ref output, ref upsertOptions, userContext, serialNo); + public Status Upsert(Key key, Input input, Value desiredValue, ref Output output, ref UpsertOptions upsertOptions, Context userContext = default) + => Upsert(ref key, ref input, ref desiredValue, ref output, ref upsertOptions, userContext); /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ValueTask.UpsertAsyncResult> UpsertAsync(ref Key key, ref Value desiredValue, Context userContext = default, long serialNo = 0, CancellationToken token = default) + public ValueTask.UpsertAsyncResult> UpsertAsync(ref Key key, ref Value desiredValue, Context userContext = default, CancellationToken token = default) { Input input = default; - return UpsertAsync(ref key, ref input, ref desiredValue, userContext, serialNo, token); + return UpsertAsync(ref key, ref input, ref desiredValue, userContext, token); } /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ValueTask.UpsertAsyncResult> UpsertAsync(ref Key key, ref Value desiredValue, ref UpsertOptions upsertOptions, Context userContext = default, long serialNo = 0, CancellationToken token = default) + public ValueTask.UpsertAsyncResult> UpsertAsync(ref Key key, ref Value desiredValue, ref UpsertOptions upsertOptions, Context userContext = default, CancellationToken token = default) { Input input = default; - return UpsertAsync(ref key, ref input, ref desiredValue, ref upsertOptions, userContext, serialNo, token); + return UpsertAsync(ref key, ref input, ref desiredValue, ref upsertOptions, userContext, token); } /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ValueTask.UpsertAsyncResult> UpsertAsync(ref Key key, ref Input input, ref Value desiredValue, Context userContext = default, long serialNo = 0, CancellationToken token = default) + public ValueTask.UpsertAsyncResult> UpsertAsync(ref Key key, ref Input input, ref Value desiredValue, Context userContext = default, CancellationToken token = default) { UpsertOptions upsertOptions = default; - return UpsertAsync(ref key, ref input, ref desiredValue, ref upsertOptions, userContext, serialNo, token); + return UpsertAsync(ref key, ref input, ref desiredValue, ref upsertOptions, userContext, token); } /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ValueTask.UpsertAsyncResult> UpsertAsync(ref Key key, ref Input input, ref Value desiredValue, ref UpsertOptions upsertOptions, Context userContext = default, long serialNo = 0, CancellationToken token = default) + public ValueTask.UpsertAsyncResult> UpsertAsync(ref Key key, ref Input input, ref Value desiredValue, ref UpsertOptions upsertOptions, Context userContext = default, CancellationToken token = default) { Debug.Assert(!clientSession.store.epoch.ThisInstanceProtected()); return clientSession.store.UpsertAsync.InternalTsavoriteSession>( - TsavoriteSession, ref key, ref input, ref desiredValue, ref upsertOptions, userContext, serialNo, token); + TsavoriteSession, ref key, ref input, ref desiredValue, ref upsertOptions, userContext, token); } /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ValueTask.UpsertAsyncResult> UpsertAsync(Key key, Value desiredValue, Context userContext = default, long serialNo = 0, CancellationToken token = default) - => UpsertAsync(ref key, ref desiredValue, userContext, serialNo, token); + public ValueTask.UpsertAsyncResult> UpsertAsync(Key key, Value desiredValue, Context userContext = default, CancellationToken token = default) + => UpsertAsync(ref key, ref desiredValue, userContext, token); /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ValueTask.UpsertAsyncResult> UpsertAsync(Key key, Value desiredValue, ref UpsertOptions upsertOptions, Context userContext = default, long serialNo = 0, CancellationToken token = default) - => UpsertAsync(ref key, ref desiredValue, ref upsertOptions, userContext, serialNo, token); + public ValueTask.UpsertAsyncResult> UpsertAsync(Key key, Value desiredValue, ref UpsertOptions upsertOptions, Context userContext = default, CancellationToken token = default) + => UpsertAsync(ref key, ref desiredValue, ref upsertOptions, userContext, token); /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ValueTask.UpsertAsyncResult> UpsertAsync(Key key, Input input, Value desiredValue, Context userContext = default, long serialNo = 0, CancellationToken token = default) - => UpsertAsync(ref key, ref input, ref desiredValue, userContext, serialNo, token); + public ValueTask.UpsertAsyncResult> UpsertAsync(Key key, Input input, Value desiredValue, Context userContext = default, CancellationToken token = default) + => UpsertAsync(ref key, ref input, ref desiredValue, userContext, token); /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ValueTask.UpsertAsyncResult> UpsertAsync(Key key, Input input, Value desiredValue, ref UpsertOptions upsertOptions, Context userContext = default, long serialNo = 0, CancellationToken token = default) - => UpsertAsync(ref key, ref input, ref desiredValue, ref upsertOptions, userContext, serialNo, token); + public ValueTask.UpsertAsyncResult> UpsertAsync(Key key, Input input, Value desiredValue, ref UpsertOptions upsertOptions, Context userContext = default, CancellationToken token = default) + => UpsertAsync(ref key, ref input, ref desiredValue, ref upsertOptions, userContext, token); /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public Status RMW(ref Key key, ref Input input, ref Output output, Context userContext = default, long serialNo = 0) - => RMW(ref key, ref input, ref output, out _, userContext, serialNo); + public Status RMW(ref Key key, ref Input input, ref Output output, Context userContext = default) + => RMW(ref key, ref input, ref output, out _, userContext); /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public Status RMW(ref Key key, ref Input input, ref Output output, ref RMWOptions rmwOptions, Context userContext = default, long serialNo = 0) - => RMW(ref key, rmwOptions.KeyHash ?? clientSession.store.comparer.GetHashCode64(ref key), ref input, ref output, out _, userContext, serialNo); + public Status RMW(ref Key key, ref Input input, ref Output output, ref RMWOptions rmwOptions, Context userContext = default) + => RMW(ref key, rmwOptions.KeyHash ?? clientSession.store.comparer.GetHashCode64(ref key), ref input, ref output, out _, userContext); /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public Status RMW(ref Key key, ref Input input, ref Output output, out RecordMetadata recordMetadata, Context userContext = default, long serialNo = 0) - => RMW(ref key, clientSession.store.comparer.GetHashCode64(ref key), ref input, ref output, out recordMetadata, userContext, serialNo); + public Status RMW(ref Key key, ref Input input, ref Output output, out RecordMetadata recordMetadata, Context userContext = default) + => RMW(ref key, clientSession.store.comparer.GetHashCode64(ref key), ref input, ref output, out recordMetadata, userContext); /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public Status RMW(ref Key key, ref Input input, ref Output output, ref RMWOptions rmwOptions, out RecordMetadata recordMetadata, Context userContext = default, long serialNo = 0) - => RMW(ref key, rmwOptions.KeyHash ?? clientSession.store.comparer.GetHashCode64(ref key), ref input, ref output, out recordMetadata, userContext, serialNo); + public Status RMW(ref Key key, ref Input input, ref Output output, ref RMWOptions rmwOptions, out RecordMetadata recordMetadata, Context userContext = default) + => RMW(ref key, rmwOptions.KeyHash ?? clientSession.store.comparer.GetHashCode64(ref key), ref input, ref output, out recordMetadata, userContext); /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public Status RMW(ref Key key, long keyHash, ref Input input, ref Output output, out RecordMetadata recordMetadata, Context userContext = default, long serialNo = 0) + public Status RMW(ref Key key, long keyHash, ref Input input, ref Output output, out RecordMetadata recordMetadata, Context userContext = default) { Debug.Assert(clientSession.store.epoch.ThisInstanceProtected()); - return clientSession.store.ContextRMW(ref key, keyHash, ref input, ref output, out recordMetadata, userContext, TsavoriteSession, serialNo); + return clientSession.store.ContextRMW(ref key, keyHash, ref input, ref output, out recordMetadata, userContext, TsavoriteSession); } /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public Status RMW(Key key, Input input, out Output output, Context userContext = default, long serialNo = 0) + public Status RMW(Key key, Input input, out Output output, Context userContext = default) { output = default; - return RMW(ref key, ref input, ref output, userContext, serialNo); + return RMW(ref key, ref input, ref output, userContext); } /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public Status RMW(Key key, Input input, out Output output, ref RMWOptions rmwOptions, Context userContext = default, long serialNo = 0) + public Status RMW(Key key, Input input, out Output output, ref RMWOptions rmwOptions, Context userContext = default) { output = default; - return RMW(ref key, ref input, ref output, ref rmwOptions, userContext, serialNo); + return RMW(ref key, ref input, ref output, ref rmwOptions, userContext); } /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public Status RMW(ref Key key, ref Input input, Context userContext = default, long serialNo = 0) + public Status RMW(ref Key key, ref Input input, Context userContext = default) { Output output = default; - return RMW(ref key, ref input, ref output, userContext, serialNo); + return RMW(ref key, ref input, ref output, userContext); } /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public Status RMW(ref Key key, ref Input input, ref RMWOptions rmwOptions, Context userContext = default, long serialNo = 0) + public Status RMW(ref Key key, ref Input input, ref RMWOptions rmwOptions, Context userContext = default) { Output output = default; - return RMW(ref key, ref input, ref output, ref rmwOptions, userContext, serialNo); + return RMW(ref key, ref input, ref output, ref rmwOptions, userContext); } /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public Status RMW(Key key, Input input, Context userContext = default, long serialNo = 0) + public Status RMW(Key key, Input input, Context userContext = default) { Output output = default; - return RMW(ref key, ref input, ref output, userContext, serialNo); + return RMW(ref key, ref input, ref output, userContext); } /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public Status RMW(Key key, Input input, ref RMWOptions rmwOptions, Context userContext = default, long serialNo = 0) + public Status RMW(Key key, Input input, ref RMWOptions rmwOptions, Context userContext = default) { Output output = default; - return RMW(ref key, ref input, ref output, ref rmwOptions, userContext, serialNo); + return RMW(ref key, ref input, ref output, ref rmwOptions, userContext); } /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ValueTask.RmwAsyncResult> RMWAsync(ref Key key, ref Input input, Context context = default, long serialNo = 0, CancellationToken token = default) + public ValueTask.RmwAsyncResult> RMWAsync(ref Key key, ref Input input, Context context = default, CancellationToken token = default) { RMWOptions rmwOptions = default; - return RMWAsync(ref key, ref input, ref rmwOptions, context, serialNo, token); + return RMWAsync(ref key, ref input, ref rmwOptions, context, token); } /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ValueTask.RmwAsyncResult> RMWAsync(ref Key key, ref Input input, ref RMWOptions rmwOptions, Context context = default, long serialNo = 0, CancellationToken token = default) + public ValueTask.RmwAsyncResult> RMWAsync(ref Key key, ref Input input, ref RMWOptions rmwOptions, Context context = default, CancellationToken token = default) { Debug.Assert(clientSession.store.epoch.ThisInstanceProtected()); return clientSession.store.RmwAsync.InternalTsavoriteSession>( - TsavoriteSession, ref key, ref input, ref rmwOptions, context, serialNo, token); + TsavoriteSession, ref key, ref input, ref rmwOptions, context, token); } /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ValueTask.RmwAsyncResult> RMWAsync(Key key, Input input, Context context = default, long serialNo = 0, CancellationToken token = default) - => RMWAsync(ref key, ref input, context, serialNo, token); + public ValueTask.RmwAsyncResult> RMWAsync(Key key, Input input, Context context = default, CancellationToken token = default) + => RMWAsync(ref key, ref input, context, token); /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ValueTask.RmwAsyncResult> RMWAsync(Key key, Input input, ref RMWOptions rmwOptions, Context context = default, long serialNo = 0, CancellationToken token = default) - => RMWAsync(ref key, ref input, ref rmwOptions, context, serialNo, token); + public ValueTask.RmwAsyncResult> RMWAsync(Key key, Input input, ref RMWOptions rmwOptions, Context context = default, CancellationToken token = default) + => RMWAsync(ref key, ref input, ref rmwOptions, context, token); /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public Status Delete(ref Key key, Context userContext = default, long serialNo = 0) - => Delete(ref key, clientSession.store.comparer.GetHashCode64(ref key), userContext, serialNo); + public Status Delete(ref Key key, Context userContext = default) + => Delete(ref key, clientSession.store.comparer.GetHashCode64(ref key), userContext); /// /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public Status Delete(ref Key key, ref DeleteOptions deleteOptions, Context userContext = default, long serialNo = 0) - => Delete(ref key, deleteOptions.KeyHash ?? clientSession.store.comparer.GetHashCode64(ref key), userContext, serialNo); + public Status Delete(ref Key key, ref DeleteOptions deleteOptions, Context userContext = default) + => Delete(ref key, deleteOptions.KeyHash ?? clientSession.store.comparer.GetHashCode64(ref key), userContext); /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public Status Delete(ref Key key, long keyHash, Context userContext = default, long serialNo = 0) + public Status Delete(ref Key key, long keyHash, Context userContext = default) { Debug.Assert(clientSession.store.epoch.ThisInstanceProtected()); return clientSession.store.ContextDelete.InternalTsavoriteSession>( - ref key, keyHash, userContext, TsavoriteSession, serialNo); + ref key, keyHash, userContext, TsavoriteSession); } /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public Status Delete(Key key, Context userContext = default, long serialNo = 0) - => Delete(ref key, userContext, serialNo); + public Status Delete(Key key, Context userContext = default) + => Delete(ref key, userContext); /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public Status Delete(Key key, ref DeleteOptions deleteOptions, Context userContext = default, long serialNo = 0) - => Delete(ref key, ref deleteOptions, userContext, serialNo); + public Status Delete(Key key, ref DeleteOptions deleteOptions, Context userContext = default) + => Delete(ref key, ref deleteOptions, userContext); /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ValueTask.DeleteAsyncResult> DeleteAsync(ref Key key, Context userContext = default, long serialNo = 0, CancellationToken token = default) + public ValueTask.DeleteAsyncResult> DeleteAsync(ref Key key, Context userContext = default, CancellationToken token = default) { DeleteOptions deleteOptions = default; - return DeleteAsync(ref key, ref deleteOptions, userContext, serialNo, token); + return DeleteAsync(ref key, ref deleteOptions, userContext, token); } /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ValueTask.DeleteAsyncResult> DeleteAsync(ref Key key, ref DeleteOptions deleteOptions, Context userContext = default, long serialNo = 0, CancellationToken token = default) + public ValueTask.DeleteAsyncResult> DeleteAsync(ref Key key, ref DeleteOptions deleteOptions, Context userContext = default, CancellationToken token = default) { Debug.Assert(!clientSession.store.epoch.ThisInstanceProtected()); return clientSession.store.DeleteAsync.InternalTsavoriteSession>( - TsavoriteSession, ref key, ref deleteOptions, userContext, serialNo, token); + TsavoriteSession, ref key, ref deleteOptions, userContext, token); } /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ValueTask.DeleteAsyncResult> DeleteAsync(Key key, Context userContext = default, long serialNo = 0, CancellationToken token = default) - => DeleteAsync(ref key, userContext, serialNo, token); + public ValueTask.DeleteAsyncResult> DeleteAsync(Key key, Context userContext = default, CancellationToken token = default) + => DeleteAsync(ref key, userContext, token); /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ValueTask.DeleteAsyncResult> DeleteAsync(Key key, ref DeleteOptions deleteOptions, Context userContext = default, long serialNo = 0, CancellationToken token = default) - => DeleteAsync(ref key, ref deleteOptions, userContext, serialNo, token); + public ValueTask.DeleteAsyncResult> DeleteAsync(Key key, ref DeleteOptions deleteOptions, Context userContext = default, CancellationToken token = default) + => DeleteAsync(ref key, ref deleteOptions, userContext, token); /// [MethodImpl(MethodImplOptions.AggressiveInlining)] diff --git a/libs/storage/Tsavorite/cs/src/core/ClientSession/UnsafeContext.cs b/libs/storage/Tsavorite/cs/src/core/ClientSession/UnsafeContext.cs index d77924f3fe..9f8a2319db 100644 --- a/libs/storage/Tsavorite/cs/src/core/ClientSession/UnsafeContext.cs +++ b/libs/storage/Tsavorite/cs/src/core/ClientSession/UnsafeContext.cs @@ -70,469 +70,469 @@ public ValueTask> Co /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public Status Read(ref Key key, ref Input input, ref Output output, Context userContext = default, long serialNo = 0) + public Status Read(ref Key key, ref Input input, ref Output output, Context userContext = default) { Debug.Assert(clientSession.store.epoch.ThisInstanceProtected()); - return clientSession.store.ContextRead(ref key, ref input, ref output, userContext, TsavoriteSession, serialNo); + return clientSession.store.ContextRead(ref key, ref input, ref output, userContext, TsavoriteSession); } /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public Status Read(ref Key key, ref Input input, ref Output output, ref ReadOptions readOptions, Context userContext = default, long serialNo = 0) + public Status Read(ref Key key, ref Input input, ref Output output, ref ReadOptions readOptions, Context userContext = default) { Debug.Assert(clientSession.store.epoch.ThisInstanceProtected()); - return clientSession.store.ContextRead(ref key, ref input, ref output, ref readOptions, out _, userContext, TsavoriteSession, serialNo); + return clientSession.store.ContextRead(ref key, ref input, ref output, ref readOptions, out _, userContext, TsavoriteSession); } /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public Status Read(Key key, Input input, out Output output, Context userContext = default, long serialNo = 0) + public Status Read(Key key, Input input, out Output output, Context userContext = default) { output = default; - return Read(ref key, ref input, ref output, userContext, serialNo); + return Read(ref key, ref input, ref output, userContext); } /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public Status Read(Key key, Input input, out Output output, ref ReadOptions readOptions, Context userContext = default, long serialNo = 0) + public Status Read(Key key, Input input, out Output output, ref ReadOptions readOptions, Context userContext = default) { output = default; - return Read(ref key, ref input, ref output, ref readOptions, userContext, serialNo); + return Read(ref key, ref input, ref output, ref readOptions, userContext); } /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public Status Read(ref Key key, ref Output output, Context userContext = default, long serialNo = 0) + public Status Read(ref Key key, ref Output output, Context userContext = default) { Input input = default; - return Read(ref key, ref input, ref output, userContext, serialNo); + return Read(ref key, ref input, ref output, userContext); } /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public Status Read(ref Key key, ref Output output, ref ReadOptions readOptions, Context userContext = default, long serialNo = 0) + public Status Read(ref Key key, ref Output output, ref ReadOptions readOptions, Context userContext = default) { Input input = default; - return Read(ref key, ref input, ref output, ref readOptions, userContext, serialNo); + return Read(ref key, ref input, ref output, ref readOptions, userContext); } /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public Status Read(Key key, out Output output, Context userContext = default, long serialNo = 0) + public Status Read(Key key, out Output output, Context userContext = default) { Input input = default; output = default; - return Read(ref key, ref input, ref output, userContext, serialNo); + return Read(ref key, ref input, ref output, userContext); } /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public Status Read(Key key, out Output output, ref ReadOptions readOptions, Context userContext = default, long serialNo = 0) + public Status Read(Key key, out Output output, ref ReadOptions readOptions, Context userContext = default) { Input input = default; output = default; - return Read(ref key, ref input, ref output, ref readOptions, userContext, serialNo); + return Read(ref key, ref input, ref output, ref readOptions, userContext); } /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public (Status status, Output output) Read(Key key, Context userContext = default, long serialNo = 0) + public (Status status, Output output) Read(Key key, Context userContext = default) { Input input = default; Output output = default; - return (Read(ref key, ref input, ref output, userContext, serialNo), output); + return (Read(ref key, ref input, ref output, userContext), output); } /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public (Status status, Output output) Read(Key key, ref ReadOptions readOptions, Context userContext = default, long serialNo = 0) + public (Status status, Output output) Read(Key key, ref ReadOptions readOptions, Context userContext = default) { Input input = default; Output output = default; - return (Read(ref key, ref input, ref output, ref readOptions, userContext, serialNo), output); + return (Read(ref key, ref input, ref output, ref readOptions, userContext), output); } /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public Status Read(ref Key key, ref Input input, ref Output output, ref ReadOptions readOptions, out RecordMetadata recordMetadata, Context userContext = default, long serialNo = 0) + public Status Read(ref Key key, ref Input input, ref Output output, ref ReadOptions readOptions, out RecordMetadata recordMetadata, Context userContext = default) { Debug.Assert(clientSession.store.epoch.ThisInstanceProtected()); - return clientSession.store.ContextRead(ref key, ref input, ref output, ref readOptions, out recordMetadata, userContext, TsavoriteSession, serialNo); + return clientSession.store.ContextRead(ref key, ref input, ref output, ref readOptions, out recordMetadata, userContext, TsavoriteSession); } /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public Status ReadAtAddress(long address, ref Input input, ref Output output, ref ReadOptions readOptions, out RecordMetadata recordMetadata, Context userContext = default, long serialNo = 0) + public Status ReadAtAddress(long address, ref Input input, ref Output output, ref ReadOptions readOptions, out RecordMetadata recordMetadata, Context userContext = default) { Debug.Assert(clientSession.store.epoch.ThisInstanceProtected()); - return clientSession.store.ContextReadAtAddress(address, ref input, ref output, ref readOptions, out recordMetadata, userContext, serialNo, TsavoriteSession); + return clientSession.store.ContextReadAtAddress(address, ref input, ref output, ref readOptions, out recordMetadata, userContext, TsavoriteSession); } /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public Status ReadAtAddress(long address, ref Key key, ref Input input, ref Output output, ref ReadOptions readOptions, out RecordMetadata recordMetadata, Context userContext = default, long serialNo = 0) + public Status ReadAtAddress(long address, ref Key key, ref Input input, ref Output output, ref ReadOptions readOptions, out RecordMetadata recordMetadata, Context userContext = default) { Debug.Assert(clientSession.store.epoch.ThisInstanceProtected()); - return clientSession.store.ContextReadAtAddress(address, ref key, ref input, ref output, ref readOptions, out recordMetadata, userContext, serialNo, TsavoriteSession); + return clientSession.store.ContextReadAtAddress(address, ref key, ref input, ref output, ref readOptions, out recordMetadata, userContext, TsavoriteSession); } /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ValueTask.ReadAsyncResult> ReadAsync(ref Key key, ref Input input, Context userContext = default, long serialNo = 0, CancellationToken cancellationToken = default) + public ValueTask.ReadAsyncResult> ReadAsync(ref Key key, ref Input input, Context userContext = default, CancellationToken cancellationToken = default) { Debug.Assert(!clientSession.store.epoch.ThisInstanceProtected()); ReadOptions readOptions = default; - return clientSession.store.ReadAsync(TsavoriteSession, ref key, ref input, ref readOptions, userContext, serialNo, cancellationToken); + return clientSession.store.ReadAsync(TsavoriteSession, ref key, ref input, ref readOptions, userContext, cancellationToken); } /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ValueTask.ReadAsyncResult> ReadAsync(Key key, Input input, Context context = default, long serialNo = 0, CancellationToken token = default) - => ReadAsync(ref key, ref input, context, serialNo, token); + public ValueTask.ReadAsyncResult> ReadAsync(Key key, Input input, Context context = default, CancellationToken token = default) + => ReadAsync(ref key, ref input, context, token); /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ValueTask.ReadAsyncResult> ReadAsync(Key key, Input input, ref ReadOptions readOptions, Context context = default, long serialNo = 0, CancellationToken token = default) - => ReadAsync(ref key, ref input, ref readOptions, context, serialNo, token); + public ValueTask.ReadAsyncResult> ReadAsync(Key key, Input input, ref ReadOptions readOptions, Context context = default, CancellationToken token = default) + => ReadAsync(ref key, ref input, ref readOptions, context, token); /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ValueTask.ReadAsyncResult> ReadAsync(ref Key key, Context userContext = default, long serialNo = 0, CancellationToken token = default) + public ValueTask.ReadAsyncResult> ReadAsync(ref Key key, Context userContext = default, CancellationToken token = default) { ReadOptions readOptions = default; - return ReadAsync(ref key, ref readOptions, userContext, serialNo, token); + return ReadAsync(ref key, ref readOptions, userContext, token); } /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ValueTask.ReadAsyncResult> ReadAsync(ref Key key, ref ReadOptions readOptions, Context userContext = default, long serialNo = 0, CancellationToken token = default) + public ValueTask.ReadAsyncResult> ReadAsync(ref Key key, ref ReadOptions readOptions, Context userContext = default, CancellationToken token = default) { Debug.Assert(!clientSession.store.epoch.ThisInstanceProtected()); Input input = default; - return clientSession.store.ReadAsync(TsavoriteSession, ref key, ref input, ref readOptions, userContext, serialNo, token); + return clientSession.store.ReadAsync(TsavoriteSession, ref key, ref input, ref readOptions, userContext, token); } /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ValueTask.ReadAsyncResult> ReadAsync(Key key, Context context = default, long serialNo = 0, CancellationToken token = default) => - ReadAsync(ref key, context, serialNo, token); + public ValueTask.ReadAsyncResult> ReadAsync(Key key, Context context = default, CancellationToken token = default) => + ReadAsync(ref key, context, token); /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ValueTask.ReadAsyncResult> ReadAsync(Key key, ref ReadOptions readOptions, Context context = default, long serialNo = 0, CancellationToken token = default) - => ReadAsync(ref key, ref readOptions, context, serialNo, token); + public ValueTask.ReadAsyncResult> ReadAsync(Key key, ref ReadOptions readOptions, Context context = default, CancellationToken token = default) + => ReadAsync(ref key, ref readOptions, context, token); /// [MethodImpl(MethodImplOptions.AggressiveInlining)] public ValueTask.ReadAsyncResult> ReadAsync(ref Key key, ref Input input, ref ReadOptions readOptions, - Context userContext = default, long serialNo = 0, CancellationToken cancellationToken = default) + Context userContext = default, CancellationToken cancellationToken = default) { Debug.Assert(!clientSession.store.epoch.ThisInstanceProtected()); - return clientSession.store.ReadAsync(TsavoriteSession, ref key, ref input, ref readOptions, userContext, serialNo, cancellationToken); + return clientSession.store.ReadAsync(TsavoriteSession, ref key, ref input, ref readOptions, userContext, cancellationToken); } /// [MethodImpl(MethodImplOptions.AggressiveInlining)] public ValueTask.ReadAsyncResult> ReadAtAddressAsync(long address, ref Input input, ref ReadOptions readOptions, - Context userContext = default, long serialNo = 0, CancellationToken cancellationToken = default) + Context userContext = default, CancellationToken cancellationToken = default) { Debug.Assert(!clientSession.store.epoch.ThisInstanceProtected()); Key key = default; - return clientSession.store.ReadAtAddressAsync(TsavoriteSession, address, ref key, ref input, ref readOptions, userContext, serialNo, cancellationToken, noKey: true); + return clientSession.store.ReadAtAddressAsync(TsavoriteSession, address, ref key, ref input, ref readOptions, userContext, cancellationToken, noKey: true); } /// [MethodImpl(MethodImplOptions.AggressiveInlining)] public ValueTask.ReadAsyncResult> ReadAtAddressAsync(long address, ref Key key, ref Input input, ref ReadOptions readOptions, - Context userContext = default, long serialNo = 0, CancellationToken cancellationToken = default) + Context userContext = default, CancellationToken cancellationToken = default) { Debug.Assert(!clientSession.store.epoch.ThisInstanceProtected()); - return clientSession.store.ReadAtAddressAsync(TsavoriteSession, address, ref key, ref input, ref readOptions, userContext, serialNo, cancellationToken, noKey: false); + return clientSession.store.ReadAtAddressAsync(TsavoriteSession, address, ref key, ref input, ref readOptions, userContext, cancellationToken, noKey: false); } /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public Status Upsert(ref Key key, ref Value desiredValue, Context userContext = default, long serialNo = 0) + public Status Upsert(ref Key key, ref Value desiredValue, Context userContext = default) { Input input = default; Output output = default; - return Upsert(ref key, clientSession.store.comparer.GetHashCode64(ref key), ref input, ref desiredValue, ref output, out _, userContext, serialNo); + return Upsert(ref key, clientSession.store.comparer.GetHashCode64(ref key), ref input, ref desiredValue, ref output, out _, userContext); } /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public Status Upsert(ref Key key, ref Value desiredValue, ref UpsertOptions upsertOptions, Context userContext = default, long serialNo = 0) + public Status Upsert(ref Key key, ref Value desiredValue, ref UpsertOptions upsertOptions, Context userContext = default) { Input input = default; Output output = default; - return Upsert(ref key, upsertOptions.KeyHash ?? clientSession.store.comparer.GetHashCode64(ref key), ref input, ref desiredValue, ref output, userContext, serialNo); + return Upsert(ref key, upsertOptions.KeyHash ?? clientSession.store.comparer.GetHashCode64(ref key), ref input, ref desiredValue, ref output, userContext); } /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public Status Upsert(ref Key key, ref Input input, ref Value desiredValue, ref Output output, Context userContext = default, long serialNo = 0) - => Upsert(ref key, clientSession.store.comparer.GetHashCode64(ref key), ref input, ref desiredValue, ref output, userContext, serialNo); + public Status Upsert(ref Key key, ref Input input, ref Value desiredValue, ref Output output, Context userContext = default) + => Upsert(ref key, clientSession.store.comparer.GetHashCode64(ref key), ref input, ref desiredValue, ref output, userContext); /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public Status Upsert(ref Key key, ref Input input, ref Value desiredValue, ref Output output, ref UpsertOptions upsertOptions, Context userContext = default, long serialNo = 0) - => Upsert(ref key, upsertOptions.KeyHash ?? clientSession.store.comparer.GetHashCode64(ref key), ref input, ref desiredValue, ref output, userContext, serialNo); + public Status Upsert(ref Key key, ref Input input, ref Value desiredValue, ref Output output, ref UpsertOptions upsertOptions, Context userContext = default) + => Upsert(ref key, upsertOptions.KeyHash ?? clientSession.store.comparer.GetHashCode64(ref key), ref input, ref desiredValue, ref output, userContext); /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - private Status Upsert(ref Key key, long keyHash, ref Input input, ref Value desiredValue, ref Output output, Context userContext = default, long serialNo = 0) + private Status Upsert(ref Key key, long keyHash, ref Input input, ref Value desiredValue, ref Output output, Context userContext = default) { Debug.Assert(clientSession.store.epoch.ThisInstanceProtected()); - return clientSession.store.ContextUpsert(ref key, keyHash, ref input, ref desiredValue, ref output, userContext, TsavoriteSession, serialNo); + return clientSession.store.ContextUpsert(ref key, keyHash, ref input, ref desiredValue, ref output, userContext, TsavoriteSession); } /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public Status Upsert(ref Key key, ref Input input, ref Value desiredValue, ref Output output, out RecordMetadata recordMetadata, Context userContext = default, long serialNo = 0) - => Upsert(ref key, clientSession.store.comparer.GetHashCode64(ref key), ref input, ref desiredValue, ref output, out recordMetadata, userContext, serialNo); + public Status Upsert(ref Key key, ref Input input, ref Value desiredValue, ref Output output, out RecordMetadata recordMetadata, Context userContext = default) + => Upsert(ref key, clientSession.store.comparer.GetHashCode64(ref key), ref input, ref desiredValue, ref output, out recordMetadata, userContext); /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public Status Upsert(ref Key key, ref Input input, ref Value desiredValue, ref Output output, ref UpsertOptions upsertOptions, out RecordMetadata recordMetadata, Context userContext = default, long serialNo = 0) - => Upsert(ref key, upsertOptions.KeyHash ?? clientSession.store.comparer.GetHashCode64(ref key), ref input, ref desiredValue, ref output, out recordMetadata, userContext, serialNo); + public Status Upsert(ref Key key, ref Input input, ref Value desiredValue, ref Output output, ref UpsertOptions upsertOptions, out RecordMetadata recordMetadata, Context userContext = default) + => Upsert(ref key, upsertOptions.KeyHash ?? clientSession.store.comparer.GetHashCode64(ref key), ref input, ref desiredValue, ref output, out recordMetadata, userContext); /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - private Status Upsert(ref Key key, long keyHash, ref Input input, ref Value desiredValue, ref Output output, out RecordMetadata recordMetadata, Context userContext = default, long serialNo = 0) + private Status Upsert(ref Key key, long keyHash, ref Input input, ref Value desiredValue, ref Output output, out RecordMetadata recordMetadata, Context userContext = default) { Debug.Assert(clientSession.store.epoch.ThisInstanceProtected()); - return clientSession.store.ContextUpsert(ref key, keyHash, ref input, ref desiredValue, ref output, out recordMetadata, userContext, TsavoriteSession, serialNo); + return clientSession.store.ContextUpsert(ref key, keyHash, ref input, ref desiredValue, ref output, out recordMetadata, userContext, TsavoriteSession); } /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public Status Upsert(Key key, Value desiredValue, Context userContext = default, long serialNo = 0) - => Upsert(ref key, ref desiredValue, userContext, serialNo); + public Status Upsert(Key key, Value desiredValue, Context userContext = default) + => Upsert(ref key, ref desiredValue, userContext); /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public Status Upsert(Key key, Value desiredValue, ref UpsertOptions upsertOptions, Context userContext = default, long serialNo = 0) - => Upsert(ref key, ref desiredValue, ref upsertOptions, userContext, serialNo); + public Status Upsert(Key key, Value desiredValue, ref UpsertOptions upsertOptions, Context userContext = default) + => Upsert(ref key, ref desiredValue, ref upsertOptions, userContext); /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public Status Upsert(Key key, Input input, Value desiredValue, ref Output output, ref UpsertOptions upsertOptions, Context userContext = default, long serialNo = 0) - => Upsert(ref key, ref input, ref desiredValue, ref output, ref upsertOptions, userContext, serialNo); + public Status Upsert(Key key, Input input, Value desiredValue, ref Output output, ref UpsertOptions upsertOptions, Context userContext = default) + => Upsert(ref key, ref input, ref desiredValue, ref output, ref upsertOptions, userContext); /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public Status Upsert(Key key, Input input, Value desiredValue, ref Output output, Context userContext = default, long serialNo = 0) - => Upsert(ref key, ref input, ref desiredValue, ref output, userContext, serialNo); + public Status Upsert(Key key, Input input, Value desiredValue, ref Output output, Context userContext = default) + => Upsert(ref key, ref input, ref desiredValue, ref output, userContext); /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ValueTask.UpsertAsyncResult> UpsertAsync(ref Key key, ref Value desiredValue, Context userContext = default, long serialNo = 0, CancellationToken token = default) + public ValueTask.UpsertAsyncResult> UpsertAsync(ref Key key, ref Value desiredValue, Context userContext = default, CancellationToken token = default) { Input input = default; - return UpsertAsync(ref key, ref input, ref desiredValue, userContext, serialNo, token); + return UpsertAsync(ref key, ref input, ref desiredValue, userContext, token); } /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ValueTask.UpsertAsyncResult> UpsertAsync(ref Key key, ref Value desiredValue, ref UpsertOptions upsertOptions, Context userContext = default, long serialNo = 0, CancellationToken token = default) + public ValueTask.UpsertAsyncResult> UpsertAsync(ref Key key, ref Value desiredValue, ref UpsertOptions upsertOptions, Context userContext = default, CancellationToken token = default) { Input input = default; - return UpsertAsync(ref key, ref input, ref desiredValue, ref upsertOptions, userContext, serialNo, token); + return UpsertAsync(ref key, ref input, ref desiredValue, ref upsertOptions, userContext, token); } /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ValueTask.UpsertAsyncResult> UpsertAsync(ref Key key, ref Input input, ref Value desiredValue, Context userContext = default, long serialNo = 0, CancellationToken token = default) + public ValueTask.UpsertAsyncResult> UpsertAsync(ref Key key, ref Input input, ref Value desiredValue, Context userContext = default, CancellationToken token = default) { UpsertOptions upsertOptions = default; - return UpsertAsync(ref key, ref input, ref desiredValue, ref upsertOptions, userContext, serialNo, token); + return UpsertAsync(ref key, ref input, ref desiredValue, ref upsertOptions, userContext, token); } /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ValueTask.UpsertAsyncResult> UpsertAsync(ref Key key, ref Input input, ref Value desiredValue, ref UpsertOptions upsertOptions, Context userContext = default, long serialNo = 0, CancellationToken token = default) + public ValueTask.UpsertAsyncResult> UpsertAsync(ref Key key, ref Input input, ref Value desiredValue, ref UpsertOptions upsertOptions, Context userContext = default, CancellationToken token = default) { Debug.Assert(!clientSession.store.epoch.ThisInstanceProtected()); return clientSession.store.UpsertAsync.InternalTsavoriteSession>( - TsavoriteSession, ref key, ref input, ref desiredValue, ref upsertOptions, userContext, serialNo, token); + TsavoriteSession, ref key, ref input, ref desiredValue, ref upsertOptions, userContext, token); } /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ValueTask.UpsertAsyncResult> UpsertAsync(Key key, Value desiredValue, Context userContext = default, long serialNo = 0, CancellationToken token = default) - => UpsertAsync(ref key, ref desiredValue, userContext, serialNo, token); + public ValueTask.UpsertAsyncResult> UpsertAsync(Key key, Value desiredValue, Context userContext = default, CancellationToken token = default) + => UpsertAsync(ref key, ref desiredValue, userContext, token); /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ValueTask.UpsertAsyncResult> UpsertAsync(Key key, Value desiredValue, ref UpsertOptions upsertOptions, Context userContext = default, long serialNo = 0, CancellationToken token = default) - => UpsertAsync(ref key, ref desiredValue, ref upsertOptions, userContext, serialNo, token); + public ValueTask.UpsertAsyncResult> UpsertAsync(Key key, Value desiredValue, ref UpsertOptions upsertOptions, Context userContext = default, CancellationToken token = default) + => UpsertAsync(ref key, ref desiredValue, ref upsertOptions, userContext, token); /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ValueTask.UpsertAsyncResult> UpsertAsync(Key key, Input input, Value desiredValue, Context userContext = default, long serialNo = 0, CancellationToken token = default) - => UpsertAsync(ref key, ref input, ref desiredValue, userContext, serialNo, token); + public ValueTask.UpsertAsyncResult> UpsertAsync(Key key, Input input, Value desiredValue, Context userContext = default, CancellationToken token = default) + => UpsertAsync(ref key, ref input, ref desiredValue, userContext, token); /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ValueTask.UpsertAsyncResult> UpsertAsync(Key key, Input input, Value desiredValue, ref UpsertOptions upsertOptions, Context userContext = default, long serialNo = 0, CancellationToken token = default) - => UpsertAsync(ref key, ref input, ref desiredValue, ref upsertOptions, userContext, serialNo, token); + public ValueTask.UpsertAsyncResult> UpsertAsync(Key key, Input input, Value desiredValue, ref UpsertOptions upsertOptions, Context userContext = default, CancellationToken token = default) + => UpsertAsync(ref key, ref input, ref desiredValue, ref upsertOptions, userContext, token); /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public Status RMW(ref Key key, ref Input input, ref Output output, Context userContext = default, long serialNo = 0) - => RMW(ref key, ref input, ref output, out _, userContext, serialNo); + public Status RMW(ref Key key, ref Input input, ref Output output, Context userContext = default) + => RMW(ref key, ref input, ref output, out _, userContext); /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public Status RMW(ref Key key, ref Input input, ref Output output, ref RMWOptions rmwOptions, Context userContext = default, long serialNo = 0) - => RMW(ref key, rmwOptions.KeyHash ?? clientSession.store.comparer.GetHashCode64(ref key), ref input, ref output, out _, userContext, serialNo); + public Status RMW(ref Key key, ref Input input, ref Output output, ref RMWOptions rmwOptions, Context userContext = default) + => RMW(ref key, rmwOptions.KeyHash ?? clientSession.store.comparer.GetHashCode64(ref key), ref input, ref output, out _, userContext); /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public Status RMW(ref Key key, ref Input input, ref Output output, out RecordMetadata recordMetadata, Context userContext = default, long serialNo = 0) - => RMW(ref key, clientSession.store.comparer.GetHashCode64(ref key), ref input, ref output, out recordMetadata, userContext, serialNo); + public Status RMW(ref Key key, ref Input input, ref Output output, out RecordMetadata recordMetadata, Context userContext = default) + => RMW(ref key, clientSession.store.comparer.GetHashCode64(ref key), ref input, ref output, out recordMetadata, userContext); /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public Status RMW(ref Key key, ref Input input, ref Output output, ref RMWOptions rmwOptions, out RecordMetadata recordMetadata, Context userContext = default, long serialNo = 0) - => RMW(ref key, rmwOptions.KeyHash ?? clientSession.store.comparer.GetHashCode64(ref key), ref input, ref output, out recordMetadata, userContext, serialNo); + public Status RMW(ref Key key, ref Input input, ref Output output, ref RMWOptions rmwOptions, out RecordMetadata recordMetadata, Context userContext = default) + => RMW(ref key, rmwOptions.KeyHash ?? clientSession.store.comparer.GetHashCode64(ref key), ref input, ref output, out recordMetadata, userContext); /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public Status RMW(ref Key key, long keyHash, ref Input input, ref Output output, out RecordMetadata recordMetadata, Context userContext = default, long serialNo = 0) + public Status RMW(ref Key key, long keyHash, ref Input input, ref Output output, out RecordMetadata recordMetadata, Context userContext = default) { Debug.Assert(clientSession.store.epoch.ThisInstanceProtected()); - return clientSession.store.ContextRMW(ref key, keyHash, ref input, ref output, out recordMetadata, userContext, TsavoriteSession, serialNo); + return clientSession.store.ContextRMW(ref key, keyHash, ref input, ref output, out recordMetadata, userContext, TsavoriteSession); } /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public Status RMW(Key key, Input input, out Output output, Context userContext = default, long serialNo = 0) + public Status RMW(Key key, Input input, out Output output, Context userContext = default) { output = default; - return RMW(ref key, ref input, ref output, userContext, serialNo); + return RMW(ref key, ref input, ref output, userContext); } /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public Status RMW(Key key, Input input, out Output output, ref RMWOptions rmwOptions, Context userContext = default, long serialNo = 0) + public Status RMW(Key key, Input input, out Output output, ref RMWOptions rmwOptions, Context userContext = default) { output = default; - return RMW(ref key, ref input, ref output, ref rmwOptions, userContext, serialNo); + return RMW(ref key, ref input, ref output, ref rmwOptions, userContext); } /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public Status RMW(ref Key key, ref Input input, Context userContext = default, long serialNo = 0) + public Status RMW(ref Key key, ref Input input, Context userContext = default) { Output output = default; - return RMW(ref key, ref input, ref output, userContext, serialNo); + return RMW(ref key, ref input, ref output, userContext); } /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public Status RMW(ref Key key, ref Input input, ref RMWOptions rmwOptions, Context userContext = default, long serialNo = 0) + public Status RMW(ref Key key, ref Input input, ref RMWOptions rmwOptions, Context userContext = default) { Output output = default; - return RMW(ref key, ref input, ref output, ref rmwOptions, userContext, serialNo); + return RMW(ref key, ref input, ref output, ref rmwOptions, userContext); } /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public Status RMW(Key key, Input input, Context userContext = default, long serialNo = 0) - => RMW(ref key, ref input, userContext, serialNo); + public Status RMW(Key key, Input input, Context userContext = default) + => RMW(ref key, ref input, userContext); /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public Status RMW(Key key, Input input, ref RMWOptions rmwOptions, Context userContext = default, long serialNo = 0) + public Status RMW(Key key, Input input, ref RMWOptions rmwOptions, Context userContext = default) { Output output = default; - return RMW(ref key, ref input, ref output, ref rmwOptions, userContext, serialNo); + return RMW(ref key, ref input, ref output, ref rmwOptions, userContext); } /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ValueTask.RmwAsyncResult> RMWAsync(ref Key key, ref Input input, Context context = default, long serialNo = 0, CancellationToken token = default) + public ValueTask.RmwAsyncResult> RMWAsync(ref Key key, ref Input input, Context context = default, CancellationToken token = default) { RMWOptions rmwOptions = default; - return RMWAsync(ref key, ref input, ref rmwOptions, context, serialNo, token); + return RMWAsync(ref key, ref input, ref rmwOptions, context, token); } /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ValueTask.RmwAsyncResult> RMWAsync(ref Key key, ref Input input, ref RMWOptions rmwOptions, Context context = default, long serialNo = 0, CancellationToken token = default) + public ValueTask.RmwAsyncResult> RMWAsync(ref Key key, ref Input input, ref RMWOptions rmwOptions, Context context = default, CancellationToken token = default) { Debug.Assert(clientSession.store.epoch.ThisInstanceProtected()); return clientSession.store.RmwAsync.InternalTsavoriteSession>( - TsavoriteSession, ref key, ref input, ref rmwOptions, context, serialNo, token); + TsavoriteSession, ref key, ref input, ref rmwOptions, context, token); } /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ValueTask.RmwAsyncResult> RMWAsync(Key key, Input input, Context context = default, long serialNo = 0, CancellationToken token = default) - => RMWAsync(ref key, ref input, context, serialNo, token); + public ValueTask.RmwAsyncResult> RMWAsync(Key key, Input input, Context context = default, CancellationToken token = default) + => RMWAsync(ref key, ref input, context, token); /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ValueTask.RmwAsyncResult> RMWAsync(Key key, Input input, ref RMWOptions rmwOptions, Context context = default, long serialNo = 0, CancellationToken token = default) - => RMWAsync(ref key, ref input, ref rmwOptions, context, serialNo, token); + public ValueTask.RmwAsyncResult> RMWAsync(Key key, Input input, ref RMWOptions rmwOptions, Context context = default, CancellationToken token = default) + => RMWAsync(ref key, ref input, ref rmwOptions, context, token); /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public Status Delete(ref Key key, Context userContext = default, long serialNo = 0) - => Delete(ref key, clientSession.store.comparer.GetHashCode64(ref key), userContext, serialNo); + public Status Delete(ref Key key, Context userContext = default) + => Delete(ref key, clientSession.store.comparer.GetHashCode64(ref key), userContext); /// /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public Status Delete(ref Key key, ref DeleteOptions deleteOptions, Context userContext = default, long serialNo = 0) - => Delete(ref key, deleteOptions.KeyHash ?? clientSession.store.comparer.GetHashCode64(ref key), userContext, serialNo); + public Status Delete(ref Key key, ref DeleteOptions deleteOptions, Context userContext = default) + => Delete(ref key, deleteOptions.KeyHash ?? clientSession.store.comparer.GetHashCode64(ref key), userContext); /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public Status Delete(ref Key key, long keyHash, Context userContext = default, long serialNo = 0) + public Status Delete(ref Key key, long keyHash, Context userContext = default) { Debug.Assert(clientSession.store.epoch.ThisInstanceProtected()); return clientSession.store.ContextDelete.InternalTsavoriteSession>( - ref key, keyHash, userContext, TsavoriteSession, serialNo); + ref key, keyHash, userContext, TsavoriteSession); } /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public Status Delete(Key key, Context userContext = default, long serialNo = 0) - => Delete(ref key, userContext, serialNo); + public Status Delete(Key key, Context userContext = default) + => Delete(ref key, userContext); /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public Status Delete(Key key, ref DeleteOptions deleteOptions, Context userContext = default, long serialNo = 0) - => Delete(ref key, ref deleteOptions, userContext, serialNo); + public Status Delete(Key key, ref DeleteOptions deleteOptions, Context userContext = default) + => Delete(ref key, ref deleteOptions, userContext); /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ValueTask.DeleteAsyncResult> DeleteAsync(ref Key key, Context userContext = default, long serialNo = 0, CancellationToken token = default) + public ValueTask.DeleteAsyncResult> DeleteAsync(ref Key key, Context userContext = default, CancellationToken token = default) { DeleteOptions deleteOptions = default; - return DeleteAsync(ref key, ref deleteOptions, userContext, serialNo, token); + return DeleteAsync(ref key, ref deleteOptions, userContext, token); } /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ValueTask.DeleteAsyncResult> DeleteAsync(ref Key key, ref DeleteOptions deleteOptions, Context userContext = default, long serialNo = 0, CancellationToken token = default) + public ValueTask.DeleteAsyncResult> DeleteAsync(ref Key key, ref DeleteOptions deleteOptions, Context userContext = default, CancellationToken token = default) { Debug.Assert(!clientSession.store.epoch.ThisInstanceProtected()); return clientSession.store.DeleteAsync.InternalTsavoriteSession>( - TsavoriteSession, ref key, ref deleteOptions, userContext, serialNo, token); + TsavoriteSession, ref key, ref deleteOptions, userContext, token); } /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ValueTask.DeleteAsyncResult> DeleteAsync(Key key, Context userContext = default, long serialNo = 0, CancellationToken token = default) - => DeleteAsync(ref key, userContext, serialNo, token); + public ValueTask.DeleteAsyncResult> DeleteAsync(Key key, Context userContext = default, CancellationToken token = default) + => DeleteAsync(ref key, userContext, token); /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ValueTask.DeleteAsyncResult> DeleteAsync(Key key, ref DeleteOptions deleteOptions, Context userContext = default, long serialNo = 0, CancellationToken token = default) - => DeleteAsync(ref key, ref deleteOptions, userContext, serialNo, token); + public ValueTask.DeleteAsyncResult> DeleteAsync(Key key, ref DeleteOptions deleteOptions, Context userContext = default, CancellationToken token = default) + => DeleteAsync(ref key, ref deleteOptions, userContext, token); /// [MethodImpl(MethodImplOptions.AggressiveInlining)] diff --git a/libs/storage/Tsavorite/cs/src/core/Compaction/ICompactionFunctions.cs b/libs/storage/Tsavorite/cs/src/core/Compaction/ICompactionFunctions.cs index 8c139588a0..0921c55a17 100644 --- a/libs/storage/Tsavorite/cs/src/core/Compaction/ICompactionFunctions.cs +++ b/libs/storage/Tsavorite/cs/src/core/Compaction/ICompactionFunctions.cs @@ -12,7 +12,7 @@ public interface ICompactionFunctions { /// /// Checks if record in the Tsavorite log is logically deleted. - /// If the record was deleted via + /// If the record was deleted via /// then this function is not called for such a record. /// /// diff --git a/libs/storage/Tsavorite/cs/src/core/Compaction/LogCompactionFunctions.cs b/libs/storage/Tsavorite/cs/src/core/Compaction/LogCompactionFunctions.cs index 0a96c6ebd5..53f7c485ff 100644 --- a/libs/storage/Tsavorite/cs/src/core/Compaction/LogCompactionFunctions.cs +++ b/libs/storage/Tsavorite/cs/src/core/Compaction/LogCompactionFunctions.cs @@ -13,8 +13,6 @@ public LogCompactionFunctions(Functions functions) _functions = functions; } - public void CheckpointCompletionCallback(int sessionID, string sessionName, CommitPoint commitPoint) { } - /// /// No reads during compaction /// diff --git a/libs/storage/Tsavorite/cs/src/core/Compaction/TsavoriteCompaction.cs b/libs/storage/Tsavorite/cs/src/core/Compaction/TsavoriteCompaction.cs index 2bb7d1570e..6395430b03 100644 --- a/libs/storage/Tsavorite/cs/src/core/Compaction/TsavoriteCompaction.cs +++ b/libs/storage/Tsavorite/cs/src/core/Compaction/TsavoriteCompaction.cs @@ -143,7 +143,7 @@ private void ScanImmutableTailToRemoveFromTempKv // Some additional information about the previous attempt internal long id; - internal long version; // TODO unused? internal long logicalAddress; - internal long serialNum; - internal HashBucketEntry entry; + internal long InitialLatestLogicalAddress; // operationFlags values internal ushort operationFlags; @@ -162,11 +160,11 @@ internal struct PendingContext internal const ushort kNoKey = 0x0001; internal const ushort kIsAsync = 0x0002; - internal ReadCopyOptions readCopyOptions; + internal ReadCopyOptions readCopyOptions; // Two byte enums + internal WriteReason writeReason; // for ConditionalCopyToTail; one byte enum internal RecordInfo recordInfo; internal long minAddress; - internal WriteReason writeReason; // for ConditionalCopyToTail // For flushing head pages on tail allocation. internal CompletionEvent flushEvent; @@ -209,18 +207,13 @@ internal bool IsAsync set => operationFlags = value ? (ushort)(operationFlags | kIsAsync) : (ushort)(operationFlags & ~kIsAsync); } + // RecordInfo is not used as such during the pending phase, so we reuse the space here. internal long InitialEntryAddress { readonly get => recordInfo.PreviousAddress; set => recordInfo.PreviousAddress = value; } - internal long InitialLatestLogicalAddress - { - readonly get => entry.Address; - set => entry.Address = value; - } - public void Dispose() { key?.Dispose(); @@ -241,7 +234,6 @@ internal sealed class TsavoriteExecutionContext internal ReadCopyOptions ReadCopyOptions; internal long version; - internal long serialNum; public Phase phase; public bool[] markers; @@ -249,7 +241,6 @@ internal sealed class TsavoriteExecutionContext public Dictionary> ioPendingRequests; public AsyncCountDown pendingReads; public AsyncQueue> readyResponses; - public List excludedSerialNos; public int asyncPendingCount; public ISynchronizationStateMachine threadStateMachine; @@ -304,22 +295,6 @@ public async ValueTask WaitPendingAsync(CancellationToken token = default) } } - /// - /// Descriptor for a CPR commit point - /// - public struct CommitPoint - { - /// - /// Serial number until which we have committed - /// - public long UntilSerialNo; - - /// - /// List of operation serial nos excluded from commit - /// - public List ExcludedSerialNos; - } - /// /// Recovery info for hybrid log /// @@ -379,32 +354,11 @@ public struct HybridLogRecoveryInfo /// public bool manualLockingActive; - /// - /// Commit tokens per session restored during Restore() - /// - public ConcurrentDictionary continueTokens; - - /// - /// Map of session name to session ID restored during Restore() - /// - public ConcurrentDictionary sessionNameMap; - - /// - /// Commit tokens per session created during Checkpoint - /// - public ConcurrentDictionary checkpointTokens; - - /// - /// Max session ID - /// - public int maxSessionID; - /// /// Object log segment offsets /// public long[] objectLogSegmentOffsets; - /// /// Tail address of delta file: -1 indicates this is not a delta checkpoint metadata /// At recovery, this value denotes the delta tail address excluding the metadata record for the checkpoint @@ -430,19 +384,17 @@ public void Initialize(Guid token, long _version) deltaTailAddress = -1; // indicates this is not a delta checkpoint metadata headAddress = 0; - checkpointTokens = new(); - objectLogSegmentOffsets = null; } + const int checkpointTokenCount = 0; // Temporary to keep compatibility with previous checkpoint versions + /// /// Initialize from stream /// /// public void Initialize(StreamReader reader) { - continueTokens = new(); - string value = reader.ReadLine(); var cversion = int.Parse(value); @@ -494,29 +446,16 @@ public void Initialize(StreamReader reader) value = reader.ReadLine(); var numSessions = int.Parse(value); + // Temporary for backward compatibility for (int i = 0; i < numSessions; i++) { - var sessionID = int.Parse(reader.ReadLine()); - var sessionName = reader.ReadLine(); - if (sessionName == "") sessionName = null; - var serialno = long.Parse(reader.ReadLine()); + _ /*var sessionID*/ = int.Parse(reader.ReadLine()); + _ /*var sessionName*/ = reader.ReadLine(); + _ /*var serialno*/ = long.Parse(reader.ReadLine()); - var exclusions = new List(); var exclusionCount = int.Parse(reader.ReadLine()); for (int j = 0; j < exclusionCount; j++) - exclusions.Add(long.Parse(reader.ReadLine())); - - continueTokens.TryAdd(sessionID, (sessionName, new CommitPoint - { - UntilSerialNo = serialno, - ExcludedSerialNos = exclusions - })); - if (sessionName != null) - { - sessionNameMap ??= new(); - sessionNameMap.TryAdd(sessionName, sessionID); - } - if (sessionID > maxSessionID) maxSessionID = sessionID; + _ = reader.ReadLine(); } // Read object log segment offsets @@ -532,7 +471,7 @@ public void Initialize(StreamReader reader) } } - if (checksum != Checksum(continueTokens.Count)) + if (checksum != Checksum(numSessions)) throw new TsavoriteException("Invalid checksum for checkpoint"); } @@ -595,7 +534,8 @@ public byte[] ToByteArray() using (StreamWriter writer = new(ms)) { writer.WriteLine(CheckpointVersion); // checkpoint version - writer.WriteLine(Checksum(checkpointTokens.Count)); // checksum + + writer.WriteLine(Checksum(checkpointTokenCount)); // checksum writer.WriteLine(guid); writer.WriteLine(useSnapshotFile); @@ -611,16 +551,7 @@ public byte[] ToByteArray() writer.WriteLine(deltaTailAddress); writer.WriteLine(manualLockingActive); - writer.WriteLine(checkpointTokens.Count); - foreach (var kvp in checkpointTokens) - { - writer.WriteLine(kvp.Key); - writer.WriteLine(kvp.Value.Item1); - writer.WriteLine(kvp.Value.Item2.UntilSerialNo); - writer.WriteLine(kvp.Value.Item2.ExcludedSerialNos.Count); - foreach (long item in kvp.Value.Item2.ExcludedSerialNos) - writer.WriteLine(item); - } + writer.WriteLine(checkpointTokenCount); // Write object log segment offsets writer.WriteLine(objectLogSegmentOffsets == null ? 0 : objectLogSegmentOffsets.Length); @@ -663,15 +594,6 @@ public readonly void DebugPrint(ILogger logger) logger?.LogInformation("Begin Address: {beginAddress}", beginAddress); logger?.LogInformation("Delta Tail Address: {deltaTailAddress}", deltaTailAddress); logger?.LogInformation("Manual Locking Active: {manualLockingActive}", manualLockingActive); - logger?.LogInformation("Num sessions recovered: {continueTokensCount}", continueTokens.Count); - logger?.LogInformation("Recovered sessions: "); - foreach (var sessionInfo in continueTokens.Take(10)) - { - logger?.LogInformation("{sessionInfo.Key}: {sessionInfo.Value}", sessionInfo.Key, sessionInfo.Value); - } - - if (continueTokens.Count > 10) - logger?.LogInformation("... {continueTokensSkipped} skipped", continueTokens.Count - 10); } } diff --git a/libs/storage/Tsavorite/cs/src/core/Index/Interfaces/FunctionsBase.cs b/libs/storage/Tsavorite/cs/src/core/Index/Interfaces/FunctionsBase.cs index 0c8318d48d..fb3ea228a6 100644 --- a/libs/storage/Tsavorite/cs/src/core/Index/Interfaces/FunctionsBase.cs +++ b/libs/storage/Tsavorite/cs/src/core/Index/Interfaces/FunctionsBase.cs @@ -65,8 +65,6 @@ public virtual void DisposeForRevivification(ref Key key, ref Value value, int n public virtual void ReadCompletionCallback(ref Key key, ref Input input, ref Output output, Context ctx, Status status, RecordMetadata recordMetadata) { } /// public virtual void RMWCompletionCallback(ref Key key, ref Input input, ref Output output, Context ctx, Status status, RecordMetadata recordMetadata) { } - /// - public virtual void CheckpointCompletionCallback(int sessionID, string sessionName, CommitPoint commitPoint) { } /// public virtual int GetRMWModifiedValueLength(ref Value value, ref Input input) => throw new TsavoriteException("GetRMWModifiedValueLength is only available for SpanByte Functions"); diff --git a/libs/storage/Tsavorite/cs/src/core/Index/Interfaces/IFunctions.cs b/libs/storage/Tsavorite/cs/src/core/Index/Interfaces/IFunctions.cs index 12843cdb1a..dd70c3cb2d 100644 --- a/libs/storage/Tsavorite/cs/src/core/Index/Interfaces/IFunctions.cs +++ b/libs/storage/Tsavorite/cs/src/core/Index/Interfaces/IFunctions.cs @@ -299,16 +299,6 @@ public interface IFunctions /// If > 0, this is a record from the freelist and we are disposing the key as well as value (it is -1 when revivifying a record in the hash chain or when doing a RETRY; for these the key does not change) void DisposeForRevivification(ref Key key, ref Value value, int newKeySize); #endregion Dispose - - #region Checkpointing - /// - /// Checkpoint completion callback (called per client session) - /// - /// ID of session reporting persistence - /// Name of session reporting persistence - /// Commit point descriptor - void CheckpointCompletionCallback(int sessionID, string sessionName, CommitPoint commitPoint); - #endregion Checkpointing } /// diff --git a/libs/storage/Tsavorite/cs/src/core/Index/Interfaces/ITsavoriteSession.cs b/libs/storage/Tsavorite/cs/src/core/Index/Interfaces/ITsavoriteSession.cs index c7d94eaa5b..055602fc51 100644 --- a/libs/storage/Tsavorite/cs/src/core/Index/Interfaces/ITsavoriteSession.cs +++ b/libs/storage/Tsavorite/cs/src/core/Index/Interfaces/ITsavoriteSession.cs @@ -12,7 +12,6 @@ internal interface ITsavoriteSession { void UnsafeResumeThread(); void UnsafeSuspendThread(); - void CheckpointCompletionCallback(int sessionID, string sessionName, CommitPoint commitPoint); } /// diff --git a/libs/storage/Tsavorite/cs/src/core/Index/Interfaces/NullTsavoriteSession.cs b/libs/storage/Tsavorite/cs/src/core/Index/Interfaces/NullTsavoriteSession.cs index a1ddbcd3d8..2a413d47f9 100644 --- a/libs/storage/Tsavorite/cs/src/core/Index/Interfaces/NullTsavoriteSession.cs +++ b/libs/storage/Tsavorite/cs/src/core/Index/Interfaces/NullTsavoriteSession.cs @@ -7,10 +7,6 @@ struct NullTsavoriteSession : ITsavoriteSession { public static readonly NullTsavoriteSession Instance = new(); - public void CheckpointCompletionCallback(int sessionID, string sessionName, CommitPoint commitPoint) - { - } - public void UnsafeResumeThread() { } diff --git a/libs/storage/Tsavorite/cs/src/core/Index/Recovery/Recovery.cs b/libs/storage/Tsavorite/cs/src/core/Index/Recovery/Recovery.cs index 91e1ce35f7..9730fbd687 100644 --- a/libs/storage/Tsavorite/cs/src/core/Index/Recovery/Recovery.cs +++ b/libs/storage/Tsavorite/cs/src/core/Index/Recovery/Recovery.cs @@ -2,7 +2,6 @@ // Licensed under the MIT license. using System; -using System.Collections.Concurrent; using System.Diagnostics; using System.Runtime.CompilerServices; using System.Threading; @@ -528,11 +527,7 @@ private void DoPostRecovery(IndexCheckpointInfo recoveredICInfo, HybridLogCheckp if (readOnlyAddress < headAddress) readOnlyAddress = headAddress; - // Recover session information hlog.RecoveryReset(tailAddress, headAddress, recoveredHLCInfo.info.beginAddress, readOnlyAddress); - _recoveredSessions = recoveredHLCInfo.info.continueTokens; - _recoveredSessionNameMap = recoveredHLCInfo.info.sessionNameMap; - maxSessionID = Math.Max(recoveredHLCInfo.info.maxSessionID, maxSessionID); checkpointManager.OnRecovery(recoveredICInfo.info.token, recoveredHLCInfo.info.guid); recoveredHLCInfo.Dispose(); } @@ -1167,22 +1162,13 @@ private void AsyncFlushPageCallbackForRecovery(uint errorCode, uint numBytes, ob } } - internal static bool AtomicSwitch(TsavoriteExecutionContext fromCtx, TsavoriteExecutionContext toCtx, long version, ConcurrentDictionary tokens) + internal static bool AtomicSwitch(TsavoriteExecutionContext fromCtx, TsavoriteExecutionContext toCtx, long version) { lock (toCtx) { if (toCtx.version < version) { CopyContext(fromCtx, toCtx); - if (toCtx.serialNum != -1) - { - tokens.TryAdd(toCtx.sessionID, (toCtx.sessionName, - new CommitPoint - { - UntilSerialNo = toCtx.serialNum, - ExcludedSerialNos = toCtx.excludedSerialNos - })); - } return true; } } diff --git a/libs/storage/Tsavorite/cs/src/core/Index/Synchronization/HybridLogCheckpointTask.cs b/libs/storage/Tsavorite/cs/src/core/Index/Synchronization/HybridLogCheckpointTask.cs index 9e52e07f35..2cd07dc142 100644 --- a/libs/storage/Tsavorite/cs/src/core/Index/Synchronization/HybridLogCheckpointTask.cs +++ b/libs/storage/Tsavorite/cs/src/core/Index/Synchronization/HybridLogCheckpointTask.cs @@ -90,12 +90,6 @@ protected static void CollectMetadata(SystemState next, TsavoriteKV< store._activeSessions.Remove(key); } } - - // Make sure previous recoverable sessions are re-checkpointed - foreach (var item in store.RecoverableSessions) - { - store._hybridLogCheckpoint.info.checkpointTokens.TryAdd(item.Item1, (item.Item2, item.Item3)); - } } /// @@ -114,20 +108,15 @@ public virtual void OnThreadState.IssueCompletionCallback(ctx, storeSession); - ctx.prevCtx.markers[EpochPhaseIdx.CheckpointCompletionCallback] = true; - } - } + if (current.Phase != Phase.PERSISTENCE_CALLBACK) + return; store.epoch.Mark(EpochPhaseIdx.CheckpointCompletionCallback, current.Version); if (store.epoch.CheckIsComplete(EpochPhaseIdx.CheckpointCompletionCallback, current.Version)) + { + // TODO: store.CheckpointCompletionCallback(); store.GlobalStateMachineStep(current); + } } } diff --git a/libs/storage/Tsavorite/cs/src/core/Index/Synchronization/TsavoriteStateMachine.cs b/libs/storage/Tsavorite/cs/src/core/Index/Synchronization/TsavoriteStateMachine.cs index 9dda26b04c..6689ad5a65 100644 --- a/libs/storage/Tsavorite/cs/src/core/Index/Synchronization/TsavoriteStateMachine.cs +++ b/libs/storage/Tsavorite/cs/src/core/Index/Synchronization/TsavoriteStateMachine.cs @@ -194,7 +194,6 @@ private void ThreadStateMachineStep( CancellationToken token = default) where TsavoriteSession : ITsavoriteSession { - #region Capture current (non-intermediate) system state var currentTask = currentSyncStateMachine; var targetState = SystemState.Copy(ref systemState); @@ -211,37 +210,6 @@ private void ThreadStateMachineStep( var currentState = ctx is null ? targetState : SystemState.Make(ctx.phase, ctx.version); var targetStartState = StartOfCurrentCycle(targetState); - #region Get returning thread to start of current cycle, issuing completion callbacks if needed - if (ctx is not null) - { - if (ctx.version < targetStartState.Version) - { - // Issue CPR callback for full session - if (ctx.serialNum != -1) - { - List excludedSerialNos = new(); - foreach (var v in ctx.ioPendingRequests.Values) - { - excludedSerialNos.Add(v.serialNum); - } - - var commitPoint = new CommitPoint - { - UntilSerialNo = ctx.serialNum, - ExcludedSerialNos = excludedSerialNos - }; - - // Thread local action - tsavoriteSession?.CheckpointCompletionCallback(ctx.sessionID, ctx.sessionName, commitPoint); - } - } - if ((ctx.version == targetStartState.Version) && (ctx.phase < Phase.REST) && ctx.threadStateMachine is not IndexSnapshotStateMachine) - { - IssueCompletionCallback(ctx, tsavoriteSession); - } - } - #endregion - // No state machine associated with target, or target is in REST phase: // we can directly fast forward session to target state if (currentTask == null || targetState.Phase == Phase.REST) @@ -307,32 +275,5 @@ private void ThreadStateMachineStep( return; } - - /// - /// Issue completion callback if needed, for the given context's prevCtx - /// - internal static void IssueCompletionCallback(TsavoriteExecutionContext ctx, TsavoriteSession tsavoriteSession) - where TsavoriteSession : ITsavoriteSession - { - CommitPoint commitPoint = default; - if (ctx.prevCtx.excludedSerialNos != null) - { - lock (ctx.prevCtx) - { - if (ctx.prevCtx.serialNum != -1) - { - commitPoint = new CommitPoint - { - UntilSerialNo = ctx.prevCtx.serialNum, - ExcludedSerialNos = ctx.prevCtx.excludedSerialNos - }; - ctx.prevCtx.excludedSerialNos = null; - } - } - if (commitPoint.ExcludedSerialNos != null) - tsavoriteSession?.CheckpointCompletionCallback(ctx.sessionID, ctx.sessionName, commitPoint); - } - - } } } \ No newline at end of file diff --git a/libs/storage/Tsavorite/cs/src/core/Index/Synchronization/VersionChangeStateMachine.cs b/libs/storage/Tsavorite/cs/src/core/Index/Synchronization/VersionChangeStateMachine.cs index 417c4bc6ab..38e645e1a7 100644 --- a/libs/storage/Tsavorite/cs/src/core/Index/Synchronization/VersionChangeStateMachine.cs +++ b/libs/storage/Tsavorite/cs/src/core/Index/Synchronization/VersionChangeStateMachine.cs @@ -56,14 +56,11 @@ public void OnThreadState( { // Need to be very careful here as threadCtx is changing var _ctx = prev.Phase == Phase.IN_PROGRESS ? ctx.prevCtx : ctx; - var tokens = store._hybridLogCheckpoint.info.checkpointTokens; - if (!store.SameCycle(ctx, current) || tokens == null) - return; if (!_ctx.markers[EpochPhaseIdx.InProgress]) { - TsavoriteKV.AtomicSwitch(ctx, ctx.prevCtx, _ctx.version, tokens); - TsavoriteKV.InitContext(ctx, ctx.prevCtx.sessionID, ctx.prevCtx.sessionName, ctx.prevCtx.serialNum); + TsavoriteKV.AtomicSwitch(ctx, ctx.prevCtx, _ctx.version); + TsavoriteKV.InitContext(ctx, ctx.prevCtx.sessionID, ctx.prevCtx.sessionName); // Has to be prevCtx, not ctx ctx.prevCtx.markers[EpochPhaseIdx.InProgress] = true; diff --git a/libs/storage/Tsavorite/cs/src/core/Index/Tsavorite/Implementation/ConditionalCopyToTail.cs b/libs/storage/Tsavorite/cs/src/core/Index/Tsavorite/Implementation/ConditionalCopyToTail.cs index 1c7c1e45a5..efb2d94cf6 100644 --- a/libs/storage/Tsavorite/cs/src/core/Index/Tsavorite/Implementation/ConditionalCopyToTail.cs +++ b/libs/storage/Tsavorite/cs/src/core/Index/Tsavorite/Implementation/ConditionalCopyToTail.cs @@ -18,7 +18,6 @@ public unsafe partial class TsavoriteKV : TsavoriteBase /// the value to insert /// Location to store output computed from input and value. /// user context corresponding to operation used during completion callback. - /// Operation serial number /// Contains information about the call context, record metadata, and so on /// The reason the CopyToTail is being done /// Whether to do IO if the search must go below HeadAddress. ReadFromImmutable, for example, @@ -27,7 +26,7 @@ public unsafe partial class TsavoriteKV : TsavoriteBase [MethodImpl(MethodImplOptions.AggressiveInlining)] private OperationStatus ConditionalCopyToTail(TsavoriteSession tsavoriteSession, ref PendingContext pendingContext, - ref Key key, ref Input input, ref Value value, ref Output output, Context userContext, long lsn, + ref Key key, ref Input input, ref Value value, ref Output output, Context userContext, ref OperationStackContext stackCtx, WriteReason writeReason, bool wantIO = true) where TsavoriteSession : ITsavoriteSession { @@ -82,7 +81,7 @@ private OperationStatus ConditionalCopyToTail(status, tsavoriteSession)); if (needIO) - status = PrepareIOForConditionalOperation(tsavoriteSession, ref pendingContext, ref key, ref input, ref value, ref output, default, 0L, + status = PrepareIOForConditionalOperation(tsavoriteSession, ref pendingContext, ref key, ref input, ref value, ref output, default, ref stackCtx, minAddress, WriteReason.Compaction); else - status = ConditionalCopyToTail(tsavoriteSession, ref pendingContext, ref key, ref input, ref value, ref output, default, 0L, ref stackCtx, WriteReason.Compaction); + status = ConditionalCopyToTail(tsavoriteSession, ref pendingContext, ref key, ref input, ref value, ref output, default, ref stackCtx, WriteReason.Compaction); return HandleOperationStatus(tsavoriteSession.Ctx, ref pendingContext, status, out _); } [MethodImpl(MethodImplOptions.AggressiveInlining)] internal OperationStatus PrepareIOForConditionalOperation(TsavoriteSession tsavoriteSession, ref PendingContext pendingContext, - ref Key key, ref Input input, ref Value value, ref Output output, Context userContext, long lsn, + ref Key key, ref Input input, ref Value value, ref Output output, Context userContext, ref OperationStackContext stackCtx, long minAddress, WriteReason writeReason, OperationType opType = OperationType.CONDITIONAL_INSERT) where TsavoriteSession : ITsavoriteSession { @@ -139,8 +138,6 @@ internal OperationStatus PrepareIOForConditionalOperation(internalStatus, tsavoriteSession)); diff --git a/libs/storage/Tsavorite/cs/src/core/Index/Tsavorite/Implementation/EpochOperations.cs b/libs/storage/Tsavorite/cs/src/core/Index/Tsavorite/Implementation/EpochOperations.cs index 58c8c174c4..f29ff13e62 100644 --- a/libs/storage/Tsavorite/cs/src/core/Index/Tsavorite/Implementation/EpochOperations.cs +++ b/libs/storage/Tsavorite/cs/src/core/Index/Tsavorite/Implementation/EpochOperations.cs @@ -21,8 +21,6 @@ internal void SynchronizeEpoch( Debug.Assert(sessionCtx.phase == Phase.PREPARE, $"sessionCtx.phase ({sessionCtx.phase}) should == Phase.PREPARE"); InternalRefresh(tsavoriteSession); Debug.Assert(sessionCtx.version > version, $"sessionCtx.version ({sessionCtx.version}) should be > version ({version})"); - - pendingContext.version = sessionCtx.version; } /// diff --git a/libs/storage/Tsavorite/cs/src/core/Index/Tsavorite/Implementation/HandleOperationStatus.cs b/libs/storage/Tsavorite/cs/src/core/Index/Tsavorite/Implementation/HandleOperationStatus.cs index 419c5cbd92..c205cb59a8 100644 --- a/libs/storage/Tsavorite/cs/src/core/Index/Tsavorite/Implementation/HandleOperationStatus.cs +++ b/libs/storage/Tsavorite/cs/src/core/Index/Tsavorite/Implementation/HandleOperationStatus.cs @@ -55,7 +55,6 @@ private bool HandleRetryStatus( return true; case OperationStatus.RETRY_LATER: InternalRefresh(tsavoriteSession); - pendingContext.version = tsavoriteSession.Ctx.version; Thread.Yield(); return true; case OperationStatus.CPR_SHIFT_DETECTED: diff --git a/libs/storage/Tsavorite/cs/src/core/Index/Tsavorite/Implementation/Helpers.cs b/libs/storage/Tsavorite/cs/src/core/Index/Tsavorite/Implementation/Helpers.cs index 04dacfbec2..8dd7897665 100644 --- a/libs/storage/Tsavorite/cs/src/core/Index/Tsavorite/Implementation/Helpers.cs +++ b/libs/storage/Tsavorite/cs/src/core/Index/Tsavorite/Implementation/Helpers.cs @@ -12,7 +12,6 @@ public unsafe partial class TsavoriteKV : TsavoriteBase private enum LatchDestination { CreateNewRecord, - CreatePendingContext, NormalProcessing, Retry } diff --git a/libs/storage/Tsavorite/cs/src/core/Index/Tsavorite/Implementation/InternalDelete.cs b/libs/storage/Tsavorite/cs/src/core/Index/Tsavorite/Implementation/InternalDelete.cs index aa568c7155..74bfdd96fd 100644 --- a/libs/storage/Tsavorite/cs/src/core/Index/Tsavorite/Implementation/InternalDelete.cs +++ b/libs/storage/Tsavorite/cs/src/core/Index/Tsavorite/Implementation/InternalDelete.cs @@ -17,7 +17,6 @@ public unsafe partial class TsavoriteKV : TsavoriteBase /// User context for the operation, in case it goes pending. /// Pending context used internally to store the context of the operation. /// Callback functions. - /// Operation serial number /// /// /// @@ -40,7 +39,7 @@ public unsafe partial class TsavoriteKV : TsavoriteBase /// [MethodImpl(MethodImplOptions.AggressiveInlining)] internal OperationStatus InternalDelete(ref Key key, long keyHash, ref Context userContext, - ref PendingContext pendingContext, TsavoriteSession tsavoriteSession, long lsn) + ref PendingContext pendingContext, TsavoriteSession tsavoriteSession) where TsavoriteSession : ITsavoriteSession { var latchOperation = LatchOperation.None; @@ -91,9 +90,6 @@ internal OperationStatus InternalDelete(ref Key key, Context userContext, - ref PendingContext pendingContext, TsavoriteSession tsavoriteSession, long lsn, ref OperationStackContext stackCtx) + ref PendingContext pendingContext, TsavoriteSession tsavoriteSession, ref OperationStackContext stackCtx) where TsavoriteSession : ITsavoriteSession { pendingContext.type = OperationType.DELETE; if (pendingContext.key == default) pendingContext.key = hlog.GetKeyContainer(ref key); pendingContext.userContext = userContext; - pendingContext.entry.word = stackCtx.recSrc.LatestLogicalAddress; + pendingContext.InitialLatestLogicalAddress = stackCtx.recSrc.LatestLogicalAddress; pendingContext.logicalAddress = stackCtx.recSrc.LogicalAddress; - pendingContext.version = tsavoriteSession.Ctx.version; - pendingContext.serialNum = lsn; } private LatchDestination CheckCPRConsistencyDelete(Phase phase, ref OperationStackContext stackCtx, ref OperationStatus status, ref LatchOperation latchOperation) diff --git a/libs/storage/Tsavorite/cs/src/core/Index/Tsavorite/Implementation/InternalRMW.cs b/libs/storage/Tsavorite/cs/src/core/Index/Tsavorite/Implementation/InternalRMW.cs index 5c804e8ed4..cf7289fcbd 100644 --- a/libs/storage/Tsavorite/cs/src/core/Index/Tsavorite/Implementation/InternalRMW.cs +++ b/libs/storage/Tsavorite/cs/src/core/Index/Tsavorite/Implementation/InternalRMW.cs @@ -20,7 +20,6 @@ public unsafe partial class TsavoriteKV : TsavoriteBase /// user context corresponding to operation used during completion callback. /// pending context created when the operation goes pending. /// Callback functions. - /// Operation serial number /// /// /// @@ -47,7 +46,7 @@ public unsafe partial class TsavoriteKV : TsavoriteBase /// [MethodImpl(MethodImplOptions.AggressiveInlining)] internal OperationStatus InternalRMW(ref Key key, long keyHash, ref Input input, ref Output output, ref Context userContext, - ref PendingContext pendingContext, TsavoriteSession tsavoriteSession, long lsn) + ref PendingContext pendingContext, TsavoriteSession tsavoriteSession) where TsavoriteSession : ITsavoriteSession { var latchOperation = LatchOperation.None; @@ -92,9 +91,6 @@ internal OperationStatus InternalRMW(r goto LatchRelease; case LatchDestination.CreateNewRecord: goto CreateNewRecord; - case LatchDestination.CreatePendingContext: - CreatePendingRMWContext(ref key, ref input, output, userContext, ref pendingContext, tsavoriteSession, lsn, ref stackCtx); - goto LatchRelease; default: Debug.Assert(latchDestination == LatchDestination.NormalProcessing, "Unknown latchDestination value; expected NormalProcessing"); break; @@ -174,7 +170,7 @@ internal OperationStatus InternalRMW(r // Disk Region: Need to issue async io requests. Locking will be checked on pending completion. status = OperationStatus.RECORD_ON_DISK; - CreatePendingRMWContext(ref key, ref input, output, userContext, ref pendingContext, tsavoriteSession, lsn, ref stackCtx); + CreatePendingRMWContext(ref key, ref input, output, userContext, ref pendingContext, tsavoriteSession, ref stackCtx); goto LatchRelease; } @@ -193,7 +189,7 @@ internal OperationStatus InternalRMW(r { // OperationStatus.SUCCESS is OK here; it means NeedCopyUpdate or NeedInitialUpdate returned false if (status == OperationStatus.ALLOCATE_FAILED && pendingContext.IsAsync || status == OperationStatus.RECORD_ON_DISK) - CreatePendingRMWContext(ref key, ref input, output, userContext, ref pendingContext, tsavoriteSession, lsn, ref stackCtx); + CreatePendingRMWContext(ref key, ref input, output, userContext, ref pendingContext, tsavoriteSession, ref stackCtx); } goto LatchRelease; } @@ -224,7 +220,7 @@ internal OperationStatus InternalRMW(r // No AggressiveInlining; this is a less-common function and it may improve inlining of InternalUpsert if the compiler decides not to inline this. private void CreatePendingRMWContext(ref Key key, ref Input input, Output output, Context userContext, - ref PendingContext pendingContext, TsavoriteSession tsavoriteSession, long lsn, ref OperationStackContext stackCtx) + ref PendingContext pendingContext, TsavoriteSession tsavoriteSession, ref OperationStackContext stackCtx) where TsavoriteSession : ITsavoriteSession { pendingContext.type = OperationType.RMW; @@ -239,8 +235,6 @@ private void CreatePendingRMWContext(r pendingContext.userContext = userContext; pendingContext.logicalAddress = stackCtx.recSrc.LogicalAddress; - pendingContext.version = tsavoriteSession.Ctx.version; - pendingContext.serialNum = lsn; } private bool TryRevivifyInChain(ref Key key, ref Input input, ref Output output, ref PendingContext pendingContext, diff --git a/libs/storage/Tsavorite/cs/src/core/Index/Tsavorite/Implementation/InternalRead.cs b/libs/storage/Tsavorite/cs/src/core/Index/Tsavorite/Implementation/InternalRead.cs index 764cac7136..32b0a6fab5 100644 --- a/libs/storage/Tsavorite/cs/src/core/Index/Tsavorite/Implementation/InternalRead.cs +++ b/libs/storage/Tsavorite/cs/src/core/Index/Tsavorite/Implementation/InternalRead.cs @@ -19,7 +19,6 @@ public unsafe partial class TsavoriteKV : TsavoriteBase /// User context for the operation, in case it goes pending. /// Pending context used internally to store the context of the operation. /// Callback functions. - /// Operation serial number /// /// /// @@ -50,7 +49,7 @@ public unsafe partial class TsavoriteKV : TsavoriteBase /// [MethodImpl(MethodImplOptions.AggressiveInlining)] internal OperationStatus InternalRead(ref Key key, long keyHash, ref Input input, ref Output output, - Context userContext, long lsn, ref PendingContext pendingContext, TsavoriteSession tsavoriteSession) + Context userContext, ref PendingContext pendingContext, TsavoriteSession tsavoriteSession) where TsavoriteSession : ITsavoriteSession { OperationStackContext stackCtx = new(keyHash); @@ -141,7 +140,7 @@ internal OperationStatus InternalRead( { if (pendingContext.readCopyOptions.CopyFrom != ReadCopyFrom.AllImmutable) return OperationStatus.SUCCESS; - return CopyFromImmutable(ref key, ref input, ref output, userContext, lsn, ref pendingContext, tsavoriteSession, ref stackCtx, ref status, stackCtx.recSrc.GetValue()); + return CopyFromImmutable(ref key, ref input, ref output, userContext, ref pendingContext, tsavoriteSession, ref stackCtx, ref status, stackCtx.recSrc.GetValue()); } return CheckFalseActionStatus(readInfo); } @@ -154,7 +153,7 @@ internal OperationStatus InternalRead( // Note: we do not lock here; we wait until reading from disk, then lock in the ContinuePendingRead chain. if (hlog.IsNullDevice) return OperationStatus.NOTFOUND; - CreatePendingReadContext(ref key, ref input, output, userContext, ref pendingContext, tsavoriteSession, lsn, stackCtx.recSrc.LogicalAddress); + CreatePendingReadContext(ref key, ref input, output, userContext, ref pendingContext, tsavoriteSession, stackCtx.recSrc.LogicalAddress); return OperationStatus.RECORD_ON_DISK; } @@ -170,16 +169,16 @@ internal OperationStatus InternalRead( } // No AggressiveInlining; this is a less-common function and it may improve inlining of InternalRead to have this be a virtcall. - private OperationStatus CopyFromImmutable(ref Key key, ref Input input, ref Output output, Context userContext, long lsn, + private OperationStatus CopyFromImmutable(ref Key key, ref Input input, ref Output output, Context userContext, ref PendingContext pendingContext, TsavoriteSession tsavoriteSession, ref OperationStackContext stackCtx, ref OperationStatus status, Value recordValue) where TsavoriteSession : ITsavoriteSession { if (pendingContext.readCopyOptions.CopyTo == ReadCopyTo.MainLog) { - status = ConditionalCopyToTail(tsavoriteSession, ref pendingContext, ref key, ref input, ref recordValue, ref output, userContext, lsn, ref stackCtx, + status = ConditionalCopyToTail(tsavoriteSession, ref pendingContext, ref key, ref input, ref recordValue, ref output, userContext, ref stackCtx, WriteReason.CopyToTail, wantIO: false); if (status == OperationStatus.ALLOCATE_FAILED && pendingContext.IsAsync) // May happen due to CopyToTailFromReadOnly - CreatePendingReadContext(ref key, ref input, output, userContext, ref pendingContext, tsavoriteSession, lsn, stackCtx.recSrc.LogicalAddress); + CreatePendingReadContext(ref key, ref input, output, userContext, ref pendingContext, tsavoriteSession, stackCtx.recSrc.LogicalAddress); return status; } if (pendingContext.readCopyOptions.CopyTo == ReadCopyTo.ReadCache @@ -213,7 +212,6 @@ private static OperationStatus CheckFalseActionStatus(ReadInfo readInfo) /// User context for the operation, in case it goes pending. /// Pending context used internally to store the context of the operation. /// Callback functions. - /// Operation serial number /// /// /// @@ -244,7 +242,7 @@ private static OperationStatus CheckFalseActionStatus(ReadInfo readInfo) /// [MethodImpl(MethodImplOptions.AggressiveInlining)] internal OperationStatus InternalReadAtAddress(long readAtAddress, ref Key key, ref Input input, ref Output output, - ref ReadOptions readOptions, Context userContext, long lsn, ref PendingContext pendingContext, TsavoriteSession tsavoriteSession) + ref ReadOptions readOptions, Context userContext, ref PendingContext pendingContext, TsavoriteSession tsavoriteSession) where TsavoriteSession : ITsavoriteSession { if (readAtAddress < hlog.BeginAddress) @@ -256,7 +254,7 @@ internal OperationStatus InternalReadAtAddress(ref Key key, ref Input input, Output output, Context userContext, - ref PendingContext pendingContext, TsavoriteSession tsavoriteSession, long lsn, long logicalAddress) + ref PendingContext pendingContext, TsavoriteSession tsavoriteSession, long logicalAddress) where TsavoriteSession : ITsavoriteSession { pendingContext.type = OperationType.READ; @@ -355,8 +353,6 @@ private void CreatePendingReadContext( pendingContext.userContext = userContext; pendingContext.logicalAddress = logicalAddress; - pendingContext.version = tsavoriteSession.Ctx.version; - pendingContext.serialNum = lsn; } } } \ No newline at end of file diff --git a/libs/storage/Tsavorite/cs/src/core/Index/Tsavorite/Implementation/InternalUpsert.cs b/libs/storage/Tsavorite/cs/src/core/Index/Tsavorite/Implementation/InternalUpsert.cs index d994b95125..35ce31371b 100644 --- a/libs/storage/Tsavorite/cs/src/core/Index/Tsavorite/Implementation/InternalUpsert.cs +++ b/libs/storage/Tsavorite/cs/src/core/Index/Tsavorite/Implementation/InternalUpsert.cs @@ -20,7 +20,6 @@ public unsafe partial class TsavoriteKV : TsavoriteBase /// User context for the operation, in case it goes pending. /// Pending context used internally to store the context of the operation. /// Callback functions. - /// Operation serial number /// /// /// @@ -43,7 +42,7 @@ public unsafe partial class TsavoriteKV : TsavoriteBase /// [MethodImpl(MethodImplOptions.AggressiveInlining)] internal OperationStatus InternalUpsert(ref Key key, long keyHash, ref Input input, ref Value value, ref Output output, - ref Context userContext, ref PendingContext pendingContext, TsavoriteSession tsavoriteSession, long lsn) + ref Context userContext, ref PendingContext pendingContext, TsavoriteSession tsavoriteSession) where TsavoriteSession : ITsavoriteSession { var latchOperation = LatchOperation.None; @@ -86,9 +85,6 @@ internal OperationStatus InternalUpsert(ref Key key, ref Input input, ref Value value, Output output, Context userContext, - ref PendingContext pendingContext, TsavoriteSession tsavoriteSession, long lsn, ref OperationStackContext stackCtx) + ref PendingContext pendingContext, TsavoriteSession tsavoriteSession, ref OperationStackContext stackCtx) where TsavoriteSession : ITsavoriteSession { pendingContext.type = OperationType.UPSERT; @@ -199,8 +195,6 @@ private void CreatePendingUpsertContext(ref Key key, ref Input input, ref Value value, ref Output output, ref PendingContext pendingContext, diff --git a/libs/storage/Tsavorite/cs/src/core/Index/Tsavorite/Tsavorite.cs b/libs/storage/Tsavorite/cs/src/core/Index/Tsavorite/Tsavorite.cs index 9fc24e1eb1..25393a232c 100644 --- a/libs/storage/Tsavorite/cs/src/core/Index/Tsavorite/Tsavorite.cs +++ b/libs/storage/Tsavorite/cs/src/core/Index/Tsavorite/Tsavorite.cs @@ -2,9 +2,7 @@ // Licensed under the MIT license. using System; -using System.Collections.Concurrent; using System.Collections.Generic; -using System.Diagnostics; using System.IO; using System.Linq; using System.Runtime.CompilerServices; @@ -66,8 +64,6 @@ public partial class TsavoriteKV : TsavoriteBase, IDisposable /// public LogAccessor ReadCache { get; } - ConcurrentDictionary _recoveredSessions; - ConcurrentDictionary _recoveredSessionNameMap; int maxSessionID; internal readonly bool IsLocking; // uses LockTable @@ -478,48 +474,7 @@ public ValueTask RecoverAsync(Guid fullCheckpointToken, int numPagesToPrel /// Whether records with versions beyond checkpoint version need to be undone (and invalidated on log) /// Version we actually recovered to public long Recover(Guid indexCheckpointToken, Guid hybridLogCheckpointToken, int numPagesToPreload = -1, bool undoNextVersion = true) - { - return InternalRecover(indexCheckpointToken, hybridLogCheckpointToken, numPagesToPreload, undoNextVersion, -1); - } - - /// - /// Enumerate all currently recoverable sessions - /// - public IEnumerable<(int, string, CommitPoint)> RecoverableSessions - { - get - { - if (_recoveredSessions != null) - { - foreach (var kvp in _recoveredSessions) - { - yield return (kvp.Key, kvp.Value.Item1, kvp.Value.Item2); - } - } - } - } - - /// - /// Dispose recoverable session with given ID, use RecoverableSessions to get recoverable session details - /// - /// - public void DisposeRecoverableSession(int sessionID) - { - if (_recoveredSessions != null && _recoveredSessions.TryRemove(sessionID, out var entry)) - { - if (entry.Item1 != null) - _recoveredSessionNameMap.TryRemove(entry.Item1, out _); - } - } - - /// - /// Dispose (all) recoverable sessions - /// - public void DisposeRecoverableSessions() - { - _recoveredSessions = null; - _recoveredSessionNameMap = null; - } + => InternalRecover(indexCheckpointToken, hybridLogCheckpointToken, numPagesToPreload, undoNextVersion, -1); /// /// Asynchronously recover from specific index and log token (blocking operation) @@ -584,7 +539,7 @@ public async ValueTask CompleteCheckpointAsync(CancellationToken token = default } [MethodImpl(MethodImplOptions.AggressiveInlining)] - internal Status ContextRead(ref Key key, ref Input input, ref Output output, Context context, TsavoriteSession tsavoriteSession, long serialNo) + internal Status ContextRead(ref Key key, ref Input input, ref Output output, Context context, TsavoriteSession tsavoriteSession) where TsavoriteSession : ITsavoriteSession { var pcontext = new PendingContext(tsavoriteSession.Ctx.ReadCopyOptions); @@ -592,19 +547,17 @@ internal Status ContextRead(ref Key ke var keyHash = comparer.GetHashCode64(ref key); do - internalStatus = InternalRead(ref key, keyHash, ref input, ref output, context, serialNo, ref pcontext, tsavoriteSession); + internalStatus = InternalRead(ref key, keyHash, ref input, ref output, context, ref pcontext, tsavoriteSession); while (HandleImmediateRetryStatus(internalStatus, tsavoriteSession, ref pcontext)); var status = HandleOperationStatus(tsavoriteSession.Ctx, ref pcontext, internalStatus); - Debug.Assert(serialNo >= tsavoriteSession.Ctx.serialNum, "Operation serial numbers must be non-decreasing"); - tsavoriteSession.Ctx.serialNum = serialNo; return status; } [MethodImpl(MethodImplOptions.AggressiveInlining)] internal Status ContextRead(ref Key key, ref Input input, ref Output output, ref ReadOptions readOptions, out RecordMetadata recordMetadata, Context context, - TsavoriteSession tsavoriteSession, long serialNo) + TsavoriteSession tsavoriteSession) where TsavoriteSession : ITsavoriteSession { var pcontext = new PendingContext(tsavoriteSession.Ctx.ReadCopyOptions, ref readOptions); @@ -612,125 +565,107 @@ internal Status ContextRead(ref Key ke var keyHash = readOptions.KeyHash ?? comparer.GetHashCode64(ref key); do - internalStatus = InternalRead(ref key, keyHash, ref input, ref output, context, serialNo, ref pcontext, tsavoriteSession); + internalStatus = InternalRead(ref key, keyHash, ref input, ref output, context, ref pcontext, tsavoriteSession); while (HandleImmediateRetryStatus(internalStatus, tsavoriteSession, ref pcontext)); var status = HandleOperationStatus(tsavoriteSession.Ctx, ref pcontext, internalStatus); recordMetadata = status.IsCompletedSuccessfully ? new(pcontext.recordInfo, pcontext.logicalAddress) : default; - - Debug.Assert(serialNo >= tsavoriteSession.Ctx.serialNum, "Operation serial numbers must be non-decreasing"); - tsavoriteSession.Ctx.serialNum = serialNo; return status; } [MethodImpl(MethodImplOptions.AggressiveInlining)] - internal Status ContextReadAtAddress(long address, ref Input input, ref Output output, ref ReadOptions readOptions, out RecordMetadata recordMetadata, Context context, long serialNo, TsavoriteSession tsavoriteSession) + internal Status ContextReadAtAddress(long address, ref Input input, ref Output output, ref ReadOptions readOptions, out RecordMetadata recordMetadata, Context context, TsavoriteSession tsavoriteSession) where TsavoriteSession : ITsavoriteSession { var pcontext = new PendingContext(tsavoriteSession.Ctx.ReadCopyOptions, ref readOptions, noKey: true); Key key = default; - return ContextReadAtAddress(address, ref key, ref input, ref output, ref readOptions, out recordMetadata, serialNo, context, ref pcontext, tsavoriteSession); + return ContextReadAtAddress(address, ref key, ref input, ref output, ref readOptions, out recordMetadata, context, ref pcontext, tsavoriteSession); } [MethodImpl(MethodImplOptions.AggressiveInlining)] - internal Status ContextReadAtAddress(long address, ref Key key, ref Input input, ref Output output, ref ReadOptions readOptions, out RecordMetadata recordMetadata, Context context, long serialNo, TsavoriteSession tsavoriteSession) + internal Status ContextReadAtAddress(long address, ref Key key, ref Input input, ref Output output, ref ReadOptions readOptions, out RecordMetadata recordMetadata, Context context, TsavoriteSession tsavoriteSession) where TsavoriteSession : ITsavoriteSession { var pcontext = new PendingContext(tsavoriteSession.Ctx.ReadCopyOptions, ref readOptions, noKey: false); - return ContextReadAtAddress(address, ref key, ref input, ref output, ref readOptions, out recordMetadata, serialNo, context, ref pcontext, tsavoriteSession); + return ContextReadAtAddress(address, ref key, ref input, ref output, ref readOptions, out recordMetadata, context, ref pcontext, tsavoriteSession); } [MethodImpl(MethodImplOptions.AggressiveInlining)] - private Status ContextReadAtAddress(long address, ref Key key, ref Input input, ref Output output, ref ReadOptions readOptions, out RecordMetadata recordMetadata, long serialNo, + private Status ContextReadAtAddress(long address, ref Key key, ref Input input, ref Output output, ref ReadOptions readOptions, out RecordMetadata recordMetadata, Context context, ref PendingContext pcontext, TsavoriteSession tsavoriteSession) where TsavoriteSession : ITsavoriteSession { OperationStatus internalStatus; do - internalStatus = InternalReadAtAddress(address, ref key, ref input, ref output, ref readOptions, context, serialNo, ref pcontext, tsavoriteSession); + internalStatus = InternalReadAtAddress(address, ref key, ref input, ref output, ref readOptions, context, ref pcontext, tsavoriteSession); while (HandleImmediateRetryStatus(internalStatus, tsavoriteSession, ref pcontext)); var status = HandleOperationStatus(tsavoriteSession.Ctx, ref pcontext, internalStatus); recordMetadata = status.IsCompletedSuccessfully ? new(pcontext.recordInfo, pcontext.logicalAddress) : default; - - Debug.Assert(serialNo >= tsavoriteSession.Ctx.serialNum, "Operation serial numbers must be non-decreasing"); - tsavoriteSession.Ctx.serialNum = serialNo; return status; } [MethodImpl(MethodImplOptions.AggressiveInlining)] - internal Status ContextUpsert(ref Key key, long keyHash, ref Input input, ref Value value, ref Output output, Context context, TsavoriteSession tsavoriteSession, long serialNo) + internal Status ContextUpsert(ref Key key, long keyHash, ref Input input, ref Value value, ref Output output, Context context, TsavoriteSession tsavoriteSession) where TsavoriteSession : ITsavoriteSession { var pcontext = default(PendingContext); OperationStatus internalStatus; do - internalStatus = InternalUpsert(ref key, keyHash, ref input, ref value, ref output, ref context, ref pcontext, tsavoriteSession, serialNo); + internalStatus = InternalUpsert(ref key, keyHash, ref input, ref value, ref output, ref context, ref pcontext, tsavoriteSession); while (HandleImmediateRetryStatus(internalStatus, tsavoriteSession, ref pcontext)); var status = HandleOperationStatus(tsavoriteSession.Ctx, ref pcontext, internalStatus); - - Debug.Assert(serialNo >= tsavoriteSession.Ctx.serialNum, "Operation serial numbers must be non-decreasing"); - tsavoriteSession.Ctx.serialNum = serialNo; return status; } [MethodImpl(MethodImplOptions.AggressiveInlining)] internal Status ContextUpsert(ref Key key, long keyHash, ref Input input, ref Value value, ref Output output, out RecordMetadata recordMetadata, - Context context, TsavoriteSession tsavoriteSession, long serialNo) + Context context, TsavoriteSession tsavoriteSession) where TsavoriteSession : ITsavoriteSession { var pcontext = default(PendingContext); OperationStatus internalStatus; do - internalStatus = InternalUpsert(ref key, keyHash, ref input, ref value, ref output, ref context, ref pcontext, tsavoriteSession, serialNo); + internalStatus = InternalUpsert(ref key, keyHash, ref input, ref value, ref output, ref context, ref pcontext, tsavoriteSession); while (HandleImmediateRetryStatus(internalStatus, tsavoriteSession, ref pcontext)); var status = HandleOperationStatus(tsavoriteSession.Ctx, ref pcontext, internalStatus); recordMetadata = status.IsCompletedSuccessfully ? new(pcontext.recordInfo, pcontext.logicalAddress) : default; - - Debug.Assert(serialNo >= tsavoriteSession.Ctx.serialNum, "Operation serial numbers must be non-decreasing"); - tsavoriteSession.Ctx.serialNum = serialNo; return status; } [MethodImpl(MethodImplOptions.AggressiveInlining)] internal Status ContextRMW(ref Key key, long keyHash, ref Input input, ref Output output, out RecordMetadata recordMetadata, - Context context, TsavoriteSession tsavoriteSession, long serialNo) + Context context, TsavoriteSession tsavoriteSession) where TsavoriteSession : ITsavoriteSession { var pcontext = default(PendingContext); OperationStatus internalStatus; do - internalStatus = InternalRMW(ref key, keyHash, ref input, ref output, ref context, ref pcontext, tsavoriteSession, serialNo); + internalStatus = InternalRMW(ref key, keyHash, ref input, ref output, ref context, ref pcontext, tsavoriteSession); while (HandleImmediateRetryStatus(internalStatus, tsavoriteSession, ref pcontext)); var status = HandleOperationStatus(tsavoriteSession.Ctx, ref pcontext, internalStatus); recordMetadata = status.IsCompletedSuccessfully ? new(pcontext.recordInfo, pcontext.logicalAddress) : default; - - Debug.Assert(serialNo >= tsavoriteSession.Ctx.serialNum, "Operation serial numbers must be non-decreasing"); - tsavoriteSession.Ctx.serialNum = serialNo; return status; } [MethodImpl(MethodImplOptions.AggressiveInlining)] - internal Status ContextDelete(ref Key key, long keyHash, Context context, TsavoriteSession tsavoriteSession, long serialNo) + internal Status ContextDelete(ref Key key, long keyHash, Context context, TsavoriteSession tsavoriteSession) where TsavoriteSession : ITsavoriteSession { var pcontext = default(PendingContext); OperationStatus internalStatus; do - internalStatus = InternalDelete(ref key, keyHash, ref context, ref pcontext, tsavoriteSession, serialNo); + internalStatus = InternalDelete(ref key, keyHash, ref context, ref pcontext, tsavoriteSession); while (HandleImmediateRetryStatus(internalStatus, tsavoriteSession, ref pcontext)); var status = HandleOperationStatus(tsavoriteSession.Ctx, ref pcontext, internalStatus); - - Debug.Assert(serialNo >= tsavoriteSession.Ctx.serialNum, "Operation serial numbers must be non-decreasing"); - tsavoriteSession.Ctx.serialNum = serialNo; return status; } diff --git a/libs/storage/Tsavorite/cs/src/core/Index/Tsavorite/TsavoriteThread.cs b/libs/storage/Tsavorite/cs/src/core/Index/Tsavorite/TsavoriteThread.cs index a56a1e6d9d..b3704ba284 100644 --- a/libs/storage/Tsavorite/cs/src/core/Index/Tsavorite/TsavoriteThread.cs +++ b/libs/storage/Tsavorite/cs/src/core/Index/Tsavorite/TsavoriteThread.cs @@ -10,56 +10,6 @@ namespace Tsavorite.core { public partial class TsavoriteKV : TsavoriteBase { - internal (string, CommitPoint) InternalContinue(int sessionID, out TsavoriteExecutionContext ctx) - { - ctx = null; - - if (_recoveredSessions != null) - { - if (_recoveredSessions.TryGetValue(sessionID, out _)) - { - // We have recovered the corresponding session. - // Now obtain the session by first locking the rest phase - var currentState = SystemState.Copy(ref systemState); - if (currentState.Phase == Phase.REST) - { - var intermediateState = SystemState.MakeIntermediate(currentState); - if (MakeTransition(currentState, intermediateState)) - { - // No one can change from REST phase - if (_recoveredSessions.TryRemove(sessionID, out var cp)) - { - // We have atomically removed session details. - // No one else can continue this session - ctx = new TsavoriteExecutionContext(); - InitContext(ctx, sessionID, cp.Item1); - ctx.prevCtx = new TsavoriteExecutionContext(); - InitContext(ctx.prevCtx, sessionID, cp.Item1); - ctx.prevCtx.version--; - ctx.serialNum = cp.Item2.UntilSerialNo; - } - else - { - // Someone else continued this session - cp = ((string)null, new CommitPoint { UntilSerialNo = -1 }); - Debug.WriteLine("Session already continued by another thread!"); - } - - MakeTransition(intermediateState, currentState); - return cp; - } - } - - // Need to try again when in REST - Debug.WriteLine("Can continue only in REST phase"); - return (null, new CommitPoint { UntilSerialNo = -1 }); - } - } - - Debug.WriteLine("No recovered sessions!"); - return (null, new CommitPoint { UntilSerialNo = -1 }); - } - [MethodImpl(MethodImplOptions.AggressiveInlining)] internal void InternalRefresh(TsavoriteSession tsavoriteSession) where TsavoriteSession : ITsavoriteSession @@ -105,7 +55,7 @@ internal void InternalRefresh(Tsavorit } } - internal static void InitContext(TsavoriteExecutionContext ctx, int sessionID, string sessionName, long lsn = -1) + internal static void InitContext(TsavoriteExecutionContext ctx, int sessionID, string sessionName) { ctx.phase = Phase.REST; // The system version starts at 1. Because we do not know what the current state machine state is, @@ -113,7 +63,6 @@ internal static void InitContext(TsavoriteExecutionConte // never "catch up" with the rest of the system when stepping through the state machine as it is ahead. ctx.version = 1; ctx.markers = new bool[8]; - ctx.serialNum = lsn; ctx.sessionID = sessionID; ctx.sessionName = sessionName; @@ -131,14 +80,7 @@ internal static void CopyContext(TsavoriteExecutionConte dst.version = src.version; dst.threadStateMachine = src.threadStateMachine; dst.markers = src.markers; - dst.serialNum = src.serialNum; dst.sessionName = src.sessionName; - dst.excludedSerialNos = new List(); - - foreach (var v in src.ioPendingRequests.Values) - { - dst.excludedSerialNos.Add(v.serialNum); - } } internal bool InternalCompletePending(TsavoriteSession tsavoriteSession, bool wait = false, diff --git a/libs/storage/Tsavorite/cs/src/core/Index/Tsavorite/WriteReason.cs b/libs/storage/Tsavorite/cs/src/core/Index/Tsavorite/WriteReason.cs index 7856f0d610..8fc7188545 100644 --- a/libs/storage/Tsavorite/cs/src/core/Index/Tsavorite/WriteReason.cs +++ b/libs/storage/Tsavorite/cs/src/core/Index/Tsavorite/WriteReason.cs @@ -6,7 +6,7 @@ namespace Tsavorite.core /// /// The reason a SingleWriter was performed /// - public enum WriteReason + public enum WriteReason : byte { /// A new record appended by Upsert Upsert, diff --git a/libs/storage/Tsavorite/cs/test/AsyncLargeObjectTests.cs b/libs/storage/Tsavorite/cs/test/AsyncLargeObjectTests.cs index 67f1717a30..5d0565f767 100644 --- a/libs/storage/Tsavorite/cs/test/AsyncLargeObjectTests.cs +++ b/libs/storage/Tsavorite/cs/test/AsyncLargeObjectTests.cs @@ -55,7 +55,7 @@ public async Task LargeObjectTest([Values] CheckpointType checkpointType) { var mykey = new MyKey { key = key }; var value = new MyLargeValue(1 + r.Next(maxSize)); - s.Upsert(ref mykey, ref value, Empty.Default, 0); + s.Upsert(ref mykey, ref value, Empty.Default); } } @@ -81,7 +81,7 @@ public async Task LargeObjectTest([Values] CheckpointType checkpointType) for (int keycnt = 0; keycnt < numOps; keycnt++) { var key = new MyKey { key = keycnt }; - var status = s2.Read(ref key, ref input, ref output, Empty.Default, 0); + var status = s2.Read(ref key, ref input, ref output, Empty.Default); if (status.IsPending) await s2.CompletePendingAsync(); diff --git a/libs/storage/Tsavorite/cs/test/AsyncTests.cs b/libs/storage/Tsavorite/cs/test/AsyncTests.cs deleted file mode 100644 index a20c94f97e..0000000000 --- a/libs/storage/Tsavorite/cs/test/AsyncTests.cs +++ /dev/null @@ -1,152 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT license. - -using System; -using System.IO; -using System.Threading; -using System.Threading.Tasks; -using NUnit.Framework; -using Tsavorite.core; -using Tsavorite.test.recovery.sumstore; - -namespace Tsavorite.test.async -{ - [TestFixture] - public class AsyncRecoveryTests - { - private TsavoriteKV store1; - private TsavoriteKV store2; - private readonly AdSimpleFunctions functions = new AdSimpleFunctions(); - private IDevice log; - - - [TestCase(CheckpointType.FoldOver)] - [TestCase(CheckpointType.Snapshot)] - [Category("TsavoriteKV"), Category("CheckpointRestore")] - [Category("Smoke")] - - public async Task AsyncRecoveryTest1(CheckpointType checkpointType) - { - TestUtils.DeleteDirectory(TestUtils.MethodTestDir, wait: true); - log = Devices.CreateLogDevice(Path.Join(TestUtils.MethodTestDir, "AsyncRecoveryTest1.log"), deleteOnClose: true); - - string testPath = Path.Join(TestUtils.MethodTestDir, "checkpoints4"); - Directory.CreateDirectory(testPath); - - store1 = new TsavoriteKV - (128, - logSettings: new LogSettings { LogDevice = log, MutableFraction = 0.1, PageSizeBits = 10, MemorySizeBits = 13 }, - checkpointSettings: new CheckpointSettings { CheckpointDir = testPath } - ); - - store2 = new TsavoriteKV - (128, - logSettings: new LogSettings { LogDevice = log, MutableFraction = 0.1, PageSizeBits = 10, MemorySizeBits = 13 }, - checkpointSettings: new CheckpointSettings { CheckpointDir = testPath } - ); - - int numOps = 5000; - var inputArray = new AdId[numOps]; - for (int i = 0; i < numOps; i++) - { - inputArray[i].adId = i; - } - - NumClicks value; - AdInput inputArg = default; - Output output = default; - - var s0 = store1.NewSession(functions); - var s1 = store1.NewSession(functions); - var s2 = store1.NewSession(functions); - - for (int key = 0; key < numOps; key++) - { - value.numClicks = key; - s1.Upsert(ref inputArray[key], ref value, Empty.Default, key); - } - - for (int key = 0; key < numOps; key++) - { - value.numClicks = key; - s2.Read(ref inputArray[key], ref inputArg, ref output, Empty.Default, key); - } - - // does not require session - store1.TryInitiateFullCheckpoint(out _, checkpointType); - await store1.CompleteCheckpointAsync(); - - s2.CompletePending(true, false); - - store1.TryInitiateFullCheckpoint(out Guid token, checkpointType); - await store1.CompleteCheckpointAsync(); - - s2.Dispose(); - s1.Dispose(); - s0.Dispose(); - store1.Dispose(); - - store2.Recover(token); // sync, does not require session - - using (var s3 = store2.ResumeSession(functions, s1.ID, out CommitPoint lsn)) - { - Assert.AreEqual(numOps - 1, lsn.UntilSerialNo); - - for (int key = 0; key < numOps; key++) - { - var status = s3.Read(ref inputArray[key], ref inputArg, ref output, Empty.Default, s3.SerialNo); - - if (status.IsPending) - s3.CompletePending(true, true); - else - { - Assert.AreEqual(key, output.value.numClicks); - } - } - } - - store2.Dispose(); - log.Dispose(); - TestUtils.DeleteDirectory(TestUtils.MethodTestDir); - } - } - - public class AdSimpleFunctions : FunctionsBase - { - public override void ReadCompletionCallback(ref AdId key, ref AdInput input, ref Output output, Empty ctx, Status status, RecordMetadata recordMetadata) - { - Assert.IsTrue(status.Found); - Assert.AreEqual(key.adId, output.value.numClicks); - } - - // Read functions - public override bool SingleReader(ref AdId key, ref AdInput input, ref NumClicks value, ref Output dst, ref ReadInfo readInfo) - { - dst.value = value; - return true; - } - - public override bool ConcurrentReader(ref AdId key, ref AdInput input, ref NumClicks value, ref Output dst, ref ReadInfo readInfo, ref RecordInfo recordInfo) - { - dst.value = value; - return true; - } - - // RMW functions - public override bool InitialUpdater(ref AdId key, ref AdInput input, ref NumClicks value, ref Output output, ref RMWInfo rmwInfo, ref RecordInfo recordInfo) { value = input.numClicks; return true; } - - public override bool InPlaceUpdater(ref AdId key, ref AdInput input, ref NumClicks value, ref Output output, ref RMWInfo rmwInfo, ref RecordInfo recordInfo) - { - Interlocked.Add(ref value.numClicks, input.numClicks.numClicks); - return true; - } - - public override bool NeedCopyUpdate(ref AdId key, ref AdInput input, ref NumClicks oldValue, ref Output output, ref RMWInfo rmwInfo) => true; - - public override bool CopyUpdater(ref AdId key, ref AdInput input, ref NumClicks oldValue, ref NumClicks newValue, ref Output output, ref RMWInfo rmwInfo, ref RecordInfo recordInfo) - { - newValue.numClicks += oldValue.numClicks + input.numClicks.numClicks; - return true; - } - } -} \ No newline at end of file diff --git a/libs/storage/Tsavorite/cs/test/BasicStorageTests.cs b/libs/storage/Tsavorite/cs/test/BasicStorageTests.cs index fa2becbbe5..22dba1adb3 100644 --- a/libs/storage/Tsavorite/cs/test/BasicStorageTests.cs +++ b/libs/storage/Tsavorite/cs/test/BasicStorageTests.cs @@ -105,7 +105,7 @@ void TestDeviceWriteRead(IDevice log) { var key1 = new KeyStruct { kfield1 = i, kfield2 = i + 1 }; var value = new ValueStruct { vfield1 = i, vfield2 = i + 1 }; - session.Upsert(ref key1, ref value, Empty.Default, 0); + session.Upsert(ref key1, ref value, Empty.Default); } session.CompletePending(true); @@ -114,7 +114,7 @@ void TestDeviceWriteRead(IDevice log) { var key1 = new KeyStruct { kfield1 = i, kfield2 = i + 1 }; input = new InputStruct { ifield1 = 1, ifield2 = 1 }; - var status = session.RMW(ref key1, ref input, Empty.Default, 0); + var status = session.RMW(ref key1, ref input, Empty.Default); if (status.IsPending) session.CompletePending(true); } @@ -126,7 +126,7 @@ void TestDeviceWriteRead(IDevice log) var key1 = new KeyStruct { kfield1 = i, kfield2 = i + 1 }; var value = new ValueStruct { vfield1 = i, vfield2 = i + 1 }; - if (session.Read(ref key1, ref input, ref output, Empty.Default, 0).IsPending) + if (session.Read(ref key1, ref input, ref output, Empty.Default).IsPending) { session.CompletePending(true); } diff --git a/libs/storage/Tsavorite/cs/test/BasicTests.cs b/libs/storage/Tsavorite/cs/test/BasicTests.cs index 4a48609bab..2912dafed1 100644 --- a/libs/storage/Tsavorite/cs/test/BasicTests.cs +++ b/libs/storage/Tsavorite/cs/test/BasicTests.cs @@ -78,8 +78,8 @@ public void NativeInMemWriteRead([Values] DeviceType deviceType) var key1 = new KeyStruct { kfield1 = 13, kfield2 = 14 }; var value = new ValueStruct { vfield1 = 23, vfield2 = 24 }; - session.Upsert(ref key1, ref value, Empty.Default, 0); - var status = session.Read(ref key1, ref input, ref output, Empty.Default, 0); + session.Upsert(ref key1, ref value, Empty.Default); + var status = session.Read(ref key1, ref input, ref output, Empty.Default); AssertCompleted(new(StatusCode.Found), status); Assert.AreEqual(value.vfield1, output.value.vfield1); @@ -99,20 +99,20 @@ public void NativeInMemWriteReadDelete([Values] DeviceType deviceType) var key1 = new KeyStruct { kfield1 = 13, kfield2 = 14 }; var value = new ValueStruct { vfield1 = 23, vfield2 = 24 }; - session.Upsert(ref key1, ref value, Empty.Default, 0); - var status = session.Read(ref key1, ref input, ref output, Empty.Default, 0); + session.Upsert(ref key1, ref value, Empty.Default); + var status = session.Read(ref key1, ref input, ref output, Empty.Default); AssertCompleted(new(StatusCode.Found), status); - session.Delete(ref key1, Empty.Default, 0); + session.Delete(ref key1, Empty.Default); - status = session.Read(ref key1, ref input, ref output, Empty.Default, 0); + status = session.Read(ref key1, ref input, ref output, Empty.Default); AssertCompleted(new(StatusCode.NotFound), status); var key2 = new KeyStruct { kfield1 = 14, kfield2 = 15 }; var value2 = new ValueStruct { vfield1 = 24, vfield2 = 25 }; - session.Upsert(ref key2, ref value2, Empty.Default, 0); - status = session.Read(ref key2, ref input, ref output, Empty.Default, 0); + session.Upsert(ref key2, ref value2, Empty.Default); + status = session.Read(ref key2, ref input, ref output, Empty.Default); AssertCompleted(new(StatusCode.Found), status); Assert.AreEqual(value2.vfield1, output.value.vfield1); @@ -141,13 +141,13 @@ public void NativeInMemWriteReadDelete2() var key1 = new KeyStruct { kfield1 = i, kfield2 = 14 }; var value = new ValueStruct { vfield1 = i, vfield2 = 24 }; - session.Upsert(ref key1, ref value, Empty.Default, 0); + session.Upsert(ref key1, ref value, Empty.Default); } for (int i = 0; i < 10 * count; i++) { var key1 = new KeyStruct { kfield1 = i, kfield2 = 14 }; - session.Delete(ref key1, Empty.Default, 0); + session.Delete(ref key1, Empty.Default); } for (int i = 0; i < 10 * count; i++) @@ -155,16 +155,16 @@ public void NativeInMemWriteReadDelete2() var key1 = new KeyStruct { kfield1 = i, kfield2 = 14 }; var value = new ValueStruct { vfield1 = i, vfield2 = 24 }; - var status = session.Read(ref key1, ref input, ref output, Empty.Default, 0); + var status = session.Read(ref key1, ref input, ref output, Empty.Default); AssertCompleted(new(StatusCode.NotFound), status); - session.Upsert(ref key1, ref value, Empty.Default, 0); + session.Upsert(ref key1, ref value, Empty.Default); } for (int i = 0; i < 10 * count; i++) { var key1 = new KeyStruct { kfield1 = i, kfield2 = 14 }; - var status = session.Read(ref key1, ref input, ref output, Empty.Default, 0); + var status = session.Read(ref key1, ref input, ref output, Empty.Default); AssertCompleted(new(StatusCode.Found), status); } } @@ -191,7 +191,7 @@ public unsafe void NativeInMemWriteRead2() var i = r.Next(10000); var key1 = new KeyStruct { kfield1 = i, kfield2 = i + 1 }; var value = new ValueStruct { vfield1 = i, vfield2 = i + 1 }; - session.Upsert(ref key1, ref value, Empty.Default, 0); + session.Upsert(ref key1, ref value, Empty.Default); } r = new Random(10); @@ -203,7 +203,7 @@ public unsafe void NativeInMemWriteRead2() var key1 = new KeyStruct { kfield1 = i, kfield2 = i + 1 }; var value = new ValueStruct { vfield1 = i, vfield2 = i + 1 }; - if (session.Read(ref key1, ref input, ref output, Empty.Default, 0).IsPending) + if (session.Read(ref key1, ref input, ref output, Empty.Default).IsPending) { session.CompletePending(true); } @@ -221,7 +221,7 @@ public unsafe void NativeInMemWriteRead2() var i = r.Next(10000); OutputStruct output = default; var key1 = new KeyStruct { kfield1 = i, kfield2 = i + 1 }; - Assert.IsFalse(session.Read(ref key1, ref input, ref output, Empty.Default, 0).Found); + Assert.IsFalse(session.Read(ref key1, ref input, ref output, Empty.Default).Found); } } @@ -246,7 +246,7 @@ public unsafe void TestShiftHeadAddress([Values] DeviceType deviceType, [Values] var i = r.Next(RandRange); var key1 = new KeyStruct { kfield1 = i, kfield2 = i + 1 }; var value = new ValueStruct { vfield1 = i, vfield2 = i + 1 }; - session.Upsert(ref key1, ref value, Empty.Default, 0); + session.Upsert(ref key1, ref value, Empty.Default); } r = new Random(RandSeed); @@ -259,7 +259,7 @@ public unsafe void TestShiftHeadAddress([Values] DeviceType deviceType, [Values] var key1 = new KeyStruct { kfield1 = i, kfield2 = i + 1 }; var value = new ValueStruct { vfield1 = i, vfield2 = i + 1 }; - if (session.Read(ref key1, ref input, ref output, Empty.Default, 0).IsPending) + if (session.Read(ref key1, ref input, ref output, Empty.Default).IsPending) { Assert.AreEqual(value.vfield1, output.value.vfield1); Assert.AreEqual(value.vfield2, output.value.vfield2); @@ -279,7 +279,7 @@ public unsafe void TestShiftHeadAddress([Values] DeviceType deviceType, [Values] var i = r.Next(RandRange); OutputStruct output = default; var key1 = new KeyStruct { kfield1 = i, kfield2 = i + 1 }; - Status foundStatus = session.Read(ref key1, ref input, ref output, Empty.Default, 0); + Status foundStatus = session.Read(ref key1, ref input, ref output, Empty.Default); Assert.IsTrue(foundStatus.IsPending); if (batchMode == BatchMode.NoBatch) { @@ -332,14 +332,14 @@ public unsafe void NativeInMemRMWRefKeys([Values] DeviceType deviceType) var i = nums[j]; var key1 = new KeyStruct { kfield1 = i, kfield2 = i + 1 }; input = new InputStruct { ifield1 = i, ifield2 = i + 1 }; - session.RMW(ref key1, ref input, Empty.Default, 0); + session.RMW(ref key1, ref input, Empty.Default); } for (int j = 0; j < nums.Length; ++j) { var i = nums[j]; var key1 = new KeyStruct { kfield1 = i, kfield2 = i + 1 }; input = new InputStruct { ifield1 = i, ifield2 = i + 1 }; - if (session.RMW(ref key1, ref input, ref output, Empty.Default, 0).IsPending) + if (session.RMW(ref key1, ref input, ref output, Empty.Default).IsPending) { session.CompletePending(true); } @@ -360,7 +360,7 @@ public unsafe void NativeInMemRMWRefKeys([Values] DeviceType deviceType) key = new KeyStruct { kfield1 = i, kfield2 = i + 1 }; ValueStruct value = new() { vfield1 = i, vfield2 = i + 1 }; - status = session.Read(ref key, ref input, ref output, Empty.Default, 0); + status = session.Read(ref key, ref input, ref output, Empty.Default); AssertCompleted(new(StatusCode.Found), status); Assert.AreEqual(2 * value.vfield1, output.value.vfield1); @@ -368,11 +368,11 @@ public unsafe void NativeInMemRMWRefKeys([Values] DeviceType deviceType) } key = new KeyStruct { kfield1 = nums.Length, kfield2 = nums.Length + 1 }; - status = session.Read(ref key, ref input, ref output, Empty.Default, 0); + status = session.Read(ref key, ref input, ref output, Empty.Default); AssertCompleted(new(StatusCode.NotFound), status); } - // Tests the overload where no reference params used: key,input,userContext,serialNo + // Tests the overload where no reference params used: key,input,userContext [Test] [Category("TsavoriteKV")] public unsafe void NativeInMemRMWNoRefKeys([Values] DeviceType deviceType) @@ -397,7 +397,7 @@ public unsafe void NativeInMemRMWNoRefKeys([Values] DeviceType deviceType) var i = nums[j]; var key1 = new KeyStruct { kfield1 = i, kfield2 = i + 1 }; input = new InputStruct { ifield1 = i, ifield2 = i + 1 }; - session.RMW(ref key1, ref input, Empty.Default, 0); + session.RMW(ref key1, ref input, Empty.Default); } // CopyUpdater @@ -420,7 +420,7 @@ public unsafe void NativeInMemRMWNoRefKeys([Values] DeviceType deviceType) key = new KeyStruct { kfield1 = i, kfield2 = i + 1 }; ValueStruct value = new() { vfield1 = i, vfield2 = i + 1 }; - status = session.Read(ref key, ref input, ref output, Empty.Default, 0); + status = session.Read(ref key, ref input, ref output, Empty.Default); AssertCompleted(new(StatusCode.Found), status); Assert.AreEqual(2 * value.vfield1, output.value.vfield1); @@ -428,11 +428,11 @@ public unsafe void NativeInMemRMWNoRefKeys([Values] DeviceType deviceType) } key = new KeyStruct { kfield1 = nums.Length, kfield2 = nums.Length + 1 }; - status = session.Read(ref key, ref input, ref output, Empty.Default, 0); + status = session.Read(ref key, ref input, ref output, Empty.Default); AssertCompleted(new(StatusCode.NotFound), status); } - // Tests the overload of .Read(key, input, out output, context, serialNo) + // Tests the overload of .Read(key, input, out output, context) [Test] [Category("TsavoriteKV")] [Category("Smoke")] @@ -445,8 +445,8 @@ public void ReadNoRefKeyInputOutput([Values] DeviceType deviceType) var key1 = new KeyStruct { kfield1 = 13, kfield2 = 14 }; var value = new ValueStruct { vfield1 = 23, vfield2 = 24 }; - session.Upsert(ref key1, ref value, Empty.Default, 0); - var status = session.Read(key1, input, out OutputStruct output, Empty.Default, 111); + session.Upsert(ref key1, ref value, Empty.Default); + var status = session.Read(key1, input, out OutputStruct output, Empty.Default); AssertCompleted(new(StatusCode.Found), status); // Verify the read data @@ -456,7 +456,7 @@ public void ReadNoRefKeyInputOutput([Values] DeviceType deviceType) Assert.AreEqual(key1.kfield2, 14); } - // Test the overload call of .Read (key, out output, userContext, serialNo) + // Test the overload call of .Read (key, out output, userContext) [Test] [Category("TsavoriteKV")] public void ReadNoRefKey([Values] DeviceType deviceType) @@ -466,8 +466,8 @@ public void ReadNoRefKey([Values] DeviceType deviceType) var key1 = new KeyStruct { kfield1 = 13, kfield2 = 14 }; var value = new ValueStruct { vfield1 = 23, vfield2 = 24 }; - session.Upsert(ref key1, ref value, Empty.Default, 0); - var status = session.Read(key1, out OutputStruct output, Empty.Default, 1); + session.Upsert(ref key1, ref value, Empty.Default); + var status = session.Read(key1, out OutputStruct output, Empty.Default); AssertCompleted(new(StatusCode.Found), status); // Verify the read data @@ -478,7 +478,7 @@ public void ReadNoRefKey([Values] DeviceType deviceType) } - // Test the overload call of .Read (ref key, ref output, userContext, serialNo) + // Test the overload call of .Read (ref key, ref output, userContext) [Test] [Category("TsavoriteKV")] [Category("Smoke")] @@ -491,8 +491,8 @@ public void ReadWithoutInput([Values] DeviceType deviceType) var key1 = new KeyStruct { kfield1 = 13, kfield2 = 14 }; var value = new ValueStruct { vfield1 = 23, vfield2 = 24 }; - session.Upsert(ref key1, ref value, Empty.Default, 0); - var status = session.Read(ref key1, ref output, Empty.Default, 99); + session.Upsert(ref key1, ref value, Empty.Default); + var status = session.Read(ref key1, ref output, Empty.Default); AssertCompleted(new(StatusCode.Found), status); // Verify the read data @@ -502,34 +502,6 @@ public void ReadWithoutInput([Values] DeviceType deviceType) Assert.AreEqual(key1.kfield2, 14); } - - // Test the overload call of .Read (ref key, ref input, ref output, ref recordInfo, userContext: context) - [Test] - [Category("TsavoriteKV")] - [Category("Smoke")] - public void ReadWithoutSerialID() - { - // Just checking without Serial ID so one device type is enough - deviceType = DeviceType.MLSD; - - Setup(128, new LogSettings { MemorySizeBits = 29 }, deviceType); - - InputStruct input = default; - OutputStruct output = default; - - var key1 = new KeyStruct { kfield1 = 13, kfield2 = 14 }; - var value = new ValueStruct { vfield1 = 23, vfield2 = 24 }; - - session.Upsert(ref key1, ref value, Empty.Default, 0); - var status = session.Read(ref key1, ref input, ref output, Empty.Default); - AssertCompleted(new(StatusCode.Found), status); - - Assert.AreEqual(value.vfield1, output.value.vfield1); - Assert.AreEqual(value.vfield2, output.value.vfield2); - Assert.AreEqual(key1.kfield1, 13); - Assert.AreEqual(key1.kfield2, 14); - } - // Test the overload call of .Read (key) [Test] [Category("TsavoriteKV")] @@ -541,7 +513,7 @@ public void ReadBareMinParams([Values] DeviceType deviceType) var key1 = new KeyStruct { kfield1 = 13, kfield2 = 14 }; var value = new ValueStruct { vfield1 = 23, vfield2 = 24 }; - session.Upsert(ref key1, ref value, Empty.Default, 0); + session.Upsert(ref key1, ref value, Empty.Default); var (status, output) = session.Read(key1); AssertCompleted(new(StatusCode.Found), status); @@ -569,8 +541,8 @@ public void ReadAtAddressDefaultOptions() var value = new ValueStruct { vfield1 = 23, vfield2 = 24 }; ReadOptions readOptions = default; - session.Upsert(ref key1, ref value, Empty.Default, 0); - var status = session.ReadAtAddress(store.Log.BeginAddress, ref input, ref output, ref readOptions, out _, Empty.Default, 0); + session.Upsert(ref key1, ref value, Empty.Default); + var status = session.ReadAtAddress(store.Log.BeginAddress, ref input, ref output, ref readOptions, out _, Empty.Default); AssertCompleted(new(StatusCode.Found), status); Assert.AreEqual(value.vfield1, output.value.vfield1); @@ -627,7 +599,7 @@ public void ReadAtAddressIgnoreReadCache() var readAtAddress = store.Log.BeginAddress; Status status; - skipReadCacheSession.Upsert(ref key1, ref value, Empty.Default, 0); + skipReadCacheSession.Upsert(ref key1, ref value, Empty.Default); void VerifyOutput() { @@ -705,7 +677,7 @@ public void UpsertDefaultsTest([Values] DeviceType deviceType) Assert.AreEqual(0, store.EntryCount); session.Upsert(ref key1, ref value); - var status = session.Read(ref key1, ref input, ref output, Empty.Default, 0); + var status = session.Read(ref key1, ref input, ref output, Empty.Default); AssertCompleted(new(StatusCode.Found), status); Assert.AreEqual(1, store.EntryCount); @@ -730,53 +702,14 @@ public void UpsertNoRefNoDefaultsTest() var key1 = new KeyStruct { kfield1 = 13, kfield2 = 14 }; var value = new ValueStruct { vfield1 = 23, vfield2 = 24 }; - session.Upsert(key1, value, Empty.Default, 0); - var status = session.Read(ref key1, ref input, ref output, Empty.Default, 0); + session.Upsert(key1, value, Empty.Default); + var status = session.Read(ref key1, ref input, ref output, Empty.Default); AssertCompleted(new(StatusCode.Found), status); Assert.AreEqual(value.vfield1, output.value.vfield1); Assert.AreEqual(value.vfield2, output.value.vfield2); } - - // Upsert Test using Serial Numbers ... based on the VersionedRead Sample - [Test] - [Category("TsavoriteKV")] - [Category("Smoke")] - public void UpsertSerialNumberTest() - { - // Simple Upsert of Serial Number test so one device is enough - deviceType = DeviceType.MLSD; - - Setup(128, new LogSettings { MemorySizeBits = 29 }, deviceType); - - int numKeys = 100; - int keyMod = 10; - int maxLap = numKeys / keyMod; - InputStruct input = default; - OutputStruct output = default; - - var value = new ValueStruct { vfield1 = 23, vfield2 = 24 }; - var key = new KeyStruct { kfield1 = 13, kfield2 = 14 }; - - for (int i = 0; i < numKeys; i++) - { - // lap is used to illustrate the changing values - var lap = i / keyMod; - session.Upsert(ref key, ref value, serialNo: lap); - } - - // Now verify - for (int j = 0; j < numKeys; j++) - { - var status = session.Read(ref key, ref input, ref output, serialNo: maxLap + 1); - - AssertCompleted(new(StatusCode.Found), status); - Assert.AreEqual(value.vfield1, output.value.vfield1); - Assert.AreEqual(value.vfield2, output.value.vfield2); - } - } - //**** Quick End to End Sample code from help docs *** // Very minor changes to LogDevice call and type of Asserts to use but basically code from Sample code in docs // Also tests the overload call of .Read (ref key ref output) diff --git a/libs/storage/Tsavorite/cs/test/BlittableLogCompactionTests.cs b/libs/storage/Tsavorite/cs/test/BlittableLogCompactionTests.cs index 9e2605be64..2e20b8a8c0 100644 --- a/libs/storage/Tsavorite/cs/test/BlittableLogCompactionTests.cs +++ b/libs/storage/Tsavorite/cs/test/BlittableLogCompactionTests.cs @@ -101,7 +101,7 @@ void drainPending() var key1 = new KeyStruct { kfield1 = i, kfield2 = i + 1 }; var value = new ValueStruct { vfield1 = i, vfield2 = i + 1 }; - var status = session.Read(ref key1, ref input, ref output, isDeleted(i) ? 1 : 0, 0); + var status = session.Read(ref key1, ref input, ref output, isDeleted(i) ? 1 : 0); if (!status.IsPending) { if (isDeleted(i)) @@ -141,7 +141,7 @@ public void BlittableLogCompactionTest1([Values] CompactionType compactionType, var key1 = new KeyStruct { kfield1 = i, kfield2 = i + 1 }; var value = new ValueStruct { vfield1 = i, vfield2 = i + 1 }; - session.Upsert(ref key1, ref value, 0, 0); + session.Upsert(ref key1, ref value, 0); } store.Log.FlushAndEvict(wait: true); @@ -173,7 +173,7 @@ public void BlittableLogCompactionTest2([Values] CompactionType compactionType, var key1 = new KeyStruct { kfield1 = i, kfield2 = i + 1 }; var value = new ValueStruct { vfield1 = i, vfield2 = i + 1 }; - session.Upsert(ref key1, ref value, 0, 0); + session.Upsert(ref key1, ref value, 0); } store.Log.FlushAndEvict(true); @@ -191,7 +191,7 @@ public void BlittableLogCompactionTest2([Values] CompactionType compactionType, { var key1 = new KeyStruct { kfield1 = i, kfield2 = i + 1 }; var value = new ValueStruct { vfield1 = i, vfield2 = i + 1 }; - session.Upsert(ref key1, ref value, 0, 0); + session.Upsert(ref key1, ref value, 0); } compactUntil = session.Compact(compactUntil, compactionType); @@ -220,13 +220,13 @@ public void BlittableLogCompactionTest3([Values] CompactionType compactionType, var key1 = new KeyStruct { kfield1 = i, kfield2 = i + 1 }; var value = new ValueStruct { vfield1 = i, vfield2 = i + 1 }; - session.Upsert(ref key1, ref value, 0, 0); + session.Upsert(ref key1, ref value, 0); if (i % 8 == 0) { int j = i / 4; key1 = new KeyStruct { kfield1 = j, kfield2 = j + 1 }; - session.Delete(ref key1, 0, 0); + session.Delete(ref key1, 0); } } @@ -261,7 +261,7 @@ public void BlittableLogCompactionCustomFunctionsTest1([Values] CompactionType c var key1 = new KeyStruct { kfield1 = i, kfield2 = i + 1 }; var value = new ValueStruct { vfield1 = i, vfield2 = i + 1 }; - session.Upsert(ref key1, ref value, 0, 0); + session.Upsert(ref key1, ref value, 0); } var tail = store.Log.TailAddress; @@ -280,7 +280,7 @@ public void BlittableLogCompactionCustomFunctionsTest1([Values] CompactionType c var ctx = (i < (totalRecords / 2) && (i % 2 != 0)) ? 1 : 0; - var status = session.Read(ref key1, ref input, ref output, ctx, 0); + var status = session.Read(ref key1, ref input, ref output, ctx); if (status.IsPending) { Assert.IsTrue(session.CompletePendingWithOutputs(out var outputs, wait: true)); @@ -317,15 +317,15 @@ public void BlittableLogCompactionCustomFunctionsTest2([Values] CompactionType c var input = default(InputStruct); var output = default(OutputStruct); - session.Upsert(ref key, ref value, 0, 0); - var status = session.Read(ref key, ref input, ref output, 0, 0); + session.Upsert(ref key, ref value, 0); + var status = session.Read(ref key, ref input, ref output, 0); Debug.Assert(status.Found); store.Log.Flush(true); value = new ValueStruct { vfield1 = 11, vfield2 = 21 }; - session.Upsert(ref key, ref value, 0, 0); - status = session.Read(ref key, ref input, ref output, 0, 0); + session.Upsert(ref key, ref value, 0); + status = session.Read(ref key, ref input, ref output, 0); Debug.Assert(status.Found); if (flushAndEvict) @@ -336,7 +336,7 @@ public void BlittableLogCompactionCustomFunctionsTest2([Values] CompactionType c var compactUntil = session.Compact(store.Log.TailAddress, compactionType); store.Log.Truncate(); - status = session.Read(ref key, ref input, ref output, 0, 0); + status = session.Read(ref key, ref input, ref output, 0); if (status.IsPending) { Assert.IsTrue(session.CompletePendingWithOutputs(out var outputs, wait: true)); diff --git a/libs/storage/Tsavorite/cs/test/BlittableLogScanTests.cs b/libs/storage/Tsavorite/cs/test/BlittableLogScanTests.cs index 34457fce0f..1e6d70065e 100644 --- a/libs/storage/Tsavorite/cs/test/BlittableLogScanTests.cs +++ b/libs/storage/Tsavorite/cs/test/BlittableLogScanTests.cs @@ -107,7 +107,7 @@ public void BlittableDiskWriteScan([Values] ScanIteratorType scanIteratorType) { var key1 = new KeyStruct { kfield1 = i, kfield2 = i + 1 }; var value = new ValueStruct { vfield1 = i, vfield2 = i + 1 }; - session.Upsert(ref key1, ref value, Empty.Default, 0); + session.Upsert(ref key1, ref value, Empty.Default); } store.Log.FlushAndEvict(true); @@ -153,7 +153,7 @@ public void BlittableScanJumpToBeginAddressTest() } var key = new KeyStruct { kfield1 = i, kfield2 = i + 1 }; var value = new ValueStruct { vfield1 = i, vfield2 = i + 1 }; - session.Upsert(ref key, ref value, Empty.Default, 0); + session.Upsert(ref key, ref value, Empty.Default); } using var iter = store.Log.Scan(store.Log.HeadAddress, store.Log.TailAddress); diff --git a/libs/storage/Tsavorite/cs/test/ExpirationTests.cs b/libs/storage/Tsavorite/cs/test/ExpirationTests.cs index 1ef868fea0..90e0398660 100644 --- a/libs/storage/Tsavorite/cs/test/ExpirationTests.cs +++ b/libs/storage/Tsavorite/cs/test/ExpirationTests.cs @@ -559,7 +559,7 @@ private unsafe void Populate(Random rng) valueSpan[j] = GetValue(i); var valueSpanByte = valueSpan.AsSpanByte(); - session.Upsert(ref keySpanByte, ref valueSpanByte, Empty.Default, 0); + session.Upsert(ref keySpanByte, ref valueSpanByte, Empty.Default); } } @@ -570,7 +570,7 @@ private unsafe ExpirationOutput GetRecord(int key, Status expectedStatus, FlushM var keySpanByte = keySpan.AsSpanByte(); ExpirationOutput output = new(); - var status = session.Read(ref keySpanByte, ref output, Empty.Default, 0); + var status = session.Read(ref keySpanByte, ref output, Empty.Default); if (status.IsPending) { Assert.AreNotEqual(FlushMode.NoFlush, flushMode); diff --git a/libs/storage/Tsavorite/cs/test/GenericByteArrayTests.cs b/libs/storage/Tsavorite/cs/test/GenericByteArrayTests.cs index 50c8c48e62..e7bc94bc82 100644 --- a/libs/storage/Tsavorite/cs/test/GenericByteArrayTests.cs +++ b/libs/storage/Tsavorite/cs/test/GenericByteArrayTests.cs @@ -63,7 +63,7 @@ public void ByteArrayBasicTest() { var _key = GetByteArray(i); var _value = GetByteArray(i); - session.Upsert(ref _key, ref _value, Empty.Default, 0); + session.Upsert(ref _key, ref _value, Empty.Default); } session.CompletePending(true); @@ -74,7 +74,7 @@ public void ByteArrayBasicTest() var key = GetByteArray(i); var value = GetByteArray(i); - if (session.Read(ref key, ref input, ref output, Empty.Default, 0).IsPending) + if (session.Read(ref key, ref input, ref output, Empty.Default).IsPending) { session.CompletePending(true); } diff --git a/libs/storage/Tsavorite/cs/test/GenericDiskDeleteTests.cs b/libs/storage/Tsavorite/cs/test/GenericDiskDeleteTests.cs index 624c5bf030..987b17b7cc 100644 --- a/libs/storage/Tsavorite/cs/test/GenericDiskDeleteTests.cs +++ b/libs/storage/Tsavorite/cs/test/GenericDiskDeleteTests.cs @@ -57,7 +57,7 @@ public void DiskDeleteBasicTest1() { var _key = new MyKey { key = i }; var _value = new MyValue { value = i }; - session.Upsert(ref _key, ref _value, 0, 0); + session.Upsert(ref _key, ref _value, 0); } for (int i = 0; i < totalRecords; i++) @@ -67,7 +67,7 @@ public void DiskDeleteBasicTest1() var key1 = new MyKey { key = i }; var value = new MyValue { value = i }; - if (session.Read(ref key1, ref input, ref output, 0, 0).IsPending) + if (session.Read(ref key1, ref input, ref output, 0).IsPending) { session.CompletePending(true); } @@ -80,7 +80,7 @@ public void DiskDeleteBasicTest1() for (int i = 0; i < totalRecords; i++) { var key1 = new MyKey { key = i }; - session.Delete(ref key1, 0, 0); + session.Delete(ref key1); } for (int i = 0; i < totalRecords; i++) @@ -89,7 +89,7 @@ public void DiskDeleteBasicTest1() var output = new MyOutput(); var key1 = new MyKey { key = i }; - var status = session.Read(ref key1, ref input, ref output, 1, 0); + var status = session.Read(ref key1, ref input, ref output, 1); if (status.IsPending) { @@ -120,58 +120,58 @@ public void DiskDeleteBasicTest2() { var _key = new MyKey { key = i }; var _value = new MyValue { value = i }; - session.Upsert(ref _key, ref _value, 0, 0); + session.Upsert(ref _key, ref _value, 0); } var key100 = new MyKey { key = 100 }; var value100 = new MyValue { value = 100 }; var key200 = new MyKey { key = 200 }; - session.Delete(ref key100, 0, 0); + session.Delete(ref key100); var input = new MyInput { value = 1000 }; var output = new MyOutput(); - var status = session.Read(ref key100, ref input, ref output, 1, 0); + var status = session.Read(ref key100, ref input, ref output, 1); Assert.IsFalse(status.Found, status.ToString()); - status = session.Upsert(ref key100, ref value100, 0, 0); + status = session.Upsert(ref key100, ref value100, 0); Assert.IsTrue(!status.Found, status.ToString()); - status = session.Read(ref key100, ref input, ref output, 0, 0); + status = session.Read(ref key100, ref input, ref output, 0); Assert.IsTrue(status.Found, status.ToString()); Assert.AreEqual(value100.value, output.value.value); - session.Delete(ref key100, 0, 0); - session.Delete(ref key200, 0, 0); + session.Delete(ref key100); + session.Delete(ref key200); // This RMW should create new initial value, since item is deleted - status = session.RMW(ref key200, ref input, 1, 0); + status = session.RMW(ref key200, ref input, 1); Assert.IsFalse(status.Found); - status = session.Read(ref key200, ref input, ref output, 0, 0); + status = session.Read(ref key200, ref input, ref output, 0); Assert.IsTrue(status.Found, status.ToString()); Assert.AreEqual(input.value, output.value.value); // Delete key 200 again - session.Delete(ref key200, 0, 0); + session.Delete(ref key200); // Eliminate all records from memory for (int i = 201; i < 2000; i++) { var _key = new MyKey { key = i }; var _value = new MyValue { value = i }; - session.Upsert(ref _key, ref _value, 0, 0); + session.Upsert(ref _key, ref _value, 0); } - status = session.Read(ref key100, ref input, ref output, 1, 0); + status = session.Read(ref key100, ref input, ref output, 1); Assert.IsTrue(status.IsPending); session.CompletePending(true); // This RMW should create new initial value, since item is deleted - status = session.RMW(ref key200, ref input, 1, 0); + status = session.RMW(ref key200, ref input, 1); Assert.IsTrue(status.IsPending); session.CompletePending(true); - status = session.Read(ref key200, ref input, ref output, 0, 0); + status = session.Read(ref key200, ref input, ref output, 0); Assert.IsTrue(status.Found, status.ToString()); Assert.AreEqual(input.value, output.value.value); } diff --git a/libs/storage/Tsavorite/cs/test/GenericLogCompactionTests.cs b/libs/storage/Tsavorite/cs/test/GenericLogCompactionTests.cs index 81dab93c71..0b620385e7 100644 --- a/libs/storage/Tsavorite/cs/test/GenericLogCompactionTests.cs +++ b/libs/storage/Tsavorite/cs/test/GenericLogCompactionTests.cs @@ -84,7 +84,7 @@ public void LogCompactBasicTest([Values] CompactionType compactionType) var key1 = new MyKey { key = i }; var value = new MyValue { value = i }; - session.Upsert(ref key1, ref value, 0, 0); + session.Upsert(ref key1, ref value, 0); } compactUntil = session.Compact(compactUntil, compactionType); @@ -99,7 +99,7 @@ public void LogCompactBasicTest([Values] CompactionType compactionType) var key1 = new MyKey { key = i }; var value = new MyValue { value = i }; - var status = session.Read(ref key1, ref input, ref output, 0, 0); + var status = session.Read(ref key1, ref input, ref output, 0); if (status.IsPending) { session.CompletePendingWithOutputs(out var completedOutputs, wait: true); @@ -131,7 +131,7 @@ public void LogCompactTestNewEntries([Values] CompactionType compactionType) var key1 = new MyKey { key = i }; var value = new MyValue { value = i }; - session.Upsert(ref key1, ref value, 0, 0); + session.Upsert(ref key1, ref value, 0); } // Put fresh entries for 1000 records @@ -139,7 +139,7 @@ public void LogCompactTestNewEntries([Values] CompactionType compactionType) { var key1 = new MyKey { key = i }; var value = new MyValue { value = i }; - session.Upsert(ref key1, ref value, 0, 0); + session.Upsert(ref key1, ref value, 0); } store.Log.Flush(true); @@ -157,7 +157,7 @@ public void LogCompactTestNewEntries([Values] CompactionType compactionType) var key1 = new MyKey { key = i }; var value = new MyValue { value = i }; - var status = session.Read(ref key1, ref input, ref output, 0, 0); + var status = session.Read(ref key1, ref input, ref output, 0); if (status.IsPending) session.CompletePending(true); else @@ -186,13 +186,13 @@ public void LogCompactAfterDeleteTest([Values] CompactionType compactionType) var key1 = new MyKey { key = i }; var value = new MyValue { value = i }; - session.Upsert(ref key1, ref value, 0, 0); + session.Upsert(ref key1, ref value, 0); if (i % 8 == 0) { int j = i / 4; key1 = new MyKey { key = j }; - session.Delete(ref key1, 0, 0); + session.Delete(ref key1); } } @@ -209,7 +209,7 @@ public void LogCompactAfterDeleteTest([Values] CompactionType compactionType) int ctx = ((i < 500) && (i % 2 == 0)) ? 1 : 0; - var status = session.Read(ref key1, ref input, ref output, ctx, 0); + var status = session.Read(ref key1, ref input, ref output, ctx); if (status.IsPending) session.CompletePending(true); else @@ -245,7 +245,7 @@ public void LogCompactBasicCustomFctnTest([Values] CompactionType compactionType var key1 = new MyKey { key = i }; var value = new MyValue { value = i }; - session.Upsert(ref key1, ref value, 0, 0); + session.Upsert(ref key1, ref value, 0); } compactUntil = session.Compact(compactUntil, compactionType, default(EvenCompactionFunctions)); @@ -261,7 +261,7 @@ public void LogCompactBasicCustomFctnTest([Values] CompactionType compactionType var ctx = (i < (totalRecords / 2) && (i % 2 != 0)) ? 1 : 0; - var status = session.Read(ref key1, ref input, ref output, ctx, 0); + var status = session.Read(ref key1, ref input, ref output, ctx); if (status.IsPending) { session.CompletePending(true); @@ -295,12 +295,12 @@ public void LogCompactCopyInPlaceCustomFctnTest([Values] CompactionType compacti var key = new MyKey { key = 100 }; var value = new MyValue { value = 20 }; - session.Upsert(ref key, ref value, 0, 0); + session.Upsert(ref key, ref value, 0); store.Log.Flush(true); value = new MyValue { value = 21 }; - session.Upsert(ref key, ref value, 0, 0); + session.Upsert(ref key, ref value, 0); store.Log.Flush(true); @@ -310,7 +310,7 @@ public void LogCompactCopyInPlaceCustomFctnTest([Values] CompactionType compacti var input = default(MyInput); var output = default(MyOutput); - var status = session.Read(ref key, ref input, ref output, 0, 0); + var status = session.Read(ref key, ref input, ref output); if (status.IsPending) { session.CompletePendingWithOutputs(out var outputs, wait: true); diff --git a/libs/storage/Tsavorite/cs/test/GenericLogScanTests.cs b/libs/storage/Tsavorite/cs/test/GenericLogScanTests.cs index f0e205b505..81585c95db 100644 --- a/libs/storage/Tsavorite/cs/test/GenericLogScanTests.cs +++ b/libs/storage/Tsavorite/cs/test/GenericLogScanTests.cs @@ -109,7 +109,7 @@ public void DiskWriteScanBasicTest([Values] DeviceType deviceType, [Values] Scan { var _key = new MyKey { key = i }; var _value = new MyValue { value = i }; - session.Upsert(ref _key, ref _value, Empty.Default, 0); + session.Upsert(ref _key, ref _value, Empty.Default); if (i % 100 == 0) store.Log.FlushAndEvict(true); } @@ -189,7 +189,7 @@ public void BlittableScanJumpToBeginAddressTest() } var key = new MyKey { key = i }; var value = new MyValue { value = i }; - session.Upsert(ref key, ref value, Empty.Default, 0); + session.Upsert(ref key, ref value, Empty.Default); } using var iter = store.Log.Scan(store.Log.HeadAddress, store.Log.TailAddress); diff --git a/libs/storage/Tsavorite/cs/test/GenericStringTests.cs b/libs/storage/Tsavorite/cs/test/GenericStringTests.cs index 7c6cdc8fee..48563015ad 100644 --- a/libs/storage/Tsavorite/cs/test/GenericStringTests.cs +++ b/libs/storage/Tsavorite/cs/test/GenericStringTests.cs @@ -60,7 +60,7 @@ public void StringBasicTest([Values] DeviceType deviceType) { var _key = $"{i}"; var _value = $"{i}"; ; - session.Upsert(ref _key, ref _value, Empty.Default, 0); + session.Upsert(ref _key, ref _value, Empty.Default); } session.CompletePending(true); Assert.AreEqual(totalRecords, store.EntryCount); @@ -72,7 +72,7 @@ public void StringBasicTest([Values] DeviceType deviceType) var key = $"{i}"; var value = $"{i}"; - var status = session.Read(ref key, ref input, ref output, Empty.Default, 0); + var status = session.Read(ref key, ref input, ref output, Empty.Default); if (status.IsPending) { session.CompletePendingWithOutputs(out var outputs, wait: true); diff --git a/libs/storage/Tsavorite/cs/test/LargeObjectTests.cs b/libs/storage/Tsavorite/cs/test/LargeObjectTests.cs index ebcd48c283..0270d54423 100644 --- a/libs/storage/Tsavorite/cs/test/LargeObjectTests.cs +++ b/libs/storage/Tsavorite/cs/test/LargeObjectTests.cs @@ -54,7 +54,7 @@ public void LargeObjectTest(CheckpointType checkpointType) { var mykey = new MyKey { key = key }; var value = new MyLargeValue(1 + r.Next(maxSize)); - session1.Upsert(ref mykey, ref value, Empty.Default, 0); + session1.Upsert(ref mykey, ref value, Empty.Default); } session1.Dispose(); @@ -80,7 +80,7 @@ public void LargeObjectTest(CheckpointType checkpointType) for (int keycnt = 0; keycnt < numOps; keycnt++) { var key = new MyKey { key = keycnt }; - var status = session2.Read(ref key, ref input, ref output, Empty.Default, 0); + var status = session2.Read(ref key, ref input, ref output, Empty.Default); if (status.IsPending) session2.CompletePending(true); diff --git a/libs/storage/Tsavorite/cs/test/LockableUnsafeContextTests.cs b/libs/storage/Tsavorite/cs/test/LockableUnsafeContextTests.cs index 868d755480..fe0b1dc4bd 100644 --- a/libs/storage/Tsavorite/cs/test/LockableUnsafeContextTests.cs +++ b/libs/storage/Tsavorite/cs/test/LockableUnsafeContextTests.cs @@ -348,7 +348,7 @@ public async Task TestShiftHeadAddressLUC([Values] SyncMode syncMode) var value = keyVec[0].Key + numRecords; if (syncMode == SyncMode.Sync) { - luContext.Upsert(ref keyVec[0].Key, ref value, Empty.Default, 0); + luContext.Upsert(ref keyVec[0].Key, ref value, Empty.Default); } else { @@ -377,7 +377,7 @@ public async Task TestShiftHeadAddressLUC([Values] SyncMode syncMode) Status status; if (syncMode == SyncMode.Sync || (c % 1 == 0)) // in .Async mode, half the ops should be sync to test CompletePendingAsync { - status = luContext.Read(ref keyVec[0].Key, ref input, ref output, Empty.Default, 0); + status = luContext.Read(ref keyVec[0].Key, ref input, ref output, Empty.Default); } else { @@ -422,7 +422,7 @@ public async Task TestShiftHeadAddressLUC([Values] SyncMode syncMode) ++expectedS; long output = 0; blt.IncrementS(ref lockKeys[idx]); - Status foundStatus = luContext.Read(ref lockKeys[idx].Key, ref input, ref output, Empty.Default, 0); + Status foundStatus = luContext.Read(ref lockKeys[idx].Key, ref input, ref output, Empty.Default); Assert.IsTrue(foundStatus.IsPending); } diff --git a/libs/storage/Tsavorite/cs/test/MiscTests.cs b/libs/storage/Tsavorite/cs/test/MiscTests.cs index ee4ea35493..5153ae41df 100644 --- a/libs/storage/Tsavorite/cs/test/MiscTests.cs +++ b/libs/storage/Tsavorite/cs/test/MiscTests.cs @@ -52,16 +52,16 @@ public void MixedTest1() var input1 = new MyInput { value = 23 }; MyOutput output = new(); - session.RMW(ref key, ref input1, Empty.Default, 0); + session.RMW(ref key, ref input1, Empty.Default); int key2 = 8999999; var input2 = new MyInput { value = 24 }; - session.RMW(ref key2, ref input2, Empty.Default, 0); + session.RMW(ref key2, ref input2, Empty.Default); - session.Read(ref key, ref input1, ref output, Empty.Default, 0); + session.Read(ref key, ref input1, ref output, Empty.Default); Assert.AreEqual(input1.value, output.value.value); - session.Read(ref key2, ref input2, ref output, Empty.Default, 0); + session.Read(ref key2, ref input2, ref output, Empty.Default); Assert.AreEqual(input2.value, output.value.value); } @@ -74,13 +74,13 @@ public void MixedTest2() for (int i = 0; i < 2000; i++) { var value = new MyValue { value = i }; - session.Upsert(ref i, ref value, Empty.Default, 0); + session.Upsert(ref i, ref value, Empty.Default); } var key2 = 23; MyInput input = new(); MyOutput g1 = new(); - var status = session.Read(ref key2, ref input, ref g1, Empty.Default, 0); + var status = session.Read(ref key2, ref input, ref g1, Empty.Default); if (status.IsPending) { @@ -92,7 +92,7 @@ public void MixedTest2() Assert.AreEqual(23, g1.value.value); key2 = 99999; - status = session.Read(ref key2, ref input, ref g1, Empty.Default, 0); + status = session.Read(ref key2, ref input, ref g1, Empty.Default); if (status.IsPending) { diff --git a/libs/storage/Tsavorite/cs/test/NativeReadCacheTests.cs b/libs/storage/Tsavorite/cs/test/NativeReadCacheTests.cs index 4b78839fbe..24da14e893 100644 --- a/libs/storage/Tsavorite/cs/test/NativeReadCacheTests.cs +++ b/libs/storage/Tsavorite/cs/test/NativeReadCacheTests.cs @@ -46,7 +46,7 @@ public void NativeDiskWriteReadCache() { var key1 = new KeyStruct { kfield1 = i, kfield2 = i + 1 }; var value = new ValueStruct { vfield1 = i, vfield2 = i + 1 }; - session.Upsert(ref key1, ref value, Empty.Default, 0); + session.Upsert(ref key1, ref value, Empty.Default); } session.CompletePending(true); @@ -60,7 +60,7 @@ public void NativeDiskWriteReadCache() var key1 = new KeyStruct { kfield1 = i, kfield2 = i + 1 }; var value = new ValueStruct { vfield1 = i, vfield2 = i + 1 }; - var status = session.Read(ref key1, ref input, ref output, Empty.Default, 0); + var status = session.Read(ref key1, ref input, ref output, Empty.Default); Assert.IsTrue(status.IsPending); session.CompletePending(true); } @@ -72,7 +72,7 @@ public void NativeDiskWriteReadCache() var key1 = new KeyStruct { kfield1 = i, kfield2 = i + 1 }; var value = new ValueStruct { vfield1 = i, vfield2 = i + 1 }; - var status = session.Read(ref key1, ref input, ref output, Empty.Default, 0); + var status = session.Read(ref key1, ref input, ref output, Empty.Default); Assert.IsTrue(status.Found); Assert.AreEqual(value.vfield1, output.value.vfield1); Assert.AreEqual(value.vfield2, output.value.vfield2); @@ -88,7 +88,7 @@ public void NativeDiskWriteReadCache() var key1 = new KeyStruct { kfield1 = i, kfield2 = i + 1 }; var value = new ValueStruct { vfield1 = i, vfield2 = i + 1 }; - var status = session.Read(ref key1, ref input, ref output, Empty.Default, 0); + var status = session.Read(ref key1, ref input, ref output, Empty.Default); Assert.IsTrue(status.IsPending); session.CompletePending(true); } @@ -100,7 +100,7 @@ public void NativeDiskWriteReadCache() var key1 = new KeyStruct { kfield1 = i, kfield2 = i + 1 }; var value = new ValueStruct { vfield1 = i, vfield2 = i + 1 }; - var status = session.Read(ref key1, ref input, ref output, Empty.Default, 0); + var status = session.Read(ref key1, ref input, ref output, Empty.Default); Assert.IsTrue(status.Found); Assert.AreEqual(value.vfield1, output.value.vfield1); Assert.AreEqual(value.vfield2, output.value.vfield2); @@ -111,13 +111,7 @@ public void NativeDiskWriteReadCache() { var key1 = new KeyStruct { kfield1 = i, kfield2 = i + 1 }; var value = new ValueStruct { vfield1 = i + 1, vfield2 = i + 2 }; - session.Upsert(ref key1, ref value, Empty.Default, 0); - - OutputStruct output = default; - var status = session.Read(ref key1, ref input, ref output, Empty.Default, 0); - Assert.IsTrue(status.Found); - Assert.AreEqual(value.vfield1, output.value.vfield1); - Assert.AreEqual(value.vfield2, output.value.vfield2); + session.Upsert(ref key1, ref value, Empty.Default); } // RMW to overwrite the read cache @@ -126,7 +120,7 @@ public void NativeDiskWriteReadCache() OutputStruct output = default; var key1 = new KeyStruct { kfield1 = i, kfield2 = i + 1 }; input = new InputStruct { ifield1 = 1, ifield2 = 1 }; - var status = session.RMW(ref key1, ref input, ref output, Empty.Default, 0); + var status = session.RMW(ref key1, ref input, ref output, Empty.Default); if (status.IsPending) { session.CompletePending(true); @@ -136,12 +130,6 @@ public void NativeDiskWriteReadCache() Assert.AreEqual(i + 1, output.value.vfield1); Assert.AreEqual(i + 2, output.value.vfield2); } - - OutputStruct expectedOutput = output; - status = session.Read(ref key1, ref input, ref output, Empty.Default, 0); - Assert.IsTrue(status.Found); - Assert.AreEqual(expectedOutput.value.vfield1, output.value.vfield1); - Assert.AreEqual(expectedOutput.value.vfield2, output.value.vfield2); } // Read 100 keys @@ -151,7 +139,7 @@ public void NativeDiskWriteReadCache() var key1 = new KeyStruct { kfield1 = i, kfield2 = i + 1 }; var value = new ValueStruct { vfield1 = i + 1, vfield2 = i + 2 }; - var status = session.Read(ref key1, ref input, ref output, Empty.Default, 0); + var status = session.Read(ref key1, ref input, ref output, Empty.Default); Assert.IsTrue(status.Found); Assert.AreEqual(value.vfield1, output.value.vfield1); Assert.AreEqual(value.vfield2, output.value.vfield2); @@ -170,7 +158,7 @@ public void NativeDiskWriteReadCache2() { var key1 = new KeyStruct { kfield1 = i, kfield2 = i + 1 }; var value = new ValueStruct { vfield1 = i, vfield2 = i + 1 }; - session.Upsert(ref key1, ref value, Empty.Default, 0); + session.Upsert(ref key1, ref value, Empty.Default); } session.CompletePending(true); @@ -184,7 +172,7 @@ public void NativeDiskWriteReadCache2() var key1 = new KeyStruct { kfield1 = i, kfield2 = i + 1 }; var value = new ValueStruct { vfield1 = i, vfield2 = i + 1 }; - var status = session.Read(ref key1, ref input, ref output, Empty.Default, 0); + var status = session.Read(ref key1, ref input, ref output, Empty.Default); Assert.IsTrue(status.IsPending); session.CompletePending(true); } @@ -196,7 +184,7 @@ public void NativeDiskWriteReadCache2() var key1 = new KeyStruct { kfield1 = i, kfield2 = i + 1 }; var value = new ValueStruct { vfield1 = i, vfield2 = i + 1 }; - var status = session.Read(ref key1, ref input, ref output, Empty.Default, 0); + var status = session.Read(ref key1, ref input, ref output, Empty.Default); Assert.IsTrue(status.Found); Assert.AreEqual(value.vfield1, output.value.vfield1); Assert.AreEqual(value.vfield2, output.value.vfield2); @@ -212,7 +200,7 @@ public void NativeDiskWriteReadCache2() var key1 = new KeyStruct { kfield1 = i, kfield2 = i + 1 }; var value = new ValueStruct { vfield1 = i, vfield2 = i + 1 }; - var status = session.Read(ref key1, ref input, ref output, Empty.Default, 0); + var status = session.Read(ref key1, ref input, ref output, Empty.Default); Assert.IsTrue(status.IsPending); session.CompletePending(true); } @@ -224,7 +212,7 @@ public void NativeDiskWriteReadCache2() var key1 = new KeyStruct { kfield1 = i, kfield2 = i + 1 }; var value = new ValueStruct { vfield1 = i, vfield2 = i + 1 }; - var status = session.Read(ref key1, ref input, ref output, Empty.Default, 0); + var status = session.Read(ref key1, ref input, ref output, Empty.Default); Assert.IsTrue(status.Found); Assert.AreEqual(value.vfield1, output.value.vfield1); Assert.AreEqual(value.vfield2, output.value.vfield2); diff --git a/libs/storage/Tsavorite/cs/test/NeedCopyUpdateTests.cs b/libs/storage/Tsavorite/cs/test/NeedCopyUpdateTests.cs index beab15543d..d7698c0bad 100644 --- a/libs/storage/Tsavorite/cs/test/NeedCopyUpdateTests.cs +++ b/libs/storage/Tsavorite/cs/test/NeedCopyUpdateTests.cs @@ -71,7 +71,7 @@ public void TryAddTest() Assert.IsTrue(status.Found, status.ToString()); store.Log.FlushAndEvict(true); - status = session.RMW(ref key, ref value2, new(StatusCode.Found), 0); // PENDING + NeedCopyUpdate + Found + status = session.RMW(ref key, ref value2, new(StatusCode.Found)); // PENDING + NeedCopyUpdate + Found Assert.IsTrue(status.IsPending, status.ToString()); session.CompletePendingWithOutputs(out var outputs, true); @@ -80,7 +80,7 @@ public void TryAddTest() Assert.IsTrue(status.Found, status.ToString()); // NeedCopyUpdate returns false, so RMW returns simply Found // Test stored value. Should be value1 - status = session.Read(ref key, ref value1, ref output, new(StatusCode.Found), 0); + status = session.Read(ref key, ref value1, ref output, new(StatusCode.Found)); Assert.IsTrue(status.IsPending, status.ToString()); session.CompletePending(true); @@ -88,7 +88,7 @@ public void TryAddTest() Assert.IsTrue(!status.Found && status.Record.Created, status.ToString()); session.CompletePending(true); store.Log.FlushAndEvict(true); - status = session.RMW(ref key, ref value2, new(StatusCode.NotFound | StatusCode.CreatedRecord), 0); // PENDING + InitialUpdater + NOTFOUND + status = session.RMW(ref key, ref value2, new(StatusCode.NotFound | StatusCode.CreatedRecord)); // PENDING + InitialUpdater + NOTFOUND Assert.IsTrue(status.IsPending, status.ToString()); session.CompletePending(true); } diff --git a/libs/storage/Tsavorite/cs/test/ObjectReadCacheTests.cs b/libs/storage/Tsavorite/cs/test/ObjectReadCacheTests.cs index 48e28c8f63..6b95ad3f23 100644 --- a/libs/storage/Tsavorite/cs/test/ObjectReadCacheTests.cs +++ b/libs/storage/Tsavorite/cs/test/ObjectReadCacheTests.cs @@ -53,7 +53,7 @@ public void ObjectDiskWriteReadCache() { var key = new MyKey { key = i }; var value = new MyValue { value = i }; - session.Upsert(ref key, ref value, Empty.Default, 0); + session.Upsert(ref key, ref value, Empty.Default); } session.CompletePending(true); @@ -67,7 +67,7 @@ public void ObjectDiskWriteReadCache() var key1 = new MyKey { key = i }; var value = new MyValue { value = i }; - var status = session.Read(ref key1, ref input, ref output, Empty.Default, 0); + var status = session.Read(ref key1, ref input, ref output, Empty.Default); Assert.IsTrue(status.IsPending); session.CompletePending(true); } @@ -79,7 +79,7 @@ public void ObjectDiskWriteReadCache() var key1 = new MyKey { key = i }; var value = new MyValue { value = i }; - var status = session.Read(ref key1, ref input, ref output, Empty.Default, 0); + var status = session.Read(ref key1, ref input, ref output, Empty.Default); Assert.IsTrue(status.Found); Assert.AreEqual(value.value, output.value.value); } @@ -94,7 +94,7 @@ public void ObjectDiskWriteReadCache() var key1 = new MyKey { key = i }; var value = new MyValue { value = i }; - var status = session.Read(ref key1, ref input, ref output, Empty.Default, 0); + var status = session.Read(ref key1, ref input, ref output, Empty.Default); Assert.IsTrue(status.IsPending); session.CompletePending(true); } @@ -106,7 +106,7 @@ public void ObjectDiskWriteReadCache() var key1 = new MyKey { key = i }; var value = new MyValue { value = i }; - var status = session.Read(ref key1, ref input, ref output, Empty.Default, 0); + var status = session.Read(ref key1, ref input, ref output, Empty.Default); Assert.IsTrue(status.Found); Assert.AreEqual(value.value, output.value.value); } @@ -117,7 +117,7 @@ public void ObjectDiskWriteReadCache() { var key1 = new MyKey { key = i }; var value = new MyValue { value = i + 1 }; - session.Upsert(ref key1, ref value, Empty.Default, 0); + session.Upsert(ref key1, ref value, Empty.Default); } // RMW to overwrite the read cache @@ -125,7 +125,7 @@ public void ObjectDiskWriteReadCache() { var key1 = new MyKey { key = i }; input = new MyInput { value = 1 }; - var status = session.RMW(ref key1, ref input, Empty.Default, 0); + var status = session.RMW(ref key1, ref input, Empty.Default); if (status.IsPending) session.CompletePending(true); } @@ -137,7 +137,7 @@ public void ObjectDiskWriteReadCache() var key1 = new MyKey { key = i }; var value = new MyValue { value = i + 1 }; - var status = session.Read(ref key1, ref input, ref output, Empty.Default, 0); + var status = session.Read(ref key1, ref input, ref output, Empty.Default); Assert.IsTrue(status.Found, $"key = {key1.key}"); Assert.AreEqual(value.value, output.value.value); } @@ -155,7 +155,7 @@ public void ObjectDiskWriteReadCache2() { var key = new MyKey { key = i }; var value = new MyValue { value = i }; - session.Upsert(ref key, ref value, Empty.Default, 0); + session.Upsert(ref key, ref value, Empty.Default); } session.CompletePending(true); @@ -169,7 +169,7 @@ public void ObjectDiskWriteReadCache2() var key1 = new MyKey { key = i }; var value = new MyValue { value = i }; - var status = session.Read(ref key1, ref input, ref output, Empty.Default, 0); + var status = session.Read(ref key1, ref input, ref output, Empty.Default); Assert.IsTrue(status.IsPending); session.CompletePending(true); } @@ -181,7 +181,7 @@ public void ObjectDiskWriteReadCache2() var key1 = new MyKey { key = i }; var value = new MyValue { value = i }; - var status = session.Read(ref key1, ref input, ref output, Empty.Default, 0); + var status = session.Read(ref key1, ref input, ref output, Empty.Default); Assert.IsTrue(status.Found); Assert.AreEqual(value.value, output.value.value); } @@ -196,7 +196,7 @@ public void ObjectDiskWriteReadCache2() var key1 = new MyKey { key = i }; var value = new MyValue { value = i }; - var status = session.Read(ref key1, ref input, ref output, Empty.Default, 0); + var status = session.Read(ref key1, ref input, ref output, Empty.Default); Assert.IsTrue(status.IsPending); session.CompletePending(true); } @@ -208,7 +208,7 @@ public void ObjectDiskWriteReadCache2() MyKey key1 = new() { key = i }; MyValue value = new() { value = i }; - var status = session.Read(ref key1, ref input, ref output, Empty.Default, 0); + var status = session.Read(ref key1, ref input, ref output, Empty.Default); Assert.IsTrue(status.Found); Assert.AreEqual(value.value, output.value.value); } diff --git a/libs/storage/Tsavorite/cs/test/ObjectRecoveryTest.cs b/libs/storage/Tsavorite/cs/test/ObjectRecoveryTest.cs index 535f6f4836..b4298fc826 100644 --- a/libs/storage/Tsavorite/cs/test/ObjectRecoveryTest.cs +++ b/libs/storage/Tsavorite/cs/test/ObjectRecoveryTest.cs @@ -104,7 +104,7 @@ public unsafe void Populate() bool first = true; for (int i = 0; i < numOps; i++) { - session.RMW(ref inputArray[i].Item1, ref inputArray[i].Item2, Empty.Default, i); + session.RMW(ref inputArray[i].Item1, ref inputArray[i].Item2, Empty.Default); if ((i + 1) % checkpointInterval == 0) { @@ -143,20 +143,14 @@ public unsafe void Verify(Guid cprVersion, Guid indexVersion) }; } - var outputArray = new Output[numUniqueKeys]; - for (int i = 0; i < numUniqueKeys; i++) - { - outputArray[i] = new Output(); - } - - // Register with thread var session = store.NewSession(new Functions()); Input input = default; // Issue read requests for (var i = 0; i < numUniqueKeys; i++) { - session.Read(ref inputArray[i].Item1, ref input, ref outputArray[i], Empty.Default, i); + Output output = new(); + session.Read(ref inputArray[i].Item1, ref input, ref output, Empty.Default); } // Complete all pending requests @@ -164,44 +158,6 @@ public unsafe void Verify(Guid cprVersion, Guid indexVersion) // Release session.Dispose(); - - // Test outputs - var checkpointInfo = default(HybridLogRecoveryInfo); - checkpointInfo.Recover(cprVersion, - new DeviceLogCommitCheckpointManager( - new LocalStorageNamedDeviceFactory(), - new DefaultCheckpointNamingScheme( - new DirectoryInfo(TestUtils.MethodTestDir).FullName)), null); - - // Compute expected array - long[] expected = new long[numUniqueKeys]; - foreach (var guid in checkpointInfo.continueTokens.Keys) - { - var cp = checkpointInfo.continueTokens[guid].Item2; - for (long i = 0; i <= cp.UntilSerialNo; i++) - { - var id = i % numUniqueKeys; - expected[id]++; - } - } - - int threadCount = 1; // single threaded test - int numCompleted = threadCount - checkpointInfo.continueTokens.Count; - for (int t = 0; t < numCompleted; t++) - { - var sno = numOps; - for (long i = 0; i < sno; i++) - { - var id = i % numUniqueKeys; - expected[id]++; - } - } - - // Assert if expected is same as found - for (long i = 0; i < numUniqueKeys; i++) - { - Assert.AreEqual(expected[i], outputArray[i].value.numClicks, $"AdId {inputArray[i].Item1.adId}"); - } } } } \ No newline at end of file diff --git a/libs/storage/Tsavorite/cs/test/ObjectRecoveryTest2.cs b/libs/storage/Tsavorite/cs/test/ObjectRecoveryTest2.cs index 7c383cabe5..09b2e5525d 100644 --- a/libs/storage/Tsavorite/cs/test/ObjectRecoveryTest2.cs +++ b/libs/storage/Tsavorite/cs/test/ObjectRecoveryTest2.cs @@ -100,7 +100,7 @@ private void Write(ClientSession 0) { @@ -122,7 +122,7 @@ private void Read(ClientSession store1; - private TsavoriteKV store2; - private TsavoriteKV store3; - private IDevice log; - private int numOps; - - [SetUp] - public void Setup() - { - TestUtils.DeleteDirectory(TestUtils.MethodTestDir, wait: true); - log = Devices.CreateLogDevice(Path.Join(TestUtils.MethodTestDir, "test.log"), deleteOnClose: true); - string checkpointDir = Path.Join(TestUtils.MethodTestDir, "checkpoints3"); - Directory.CreateDirectory(checkpointDir); - - store1 = new TsavoriteKV - (16, - logSettings: new LogSettings { LogDevice = log, MutableFraction = 0.1, MemorySizeBits = 29 }, - checkpointSettings: new CheckpointSettings { CheckpointDir = checkpointDir } - ); - - store2 = new TsavoriteKV - (16, - logSettings: new LogSettings { LogDevice = log, MutableFraction = 0.1, MemorySizeBits = 29 }, - checkpointSettings: new CheckpointSettings { CheckpointDir = checkpointDir } - ); - - store3 = new TsavoriteKV - (16, - logSettings: new LogSettings { LogDevice = log, MutableFraction = 0.1, MemorySizeBits = 29 }, - checkpointSettings: new CheckpointSettings { CheckpointDir = checkpointDir } - ); - - numOps = 5000; - } - - [TearDown] - public void TearDown() - { - store1?.Dispose(); - store2?.Dispose(); - store3?.Dispose(); - store1 = null; - store2 = null; - store3 = null; - log?.Dispose(); - log = null; - TestUtils.DeleteDirectory(TestUtils.MethodTestDir); - } - - [Test] - [Category("TsavoriteKV")] - [Category("CheckpointRestore")] - [Category("Smoke")] - public async ValueTask RecoverContinueTest([Values] bool isAsync) - { - long sno = 0; - - var firstsession = store1.NewSession(new AdSimpleFunctions(), "first"); - IncrementAllValues(ref firstsession, ref sno); - store1.TryInitiateFullCheckpoint(out _, CheckpointType.Snapshot); - store1.CompleteCheckpointAsync().AsTask().GetAwaiter().GetResult(); - firstsession.Dispose(); - - // Check if values after checkpoint are correct - var session1 = store1.NewSession(new AdSimpleFunctions()); - CheckAllValues(ref session1, 1); - session1.Dispose(); - - // Recover and check if recovered values are correct - if (isAsync) - await store2.RecoverAsync(); - else - store2.Recover(); - var session2 = store2.NewSession(new AdSimpleFunctions()); - CheckAllValues(ref session2, 1); - session2.Dispose(); - - // Continue and increment values - var continuesession = store2.ResumeSession(new AdSimpleFunctions(), "first", out CommitPoint cp); - long newSno = cp.UntilSerialNo; - Assert.AreEqual(sno - 1, newSno); - IncrementAllValues(ref continuesession, ref sno); - store2.TryInitiateFullCheckpoint(out _, CheckpointType.Snapshot); - store2.CompleteCheckpointAsync().AsTask().GetAwaiter().GetResult(); - continuesession.Dispose(); - - // Check if values after continue checkpoint are correct - var session3 = store2.NewSession(new AdSimpleFunctions()); - CheckAllValues(ref session3, 2); - session3.Dispose(); - - // Recover and check if recovered values are correct - if (isAsync) - await store3.RecoverAsync(); - else - store3.Recover(); - - var nextsession = store3.ResumeSession(new AdSimpleFunctions(), "first", out cp); - long newSno2 = cp.UntilSerialNo; - Assert.AreEqual(sno - 1, newSno2); - CheckAllValues(ref nextsession, 2); - nextsession.Dispose(); - } - - private void CheckAllValues( - ref ClientSession store, - int value) - { - AdInput inputArg = default; - Output outputArg = default; - for (var key = 0; key < numOps; key++) - { - inputArg.adId.adId = key; - var status = store.Read(ref inputArg.adId, ref inputArg, ref outputArg, Empty.Default, store.SerialNo); - - if (status.IsPending) - store.CompletePending(true); - else - { - Assert.AreEqual(value, outputArg.value.numClicks); - } - } - - store.CompletePending(true); - } - - private void IncrementAllValues( - ref ClientSession store, - ref long sno) - { - AdInput inputArg = default; - for (int key = 0; key < numOps; key++, sno++) - { - inputArg.adId.adId = key; - inputArg.numClicks.numClicks = 1; - store.RMW(ref inputArg.adId, ref inputArg, Empty.Default, sno); - } - store.CompletePending(true); - } - - - } - - public class AdSimpleFunctions : FunctionsBase - { - public override void ReadCompletionCallback(ref AdId key, ref AdInput input, ref Output output, Empty ctx, Status status, RecordMetadata recordMetadata) - { - Assert.IsTrue(status.Found); - Assert.AreEqual(key.adId, output.value.numClicks); - } - - // Read functions - public override bool SingleReader(ref AdId key, ref AdInput input, ref NumClicks value, ref Output dst, ref ReadInfo readInfo) - { - dst.value = value; - return true; - } - - public override bool ConcurrentReader(ref AdId key, ref AdInput input, ref NumClicks value, ref Output dst, ref ReadInfo readInfo, ref RecordInfo recordInfo) - { - dst.value = value; - return true; - } - - // RMW functions - public override bool InitialUpdater(ref AdId key, ref AdInput input, ref NumClicks value, ref Output output, ref RMWInfo rmwInfo, ref RecordInfo recordInfo) - { - value = input.numClicks; - return true; - } - - public override bool InPlaceUpdater(ref AdId key, ref AdInput input, ref NumClicks value, ref Output output, ref RMWInfo rmwInfo, ref RecordInfo recordInfo) - { - Interlocked.Add(ref value.numClicks, input.numClicks.numClicks); - return true; - } - - public override bool NeedCopyUpdate(ref AdId key, ref AdInput input, ref NumClicks oldValue, ref Output output, ref RMWInfo rmwInfo) => true; - - public override bool CopyUpdater(ref AdId key, ref AdInput input, ref NumClicks oldValue, ref NumClicks newValue, ref Output output, ref RMWInfo rmwInfo, ref RecordInfo recordInfo) - { - newValue.numClicks += oldValue.numClicks + input.numClicks.numClicks; - return true; - } - } -} \ No newline at end of file diff --git a/libs/storage/Tsavorite/cs/test/RecoveryChecks.cs b/libs/storage/Tsavorite/cs/test/RecoveryChecks.cs index 1aeebe0e59..bf8e9f8129 100644 --- a/libs/storage/Tsavorite/cs/test/RecoveryChecks.cs +++ b/libs/storage/Tsavorite/cs/test/RecoveryChecks.cs @@ -250,15 +250,7 @@ public void RecoveryCheck2Repeated([Values] CheckpointType checkpointType) ); if (i > 0) - { store.Recover(default, token); - if (i == 3) store.DisposeRecoverableSessions(); - int recoverableSessionCount = store.RecoverableSessions.Count(); - if (i < 3) - Assert.AreEqual(i, recoverableSessionCount); - else - Assert.AreEqual(i - 3, recoverableSessionCount); - } using var s1 = store.NewSession>(new SimpleFunctions()); diff --git a/libs/storage/Tsavorite/cs/test/RecoveryTests.cs b/libs/storage/Tsavorite/cs/test/RecoveryTests.cs index 3249c8ce0a..a1a86952c1 100644 --- a/libs/storage/Tsavorite/cs/test/RecoveryTests.cs +++ b/libs/storage/Tsavorite/cs/test/RecoveryTests.cs @@ -143,7 +143,7 @@ private void Populate(Action checkpointAction) // Process the batch of input data for (int i = 0; i < numOps; i++) { - session.RMW(ref inputArray[i].adId, ref inputArray[i], Empty.Default, i); + session.RMW(ref inputArray[i].adId, ref inputArray[i], Empty.Default); checkpointAction(i); @@ -183,7 +183,7 @@ private async ValueTask RecoverAndTestAsync(int tokenIndex, bool isAsync) // Issue read requests for (var i = 0; i < numUniqueKeys; i++) { - var status = session.Read(ref inputArray[i].adId, ref input, ref output, Empty.Default, i); + var status = session.Read(ref inputArray[i].adId, ref input, ref output, Empty.Default); Assert.IsTrue(status.Found, $"At tokenIndex {tokenIndex}, keyIndex {i}, AdId {inputArray[i].adId.adId}"); inputArray[i].numClicks = output.value; } @@ -193,44 +193,6 @@ private async ValueTask RecoverAndTestAsync(int tokenIndex, bool isAsync) // Release session.Dispose(); - - // Test outputs - var checkpointInfo = default(HybridLogRecoveryInfo); - checkpointInfo.Recover(logToken, - new DeviceLogCommitCheckpointManager( - new LocalStorageNamedDeviceFactory(), - new DefaultCheckpointNamingScheme( - new DirectoryInfo(TestUtils.MethodTestDir).FullName))); - - // Compute expected array - long[] expected = new long[numUniqueKeys]; - foreach (var guid in checkpointInfo.continueTokens.Keys) - { - var cp = checkpointInfo.continueTokens[guid].Item2; - for (long i = 0; i <= cp.UntilSerialNo; i++) - { - var id = i % numUniqueKeys; - expected[id]++; - } - } - - int threadCount = 1; // single threaded test - int numCompleted = threadCount - checkpointInfo.continueTokens.Count; - for (int t = 0; t < numCompleted; t++) - { - var sno = numOps; - for (long i = 0; i < sno; i++) - { - var id = i % numUniqueKeys; - expected[id]++; - } - } - - // Assert if expected is same as found - for (long i = 0; i < numUniqueKeys; i++) - { - Assert.AreEqual(expected[i], inputArray[i].numClicks.numClicks, $"At keyIndex {i}, AdId {inputArray[i].adId.adId}"); - } } } @@ -399,7 +361,7 @@ private unsafe void Populate(TsavoriteKV store) valueSpan[j] = i; var valueSpanByte = valueSpan.Slice(0, len).AsSpanByte(); - session.Upsert(ref keySpanByte, ref valueSpanByte, Empty.Default, 0); + session.Upsert(ref keySpanByte, ref valueSpanByte, Empty.Default); } session.CompletePending(true); } @@ -473,7 +435,7 @@ private static void Read(TsavoriteKV store) var len = GetRandomLength(rng); int[] output = null; - var status = session.Read(ref keySpanByte, ref output, Empty.Default, 0); + var status = session.Read(ref keySpanByte, ref output, Empty.Default); Assert.IsTrue(status.Found); for (int j = 0; j < len; j++) diff --git a/libs/storage/Tsavorite/cs/test/SessionTests.cs b/libs/storage/Tsavorite/cs/test/SessionTests.cs index ea5da9b89d..e86d42e0c0 100644 --- a/libs/storage/Tsavorite/cs/test/SessionTests.cs +++ b/libs/storage/Tsavorite/cs/test/SessionTests.cs @@ -46,8 +46,8 @@ public void SessionTest1() var key1 = new KeyStruct { kfield1 = 13, kfield2 = 14 }; var value = new ValueStruct { vfield1 = 23, vfield2 = 24 }; - session.Upsert(ref key1, ref value, Empty.Default, 0); - var status = session.Read(ref key1, ref input, ref output, Empty.Default, 0); + session.Upsert(ref key1, ref value, Empty.Default); + var status = session.Read(ref key1, ref input, ref output, Empty.Default); if (status.IsPending) { @@ -74,10 +74,10 @@ public void SessionTest2() var key2 = new KeyStruct { kfield1 = 15, kfield2 = 16 }; var value2 = new ValueStruct { vfield1 = 25, vfield2 = 26 }; - session1.Upsert(ref key1, ref value1, Empty.Default, 0); - session2.Upsert(ref key2, ref value2, Empty.Default, 0); + session1.Upsert(ref key1, ref value1, Empty.Default); + session2.Upsert(ref key2, ref value2, Empty.Default); - var status = session1.Read(ref key1, ref input, ref output, Empty.Default, 0); + var status = session1.Read(ref key1, ref input, ref output, Empty.Default); if (status.IsPending) { @@ -89,7 +89,7 @@ public void SessionTest2() Assert.AreEqual(value1.vfield1, output.value.vfield1); Assert.AreEqual(value1.vfield2, output.value.vfield2); - status = session2.Read(ref key2, ref input, ref output, Empty.Default, 0); + status = session2.Read(ref key2, ref input, ref output, Empty.Default); if (status.IsPending) { @@ -115,8 +115,8 @@ public void SessionTest3() var key1 = new KeyStruct { kfield1 = 13, kfield2 = 14 }; var value = new ValueStruct { vfield1 = 23, vfield2 = 24 }; - session.Upsert(ref key1, ref value, Empty.Default, 0); - var status = session.Read(ref key1, ref input, ref output, Empty.Default, 0); + session.Upsert(ref key1, ref value, Empty.Default); + var status = session.Read(ref key1, ref input, ref output, Empty.Default); if (status.IsPending) { @@ -144,8 +144,8 @@ public void SessionTest4() var key1 = new KeyStruct { kfield1 = 14, kfield2 = 15 }; var value1 = new ValueStruct { vfield1 = 24, vfield2 = 25 }; - session1.Upsert(ref key1, ref value1, Empty.Default, 0); - var status = session1.Read(ref key1, ref input, ref output, Empty.Default, 0); + session1.Upsert(ref key1, ref value1, Empty.Default); + var status = session1.Read(ref key1, ref input, ref output, Empty.Default); if (status.IsPending) { @@ -166,9 +166,9 @@ public void SessionTest4() var key2 = new KeyStruct { kfield1 = 15, kfield2 = 16 }; var value2 = new ValueStruct { vfield1 = 25, vfield2 = 26 }; - session2.Upsert(ref key2, ref value2, Empty.Default, 0); + session2.Upsert(ref key2, ref value2, Empty.Default); - var status = session2.Read(ref key2, ref input, ref output, Empty.Default, 0); + var status = session2.Read(ref key2, ref input, ref output, Empty.Default); if (status.IsPending) { @@ -197,8 +197,8 @@ public void SessionTest5() var key1 = new KeyStruct { kfield1 = 16, kfield2 = 17 }; var value1 = new ValueStruct { vfield1 = 26, vfield2 = 27 }; - session.Upsert(ref key1, ref value1, Empty.Default, 0); - var status = session.Read(ref key1, ref input, ref output, Empty.Default, 0); + session.Upsert(ref key1, ref value1, Empty.Default); + var status = session.Read(ref key1, ref input, ref output, Empty.Default); if (status.IsPending) { @@ -217,9 +217,9 @@ public void SessionTest5() var key2 = new KeyStruct { kfield1 = 17, kfield2 = 18 }; var value2 = new ValueStruct { vfield1 = 27, vfield2 = 28 }; - session.Upsert(ref key2, ref value2, Empty.Default, 0); + session.Upsert(ref key2, ref value2, Empty.Default); - status = session.Read(ref key2, ref input, ref output, Empty.Default, 0); + status = session.Read(ref key2, ref input, ref output, Empty.Default); if (status.IsPending) { @@ -228,7 +228,7 @@ public void SessionTest5() } Assert.IsTrue(status.Found); - status = session.Read(ref key2, ref input, ref output, Empty.Default, 0); + status = session.Read(ref key2, ref input, ref output, Empty.Default); if (status.IsPending) { diff --git a/libs/storage/Tsavorite/cs/test/SharedDirectoryTests.cs b/libs/storage/Tsavorite/cs/test/SharedDirectoryTests.cs index 0129d977d3..1259fb8999 100644 --- a/libs/storage/Tsavorite/cs/test/SharedDirectoryTests.cs +++ b/libs/storage/Tsavorite/cs/test/SharedDirectoryTests.cs @@ -170,7 +170,7 @@ private void Populate(TsavoriteKV store) // Process the batch of input data for (int i = 0; i < numOps; i++) { - session.RMW(ref inputArray[i].adId, ref inputArray[i], Empty.Default, i); + session.RMW(ref inputArray[i].adId, ref inputArray[i], Empty.Default); if (i % completePendingInterval == 0) { @@ -206,43 +206,14 @@ private void Test(TsavoriteTestInstance tsavoriteInstance, Guid checkpointToken) // Issue read requests for (var i = 0; i < numUniqueKeys; i++) { - var status = session.Read(ref inputArray[i].adId, ref input, ref output, Empty.Default, i); + var status = session.Read(ref inputArray[i].adId, ref input, ref output, Empty.Default); Assert.IsTrue(status.Found); inputArray[i].numClicks = output.value; } // Complete all pending requests session.CompletePending(true); - - // Compute expected array - long[] expected = new long[numUniqueKeys]; - foreach (var guid in checkpointInfo.continueTokens.Keys) - { - var sno = checkpointInfo.continueTokens[guid].Item2.UntilSerialNo; - for (long i = 0; i <= sno; i++) - { - var id = i % numUniqueKeys; - expected[id]++; - } - } - - int threadCount = 1; // single threaded test - int numCompleted = threadCount - checkpointInfo.continueTokens.Count; - for (int t = 0; t < numCompleted; t++) - { - var sno = numOps; - for (long i = 0; i < sno; i++) - { - var id = i % numUniqueKeys; - expected[id]++; - } - } - - // Assert that expected is same as found - for (long i = 0; i < numUniqueKeys; i++) - { - Assert.AreEqual(expected[i], inputArray[i].numClicks.numClicks, $"AdId {inputArray[i].adId.adId}"); - } + session.Dispose(); } private bool IsDirectoryEmpty(string path) => !Directory.Exists(path) || !Directory.EnumerateFileSystemEntries(path).Any(); diff --git a/libs/storage/Tsavorite/cs/test/SimpleAsyncTests.cs b/libs/storage/Tsavorite/cs/test/SimpleAsyncTests.cs index dc758fcd45..01935dd53f 100644 --- a/libs/storage/Tsavorite/cs/test/SimpleAsyncTests.cs +++ b/libs/storage/Tsavorite/cs/test/SimpleAsyncTests.cs @@ -68,7 +68,7 @@ public async Task ReadAsyncMinParamTest() } } - // Test that does .ReadAsync with minimum parameters but no default (ref key, userContext, serialNo, token) + // Test that does .ReadAsync with minimum parameters but no default (ref key, userContext, token) [Test] [Category("TsavoriteKV")] public async Task ReadAsyncMinParamTestNoDefaultTest() @@ -84,7 +84,7 @@ public async Task ReadAsyncMinParamTestNoDefaultTest() for (long key = 0; key < numOps; key++) { - var (status, output) = (await s1.ReadAsync(ref key, Empty.Default, 99, cancellationToken)).Complete(); + var (status, output) = (await s1.ReadAsync(ref key, Empty.Default, cancellationToken)).Complete(); Assert.IsTrue(status.Found); Assert.AreEqual(key, output); } @@ -105,7 +105,7 @@ public async Task ReadAsyncNoRefKeyTest() for (long key = 0; key < numOps; key++) { - var (status, output) = (await s1.ReadAsync(key, Empty.Default, 99)).Complete(); + var (status, output) = (await s1.ReadAsync(key, Empty.Default)).Complete(); Assert.IsTrue(status.Found); Assert.AreEqual(key, output); } @@ -177,7 +177,7 @@ public async Task ReadAsyncNoRefKeyNoRefInputTest() (await t1).Complete(); (await t2).Complete(); // should trigger RMW re-do - (status, output) = (await s1.ReadAsync(key, output, Empty.Default, 129)).Complete(); + (status, output) = (await s1.ReadAsync(key, output, Empty.Default)).Complete(); Assert.IsTrue(status.Found); Assert.AreEqual(key + input + input, output); } @@ -249,7 +249,7 @@ public async Task UpsertReadDeleteReadAsyncMinParamByValueTest() } // Test that uses StartAddress parameter - // (ref key, ref input, StartAddress, userContext, serialNo, CancellationToken) + // (ref key, ref input, StartAddress, userContext, CancellationToken) [Test] [Category("TsavoriteKV")] public async Task AsyncStartAddressParamTest() @@ -295,7 +295,7 @@ public async Task AsyncStartAddressParamTest() addresses[key] = store.Log.TailAddress - recordSize; readOptions = default; - (status, output) = (await s1.ReadAtAddressAsync(addresses[key], ref key, ref output, ref readOptions, Empty.Default, 129)).Complete(); + (status, output) = (await s1.ReadAtAddressAsync(addresses[key], ref key, ref output, ref readOptions, Empty.Default)).Complete(); Assert.IsTrue(status.Found); Assert.AreEqual(key + input + input, output); } diff --git a/libs/storage/Tsavorite/cs/test/SimpleRecoveryTest.cs b/libs/storage/Tsavorite/cs/test/SimpleRecoveryTest.cs index c00241fdcf..30da38ff59 100644 --- a/libs/storage/Tsavorite/cs/test/SimpleRecoveryTest.cs +++ b/libs/storage/Tsavorite/cs/test/SimpleRecoveryTest.cs @@ -116,7 +116,7 @@ private async ValueTask SimpleRecoveryTest1_Worker(CheckpointType checkpointType for (int key = 0; key < numOps; key++) { value.numClicks = key; - session1.Upsert(ref inputArray[key], ref value, Empty.Default, 0); + session1.Upsert(ref inputArray[key], ref value, Empty.Default); } if (testCommitCookie) @@ -136,11 +136,11 @@ private async ValueTask SimpleRecoveryTest1_Worker(CheckpointType checkpointType Assert.Null(store2.RecoveredCommitCookie); var session2 = store2.NewSession(new AdSimpleFunctions()); - Assert.AreEqual(2, session2.ID); + Assert.AreEqual(1, session2.ID); // This is the first session on the recovered store for (int key = 0; key < numOps; key++) { - var status = session2.Read(ref inputArray[key], ref inputArg, ref output, Empty.Default, 0); + var status = session2.Read(ref inputArray[key], ref inputArg, ref output, Empty.Default); if (status.IsPending) { @@ -183,7 +183,7 @@ public async ValueTask SimpleRecoveryTest2([Values] CheckpointType checkpointTyp for (int key = 0; key < numOps; key++) { value.numClicks = key; - session1.Upsert(ref inputArray[key], ref value, Empty.Default, 0); + session1.Upsert(ref inputArray[key], ref value, Empty.Default); } store1.TryInitiateFullCheckpoint(out Guid token, checkpointType); store1.CompleteCheckpointAsync().AsTask().GetAwaiter().GetResult(); @@ -197,7 +197,7 @@ public async ValueTask SimpleRecoveryTest2([Values] CheckpointType checkpointTyp var session2 = store2.NewSession(new AdSimpleFunctions()); for (int key = 0; key < numOps; key++) { - var status = session2.Read(ref inputArray[key], ref inputArg, ref output, Empty.Default, 0); + var status = session2.Read(ref inputArray[key], ref inputArg, ref output, Empty.Default); if (status.IsPending) session2.CompletePending(true); @@ -233,7 +233,7 @@ public async ValueTask ShouldRecoverBeginAddress([Values] bool isAsync) for (int key = 0; key < numOps; key++) { value.numClicks = key; - session1.Upsert(ref inputArray[key], ref value, Empty.Default, 0); + session1.Upsert(ref inputArray[key], ref value, Empty.Default); if (key == 2999) address = store1.Log.TailAddress; @@ -282,7 +282,7 @@ public void SimpleReadAndUpdateInfoTest() { value.numClicks = key; if ((key & 1) > 0) - session1.Upsert(ref inputArray[key], ref value, Empty.Default, 0); + session1.Upsert(ref inputArray[key], ref value, Empty.Default); else { AdInput input = new() { adId = inputArray[key], numClicks = value }; @@ -299,11 +299,11 @@ public void SimpleReadAndUpdateInfoTest() // Just need one operation here to verify readInfo/upsertInfo in the functions var lastKey = inputArray.Length - 1; - var status = session2.Read(ref inputArray[lastKey], ref inputArg, ref output, Empty.Default, 0); + var status = session2.Read(ref inputArray[lastKey], ref inputArg, ref output, Empty.Default); Assert.IsFalse(status.IsPending, status.ToString()); value.numClicks = lastKey; - status = session2.Upsert(ref inputArray[lastKey], ref value, Empty.Default, 0); + status = session2.Upsert(ref inputArray[lastKey], ref value, Empty.Default); Assert.IsFalse(status.IsPending, status.ToString()); inputArg = new() { adId = inputArray[lastKey], numClicks = new NumClicks { numClicks = 0 } }; // CopyUpdater adds, so make this 0 @@ -315,7 +315,7 @@ public void SimpleReadAndUpdateInfoTest() output.value = new() { numClicks = lastKey }; inputArg.numClicks = new() { numClicks = lastKey }; - status = session2.Read(ref inputArray[lastKey], ref inputArg, ref output, Empty.Default, 0); + status = session2.Read(ref inputArray[lastKey], ref inputArg, ref output, Empty.Default); Assert.IsTrue(status.IsPending, status.ToString()); session2.CompletePending(wait: true); diff --git a/libs/storage/Tsavorite/cs/test/SingleWriterTests.cs b/libs/storage/Tsavorite/cs/test/SingleWriterTests.cs index ac181457c7..158a400943 100644 --- a/libs/storage/Tsavorite/cs/test/SingleWriterTests.cs +++ b/libs/storage/Tsavorite/cs/test/SingleWriterTests.cs @@ -30,7 +30,7 @@ class SingleWriterTests { const int numRecords = 1000; const int valueMult = 1_000_000; - const WriteReason NoReason = (WriteReason)(-1); + const WriteReason NoReason = (WriteReason)(255); SingleWriterTestFunctions functions; diff --git a/libs/storage/Tsavorite/cs/test/SpanByteTests.cs b/libs/storage/Tsavorite/cs/test/SpanByteTests.cs index 027dc7bec6..0db6ac59ab 100644 --- a/libs/storage/Tsavorite/cs/test/SpanByteTests.cs +++ b/libs/storage/Tsavorite/cs/test/SpanByteTests.cs @@ -259,7 +259,7 @@ void Set(ref Span keySpan, long keyValue, ref Span valueSpan, int va keySpan[0] = keyValue; value.Length = valueLength; valueSpan[0] = tag; - session.Upsert(ref key, ref value, Empty.Default, 0); + session.Upsert(ref key, ref value, Empty.Default); } } } diff --git a/libs/storage/Tsavorite/cs/test/SpanByteVLVectorTests.cs b/libs/storage/Tsavorite/cs/test/SpanByteVLVectorTests.cs index d799edbd30..5ce474ad01 100644 --- a/libs/storage/Tsavorite/cs/test/SpanByteVLVectorTests.cs +++ b/libs/storage/Tsavorite/cs/test/SpanByteVLVectorTests.cs @@ -45,7 +45,7 @@ public unsafe void VLVectorSingleKeyTest() valueSpan[j] = len; var valueSpanByte = valueSpan.Slice(0, len).AsSpanByte(); - s.Upsert(ref keySpanByte, ref valueSpanByte, Empty.Default, 0); + s.Upsert(ref keySpanByte, ref valueSpanByte, Empty.Default); } // Reset rng to get the same sequence of value lengths @@ -57,7 +57,7 @@ public unsafe void VLVectorSingleKeyTest() var valueLen = GetRandomLength(rng); int[] output = null; - var status = s.Read(ref keySpanByte, ref output, Empty.Default, 0); + var status = s.Read(ref keySpanByte, ref output, Empty.Default); if (status.IsPending) { @@ -107,7 +107,7 @@ public unsafe void VLVectorMultiKeyTest() valueSpan[j] = valueLen; var valueSpanByte = valueSpan.Slice(0, valueLen).AsSpanByte(); - s.Upsert(ref keySpanByte, ref valueSpanByte, Empty.Default, 0); + s.Upsert(ref keySpanByte, ref valueSpanByte, Empty.Default); } // Reset rng to get the same sequence of key and value lengths @@ -121,7 +121,7 @@ public unsafe void VLVectorMultiKeyTest() var valueLen = GetRandomLength(rng); int[] output = null; - var status = s.Read(ref keySpanByte, ref output, Empty.Default, 0); + var status = s.Read(ref keySpanByte, ref output, Empty.Default); if (status.IsPending) { diff --git a/libs/storage/Tsavorite/cs/test/StateMachineBarrierTests.cs b/libs/storage/Tsavorite/cs/test/StateMachineBarrierTests.cs index f179ab809c..59b314e50c 100644 --- a/libs/storage/Tsavorite/cs/test/StateMachineBarrierTests.cs +++ b/libs/storage/Tsavorite/cs/test/StateMachineBarrierTests.cs @@ -74,8 +74,6 @@ public void StateMachineBarrierTest1() SystemState.Equal(SystemState.Make(Phase.WAIT_FLUSH, 2), store.SystemState) ); - f.checkpointCallbackExpectation = 1; - // Forward the rest of the state machine while (!SystemState.Equal(SystemState.Make(Phase.REST, 2), store.SystemState)) { @@ -83,15 +81,11 @@ public void StateMachineBarrierTest1() s2.Refresh(); } - Assert.AreEqual(0, f.checkpointCallbackExpectation); - // Dispose session s2; does not move state machine forward s2.Dispose(); uc1.EndUnsafe(); s1.Dispose(); - - RecoverAndTest(log); } void Prepare(out SimpleFunctions f, @@ -120,7 +114,7 @@ void Prepare(out SimpleFunctions f, for (int key = 0; key < numOps; key++) { value.numClicks = key; - s1.Upsert(ref inputArray[key], ref value, Empty.Default, key); + s1.Upsert(ref inputArray[key], ref value, Empty.Default); } // Ensure state machine needs no I/O wait during WAIT_FLUSH @@ -141,47 +135,5 @@ void Prepare(out SimpleFunctions f, // We should be in PREPARE, 1 Assert.IsTrue(SystemState.Equal(SystemState.Make(Phase.PREPARE, 1), store.SystemState)); } - - void RecoverAndTest(IDevice log) - { - NumClicks inputArg = default; - NumClicks output = default; - var f = new SimpleFunctions(); - - var store = new TsavoriteKV - (128, - logSettings: new LogSettings { LogDevice = log, MutableFraction = 0.1, PageSizeBits = 10, MemorySizeBits = 13 }, - checkpointSettings: new CheckpointSettings { CheckpointDir = Path.Join(TestUtils.MethodTestDir, "statemachinetest") } - ); - - store.Recover(); // sync, does not require session - - using (var s3 = store.ResumeSession(f, "foo", out CommitPoint lsn)) - { - Assert.AreEqual(numOps - 1, lsn.UntilSerialNo); - - // Expect checkpoint completion callback - f.checkpointCallbackExpectation = 1; - - s3.Refresh(); - - // Completion callback should have been called once - Assert.AreEqual(0, f.checkpointCallbackExpectation); - - for (var key = 0; key < numOps; key++) - { - var status = s3.Read(ref inputArray[key], ref inputArg, ref output, Empty.Default, s3.SerialNo); - - if (status.IsPending) - s3.CompletePending(true); - else - { - Assert.AreEqual(key, output.numClicks); - } - } - } - - store.Dispose(); - } } } \ No newline at end of file diff --git a/libs/storage/Tsavorite/cs/test/StateMachineTests.cs b/libs/storage/Tsavorite/cs/test/StateMachineTests.cs index 690f1eea99..b7bcf56af3 100644 --- a/libs/storage/Tsavorite/cs/test/StateMachineTests.cs +++ b/libs/storage/Tsavorite/cs/test/StateMachineTests.cs @@ -3,7 +3,6 @@ using System.Collections.Generic; using System.IO; -using System.Threading; using NUnit.Framework; using Tsavorite.core; using Tsavorite.test.recovery.sumstore; @@ -75,15 +74,8 @@ public void StateMachineTest1() // We should be in WAIT_FLUSH, 2 Assert.IsTrue(SystemState.Equal(SystemState.Make(Phase.WAIT_FLUSH, 2), store.SystemState)); - // Expect checkpoint completion callback - f.checkpointCallbackExpectation = 1; - uc1.Refresh(); - // Completion callback should have been called once - Assert.AreEqual(0, f.checkpointCallbackExpectation); - - // We should be in PERSISTENCE_CALLBACK, 2 Assert.IsTrue(SystemState.Equal(SystemState.Make(Phase.PERSISTENCE_CALLBACK, 2), store.SystemState)); @@ -97,8 +89,6 @@ public void StateMachineTest1() uc1.EndUnsafe(); s1.Dispose(); - - RecoverAndTest(log); } @@ -129,23 +119,15 @@ public void StateMachineTest2() // We should be in WAIT_FLUSH, 2 Assert.IsTrue(SystemState.Equal(SystemState.Make(Phase.WAIT_FLUSH, 2), store.SystemState)); - // Expect checkpoint completion callback - f.checkpointCallbackExpectation = 1; - // Since s1 is the only session now, it will fast-foward state machine // to completion uc1.Refresh(); - // Completion callback should have been called once - Assert.AreEqual(0, f.checkpointCallbackExpectation); - // We should be in REST, 2 Assert.IsTrue(SystemState.Equal(SystemState.Make(Phase.REST, 2), store.SystemState)); uc1.EndUnsafe(); s1.Dispose(); - - RecoverAndTest(log); } [TestCase] @@ -173,20 +155,12 @@ public void StateMachineTest3() // We should be in REST, 2 Assert.IsTrue(SystemState.Equal(SystemState.Make(Phase.REST, 2), store.SystemState)); - // Expect checkpoint completion callback - f.checkpointCallbackExpectation = 1; - uc1.BeginUnsafe(); - // Completion callback should have been called once - Assert.AreEqual(0, f.checkpointCallbackExpectation); - s2.Dispose(); uc1.EndUnsafe(); s1.Dispose(); - - RecoverAndTest(log); } [TestCase] @@ -223,20 +197,12 @@ public void StateMachineTest4() // We should be in REST, 2 Assert.IsTrue(SystemState.Equal(SystemState.Make(Phase.REST, 2), store.SystemState)); - // Expect checkpoint completion callback - f.checkpointCallbackExpectation = 1; - uc1.BeginUnsafe(); - // Completion callback should have been called once - Assert.AreEqual(0, f.checkpointCallbackExpectation); - s2.Dispose(); uc1.EndUnsafe(); s1.Dispose(); - - RecoverAndTest(log); } [TestCase] @@ -266,14 +232,8 @@ public void StateMachineTest5() // We should be in PERSISTENCE_CALLBACK, 2 Assert.IsTrue(SystemState.Equal(SystemState.Make(Phase.PERSISTENCE_CALLBACK, 2), store.SystemState)); - // Expect checkpoint completion callback - f.checkpointCallbackExpectation = 1; - uc1.Refresh(); - // Completion callback should have been called once - Assert.AreEqual(0, f.checkpointCallbackExpectation); - // We should be in REST, 2 Assert.IsTrue(SystemState.Equal(SystemState.Make(Phase.REST, 2), store.SystemState)); @@ -290,20 +250,12 @@ public void StateMachineTest5() // We should be in REST, 2 Assert.IsTrue(SystemState.Equal(SystemState.Make(Phase.REST, 2), store.SystemState)); - // Expect no checkpoint completion callback on resume - f.checkpointCallbackExpectation = 0; - uc1.BeginUnsafe(); - // Completion callback should have been called once - Assert.AreEqual(0, f.checkpointCallbackExpectation); - s2.Dispose(); uc1.EndUnsafe(); s1.Dispose(); - - RecoverAndTest(log); } @@ -337,18 +289,10 @@ public void StateMachineTest6() // We should be in REST, 3 Assert.IsTrue(SystemState.Equal(SystemState.Make(Phase.REST, 3), store.SystemState)); - // Expect checkpoint completion callback on resume - f.checkpointCallbackExpectation = 1; - uc1.BeginUnsafe(); - // Completion callback should have been called once - Assert.AreEqual(0, f.checkpointCallbackExpectation); - uc1.EndUnsafe(); s1.Dispose(); - - RecoverAndTest(log); } [TestCase] @@ -379,11 +323,8 @@ public void LUCScenario1() // fast-foward state machine to completion Assert.IsTrue(SystemState.Equal(SystemState.Make(Phase.REST, 2), store.SystemState)); - // Expect checkpoint completion callback - f.checkpointCallbackExpectation = 1; lts.Refresh(); - RecoverAndTest(log); s1.Dispose(); ts.Dispose(); lts.Dispose(); @@ -429,13 +370,11 @@ public void LUCScenario2() Assert.IsTrue(lts.isProtected); lts.DisposeLUC(); - // Expect checkpoint completion callback - f.checkpointCallbackExpectation = 1; - RecoverAndTest(log); s1.Dispose(); ts.Dispose(); lts.Dispose(); } + [TestCase] [Category("TsavoriteKV"), Category("CheckpointRestore")] public void LUCScenario3() @@ -487,14 +426,11 @@ public void LUCScenario3() Assert.IsTrue(SystemState.Equal(SystemState.Make(Phase.REST, 2), store.SystemState)); // Expect checkpoint completion callback - f.checkpointCallbackExpectation = 1; - RecoverAndTest(log); s1.Dispose(); ts.Dispose(); lts.Dispose(); } - [TestCase] [Category("TsavoriteKV")] [Category("CheckpointRestore")] @@ -523,14 +459,8 @@ public void StateMachineCallbackTest1() Assert.IsTrue(SystemState.Equal(SystemState.Make(Phase.WAIT_FLUSH, 2), store.SystemState)); callback.CheckInvoked(store.SystemState); - // Expect checkpoint completion callback - f.checkpointCallbackExpectation = 1; - uc1.Refresh(); - // Completion callback should have been called once - Assert.IsTrue(f.checkpointCallbackExpectation == 0); - // We should be in PERSISTENCE_CALLBACK, 2 Assert.IsTrue(SystemState.Equal(SystemState.Make(Phase.PERSISTENCE_CALLBACK, 2), store.SystemState)); callback.CheckInvoked(store.SystemState); @@ -546,11 +476,8 @@ public void StateMachineCallbackTest1() uc1.EndUnsafe(); s1.Dispose(); - - RecoverAndTest(log); } - [TestCase] [Category("TsavoriteKV")] [Category("CheckpointRestore")] @@ -574,14 +501,8 @@ public void VersionChangeTest() // We should be in WAIT_FLUSH, 2 Assert.IsTrue(SystemState.Equal(SystemState.Make(Phase.WAIT_FLUSH, toVersion), store.SystemState)); - // Expect checkpoint completion callback - f.checkpointCallbackExpectation = 1; - uc1.Refresh(); - // Completion callback should have been called once - Assert.IsTrue(f.checkpointCallbackExpectation == 0); - // We should be in PERSISTENCE_CALLBACK, 2 Assert.IsTrue(SystemState.Equal(SystemState.Make(Phase.PERSISTENCE_CALLBACK, toVersion), store.SystemState)); @@ -595,11 +516,8 @@ public void VersionChangeTest() uc1.EndUnsafe(); s1.Dispose(); - - RecoverAndTest(log); } - void Prepare(out SimpleFunctions f, out ClientSession s1, out UnsafeContext uc1, @@ -626,7 +544,7 @@ void Prepare(out SimpleFunctions f, for (int key = 0; key < numOps; key++) { value.numClicks = key; - s1.Upsert(ref inputArray[key], ref value, Empty.Default, key); + s1.Upsert(ref inputArray[key], ref value, Empty.Default); } // Ensure state machine needs no I/O wait during WAIT_FLUSH @@ -662,7 +580,7 @@ void CreateSessions(out SimpleFunctions f, for (int key = 0; key < numOps; key++) { value.numClicks = key; - s1.Upsert(ref inputArray[key], ref value, Empty.Default, key); + s1.Upsert(ref inputArray[key], ref value, Empty.Default); } // Ensure state machine needs no I/O wait during WAIT_FLUSH @@ -679,67 +597,10 @@ void CreateSessions(out SimpleFunctions f, store.TryInitiateIndexCheckpoint(out _); store.CompleteCheckpointAsync().AsTask().GetAwaiter().GetResult(); } - - void RecoverAndTest(IDevice log) - { - NumClicks inputArg = default; - NumClicks output = default; - var f = new SimpleFunctions(); - - var store = new TsavoriteKV - (128, - logSettings: new LogSettings { LogDevice = log, MutableFraction = 0.1, PageSizeBits = 10, MemorySizeBits = 13 }, - checkpointSettings: new CheckpointSettings { CheckpointDir = Path.Join(TestUtils.MethodTestDir, "statemachinetest") } - ); - - store.Recover(); // sync, does not require session - - using (var s3 = store.ResumeSession(f, "foo", out CommitPoint lsn)) - { - Assert.AreEqual(numOps - 1, lsn.UntilSerialNo); - - // Expect checkpoint completion callback - f.checkpointCallbackExpectation = 1; - - s3.Refresh(); - - // Completion callback should have been called once - Assert.AreEqual(0, f.checkpointCallbackExpectation); - - for (var key = 0; key < numOps; key++) - { - var status = s3.Read(ref inputArray[key], ref inputArg, ref output, Empty.Default, s3.SerialNo); - - if (status.IsPending) - s3.CompletePending(true); - else - { - Assert.AreEqual(key, output.numClicks); - } - } - } - - store.Dispose(); - } } public class SimpleFunctions : SimpleFunctions { - public int checkpointCallbackExpectation = 0; - - public override void CheckpointCompletionCallback(int sessionID, string sessionName, CommitPoint commitPoint) - { - switch (checkpointCallbackExpectation) - { - case 0: - Assert.Fail("Unexpected checkpoint callback"); - break; - default: - Interlocked.Decrement(ref checkpointCallbackExpectation); - break; - } - } - public override void ReadCompletionCallback(ref AdId key, ref NumClicks input, ref NumClicks output, Empty ctx, Status status, RecordMetadata recordMetadata) { Assert.IsTrue(status.Found); diff --git a/libs/storage/Tsavorite/cs/test/UnsafeContextTests.cs b/libs/storage/Tsavorite/cs/test/UnsafeContextTests.cs index 036855ceeb..b741eb93c4 100644 --- a/libs/storage/Tsavorite/cs/test/UnsafeContextTests.cs +++ b/libs/storage/Tsavorite/cs/test/UnsafeContextTests.cs @@ -82,8 +82,8 @@ public void NativeInMemWriteRead([Values] DeviceType deviceType) var key1 = new KeyStruct { kfield1 = 13, kfield2 = 14 }; var value = new ValueStruct { vfield1 = 23, vfield2 = 24 }; - uContext.Upsert(ref key1, ref value, Empty.Default, 0); - var status = uContext.Read(ref key1, ref input, ref output, Empty.Default, 0); + uContext.Upsert(ref key1, ref value, Empty.Default); + var status = uContext.Read(ref key1, ref input, ref output, Empty.Default); AssertCompleted(new(StatusCode.Found), status); Assert.AreEqual(value.vfield1, output.value.vfield1); @@ -111,20 +111,20 @@ public void NativeInMemWriteReadDelete([Values] DeviceType deviceType) var key1 = new KeyStruct { kfield1 = 13, kfield2 = 14 }; var value = new ValueStruct { vfield1 = 23, vfield2 = 24 }; - uContext.Upsert(ref key1, ref value, Empty.Default, 0); - var status = uContext.Read(ref key1, ref input, ref output, Empty.Default, 0); + uContext.Upsert(ref key1, ref value, Empty.Default); + var status = uContext.Read(ref key1, ref input, ref output, Empty.Default); AssertCompleted(new(StatusCode.Found), status); - uContext.Delete(ref key1, Empty.Default, 0); + uContext.Delete(ref key1, Empty.Default); - status = uContext.Read(ref key1, ref input, ref output, Empty.Default, 0); + status = uContext.Read(ref key1, ref input, ref output, Empty.Default); AssertCompleted(new(StatusCode.NotFound), status); var key2 = new KeyStruct { kfield1 = 14, kfield2 = 15 }; var value2 = new ValueStruct { vfield1 = 24, vfield2 = 25 }; - uContext.Upsert(ref key2, ref value2, Empty.Default, 0); - status = uContext.Read(ref key2, ref input, ref output, Empty.Default, 0); + uContext.Upsert(ref key2, ref value2, Empty.Default); + status = uContext.Read(ref key2, ref input, ref output, Empty.Default); AssertCompleted(new(StatusCode.Found), status); Assert.AreEqual(value2.vfield1, output.value.vfield1); @@ -161,13 +161,13 @@ public void NativeInMemWriteReadDelete2() var key1 = new KeyStruct { kfield1 = i, kfield2 = 14 }; var value = new ValueStruct { vfield1 = i, vfield2 = 24 }; - uContext.Upsert(ref key1, ref value, Empty.Default, 0); + uContext.Upsert(ref key1, ref value, Empty.Default); } for (int i = 0; i < 10 * count; i++) { var key1 = new KeyStruct { kfield1 = i, kfield2 = 14 }; - uContext.Delete(ref key1, Empty.Default, 0); + uContext.Delete(ref key1, Empty.Default); } for (int i = 0; i < 10 * count; i++) @@ -175,16 +175,16 @@ public void NativeInMemWriteReadDelete2() var key1 = new KeyStruct { kfield1 = i, kfield2 = 14 }; var value = new ValueStruct { vfield1 = i, vfield2 = 24 }; - var status = uContext.Read(ref key1, ref input, ref output, Empty.Default, 0); + var status = uContext.Read(ref key1, ref input, ref output, Empty.Default); AssertCompleted(new(StatusCode.NotFound), status); - uContext.Upsert(ref key1, ref value, Empty.Default, 0); + uContext.Upsert(ref key1, ref value, Empty.Default); } for (int i = 0; i < 10 * count; i++) { var key1 = new KeyStruct { kfield1 = i, kfield2 = 14 }; - var status = uContext.Read(ref key1, ref input, ref output, Empty.Default, 0); + var status = uContext.Read(ref key1, ref input, ref output, Empty.Default); AssertCompleted(new(StatusCode.Found), status); } } @@ -218,7 +218,7 @@ public unsafe void NativeInMemWriteRead2() var i = r.Next(10000); var key1 = new KeyStruct { kfield1 = i, kfield2 = i + 1 }; var value = new ValueStruct { vfield1 = i, vfield2 = i + 1 }; - uContext.Upsert(ref key1, ref value, Empty.Default, 0); + uContext.Upsert(ref key1, ref value, Empty.Default); } r = new Random(10); @@ -230,7 +230,7 @@ public unsafe void NativeInMemWriteRead2() var key1 = new KeyStruct { kfield1 = i, kfield2 = i + 1 }; var value = new ValueStruct { vfield1 = i, vfield2 = i + 1 }; - if (uContext.Read(ref key1, ref input, ref output, Empty.Default, 0).IsPending) + if (uContext.Read(ref key1, ref input, ref output, Empty.Default).IsPending) { uContext.CompletePending(true); } @@ -248,7 +248,7 @@ public unsafe void NativeInMemWriteRead2() var i = r.Next(10000); OutputStruct output = default; var key1 = new KeyStruct { kfield1 = i, kfield2 = i + 1 }; - Assert.IsFalse(uContext.Read(ref key1, ref input, ref output, Empty.Default, 0).Found); + Assert.IsFalse(uContext.Read(ref key1, ref input, ref output, Empty.Default).Found); } } finally @@ -282,7 +282,7 @@ public async Task TestShiftHeadAddressUC([Values] DeviceType deviceType, [Values var value = new ValueStruct { vfield1 = i, vfield2 = i + 1 }; if (syncMode == SyncMode.Sync) { - uContext.Upsert(ref key1, ref value, Empty.Default, 0); + uContext.Upsert(ref key1, ref value, Empty.Default); } else { @@ -306,7 +306,7 @@ public async Task TestShiftHeadAddressUC([Values] DeviceType deviceType, [Values Status status; if (syncMode == SyncMode.Sync || (c % 1 == 0)) // in .Async mode, half the ops should be sync to test CompletePendingAsync { - status = uContext.Read(ref key1, ref input, ref output, Empty.Default, 0); + status = uContext.Read(ref key1, ref input, ref output, Empty.Default); } else { @@ -342,7 +342,7 @@ public async Task TestShiftHeadAddressUC([Values] DeviceType deviceType, [Values var i = r.Next(RandRange); OutputStruct output = default; var key1 = new KeyStruct { kfield1 = i, kfield2 = i + 1 }; - Status foundStatus = uContext.Read(ref key1, ref input, ref output, Empty.Default, 0); + Status foundStatus = uContext.Read(ref key1, ref input, ref output, Empty.Default); Assert.IsTrue(foundStatus.IsPending); } @@ -402,14 +402,14 @@ public unsafe void NativeInMemRMWRefKeys([Values] DeviceType deviceType) var i = nums[j]; var key1 = new KeyStruct { kfield1 = i, kfield2 = i + 1 }; input = new InputStruct { ifield1 = i, ifield2 = i + 1 }; - uContext.RMW(ref key1, ref input, Empty.Default, 0); + uContext.RMW(ref key1, ref input, Empty.Default); } for (int j = 0; j < nums.Length; ++j) { var i = nums[j]; var key1 = new KeyStruct { kfield1 = i, kfield2 = i + 1 }; input = new InputStruct { ifield1 = i, ifield2 = i + 1 }; - if (uContext.RMW(ref key1, ref input, ref output, Empty.Default, 0).IsPending) + if (uContext.RMW(ref key1, ref input, ref output, Empty.Default).IsPending) { uContext.CompletePending(true); } @@ -430,7 +430,7 @@ public unsafe void NativeInMemRMWRefKeys([Values] DeviceType deviceType) key = new KeyStruct { kfield1 = i, kfield2 = i + 1 }; ValueStruct value = new() { vfield1 = i, vfield2 = i + 1 }; - status = uContext.Read(ref key, ref input, ref output, Empty.Default, 0); + status = uContext.Read(ref key, ref input, ref output, Empty.Default); AssertCompleted(new(StatusCode.Found), status); Assert.AreEqual(2 * value.vfield1, output.value.vfield1); @@ -438,7 +438,7 @@ public unsafe void NativeInMemRMWRefKeys([Values] DeviceType deviceType) } key = new KeyStruct { kfield1 = nums.Length, kfield2 = nums.Length + 1 }; - status = uContext.Read(ref key, ref input, ref output, Empty.Default, 0); + status = uContext.Read(ref key, ref input, ref output, Empty.Default); AssertCompleted(new(StatusCode.NotFound), status); } finally @@ -447,7 +447,7 @@ public unsafe void NativeInMemRMWRefKeys([Values] DeviceType deviceType) } } - // Tests the overload where no reference params used: key,input,userContext,serialNo + // Tests the overload where no reference params used: key,input,userContext [Test] [Category("TsavoriteKV")] public unsafe void NativeInMemRMWNoRefKeys([Values] DeviceType deviceType) @@ -474,7 +474,7 @@ public unsafe void NativeInMemRMWNoRefKeys([Values] DeviceType deviceType) var i = nums[j]; var key1 = new KeyStruct { kfield1 = i, kfield2 = i + 1 }; input = new InputStruct { ifield1 = i, ifield2 = i + 1 }; - uContext.RMW(ref key1, ref input, Empty.Default, 0); + uContext.RMW(ref key1, ref input, Empty.Default); } for (int j = 0; j < nums.Length; ++j) { @@ -495,7 +495,7 @@ public unsafe void NativeInMemRMWNoRefKeys([Values] DeviceType deviceType) key = new KeyStruct { kfield1 = i, kfield2 = i + 1 }; ValueStruct value = new() { vfield1 = i, vfield2 = i + 1 }; - status = uContext.Read(ref key, ref input, ref output, Empty.Default, 0); + status = uContext.Read(ref key, ref input, ref output, Empty.Default); AssertCompleted(new(StatusCode.Found), status); Assert.AreEqual(2 * value.vfield1, output.value.vfield1); @@ -503,7 +503,7 @@ public unsafe void NativeInMemRMWNoRefKeys([Values] DeviceType deviceType) } key = new KeyStruct { kfield1 = nums.Length, kfield2 = nums.Length + 1 }; - status = uContext.Read(ref key, ref input, ref output, Empty.Default, 0); + status = uContext.Read(ref key, ref input, ref output, Empty.Default); AssertCompleted(new(StatusCode.NotFound), status); } finally @@ -512,7 +512,7 @@ public unsafe void NativeInMemRMWNoRefKeys([Values] DeviceType deviceType) } } - // Tests the overload of .Read(key, input, out output, context, serialNo) + // Tests the overload of .Read(key, input, out output, context) [Test] [Category("TsavoriteKV")] [Category("Smoke")] @@ -528,8 +528,8 @@ public void ReadNoRefKeyInputOutput([Values] DeviceType deviceType) var key1 = new KeyStruct { kfield1 = 13, kfield2 = 14 }; var value = new ValueStruct { vfield1 = 23, vfield2 = 24 }; - uContext.Upsert(ref key1, ref value, Empty.Default, 0); - var status = uContext.Read(key1, input, out OutputStruct output, Empty.Default, 111); + uContext.Upsert(ref key1, ref value, Empty.Default); + var status = uContext.Read(key1, input, out OutputStruct output, Empty.Default); AssertCompleted(new(StatusCode.Found), status); // Verify the read data @@ -544,7 +544,7 @@ public void ReadNoRefKeyInputOutput([Values] DeviceType deviceType) } } - // Test the overload call of .Read (key, out output, userContext, serialNo) + // Test the overload call of .Read (key, out output, userContext) [Test] [Category("TsavoriteKV")] public void ReadNoRefKey([Values] DeviceType deviceType) @@ -557,8 +557,8 @@ public void ReadNoRefKey([Values] DeviceType deviceType) var key1 = new KeyStruct { kfield1 = 13, kfield2 = 14 }; var value = new ValueStruct { vfield1 = 23, vfield2 = 24 }; - uContext.Upsert(ref key1, ref value, Empty.Default, 0); - var status = uContext.Read(key1, out OutputStruct output, Empty.Default, 1); + uContext.Upsert(ref key1, ref value, Empty.Default); + var status = uContext.Read(key1, out OutputStruct output, Empty.Default); AssertCompleted(new(StatusCode.Found), status); // Verify the read data @@ -574,7 +574,7 @@ public void ReadNoRefKey([Values] DeviceType deviceType) } - // Test the overload call of .Read (ref key, ref output, userContext, serialNo) + // Test the overload call of .Read (ref key, ref output, userContext) [Test] [Category("TsavoriteKV")] [Category("Smoke")] @@ -590,8 +590,8 @@ public void ReadWithoutInput([Values] DeviceType deviceType) var key1 = new KeyStruct { kfield1 = 13, kfield2 = 14 }; var value = new ValueStruct { vfield1 = 23, vfield2 = 24 }; - uContext.Upsert(ref key1, ref value, Empty.Default, 0); - var status = uContext.Read(ref key1, ref output, Empty.Default, 99); + uContext.Upsert(ref key1, ref value, Empty.Default); + var status = uContext.Read(ref key1, ref output, Empty.Default); AssertCompleted(new(StatusCode.Found), status); // Verify the read data @@ -606,41 +606,6 @@ public void ReadWithoutInput([Values] DeviceType deviceType) } } - // Test the overload call of .Read (ref key, ref input, ref output, ref recordInfo, userContext: context) - [Test] - [Category("TsavoriteKV")] - [Category("Smoke")] - public void ReadWithoutSerialID() - { - // Just checking without Serial ID so one device type is enough - deviceType = DeviceType.MLSD; - - Setup(128, new LogSettings { MemorySizeBits = 29 }, deviceType); - uContext.BeginUnsafe(); - - try - { - InputStruct input = default; - OutputStruct output = default; - - var key1 = new KeyStruct { kfield1 = 13, kfield2 = 14 }; - var value = new ValueStruct { vfield1 = 23, vfield2 = 24 }; - - uContext.Upsert(ref key1, ref value, Empty.Default, 0); - var status = uContext.Read(ref key1, ref input, ref output, Empty.Default); - AssertCompleted(new(StatusCode.Found), status); - - Assert.AreEqual(value.vfield1, output.value.vfield1); - Assert.AreEqual(value.vfield2, output.value.vfield2); - Assert.AreEqual(key1.kfield1, 13); - Assert.AreEqual(key1.kfield2, 14); - } - finally - { - uContext.EndUnsafe(); - } - } - // Test the overload call of .Read (key) [Test] [Category("TsavoriteKV")] @@ -655,7 +620,7 @@ public void ReadBareMinParams([Values] DeviceType deviceType) var key1 = new KeyStruct { kfield1 = 13, kfield2 = 14 }; var value = new ValueStruct { vfield1 = 23, vfield2 = 24 }; - uContext.Upsert(ref key1, ref value, Empty.Default, 0); + uContext.Upsert(ref key1, ref value, Empty.Default); var (status, output) = uContext.Read(key1); AssertCompleted(new(StatusCode.Found), status);