FASTER/cs/test/DisposeTests.cs

719 строки
30 KiB
C#
Исходник Обычный вид История

[C#] FASTER v2 release (#563) * various changes from indexing work (#562) * various changes from indexing work - Add BeginAddress and EndAddress to scan iterators - Allow null deltaFileDevice in HybridLogCheckpointInfo.Recover - Rename FoldOverSnapshot to useFoldOverCheckpoint - Make TakeHybridLogCheckpoint overload call through to overload to avoid duplication - Add default values to new scanDelta and recoverTo arguments - Add missing checkpointManager.OnRecovery call to IntenralRecoverAsync - Fix some comments * Fix shortened name in test to work on Linux * [C#] Record-expiration support in RMW (#545) * Add support for record-expiration management to RMW and I(Advanced)Functions * Update Remote to RMW changes for expiration support * moving remote to IAdvFun * LogDir semantics - minor update Co-authored-by: Badrish Chandramouli <badrishc@microsoft.com> * [C#] Added PostCopyUpdater to IAdvancedFunctions (#561) * Add support for record-expiration management to RMW and I(Advanced)Functions * Update Remote to RMW changes for expiration support * Added PCU * Fixing testcase so that RMW does not expect old address. * Fix PCU bugs * Extend PostCopyUpdate to IFunctions; fix a few comments in remote Co-authored-by: TedHartMS <15467143+TedHartMS@users.noreply.github.com> * [C#] Merge IAdvancedFunctions into IFunctions (#565) * Merge IAdvancedFunctions into IFunctions * Add SupportsPostOperations and Post(IU|CU|SD); expand "ref RecordInfo recordInfo, long address" on Functions * Add RecordMetadata to RMWCompletionCallback params; improve ReadAddressTests * Add tests of Upsert with Input * [C#] RecordInfo v2 (#577) * RecordInfo v2 * fix version jump in CPR. * Updated misc stuff * misc updates to SpanByte * Remove IntExclLocker * Add Try APIs to record locking * Remove FASTERLegacy (#581) * Add Output parameter to Upsert (#574) * Add overloads of Upsert that take "ref Output" and one that takes "out RecordMetadata"; Fix RMW setting pendingContext.RecordInfo/LA; add locking of PostCopyUpdater, PostInitalUpdater, PostSingleWriter; * Reorganize ClientSession IntenralFasterSession to group functions for a given area (Read, Upsert, RMW, etc.) together * Fix locking on Post* calls * Fixes for Post* locking * remove net461 and netcoreapp2.1; add net6.0 in <Choose> to work on later in VS2022 * Update to new RecordInfo locking calls * Update to new IFunctions Locking signatures and RecordInfo implementation * Add post operations to Faster.benchmark * [C#] Checkpoint, Recovery, RecordInfo updates (#588) * Removed WAIT_PENDING * * Use only 1 bit for newVersion in RecordInfo, for CPR. Semantics are that sessions in v+1 will create records in fuzzy region with this bit set. Recovery only scans fuzzy region to elide such records. * Add 1 Filler bit for future use with fillers in records * Increase read lock bits to 6 (64 parallel readers) * Use dirty bit for incremental checkpoints * fix ycsb to not delete data file if we are using --recover * Fix epoch re-entry violation * Move to long versions, for KV checkpoints. * Shuffle around stuff for better cache alignment in benchmark. * Updates based on review * [C#] FasterLog Commit Optimization (v2) (#587) * Checkpoint work * Add notion of manual commit * Recovery of commit cookie * alternative design of log-cookie * Implementation improvement * code review comments * Cleanup + testing * Add management utility for LogCommitManager * Handle race on manual commit code path where not the latest tail is written out * Add condition to only scan log in fastCommitMode * Rough draft to allow for 1. elided commit record when fastCommit turned off and 2. "loose" commits * checkpoint changes * fix bug with readonly log allocator initialization * disable fast commit temporarily for CI * fix MLSD and mem device fast commit behavior * fix AzureStorageDevice exception type and remove self-termination on failure * test case on concurrent inserts * Re-enable epoch protection on CommitInternal * Ensure that full flush list error callbacks do not break FlushedUntilAddress tracking * Fix unclean shutdown of stress test * update device log test to scan until tail instead * change error code used for full flush list to better distinguish from others * Minor updates. Co-authored-by: Badrish Chandramouli <badrishc@microsoft.com> * Remove legacy local log commit manager * [C#] FasterLog v2 - misc changes, removed OverWrite commits (#593) * Checkin misc changes, removed overWrite commits * simplify OnRecovery logic * Fix build after merge * fix alignment of device commit manager * [C#] v2 pending flush list (#596) * Make PendingFlushList never error out in stressful situations. Current implementation uses lock for ~5-10% perf degradation over prior structure. * [C#] FasterLog v2: Fix FasterLog missed final commit (#597) * Fix FasterLog missed final commit. * [C#] Log compaction v2 (#598) * initial checkin * New ShiftBeginAddress behavior -- only shifts BeginAddress variable and does not truncate physical log unless option is specified. Also added Log.Truncate API for physical log truncation. Truncate log until persisted BeginAddress after taking a checkpoint. * Fix epoch protection orderings. * minor improvement to TestUtils to avoid race exception. * update Program.cs * updates from master. * [C#] V2 Custom Commit Strategy (#599) * Add FasterLogCommitStrategy * Use Bakery algorithm for latch * Documentation + tests + improved threading performance * Fix initialization error * Revert to v2 synchronization scheme * Optimization around commit strategies * Refactor CommitPolicy only for normal commits * fix missing spin wait * [C#] Fix v2 CommitPolicy Warnings (#607) * fix warnings * fix broken test * update for code consistency * Merged PR 59053: Network Stack Refactoring into FASTER This pull request contains the necessary changes for the updated network stack interface used by FASTER. It adds INetworkSender.cs and NetworkSenderBase.cs that can be used to implement custom communication protocols. Currently only TcpNetworkSender is supported. * Create .dockerignore * Added TentativeHeadAddress - we first shift this, and when all threads agree, we can do some pre-closing work such as eviction. Then we can shift the actual HeadAddress, closing pages when all threads agree on this. (#608) * Cleanup and remove dead code + reuse base provider. * Code cleanup * [C#] minor cleanup of fasterlog v2 (#611) * minor cleanup of fasterlog * [C#] Remove CheckpointType from CheckpointSettings (v2) (#614) * Remove CheckpointType from CheckpointSettings. Users have to specify checkpoint type on a per checkpoint basis. * fix build break * Fix CTT to call PostSingleWriter. * Avoid double init of FasterLog * [C#] Fixing warnings (#615) * Fixing CI warnings * [C#] Updating dependent package versions in v2 (#616) * Updating dependent package versions * nit * [C#] Improved FasterKV and FasterLog settings API for v2 (#618) * Simpler config API for v2. Move FasterLog to its own folder. * Remove purgeEarlierCommits from reader. Instead: 1. writer retries file deletes (in device commit manager) if access denied, in a loop, until timeout 2. reader (user code) retries recover async if it fails due to file deleted, until timeout * [C#] FasterLog V2 Device error handling (#612) * prototype device * prototype failure handling * Add proposed error handling code * Basic error handling tasks * Fault tolerant devices * Change to failure handler based approach instead of just throwing an exception * Remove brittle error handling code * make sure to read pages from flaky device on recovery in test * fix warnings * code review comments * See if we can enforce clean shutdown * Add extensions to enqueue SpanByte to FasterLog, and unsafely iterate without memory copy. (#621) * [C#] FasterLog v2 Add ability to explicitly terminate a log (#620) * Add ability to explicitly terminate a log * remove special 0-length return on eof * Add LogCompleted in iterator * Change comment and test * fix async iteration logic * fixes Co-authored-by: Badrish Chandramouli <badrishc@microsoft.com> * Maybe fix SVS issue with atomic reads (#622) * [C#] FasterLog v2 iteration fix (#623) * First pass of fixes * undo local change * [C#] Updated docs for FasterLog v2 (#624) * some updates * Add missing documentation * Update 40-fasterlog-basics.md Co-authored-by: Badrish Chandramouli <badrish@gmail.com> * Fix logic for directory delete timeouts. * Speed up testcases * [C#] Lockable Unsafe Context (LUC) in FasterKV v2 (WIP) (#605) * WIP on ManualFasterOperations * fixes for v2 merge * Updates to locking (still in progress) - Remove User-defined locks - Move SupportsLocking up to FasterKV level - Skip Stub and Sealed in iterators - Change PendingContext.OperationFlags from byte to ushort - Add ReadFlags.SkipCopyToTail - Add IsLocked*, TranferLocks methods to RecordInfo - Add UnsafeCompletePending* to ManualOps - Track lock counts in ManualOps and throw if Dispose() is called with locks or epoch held - Add LockInfo for ManualOps.*Lock - Implementation and testing of Faster operations with ManualOps locks - Fix ReadAddressTests to reflect improved consistency of not returning readcache addresses * Locking docs * Update 30-fasterkv-manual-locking.md * Updated doc to GH review and discussions * WIP for LockableRawContext * Existing tests run * Rename to LockableRawContext, IFasterContext * Perf workaround for LockTable.IsActive * WIP on ReadCacheEvict and MemoryPageLockEvictionScan * Add ReadCache and LockTable-transfer tests; move ReadCache tests out to their own sub-hierarchy * Test MemoryPageLockEvictionScan * Add testing for two-phase upsert/copytotail * Remove manual locking bits in Recovery; minor refactorings in Recovery.cs to reduce duplication * Add manual locking to FASTER.benchmark * More LockTable testing and fixes, mostly around ocking nonexistent key while Upsert/RMW/Deleting that key * Add UnsafeContext and make it the default for FASTER.Benchmark * Updates from code review: - IsLocked returns shared lock count (added test) - Fix location of IsIntermediate checks in RecordInfo.Lock/Seal - Remove unused IEqualityComparer in LockTableEntry * Rename Take(Full|Index|HybridLog)Checkpoint to TryInitiate(Full|Index|HybridLog)Checkpoint, so it is obvious they need to complete it * - Remove SupportsPostOperations; this is now always done - Add SingleDeleter for symmetry with Upsert - Add DisposeKey and DisposeValue * Add CopyWriter, to distinguish "maintentance" copying (CopyToTail or copy to ReadCache) from API-parameter copies * merge fixes * Remove obsolete Functions-level locking and postOps specifications * Fix Remote build Co-authored-by: Badrish Chandramouli <badrishc@microsoft.com> * fix semantic merge conflict in MemoryPageScanIterator (#632) * [C#] Add WriteReason parameter to SingleWriter (#630) * Add Functions.PostCopyWriter; update MemOnlyCache to use Post(Single|Copy)Writer * Remove (Post)CopyWriter and replace with WriteReason parameter to (Post)SingleWriter * Move SingleWriter "reason" parameter * Move ReadFlags and WriteReason to their own files; rename SupportsLocking -> DisableLocking with default 'false' * Update Remote to disableLocking name and default change * [C#] Various Fixes (#635) * Fixes: - Fixed WriteReason when CTT overrides ReadCache - make DisableLocking a readonly member - Call SetTentativeAtomic after Post* - Make readcache and comparer private with internal accessors for test - FIx intermittent failure of BasicHighLatencyDeviceTest * back out changes to move from internal -> private for FKV.readcache and .comparer * [C#] Remove StrictCPR (#636) * Removed WAIT_PENDING * StrictCPR removal WIP * Fix bug in state machine test, as it was not using unsafe context for fine grained control over the state machine execution. * Remove PendingContext.HeldLatch and heldOperation local * Revise FASTER.Benchmark to replace --noaff with --safectx and integrate this into Ycsb and SpanbyteYcsb * check epoch protection for complete pending * *UnsafeContext: AnyInstanceProtected -> ThisInstanceProtected Co-authored-by: TedHartMS <15467143+TedHartMS@users.noreply.github.com> * [C#] Support int session ID for FasterKV (#641) * Support int session ID for FasterKV * fix remote solution, minor name updates * update FasterLog API for TryEnqueue of custom header * [C#] IEntry interface for FasterLog (#639) * enqueue with entries prototype * Add IEntry tests and method variants * Address code review comments * Rename + read entries * Add async versions of consumer * Make interfaces top-level * Correct header offset in FasterLog new API * [C#] Recover returns version we recovered to (#648) * add to FasterLog SpanByte API * fix breaking tests * Fix dispose loop * Update FasterServerBase.cs * do not remove ioPendingRequests in RMWAsync if there was no disk request (#653) * [C#] [WIP] Status return code v2 (#638) * Prototype of status as struct * improving status a bit * fix build break, expose underlying (raw) status code to user * misc * Update StatusCode * Update Remote to new Status(Code); fix test cases; fix StatusCode layout; fine-tune Status(Code) names; make StatusCode internal * Update StatusCode and Status to final spec * Update Remote to new Status spec * unrelated nit Co-authored-by: TedHartMS <15467143+TedHartMS@users.noreply.github.com> * [C#] Change IFunctions 'address' parameter to UpdateInfo or ReadInfo (#652) * Add UpdateInfo and ReadInfo to IFunctions calls * Update Remote IFunctions implementations to UpdateInfo/ReadInfo changes Co-authored-by: Badrish Chandramouli <badrishc@microsoft.com> * Wire status into remote v2 (#657) Add NotFound API for status * Status naming changes and UpdateInfo structure split for v2 preview (#658) * [C#] Add Status.Record (#659) * Add Status.Record; update OperationStatus with all Advanced Status codes * Update Remote for status.Pending => .IsPending * Update nuspecs * more updates * Update azure-pipelines.yml * Update azure-pipelines.yml * revert windows-2022 in yml * Rename StatusCode.OK to Found (#662) * nit * update SpanByte with API to get pointer including metadata * Fixing ranges in OnPagesReadyToClose * [C#] Websocket bug-fixes (#663) * Fixed nits in websockets: * Clean disconnection * Support correction for large packets * Small nit for correcting message length * changed status to new FASTER status codes * Modified status codes Co-authored-by: Rohan Kadekodi <kadekodirohan@gmail.com> * Revert THA * nits * Improving cache tracker * fix NET5_0 to NET5_0_OR_GREATER * [C#] Add CompletePending[WithOutputs] to IFasterContext (#664) * Move CompletePending(WithOutputs) into IFasterContext * Skip LockEvictionObserver entirely if no LUCs active * Make Decrement interlocked; inline one accessor; revert CMakeLists.txt * [C#] Upgrade blob tests to Azurite, enable blob tests on Linux, use windows-2022 for CI (#666) * install azurite * Change testcase to make sure commit completed before dispose, it is up to user to ensure no ongoing commits at time of dispose. * [C#] UnsealPhysicalAddress fix (#665) * Fix unsealPA going below HA; return SUCCESS instead of NOTFOUND from normal reads that find an obsolete record in ITCTT * Ensure InternalLock calls require epoch protection * WIP: Spin wait on Pending Reads/RMWs until ClosedUntilAddress catches up. Still needs to handle partial page evictions. * Ensure partial ClosedUntilAddress shifts occur correctly. * [C#] Cancellation, ReadOptions, ReadFlags refactor (#668) * Add DeleteRecord and CancelOperation to *Info structures and IFunctions * Added ReadOptions * Move IFunctions methods' "ref RecordInfo" parameter to an *Info property, as it does not need to be updated * Update ReadFlags * ReadFlags fixes * Change XxxInfo.DeleteRecord/.CancelAction to XxxAction enum * Fixing Expiration tests * Add Phase to ExpirationTests * Add ReadOnly region to expiration tests * Delete and Upsert search down to HeadAddress if active LUC * [C#] Misc v2 fixes (#675) Fix misc bugs in v2 * update spanbyte * Yield thread when unable to reserve epoch entry, move iteration count outside table loop. * remove exception from overloaded lightepoch * Fix benchmark to run on .net 6 and linux. * fix another place * [C#] Improvements to LightEpoch * Use AllocateArray in LightEpoch * LightEpoch: Use two hash functions + linear probe, cache last successful probe per thread. Adjust table size based on number of machine processors. * [C#] Use GC.AllocateArray (#683) * Use GC.AllocateArray where possible * update benchmark as well. * Update buffer pool to use GC.AllocateArray * fix debug assert * Make DisposeSession protected in FasterServerBase. * Added SetBytesRead to IServerSession * - update sample .csprojs to target net6 and remove platform-related conditionals from all .csprojs now that we've moved to VS 2022 (#687) - add Status.Expired - update FASTER.client's copies of Status(Code).cs - Replace a TODO with an explanatory comment * Slight refactor of network stack. * Use GC.AllocateArray in SeaaBuffer * Another GC.AllocateArray substitution * [C#] [WIP] Wire disposal into IFunctions v2 (#685) * Add hook for failed CAS during SingleWriter. Still need to support other failed CAS scenarios. * Implement Dispose() functions - (MemoryLogCompactionTests fails at this time) * Fix MemoryLogCompactionTests; move DisposeDeserializedFromDisk up to ICPRFC Co-authored-by: TedHartMS <15467143+TedHartMS@users.noreply.github.com> Co-authored-by: Ted Hart <15467143+TedHartMS@users.noreply.github.com> Co-authored-by: Tianyu Li <litianyu@mit.edu> Co-authored-by: Vasileios Zois <vazois@microsoft.com> Co-authored-by: Sebastian Burckhardt <sburckha@microsoft.com> Co-authored-by: rohankadekodi-msr <69916400+rohankadekodi-msr@users.noreply.github.com> Co-authored-by: Rohan Kadekodi <kadekodirohan@gmail.com>
2022-04-14 02:03:35 +03:00
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
#if false
[C#] FASTER v2 release (#563) * various changes from indexing work (#562) * various changes from indexing work - Add BeginAddress and EndAddress to scan iterators - Allow null deltaFileDevice in HybridLogCheckpointInfo.Recover - Rename FoldOverSnapshot to useFoldOverCheckpoint - Make TakeHybridLogCheckpoint overload call through to overload to avoid duplication - Add default values to new scanDelta and recoverTo arguments - Add missing checkpointManager.OnRecovery call to IntenralRecoverAsync - Fix some comments * Fix shortened name in test to work on Linux * [C#] Record-expiration support in RMW (#545) * Add support for record-expiration management to RMW and I(Advanced)Functions * Update Remote to RMW changes for expiration support * moving remote to IAdvFun * LogDir semantics - minor update Co-authored-by: Badrish Chandramouli <badrishc@microsoft.com> * [C#] Added PostCopyUpdater to IAdvancedFunctions (#561) * Add support for record-expiration management to RMW and I(Advanced)Functions * Update Remote to RMW changes for expiration support * Added PCU * Fixing testcase so that RMW does not expect old address. * Fix PCU bugs * Extend PostCopyUpdate to IFunctions; fix a few comments in remote Co-authored-by: TedHartMS <15467143+TedHartMS@users.noreply.github.com> * [C#] Merge IAdvancedFunctions into IFunctions (#565) * Merge IAdvancedFunctions into IFunctions * Add SupportsPostOperations and Post(IU|CU|SD); expand "ref RecordInfo recordInfo, long address" on Functions * Add RecordMetadata to RMWCompletionCallback params; improve ReadAddressTests * Add tests of Upsert with Input * [C#] RecordInfo v2 (#577) * RecordInfo v2 * fix version jump in CPR. * Updated misc stuff * misc updates to SpanByte * Remove IntExclLocker * Add Try APIs to record locking * Remove FASTERLegacy (#581) * Add Output parameter to Upsert (#574) * Add overloads of Upsert that take "ref Output" and one that takes "out RecordMetadata"; Fix RMW setting pendingContext.RecordInfo/LA; add locking of PostCopyUpdater, PostInitalUpdater, PostSingleWriter; * Reorganize ClientSession IntenralFasterSession to group functions for a given area (Read, Upsert, RMW, etc.) together * Fix locking on Post* calls * Fixes for Post* locking * remove net461 and netcoreapp2.1; add net6.0 in <Choose> to work on later in VS2022 * Update to new RecordInfo locking calls * Update to new IFunctions Locking signatures and RecordInfo implementation * Add post operations to Faster.benchmark * [C#] Checkpoint, Recovery, RecordInfo updates (#588) * Removed WAIT_PENDING * * Use only 1 bit for newVersion in RecordInfo, for CPR. Semantics are that sessions in v+1 will create records in fuzzy region with this bit set. Recovery only scans fuzzy region to elide such records. * Add 1 Filler bit for future use with fillers in records * Increase read lock bits to 6 (64 parallel readers) * Use dirty bit for incremental checkpoints * fix ycsb to not delete data file if we are using --recover * Fix epoch re-entry violation * Move to long versions, for KV checkpoints. * Shuffle around stuff for better cache alignment in benchmark. * Updates based on review * [C#] FasterLog Commit Optimization (v2) (#587) * Checkpoint work * Add notion of manual commit * Recovery of commit cookie * alternative design of log-cookie * Implementation improvement * code review comments * Cleanup + testing * Add management utility for LogCommitManager * Handle race on manual commit code path where not the latest tail is written out * Add condition to only scan log in fastCommitMode * Rough draft to allow for 1. elided commit record when fastCommit turned off and 2. "loose" commits * checkpoint changes * fix bug with readonly log allocator initialization * disable fast commit temporarily for CI * fix MLSD and mem device fast commit behavior * fix AzureStorageDevice exception type and remove self-termination on failure * test case on concurrent inserts * Re-enable epoch protection on CommitInternal * Ensure that full flush list error callbacks do not break FlushedUntilAddress tracking * Fix unclean shutdown of stress test * update device log test to scan until tail instead * change error code used for full flush list to better distinguish from others * Minor updates. Co-authored-by: Badrish Chandramouli <badrishc@microsoft.com> * Remove legacy local log commit manager * [C#] FasterLog v2 - misc changes, removed OverWrite commits (#593) * Checkin misc changes, removed overWrite commits * simplify OnRecovery logic * Fix build after merge * fix alignment of device commit manager * [C#] v2 pending flush list (#596) * Make PendingFlushList never error out in stressful situations. Current implementation uses lock for ~5-10% perf degradation over prior structure. * [C#] FasterLog v2: Fix FasterLog missed final commit (#597) * Fix FasterLog missed final commit. * [C#] Log compaction v2 (#598) * initial checkin * New ShiftBeginAddress behavior -- only shifts BeginAddress variable and does not truncate physical log unless option is specified. Also added Log.Truncate API for physical log truncation. Truncate log until persisted BeginAddress after taking a checkpoint. * Fix epoch protection orderings. * minor improvement to TestUtils to avoid race exception. * update Program.cs * updates from master. * [C#] V2 Custom Commit Strategy (#599) * Add FasterLogCommitStrategy * Use Bakery algorithm for latch * Documentation + tests + improved threading performance * Fix initialization error * Revert to v2 synchronization scheme * Optimization around commit strategies * Refactor CommitPolicy only for normal commits * fix missing spin wait * [C#] Fix v2 CommitPolicy Warnings (#607) * fix warnings * fix broken test * update for code consistency * Merged PR 59053: Network Stack Refactoring into FASTER This pull request contains the necessary changes for the updated network stack interface used by FASTER. It adds INetworkSender.cs and NetworkSenderBase.cs that can be used to implement custom communication protocols. Currently only TcpNetworkSender is supported. * Create .dockerignore * Added TentativeHeadAddress - we first shift this, and when all threads agree, we can do some pre-closing work such as eviction. Then we can shift the actual HeadAddress, closing pages when all threads agree on this. (#608) * Cleanup and remove dead code + reuse base provider. * Code cleanup * [C#] minor cleanup of fasterlog v2 (#611) * minor cleanup of fasterlog * [C#] Remove CheckpointType from CheckpointSettings (v2) (#614) * Remove CheckpointType from CheckpointSettings. Users have to specify checkpoint type on a per checkpoint basis. * fix build break * Fix CTT to call PostSingleWriter. * Avoid double init of FasterLog * [C#] Fixing warnings (#615) * Fixing CI warnings * [C#] Updating dependent package versions in v2 (#616) * Updating dependent package versions * nit * [C#] Improved FasterKV and FasterLog settings API for v2 (#618) * Simpler config API for v2. Move FasterLog to its own folder. * Remove purgeEarlierCommits from reader. Instead: 1. writer retries file deletes (in device commit manager) if access denied, in a loop, until timeout 2. reader (user code) retries recover async if it fails due to file deleted, until timeout * [C#] FasterLog V2 Device error handling (#612) * prototype device * prototype failure handling * Add proposed error handling code * Basic error handling tasks * Fault tolerant devices * Change to failure handler based approach instead of just throwing an exception * Remove brittle error handling code * make sure to read pages from flaky device on recovery in test * fix warnings * code review comments * See if we can enforce clean shutdown * Add extensions to enqueue SpanByte to FasterLog, and unsafely iterate without memory copy. (#621) * [C#] FasterLog v2 Add ability to explicitly terminate a log (#620) * Add ability to explicitly terminate a log * remove special 0-length return on eof * Add LogCompleted in iterator * Change comment and test * fix async iteration logic * fixes Co-authored-by: Badrish Chandramouli <badrishc@microsoft.com> * Maybe fix SVS issue with atomic reads (#622) * [C#] FasterLog v2 iteration fix (#623) * First pass of fixes * undo local change * [C#] Updated docs for FasterLog v2 (#624) * some updates * Add missing documentation * Update 40-fasterlog-basics.md Co-authored-by: Badrish Chandramouli <badrish@gmail.com> * Fix logic for directory delete timeouts. * Speed up testcases * [C#] Lockable Unsafe Context (LUC) in FasterKV v2 (WIP) (#605) * WIP on ManualFasterOperations * fixes for v2 merge * Updates to locking (still in progress) - Remove User-defined locks - Move SupportsLocking up to FasterKV level - Skip Stub and Sealed in iterators - Change PendingContext.OperationFlags from byte to ushort - Add ReadFlags.SkipCopyToTail - Add IsLocked*, TranferLocks methods to RecordInfo - Add UnsafeCompletePending* to ManualOps - Track lock counts in ManualOps and throw if Dispose() is called with locks or epoch held - Add LockInfo for ManualOps.*Lock - Implementation and testing of Faster operations with ManualOps locks - Fix ReadAddressTests to reflect improved consistency of not returning readcache addresses * Locking docs * Update 30-fasterkv-manual-locking.md * Updated doc to GH review and discussions * WIP for LockableRawContext * Existing tests run * Rename to LockableRawContext, IFasterContext * Perf workaround for LockTable.IsActive * WIP on ReadCacheEvict and MemoryPageLockEvictionScan * Add ReadCache and LockTable-transfer tests; move ReadCache tests out to their own sub-hierarchy * Test MemoryPageLockEvictionScan * Add testing for two-phase upsert/copytotail * Remove manual locking bits in Recovery; minor refactorings in Recovery.cs to reduce duplication * Add manual locking to FASTER.benchmark * More LockTable testing and fixes, mostly around ocking nonexistent key while Upsert/RMW/Deleting that key * Add UnsafeContext and make it the default for FASTER.Benchmark * Updates from code review: - IsLocked returns shared lock count (added test) - Fix location of IsIntermediate checks in RecordInfo.Lock/Seal - Remove unused IEqualityComparer in LockTableEntry * Rename Take(Full|Index|HybridLog)Checkpoint to TryInitiate(Full|Index|HybridLog)Checkpoint, so it is obvious they need to complete it * - Remove SupportsPostOperations; this is now always done - Add SingleDeleter for symmetry with Upsert - Add DisposeKey and DisposeValue * Add CopyWriter, to distinguish "maintentance" copying (CopyToTail or copy to ReadCache) from API-parameter copies * merge fixes * Remove obsolete Functions-level locking and postOps specifications * Fix Remote build Co-authored-by: Badrish Chandramouli <badrishc@microsoft.com> * fix semantic merge conflict in MemoryPageScanIterator (#632) * [C#] Add WriteReason parameter to SingleWriter (#630) * Add Functions.PostCopyWriter; update MemOnlyCache to use Post(Single|Copy)Writer * Remove (Post)CopyWriter and replace with WriteReason parameter to (Post)SingleWriter * Move SingleWriter "reason" parameter * Move ReadFlags and WriteReason to their own files; rename SupportsLocking -> DisableLocking with default 'false' * Update Remote to disableLocking name and default change * [C#] Various Fixes (#635) * Fixes: - Fixed WriteReason when CTT overrides ReadCache - make DisableLocking a readonly member - Call SetTentativeAtomic after Post* - Make readcache and comparer private with internal accessors for test - FIx intermittent failure of BasicHighLatencyDeviceTest * back out changes to move from internal -> private for FKV.readcache and .comparer * [C#] Remove StrictCPR (#636) * Removed WAIT_PENDING * StrictCPR removal WIP * Fix bug in state machine test, as it was not using unsafe context for fine grained control over the state machine execution. * Remove PendingContext.HeldLatch and heldOperation local * Revise FASTER.Benchmark to replace --noaff with --safectx and integrate this into Ycsb and SpanbyteYcsb * check epoch protection for complete pending * *UnsafeContext: AnyInstanceProtected -> ThisInstanceProtected Co-authored-by: TedHartMS <15467143+TedHartMS@users.noreply.github.com> * [C#] Support int session ID for FasterKV (#641) * Support int session ID for FasterKV * fix remote solution, minor name updates * update FasterLog API for TryEnqueue of custom header * [C#] IEntry interface for FasterLog (#639) * enqueue with entries prototype * Add IEntry tests and method variants * Address code review comments * Rename + read entries * Add async versions of consumer * Make interfaces top-level * Correct header offset in FasterLog new API * [C#] Recover returns version we recovered to (#648) * add to FasterLog SpanByte API * fix breaking tests * Fix dispose loop * Update FasterServerBase.cs * do not remove ioPendingRequests in RMWAsync if there was no disk request (#653) * [C#] [WIP] Status return code v2 (#638) * Prototype of status as struct * improving status a bit * fix build break, expose underlying (raw) status code to user * misc * Update StatusCode * Update Remote to new Status(Code); fix test cases; fix StatusCode layout; fine-tune Status(Code) names; make StatusCode internal * Update StatusCode and Status to final spec * Update Remote to new Status spec * unrelated nit Co-authored-by: TedHartMS <15467143+TedHartMS@users.noreply.github.com> * [C#] Change IFunctions 'address' parameter to UpdateInfo or ReadInfo (#652) * Add UpdateInfo and ReadInfo to IFunctions calls * Update Remote IFunctions implementations to UpdateInfo/ReadInfo changes Co-authored-by: Badrish Chandramouli <badrishc@microsoft.com> * Wire status into remote v2 (#657) Add NotFound API for status * Status naming changes and UpdateInfo structure split for v2 preview (#658) * [C#] Add Status.Record (#659) * Add Status.Record; update OperationStatus with all Advanced Status codes * Update Remote for status.Pending => .IsPending * Update nuspecs * more updates * Update azure-pipelines.yml * Update azure-pipelines.yml * revert windows-2022 in yml * Rename StatusCode.OK to Found (#662) * nit * update SpanByte with API to get pointer including metadata * Fixing ranges in OnPagesReadyToClose * [C#] Websocket bug-fixes (#663) * Fixed nits in websockets: * Clean disconnection * Support correction for large packets * Small nit for correcting message length * changed status to new FASTER status codes * Modified status codes Co-authored-by: Rohan Kadekodi <kadekodirohan@gmail.com> * Revert THA * nits * Improving cache tracker * fix NET5_0 to NET5_0_OR_GREATER * [C#] Add CompletePending[WithOutputs] to IFasterContext (#664) * Move CompletePending(WithOutputs) into IFasterContext * Skip LockEvictionObserver entirely if no LUCs active * Make Decrement interlocked; inline one accessor; revert CMakeLists.txt * [C#] Upgrade blob tests to Azurite, enable blob tests on Linux, use windows-2022 for CI (#666) * install azurite * Change testcase to make sure commit completed before dispose, it is up to user to ensure no ongoing commits at time of dispose. * [C#] UnsealPhysicalAddress fix (#665) * Fix unsealPA going below HA; return SUCCESS instead of NOTFOUND from normal reads that find an obsolete record in ITCTT * Ensure InternalLock calls require epoch protection * WIP: Spin wait on Pending Reads/RMWs until ClosedUntilAddress catches up. Still needs to handle partial page evictions. * Ensure partial ClosedUntilAddress shifts occur correctly. * [C#] Cancellation, ReadOptions, ReadFlags refactor (#668) * Add DeleteRecord and CancelOperation to *Info structures and IFunctions * Added ReadOptions * Move IFunctions methods' "ref RecordInfo" parameter to an *Info property, as it does not need to be updated * Update ReadFlags * ReadFlags fixes * Change XxxInfo.DeleteRecord/.CancelAction to XxxAction enum * Fixing Expiration tests * Add Phase to ExpirationTests * Add ReadOnly region to expiration tests * Delete and Upsert search down to HeadAddress if active LUC * [C#] Misc v2 fixes (#675) Fix misc bugs in v2 * update spanbyte * Yield thread when unable to reserve epoch entry, move iteration count outside table loop. * remove exception from overloaded lightepoch * Fix benchmark to run on .net 6 and linux. * fix another place * [C#] Improvements to LightEpoch * Use AllocateArray in LightEpoch * LightEpoch: Use two hash functions + linear probe, cache last successful probe per thread. Adjust table size based on number of machine processors. * [C#] Use GC.AllocateArray (#683) * Use GC.AllocateArray where possible * update benchmark as well. * Update buffer pool to use GC.AllocateArray * fix debug assert * Make DisposeSession protected in FasterServerBase. * Added SetBytesRead to IServerSession * - update sample .csprojs to target net6 and remove platform-related conditionals from all .csprojs now that we've moved to VS 2022 (#687) - add Status.Expired - update FASTER.client's copies of Status(Code).cs - Replace a TODO with an explanatory comment * Slight refactor of network stack. * Use GC.AllocateArray in SeaaBuffer * Another GC.AllocateArray substitution * [C#] [WIP] Wire disposal into IFunctions v2 (#685) * Add hook for failed CAS during SingleWriter. Still need to support other failed CAS scenarios. * Implement Dispose() functions - (MemoryLogCompactionTests fails at this time) * Fix MemoryLogCompactionTests; move DisposeDeserializedFromDisk up to ICPRFC Co-authored-by: TedHartMS <15467143+TedHartMS@users.noreply.github.com> Co-authored-by: Ted Hart <15467143+TedHartMS@users.noreply.github.com> Co-authored-by: Tianyu Li <litianyu@mit.edu> Co-authored-by: Vasileios Zois <vazois@microsoft.com> Co-authored-by: Sebastian Burckhardt <sburckha@microsoft.com> Co-authored-by: rohankadekodi-msr <69916400+rohankadekodi-msr@users.noreply.github.com> Co-authored-by: Rohan Kadekodi <kadekodirohan@gmail.com>
2022-04-14 02:03:35 +03:00
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
using FASTER.core;
using NUnit.Framework;
using static FASTER.test.TestUtils;
namespace FASTER.test.Dispose
{
[TestFixture]
internal class DisposeTests
{
// MyKey and MyValue are classes; we want to be sure we are getting the right Keys and Values to Dispose().
private FasterKV<MyKey, MyValue> fht;
private IDevice log, objlog;
// Events to coordinate forcing CAS failure (by appending a new item), etc.
private SemaphoreSlim sutGate; // Session Under Test
private SemaphoreSlim otherGate; // Other session that inserts a colliding value
[SetUp]
public void Setup()
{
DeleteDirectory(MethodTestDir, wait: true);
sutGate = new(0);
otherGate = new(0);
log = Devices.CreateLogDevice(MethodTestDir + "/ObjectFASTERTests.log", deleteOnClose: true);
objlog = Devices.CreateLogDevice(MethodTestDir + "/ObjectFASTERTests.obj.log", deleteOnClose: true);
LogSettings logSettings = new () { LogDevice = log, ObjectLogDevice = objlog, MutableFraction = 0.1, MemorySizeBits = 15, PageSizeBits = 10 };
foreach (var arg in TestContext.CurrentContext.Test.Arguments)
{
if (arg is ReadCopyDestination dest)
{
if (dest == ReadCopyDestination.ReadCache)
logSettings.ReadCacheSettings = new() { PageSizeBits = 12, MemorySizeBits = 22 };
break;
}
}
fht = new FasterKV<MyKey, MyValue>(128, logSettings: logSettings, comparer: new MyKeyComparer(),
serializerSettings: new SerializerSettings<MyKey, MyValue> { keySerializer = () => new MyKeySerializer(), valueSerializer = () => new MyValueSerializer() }
);
}
[TearDown]
public void TearDown()
{
fht?.Dispose();
fht = null;
log?.Dispose();
log = null;
objlog?.Dispose();
objlog = null;
DeleteDirectory(MethodTestDir);
}
// This is passed to the FasterKV ctor to override the default one. This lets us use a different key for the colliding
// CAS; we can't use the same key because Readonly-region handling in the first session Seals the to-be-transferred record,
// so the second session would loop forever while the first session waits for the collision to be written.
class MyKeyComparer : IFasterEqualityComparer<MyKey>
{
public long GetHashCode64(ref MyKey key) => Utility.GetHashCode(key.key % TestKey);
public bool Equals(ref MyKey k1, ref MyKey k2) => k1.key == k2.key;
}
const int TestKey = 111;
const int TestCollidingKey = TestKey * 2;
const int TestCollidingKey2 = TestKey * 3;
const int TestInitialValue = 3333;
const int TestUpdatedValue = 5555;
const int TestCollidingValue = 7777;
const int TestCollidingValue2 = 9999;
internal enum DisposeHandler
{
None,
SingleWriter,
CopyUpdater,
InitialUpdater,
SingleDeleter,
DeserializedFromDisk,
}
public class DisposeFunctions : FunctionsBase<MyKey, MyValue, MyInput, MyOutput, Empty>
{
private readonly DisposeTests tester;
internal readonly bool isSUT; // IsSessionUnderTest
internal Queue<DisposeHandler> handlerQueue = new();
private bool isRetry;
private bool isSplice;
internal DisposeFunctions(DisposeTests tester, bool sut, bool splice = false)
{
this.tester = tester;
isSUT = sut;
isSplice = splice;
}
void WaitForEvent()
{
if (isSUT)
{
MyKey key = new() { key = TestKey };
tester.fht.FindKey(ref key, out var entry);
var address = entry.Address;
if (isSplice)
{
// There should be one readcache entry for this test.
Assert.IsTrue(new HashBucketEntry() { word = entry.Address }.ReadCache);
Assert.GreaterOrEqual(address, tester.fht.ReadCache.HeadAddress);
var physicalAddress = tester.fht.readcache.GetPhysicalAddress(entry.AbsoluteAddress);
[C#] FASTER v2 release (#563) * various changes from indexing work (#562) * various changes from indexing work - Add BeginAddress and EndAddress to scan iterators - Allow null deltaFileDevice in HybridLogCheckpointInfo.Recover - Rename FoldOverSnapshot to useFoldOverCheckpoint - Make TakeHybridLogCheckpoint overload call through to overload to avoid duplication - Add default values to new scanDelta and recoverTo arguments - Add missing checkpointManager.OnRecovery call to IntenralRecoverAsync - Fix some comments * Fix shortened name in test to work on Linux * [C#] Record-expiration support in RMW (#545) * Add support for record-expiration management to RMW and I(Advanced)Functions * Update Remote to RMW changes for expiration support * moving remote to IAdvFun * LogDir semantics - minor update Co-authored-by: Badrish Chandramouli <badrishc@microsoft.com> * [C#] Added PostCopyUpdater to IAdvancedFunctions (#561) * Add support for record-expiration management to RMW and I(Advanced)Functions * Update Remote to RMW changes for expiration support * Added PCU * Fixing testcase so that RMW does not expect old address. * Fix PCU bugs * Extend PostCopyUpdate to IFunctions; fix a few comments in remote Co-authored-by: TedHartMS <15467143+TedHartMS@users.noreply.github.com> * [C#] Merge IAdvancedFunctions into IFunctions (#565) * Merge IAdvancedFunctions into IFunctions * Add SupportsPostOperations and Post(IU|CU|SD); expand "ref RecordInfo recordInfo, long address" on Functions * Add RecordMetadata to RMWCompletionCallback params; improve ReadAddressTests * Add tests of Upsert with Input * [C#] RecordInfo v2 (#577) * RecordInfo v2 * fix version jump in CPR. * Updated misc stuff * misc updates to SpanByte * Remove IntExclLocker * Add Try APIs to record locking * Remove FASTERLegacy (#581) * Add Output parameter to Upsert (#574) * Add overloads of Upsert that take "ref Output" and one that takes "out RecordMetadata"; Fix RMW setting pendingContext.RecordInfo/LA; add locking of PostCopyUpdater, PostInitalUpdater, PostSingleWriter; * Reorganize ClientSession IntenralFasterSession to group functions for a given area (Read, Upsert, RMW, etc.) together * Fix locking on Post* calls * Fixes for Post* locking * remove net461 and netcoreapp2.1; add net6.0 in <Choose> to work on later in VS2022 * Update to new RecordInfo locking calls * Update to new IFunctions Locking signatures and RecordInfo implementation * Add post operations to Faster.benchmark * [C#] Checkpoint, Recovery, RecordInfo updates (#588) * Removed WAIT_PENDING * * Use only 1 bit for newVersion in RecordInfo, for CPR. Semantics are that sessions in v+1 will create records in fuzzy region with this bit set. Recovery only scans fuzzy region to elide such records. * Add 1 Filler bit for future use with fillers in records * Increase read lock bits to 6 (64 parallel readers) * Use dirty bit for incremental checkpoints * fix ycsb to not delete data file if we are using --recover * Fix epoch re-entry violation * Move to long versions, for KV checkpoints. * Shuffle around stuff for better cache alignment in benchmark. * Updates based on review * [C#] FasterLog Commit Optimization (v2) (#587) * Checkpoint work * Add notion of manual commit * Recovery of commit cookie * alternative design of log-cookie * Implementation improvement * code review comments * Cleanup + testing * Add management utility for LogCommitManager * Handle race on manual commit code path where not the latest tail is written out * Add condition to only scan log in fastCommitMode * Rough draft to allow for 1. elided commit record when fastCommit turned off and 2. "loose" commits * checkpoint changes * fix bug with readonly log allocator initialization * disable fast commit temporarily for CI * fix MLSD and mem device fast commit behavior * fix AzureStorageDevice exception type and remove self-termination on failure * test case on concurrent inserts * Re-enable epoch protection on CommitInternal * Ensure that full flush list error callbacks do not break FlushedUntilAddress tracking * Fix unclean shutdown of stress test * update device log test to scan until tail instead * change error code used for full flush list to better distinguish from others * Minor updates. Co-authored-by: Badrish Chandramouli <badrishc@microsoft.com> * Remove legacy local log commit manager * [C#] FasterLog v2 - misc changes, removed OverWrite commits (#593) * Checkin misc changes, removed overWrite commits * simplify OnRecovery logic * Fix build after merge * fix alignment of device commit manager * [C#] v2 pending flush list (#596) * Make PendingFlushList never error out in stressful situations. Current implementation uses lock for ~5-10% perf degradation over prior structure. * [C#] FasterLog v2: Fix FasterLog missed final commit (#597) * Fix FasterLog missed final commit. * [C#] Log compaction v2 (#598) * initial checkin * New ShiftBeginAddress behavior -- only shifts BeginAddress variable and does not truncate physical log unless option is specified. Also added Log.Truncate API for physical log truncation. Truncate log until persisted BeginAddress after taking a checkpoint. * Fix epoch protection orderings. * minor improvement to TestUtils to avoid race exception. * update Program.cs * updates from master. * [C#] V2 Custom Commit Strategy (#599) * Add FasterLogCommitStrategy * Use Bakery algorithm for latch * Documentation + tests + improved threading performance * Fix initialization error * Revert to v2 synchronization scheme * Optimization around commit strategies * Refactor CommitPolicy only for normal commits * fix missing spin wait * [C#] Fix v2 CommitPolicy Warnings (#607) * fix warnings * fix broken test * update for code consistency * Merged PR 59053: Network Stack Refactoring into FASTER This pull request contains the necessary changes for the updated network stack interface used by FASTER. It adds INetworkSender.cs and NetworkSenderBase.cs that can be used to implement custom communication protocols. Currently only TcpNetworkSender is supported. * Create .dockerignore * Added TentativeHeadAddress - we first shift this, and when all threads agree, we can do some pre-closing work such as eviction. Then we can shift the actual HeadAddress, closing pages when all threads agree on this. (#608) * Cleanup and remove dead code + reuse base provider. * Code cleanup * [C#] minor cleanup of fasterlog v2 (#611) * minor cleanup of fasterlog * [C#] Remove CheckpointType from CheckpointSettings (v2) (#614) * Remove CheckpointType from CheckpointSettings. Users have to specify checkpoint type on a per checkpoint basis. * fix build break * Fix CTT to call PostSingleWriter. * Avoid double init of FasterLog * [C#] Fixing warnings (#615) * Fixing CI warnings * [C#] Updating dependent package versions in v2 (#616) * Updating dependent package versions * nit * [C#] Improved FasterKV and FasterLog settings API for v2 (#618) * Simpler config API for v2. Move FasterLog to its own folder. * Remove purgeEarlierCommits from reader. Instead: 1. writer retries file deletes (in device commit manager) if access denied, in a loop, until timeout 2. reader (user code) retries recover async if it fails due to file deleted, until timeout * [C#] FasterLog V2 Device error handling (#612) * prototype device * prototype failure handling * Add proposed error handling code * Basic error handling tasks * Fault tolerant devices * Change to failure handler based approach instead of just throwing an exception * Remove brittle error handling code * make sure to read pages from flaky device on recovery in test * fix warnings * code review comments * See if we can enforce clean shutdown * Add extensions to enqueue SpanByte to FasterLog, and unsafely iterate without memory copy. (#621) * [C#] FasterLog v2 Add ability to explicitly terminate a log (#620) * Add ability to explicitly terminate a log * remove special 0-length return on eof * Add LogCompleted in iterator * Change comment and test * fix async iteration logic * fixes Co-authored-by: Badrish Chandramouli <badrishc@microsoft.com> * Maybe fix SVS issue with atomic reads (#622) * [C#] FasterLog v2 iteration fix (#623) * First pass of fixes * undo local change * [C#] Updated docs for FasterLog v2 (#624) * some updates * Add missing documentation * Update 40-fasterlog-basics.md Co-authored-by: Badrish Chandramouli <badrish@gmail.com> * Fix logic for directory delete timeouts. * Speed up testcases * [C#] Lockable Unsafe Context (LUC) in FasterKV v2 (WIP) (#605) * WIP on ManualFasterOperations * fixes for v2 merge * Updates to locking (still in progress) - Remove User-defined locks - Move SupportsLocking up to FasterKV level - Skip Stub and Sealed in iterators - Change PendingContext.OperationFlags from byte to ushort - Add ReadFlags.SkipCopyToTail - Add IsLocked*, TranferLocks methods to RecordInfo - Add UnsafeCompletePending* to ManualOps - Track lock counts in ManualOps and throw if Dispose() is called with locks or epoch held - Add LockInfo for ManualOps.*Lock - Implementation and testing of Faster operations with ManualOps locks - Fix ReadAddressTests to reflect improved consistency of not returning readcache addresses * Locking docs * Update 30-fasterkv-manual-locking.md * Updated doc to GH review and discussions * WIP for LockableRawContext * Existing tests run * Rename to LockableRawContext, IFasterContext * Perf workaround for LockTable.IsActive * WIP on ReadCacheEvict and MemoryPageLockEvictionScan * Add ReadCache and LockTable-transfer tests; move ReadCache tests out to their own sub-hierarchy * Test MemoryPageLockEvictionScan * Add testing for two-phase upsert/copytotail * Remove manual locking bits in Recovery; minor refactorings in Recovery.cs to reduce duplication * Add manual locking to FASTER.benchmark * More LockTable testing and fixes, mostly around ocking nonexistent key while Upsert/RMW/Deleting that key * Add UnsafeContext and make it the default for FASTER.Benchmark * Updates from code review: - IsLocked returns shared lock count (added test) - Fix location of IsIntermediate checks in RecordInfo.Lock/Seal - Remove unused IEqualityComparer in LockTableEntry * Rename Take(Full|Index|HybridLog)Checkpoint to TryInitiate(Full|Index|HybridLog)Checkpoint, so it is obvious they need to complete it * - Remove SupportsPostOperations; this is now always done - Add SingleDeleter for symmetry with Upsert - Add DisposeKey and DisposeValue * Add CopyWriter, to distinguish "maintentance" copying (CopyToTail or copy to ReadCache) from API-parameter copies * merge fixes * Remove obsolete Functions-level locking and postOps specifications * Fix Remote build Co-authored-by: Badrish Chandramouli <badrishc@microsoft.com> * fix semantic merge conflict in MemoryPageScanIterator (#632) * [C#] Add WriteReason parameter to SingleWriter (#630) * Add Functions.PostCopyWriter; update MemOnlyCache to use Post(Single|Copy)Writer * Remove (Post)CopyWriter and replace with WriteReason parameter to (Post)SingleWriter * Move SingleWriter "reason" parameter * Move ReadFlags and WriteReason to their own files; rename SupportsLocking -> DisableLocking with default 'false' * Update Remote to disableLocking name and default change * [C#] Various Fixes (#635) * Fixes: - Fixed WriteReason when CTT overrides ReadCache - make DisableLocking a readonly member - Call SetTentativeAtomic after Post* - Make readcache and comparer private with internal accessors for test - FIx intermittent failure of BasicHighLatencyDeviceTest * back out changes to move from internal -> private for FKV.readcache and .comparer * [C#] Remove StrictCPR (#636) * Removed WAIT_PENDING * StrictCPR removal WIP * Fix bug in state machine test, as it was not using unsafe context for fine grained control over the state machine execution. * Remove PendingContext.HeldLatch and heldOperation local * Revise FASTER.Benchmark to replace --noaff with --safectx and integrate this into Ycsb and SpanbyteYcsb * check epoch protection for complete pending * *UnsafeContext: AnyInstanceProtected -> ThisInstanceProtected Co-authored-by: TedHartMS <15467143+TedHartMS@users.noreply.github.com> * [C#] Support int session ID for FasterKV (#641) * Support int session ID for FasterKV * fix remote solution, minor name updates * update FasterLog API for TryEnqueue of custom header * [C#] IEntry interface for FasterLog (#639) * enqueue with entries prototype * Add IEntry tests and method variants * Address code review comments * Rename + read entries * Add async versions of consumer * Make interfaces top-level * Correct header offset in FasterLog new API * [C#] Recover returns version we recovered to (#648) * add to FasterLog SpanByte API * fix breaking tests * Fix dispose loop * Update FasterServerBase.cs * do not remove ioPendingRequests in RMWAsync if there was no disk request (#653) * [C#] [WIP] Status return code v2 (#638) * Prototype of status as struct * improving status a bit * fix build break, expose underlying (raw) status code to user * misc * Update StatusCode * Update Remote to new Status(Code); fix test cases; fix StatusCode layout; fine-tune Status(Code) names; make StatusCode internal * Update StatusCode and Status to final spec * Update Remote to new Status spec * unrelated nit Co-authored-by: TedHartMS <15467143+TedHartMS@users.noreply.github.com> * [C#] Change IFunctions 'address' parameter to UpdateInfo or ReadInfo (#652) * Add UpdateInfo and ReadInfo to IFunctions calls * Update Remote IFunctions implementations to UpdateInfo/ReadInfo changes Co-authored-by: Badrish Chandramouli <badrishc@microsoft.com> * Wire status into remote v2 (#657) Add NotFound API for status * Status naming changes and UpdateInfo structure split for v2 preview (#658) * [C#] Add Status.Record (#659) * Add Status.Record; update OperationStatus with all Advanced Status codes * Update Remote for status.Pending => .IsPending * Update nuspecs * more updates * Update azure-pipelines.yml * Update azure-pipelines.yml * revert windows-2022 in yml * Rename StatusCode.OK to Found (#662) * nit * update SpanByte with API to get pointer including metadata * Fixing ranges in OnPagesReadyToClose * [C#] Websocket bug-fixes (#663) * Fixed nits in websockets: * Clean disconnection * Support correction for large packets * Small nit for correcting message length * changed status to new FASTER status codes * Modified status codes Co-authored-by: Rohan Kadekodi <kadekodirohan@gmail.com> * Revert THA * nits * Improving cache tracker * fix NET5_0 to NET5_0_OR_GREATER * [C#] Add CompletePending[WithOutputs] to IFasterContext (#664) * Move CompletePending(WithOutputs) into IFasterContext * Skip LockEvictionObserver entirely if no LUCs active * Make Decrement interlocked; inline one accessor; revert CMakeLists.txt * [C#] Upgrade blob tests to Azurite, enable blob tests on Linux, use windows-2022 for CI (#666) * install azurite * Change testcase to make sure commit completed before dispose, it is up to user to ensure no ongoing commits at time of dispose. * [C#] UnsealPhysicalAddress fix (#665) * Fix unsealPA going below HA; return SUCCESS instead of NOTFOUND from normal reads that find an obsolete record in ITCTT * Ensure InternalLock calls require epoch protection * WIP: Spin wait on Pending Reads/RMWs until ClosedUntilAddress catches up. Still needs to handle partial page evictions. * Ensure partial ClosedUntilAddress shifts occur correctly. * [C#] Cancellation, ReadOptions, ReadFlags refactor (#668) * Add DeleteRecord and CancelOperation to *Info structures and IFunctions * Added ReadOptions * Move IFunctions methods' "ref RecordInfo" parameter to an *Info property, as it does not need to be updated * Update ReadFlags * ReadFlags fixes * Change XxxInfo.DeleteRecord/.CancelAction to XxxAction enum * Fixing Expiration tests * Add Phase to ExpirationTests * Add ReadOnly region to expiration tests * Delete and Upsert search down to HeadAddress if active LUC * [C#] Misc v2 fixes (#675) Fix misc bugs in v2 * update spanbyte * Yield thread when unable to reserve epoch entry, move iteration count outside table loop. * remove exception from overloaded lightepoch * Fix benchmark to run on .net 6 and linux. * fix another place * [C#] Improvements to LightEpoch * Use AllocateArray in LightEpoch * LightEpoch: Use two hash functions + linear probe, cache last successful probe per thread. Adjust table size based on number of machine processors. * [C#] Use GC.AllocateArray (#683) * Use GC.AllocateArray where possible * update benchmark as well. * Update buffer pool to use GC.AllocateArray * fix debug assert * Make DisposeSession protected in FasterServerBase. * Added SetBytesRead to IServerSession * - update sample .csprojs to target net6 and remove platform-related conditionals from all .csprojs now that we've moved to VS 2022 (#687) - add Status.Expired - update FASTER.client's copies of Status(Code).cs - Replace a TODO with an explanatory comment * Slight refactor of network stack. * Use GC.AllocateArray in SeaaBuffer * Another GC.AllocateArray substitution * [C#] [WIP] Wire disposal into IFunctions v2 (#685) * Add hook for failed CAS during SingleWriter. Still need to support other failed CAS scenarios. * Implement Dispose() functions - (MemoryLogCompactionTests fails at this time) * Fix MemoryLogCompactionTests; move DisposeDeserializedFromDisk up to ICPRFC Co-authored-by: TedHartMS <15467143+TedHartMS@users.noreply.github.com> Co-authored-by: Ted Hart <15467143+TedHartMS@users.noreply.github.com> Co-authored-by: Tianyu Li <litianyu@mit.edu> Co-authored-by: Vasileios Zois <vazois@microsoft.com> Co-authored-by: Sebastian Burckhardt <sburckha@microsoft.com> Co-authored-by: rohankadekodi-msr <69916400+rohankadekodi-msr@users.noreply.github.com> Co-authored-by: Rohan Kadekodi <kadekodirohan@gmail.com>
2022-04-14 02:03:35 +03:00
ref RecordInfo recordInfo = ref tester.fht.readcache.GetInfo(physicalAddress);
address = recordInfo.PreviousAddress;
// There should be only one readcache entry for this test.
Assert.IsFalse(new HashBucketEntry() { word = address }.ReadCache);
}
tester.otherGate.Release();
tester.sutGate.Wait();
// There's a little race where the SUT session could still beat the other session to the CAS
if (!isRetry)
{
if (!isSplice)
{
while (entry.Address == address)
{
Thread.Yield();
tester.fht.FindKey(ref key, out entry);
}
}
else
{
Assert.GreaterOrEqual(address, tester.fht.ReadCache.HeadAddress);
var physicalAddress = tester.fht.readcache.GetPhysicalAddress(entry.AbsoluteAddress);
[C#] FASTER v2 release (#563) * various changes from indexing work (#562) * various changes from indexing work - Add BeginAddress and EndAddress to scan iterators - Allow null deltaFileDevice in HybridLogCheckpointInfo.Recover - Rename FoldOverSnapshot to useFoldOverCheckpoint - Make TakeHybridLogCheckpoint overload call through to overload to avoid duplication - Add default values to new scanDelta and recoverTo arguments - Add missing checkpointManager.OnRecovery call to IntenralRecoverAsync - Fix some comments * Fix shortened name in test to work on Linux * [C#] Record-expiration support in RMW (#545) * Add support for record-expiration management to RMW and I(Advanced)Functions * Update Remote to RMW changes for expiration support * moving remote to IAdvFun * LogDir semantics - minor update Co-authored-by: Badrish Chandramouli <badrishc@microsoft.com> * [C#] Added PostCopyUpdater to IAdvancedFunctions (#561) * Add support for record-expiration management to RMW and I(Advanced)Functions * Update Remote to RMW changes for expiration support * Added PCU * Fixing testcase so that RMW does not expect old address. * Fix PCU bugs * Extend PostCopyUpdate to IFunctions; fix a few comments in remote Co-authored-by: TedHartMS <15467143+TedHartMS@users.noreply.github.com> * [C#] Merge IAdvancedFunctions into IFunctions (#565) * Merge IAdvancedFunctions into IFunctions * Add SupportsPostOperations and Post(IU|CU|SD); expand "ref RecordInfo recordInfo, long address" on Functions * Add RecordMetadata to RMWCompletionCallback params; improve ReadAddressTests * Add tests of Upsert with Input * [C#] RecordInfo v2 (#577) * RecordInfo v2 * fix version jump in CPR. * Updated misc stuff * misc updates to SpanByte * Remove IntExclLocker * Add Try APIs to record locking * Remove FASTERLegacy (#581) * Add Output parameter to Upsert (#574) * Add overloads of Upsert that take "ref Output" and one that takes "out RecordMetadata"; Fix RMW setting pendingContext.RecordInfo/LA; add locking of PostCopyUpdater, PostInitalUpdater, PostSingleWriter; * Reorganize ClientSession IntenralFasterSession to group functions for a given area (Read, Upsert, RMW, etc.) together * Fix locking on Post* calls * Fixes for Post* locking * remove net461 and netcoreapp2.1; add net6.0 in <Choose> to work on later in VS2022 * Update to new RecordInfo locking calls * Update to new IFunctions Locking signatures and RecordInfo implementation * Add post operations to Faster.benchmark * [C#] Checkpoint, Recovery, RecordInfo updates (#588) * Removed WAIT_PENDING * * Use only 1 bit for newVersion in RecordInfo, for CPR. Semantics are that sessions in v+1 will create records in fuzzy region with this bit set. Recovery only scans fuzzy region to elide such records. * Add 1 Filler bit for future use with fillers in records * Increase read lock bits to 6 (64 parallel readers) * Use dirty bit for incremental checkpoints * fix ycsb to not delete data file if we are using --recover * Fix epoch re-entry violation * Move to long versions, for KV checkpoints. * Shuffle around stuff for better cache alignment in benchmark. * Updates based on review * [C#] FasterLog Commit Optimization (v2) (#587) * Checkpoint work * Add notion of manual commit * Recovery of commit cookie * alternative design of log-cookie * Implementation improvement * code review comments * Cleanup + testing * Add management utility for LogCommitManager * Handle race on manual commit code path where not the latest tail is written out * Add condition to only scan log in fastCommitMode * Rough draft to allow for 1. elided commit record when fastCommit turned off and 2. "loose" commits * checkpoint changes * fix bug with readonly log allocator initialization * disable fast commit temporarily for CI * fix MLSD and mem device fast commit behavior * fix AzureStorageDevice exception type and remove self-termination on failure * test case on concurrent inserts * Re-enable epoch protection on CommitInternal * Ensure that full flush list error callbacks do not break FlushedUntilAddress tracking * Fix unclean shutdown of stress test * update device log test to scan until tail instead * change error code used for full flush list to better distinguish from others * Minor updates. Co-authored-by: Badrish Chandramouli <badrishc@microsoft.com> * Remove legacy local log commit manager * [C#] FasterLog v2 - misc changes, removed OverWrite commits (#593) * Checkin misc changes, removed overWrite commits * simplify OnRecovery logic * Fix build after merge * fix alignment of device commit manager * [C#] v2 pending flush list (#596) * Make PendingFlushList never error out in stressful situations. Current implementation uses lock for ~5-10% perf degradation over prior structure. * [C#] FasterLog v2: Fix FasterLog missed final commit (#597) * Fix FasterLog missed final commit. * [C#] Log compaction v2 (#598) * initial checkin * New ShiftBeginAddress behavior -- only shifts BeginAddress variable and does not truncate physical log unless option is specified. Also added Log.Truncate API for physical log truncation. Truncate log until persisted BeginAddress after taking a checkpoint. * Fix epoch protection orderings. * minor improvement to TestUtils to avoid race exception. * update Program.cs * updates from master. * [C#] V2 Custom Commit Strategy (#599) * Add FasterLogCommitStrategy * Use Bakery algorithm for latch * Documentation + tests + improved threading performance * Fix initialization error * Revert to v2 synchronization scheme * Optimization around commit strategies * Refactor CommitPolicy only for normal commits * fix missing spin wait * [C#] Fix v2 CommitPolicy Warnings (#607) * fix warnings * fix broken test * update for code consistency * Merged PR 59053: Network Stack Refactoring into FASTER This pull request contains the necessary changes for the updated network stack interface used by FASTER. It adds INetworkSender.cs and NetworkSenderBase.cs that can be used to implement custom communication protocols. Currently only TcpNetworkSender is supported. * Create .dockerignore * Added TentativeHeadAddress - we first shift this, and when all threads agree, we can do some pre-closing work such as eviction. Then we can shift the actual HeadAddress, closing pages when all threads agree on this. (#608) * Cleanup and remove dead code + reuse base provider. * Code cleanup * [C#] minor cleanup of fasterlog v2 (#611) * minor cleanup of fasterlog * [C#] Remove CheckpointType from CheckpointSettings (v2) (#614) * Remove CheckpointType from CheckpointSettings. Users have to specify checkpoint type on a per checkpoint basis. * fix build break * Fix CTT to call PostSingleWriter. * Avoid double init of FasterLog * [C#] Fixing warnings (#615) * Fixing CI warnings * [C#] Updating dependent package versions in v2 (#616) * Updating dependent package versions * nit * [C#] Improved FasterKV and FasterLog settings API for v2 (#618) * Simpler config API for v2. Move FasterLog to its own folder. * Remove purgeEarlierCommits from reader. Instead: 1. writer retries file deletes (in device commit manager) if access denied, in a loop, until timeout 2. reader (user code) retries recover async if it fails due to file deleted, until timeout * [C#] FasterLog V2 Device error handling (#612) * prototype device * prototype failure handling * Add proposed error handling code * Basic error handling tasks * Fault tolerant devices * Change to failure handler based approach instead of just throwing an exception * Remove brittle error handling code * make sure to read pages from flaky device on recovery in test * fix warnings * code review comments * See if we can enforce clean shutdown * Add extensions to enqueue SpanByte to FasterLog, and unsafely iterate without memory copy. (#621) * [C#] FasterLog v2 Add ability to explicitly terminate a log (#620) * Add ability to explicitly terminate a log * remove special 0-length return on eof * Add LogCompleted in iterator * Change comment and test * fix async iteration logic * fixes Co-authored-by: Badrish Chandramouli <badrishc@microsoft.com> * Maybe fix SVS issue with atomic reads (#622) * [C#] FasterLog v2 iteration fix (#623) * First pass of fixes * undo local change * [C#] Updated docs for FasterLog v2 (#624) * some updates * Add missing documentation * Update 40-fasterlog-basics.md Co-authored-by: Badrish Chandramouli <badrish@gmail.com> * Fix logic for directory delete timeouts. * Speed up testcases * [C#] Lockable Unsafe Context (LUC) in FasterKV v2 (WIP) (#605) * WIP on ManualFasterOperations * fixes for v2 merge * Updates to locking (still in progress) - Remove User-defined locks - Move SupportsLocking up to FasterKV level - Skip Stub and Sealed in iterators - Change PendingContext.OperationFlags from byte to ushort - Add ReadFlags.SkipCopyToTail - Add IsLocked*, TranferLocks methods to RecordInfo - Add UnsafeCompletePending* to ManualOps - Track lock counts in ManualOps and throw if Dispose() is called with locks or epoch held - Add LockInfo for ManualOps.*Lock - Implementation and testing of Faster operations with ManualOps locks - Fix ReadAddressTests to reflect improved consistency of not returning readcache addresses * Locking docs * Update 30-fasterkv-manual-locking.md * Updated doc to GH review and discussions * WIP for LockableRawContext * Existing tests run * Rename to LockableRawContext, IFasterContext * Perf workaround for LockTable.IsActive * WIP on ReadCacheEvict and MemoryPageLockEvictionScan * Add ReadCache and LockTable-transfer tests; move ReadCache tests out to their own sub-hierarchy * Test MemoryPageLockEvictionScan * Add testing for two-phase upsert/copytotail * Remove manual locking bits in Recovery; minor refactorings in Recovery.cs to reduce duplication * Add manual locking to FASTER.benchmark * More LockTable testing and fixes, mostly around ocking nonexistent key while Upsert/RMW/Deleting that key * Add UnsafeContext and make it the default for FASTER.Benchmark * Updates from code review: - IsLocked returns shared lock count (added test) - Fix location of IsIntermediate checks in RecordInfo.Lock/Seal - Remove unused IEqualityComparer in LockTableEntry * Rename Take(Full|Index|HybridLog)Checkpoint to TryInitiate(Full|Index|HybridLog)Checkpoint, so it is obvious they need to complete it * - Remove SupportsPostOperations; this is now always done - Add SingleDeleter for symmetry with Upsert - Add DisposeKey and DisposeValue * Add CopyWriter, to distinguish "maintentance" copying (CopyToTail or copy to ReadCache) from API-parameter copies * merge fixes * Remove obsolete Functions-level locking and postOps specifications * Fix Remote build Co-authored-by: Badrish Chandramouli <badrishc@microsoft.com> * fix semantic merge conflict in MemoryPageScanIterator (#632) * [C#] Add WriteReason parameter to SingleWriter (#630) * Add Functions.PostCopyWriter; update MemOnlyCache to use Post(Single|Copy)Writer * Remove (Post)CopyWriter and replace with WriteReason parameter to (Post)SingleWriter * Move SingleWriter "reason" parameter * Move ReadFlags and WriteReason to their own files; rename SupportsLocking -> DisableLocking with default 'false' * Update Remote to disableLocking name and default change * [C#] Various Fixes (#635) * Fixes: - Fixed WriteReason when CTT overrides ReadCache - make DisableLocking a readonly member - Call SetTentativeAtomic after Post* - Make readcache and comparer private with internal accessors for test - FIx intermittent failure of BasicHighLatencyDeviceTest * back out changes to move from internal -> private for FKV.readcache and .comparer * [C#] Remove StrictCPR (#636) * Removed WAIT_PENDING * StrictCPR removal WIP * Fix bug in state machine test, as it was not using unsafe context for fine grained control over the state machine execution. * Remove PendingContext.HeldLatch and heldOperation local * Revise FASTER.Benchmark to replace --noaff with --safectx and integrate this into Ycsb and SpanbyteYcsb * check epoch protection for complete pending * *UnsafeContext: AnyInstanceProtected -> ThisInstanceProtected Co-authored-by: TedHartMS <15467143+TedHartMS@users.noreply.github.com> * [C#] Support int session ID for FasterKV (#641) * Support int session ID for FasterKV * fix remote solution, minor name updates * update FasterLog API for TryEnqueue of custom header * [C#] IEntry interface for FasterLog (#639) * enqueue with entries prototype * Add IEntry tests and method variants * Address code review comments * Rename + read entries * Add async versions of consumer * Make interfaces top-level * Correct header offset in FasterLog new API * [C#] Recover returns version we recovered to (#648) * add to FasterLog SpanByte API * fix breaking tests * Fix dispose loop * Update FasterServerBase.cs * do not remove ioPendingRequests in RMWAsync if there was no disk request (#653) * [C#] [WIP] Status return code v2 (#638) * Prototype of status as struct * improving status a bit * fix build break, expose underlying (raw) status code to user * misc * Update StatusCode * Update Remote to new Status(Code); fix test cases; fix StatusCode layout; fine-tune Status(Code) names; make StatusCode internal * Update StatusCode and Status to final spec * Update Remote to new Status spec * unrelated nit Co-authored-by: TedHartMS <15467143+TedHartMS@users.noreply.github.com> * [C#] Change IFunctions 'address' parameter to UpdateInfo or ReadInfo (#652) * Add UpdateInfo and ReadInfo to IFunctions calls * Update Remote IFunctions implementations to UpdateInfo/ReadInfo changes Co-authored-by: Badrish Chandramouli <badrishc@microsoft.com> * Wire status into remote v2 (#657) Add NotFound API for status * Status naming changes and UpdateInfo structure split for v2 preview (#658) * [C#] Add Status.Record (#659) * Add Status.Record; update OperationStatus with all Advanced Status codes * Update Remote for status.Pending => .IsPending * Update nuspecs * more updates * Update azure-pipelines.yml * Update azure-pipelines.yml * revert windows-2022 in yml * Rename StatusCode.OK to Found (#662) * nit * update SpanByte with API to get pointer including metadata * Fixing ranges in OnPagesReadyToClose * [C#] Websocket bug-fixes (#663) * Fixed nits in websockets: * Clean disconnection * Support correction for large packets * Small nit for correcting message length * changed status to new FASTER status codes * Modified status codes Co-authored-by: Rohan Kadekodi <kadekodirohan@gmail.com> * Revert THA * nits * Improving cache tracker * fix NET5_0 to NET5_0_OR_GREATER * [C#] Add CompletePending[WithOutputs] to IFasterContext (#664) * Move CompletePending(WithOutputs) into IFasterContext * Skip LockEvictionObserver entirely if no LUCs active * Make Decrement interlocked; inline one accessor; revert CMakeLists.txt * [C#] Upgrade blob tests to Azurite, enable blob tests on Linux, use windows-2022 for CI (#666) * install azurite * Change testcase to make sure commit completed before dispose, it is up to user to ensure no ongoing commits at time of dispose. * [C#] UnsealPhysicalAddress fix (#665) * Fix unsealPA going below HA; return SUCCESS instead of NOTFOUND from normal reads that find an obsolete record in ITCTT * Ensure InternalLock calls require epoch protection * WIP: Spin wait on Pending Reads/RMWs until ClosedUntilAddress catches up. Still needs to handle partial page evictions. * Ensure partial ClosedUntilAddress shifts occur correctly. * [C#] Cancellation, ReadOptions, ReadFlags refactor (#668) * Add DeleteRecord and CancelOperation to *Info structures and IFunctions * Added ReadOptions * Move IFunctions methods' "ref RecordInfo" parameter to an *Info property, as it does not need to be updated * Update ReadFlags * ReadFlags fixes * Change XxxInfo.DeleteRecord/.CancelAction to XxxAction enum * Fixing Expiration tests * Add Phase to ExpirationTests * Add ReadOnly region to expiration tests * Delete and Upsert search down to HeadAddress if active LUC * [C#] Misc v2 fixes (#675) Fix misc bugs in v2 * update spanbyte * Yield thread when unable to reserve epoch entry, move iteration count outside table loop. * remove exception from overloaded lightepoch * Fix benchmark to run on .net 6 and linux. * fix another place * [C#] Improvements to LightEpoch * Use AllocateArray in LightEpoch * LightEpoch: Use two hash functions + linear probe, cache last successful probe per thread. Adjust table size based on number of machine processors. * [C#] Use GC.AllocateArray (#683) * Use GC.AllocateArray where possible * update benchmark as well. * Update buffer pool to use GC.AllocateArray * fix debug assert * Make DisposeSession protected in FasterServerBase. * Added SetBytesRead to IServerSession * - update sample .csprojs to target net6 and remove platform-related conditionals from all .csprojs now that we've moved to VS 2022 (#687) - add Status.Expired - update FASTER.client's copies of Status(Code).cs - Replace a TODO with an explanatory comment * Slight refactor of network stack. * Use GC.AllocateArray in SeaaBuffer * Another GC.AllocateArray substitution * [C#] [WIP] Wire disposal into IFunctions v2 (#685) * Add hook for failed CAS during SingleWriter. Still need to support other failed CAS scenarios. * Implement Dispose() functions - (MemoryLogCompactionTests fails at this time) * Fix MemoryLogCompactionTests; move DisposeDeserializedFromDisk up to ICPRFC Co-authored-by: TedHartMS <15467143+TedHartMS@users.noreply.github.com> Co-authored-by: Ted Hart <15467143+TedHartMS@users.noreply.github.com> Co-authored-by: Tianyu Li <litianyu@mit.edu> Co-authored-by: Vasileios Zois <vazois@microsoft.com> Co-authored-by: Sebastian Burckhardt <sburckha@microsoft.com> Co-authored-by: rohankadekodi-msr <69916400+rohankadekodi-msr@users.noreply.github.com> Co-authored-by: Rohan Kadekodi <kadekodirohan@gmail.com>
2022-04-14 02:03:35 +03:00
ref RecordInfo recordInfo = ref tester.fht.readcache.GetInfo(physicalAddress);
while (recordInfo.PreviousAddress == address)
{
// Wait for the splice to happen
Thread.Yield();
}
}
}
isRetry = true; // the next call will be from RETRY_NOW
}
}
void SignalEvent()
{
// Let the SUT proceed, which will trigger a RETRY_NOW due to the failed CAS, so we need to release for the second wait as well.
// Release with a count of 2 to handle the attempt it's currently blocked on and the subsequent retry.
[C#] FASTER v2 release (#563) * various changes from indexing work (#562) * various changes from indexing work - Add BeginAddress and EndAddress to scan iterators - Allow null deltaFileDevice in HybridLogCheckpointInfo.Recover - Rename FoldOverSnapshot to useFoldOverCheckpoint - Make TakeHybridLogCheckpoint overload call through to overload to avoid duplication - Add default values to new scanDelta and recoverTo arguments - Add missing checkpointManager.OnRecovery call to IntenralRecoverAsync - Fix some comments * Fix shortened name in test to work on Linux * [C#] Record-expiration support in RMW (#545) * Add support for record-expiration management to RMW and I(Advanced)Functions * Update Remote to RMW changes for expiration support * moving remote to IAdvFun * LogDir semantics - minor update Co-authored-by: Badrish Chandramouli <badrishc@microsoft.com> * [C#] Added PostCopyUpdater to IAdvancedFunctions (#561) * Add support for record-expiration management to RMW and I(Advanced)Functions * Update Remote to RMW changes for expiration support * Added PCU * Fixing testcase so that RMW does not expect old address. * Fix PCU bugs * Extend PostCopyUpdate to IFunctions; fix a few comments in remote Co-authored-by: TedHartMS <15467143+TedHartMS@users.noreply.github.com> * [C#] Merge IAdvancedFunctions into IFunctions (#565) * Merge IAdvancedFunctions into IFunctions * Add SupportsPostOperations and Post(IU|CU|SD); expand "ref RecordInfo recordInfo, long address" on Functions * Add RecordMetadata to RMWCompletionCallback params; improve ReadAddressTests * Add tests of Upsert with Input * [C#] RecordInfo v2 (#577) * RecordInfo v2 * fix version jump in CPR. * Updated misc stuff * misc updates to SpanByte * Remove IntExclLocker * Add Try APIs to record locking * Remove FASTERLegacy (#581) * Add Output parameter to Upsert (#574) * Add overloads of Upsert that take "ref Output" and one that takes "out RecordMetadata"; Fix RMW setting pendingContext.RecordInfo/LA; add locking of PostCopyUpdater, PostInitalUpdater, PostSingleWriter; * Reorganize ClientSession IntenralFasterSession to group functions for a given area (Read, Upsert, RMW, etc.) together * Fix locking on Post* calls * Fixes for Post* locking * remove net461 and netcoreapp2.1; add net6.0 in <Choose> to work on later in VS2022 * Update to new RecordInfo locking calls * Update to new IFunctions Locking signatures and RecordInfo implementation * Add post operations to Faster.benchmark * [C#] Checkpoint, Recovery, RecordInfo updates (#588) * Removed WAIT_PENDING * * Use only 1 bit for newVersion in RecordInfo, for CPR. Semantics are that sessions in v+1 will create records in fuzzy region with this bit set. Recovery only scans fuzzy region to elide such records. * Add 1 Filler bit for future use with fillers in records * Increase read lock bits to 6 (64 parallel readers) * Use dirty bit for incremental checkpoints * fix ycsb to not delete data file if we are using --recover * Fix epoch re-entry violation * Move to long versions, for KV checkpoints. * Shuffle around stuff for better cache alignment in benchmark. * Updates based on review * [C#] FasterLog Commit Optimization (v2) (#587) * Checkpoint work * Add notion of manual commit * Recovery of commit cookie * alternative design of log-cookie * Implementation improvement * code review comments * Cleanup + testing * Add management utility for LogCommitManager * Handle race on manual commit code path where not the latest tail is written out * Add condition to only scan log in fastCommitMode * Rough draft to allow for 1. elided commit record when fastCommit turned off and 2. "loose" commits * checkpoint changes * fix bug with readonly log allocator initialization * disable fast commit temporarily for CI * fix MLSD and mem device fast commit behavior * fix AzureStorageDevice exception type and remove self-termination on failure * test case on concurrent inserts * Re-enable epoch protection on CommitInternal * Ensure that full flush list error callbacks do not break FlushedUntilAddress tracking * Fix unclean shutdown of stress test * update device log test to scan until tail instead * change error code used for full flush list to better distinguish from others * Minor updates. Co-authored-by: Badrish Chandramouli <badrishc@microsoft.com> * Remove legacy local log commit manager * [C#] FasterLog v2 - misc changes, removed OverWrite commits (#593) * Checkin misc changes, removed overWrite commits * simplify OnRecovery logic * Fix build after merge * fix alignment of device commit manager * [C#] v2 pending flush list (#596) * Make PendingFlushList never error out in stressful situations. Current implementation uses lock for ~5-10% perf degradation over prior structure. * [C#] FasterLog v2: Fix FasterLog missed final commit (#597) * Fix FasterLog missed final commit. * [C#] Log compaction v2 (#598) * initial checkin * New ShiftBeginAddress behavior -- only shifts BeginAddress variable and does not truncate physical log unless option is specified. Also added Log.Truncate API for physical log truncation. Truncate log until persisted BeginAddress after taking a checkpoint. * Fix epoch protection orderings. * minor improvement to TestUtils to avoid race exception. * update Program.cs * updates from master. * [C#] V2 Custom Commit Strategy (#599) * Add FasterLogCommitStrategy * Use Bakery algorithm for latch * Documentation + tests + improved threading performance * Fix initialization error * Revert to v2 synchronization scheme * Optimization around commit strategies * Refactor CommitPolicy only for normal commits * fix missing spin wait * [C#] Fix v2 CommitPolicy Warnings (#607) * fix warnings * fix broken test * update for code consistency * Merged PR 59053: Network Stack Refactoring into FASTER This pull request contains the necessary changes for the updated network stack interface used by FASTER. It adds INetworkSender.cs and NetworkSenderBase.cs that can be used to implement custom communication protocols. Currently only TcpNetworkSender is supported. * Create .dockerignore * Added TentativeHeadAddress - we first shift this, and when all threads agree, we can do some pre-closing work such as eviction. Then we can shift the actual HeadAddress, closing pages when all threads agree on this. (#608) * Cleanup and remove dead code + reuse base provider. * Code cleanup * [C#] minor cleanup of fasterlog v2 (#611) * minor cleanup of fasterlog * [C#] Remove CheckpointType from CheckpointSettings (v2) (#614) * Remove CheckpointType from CheckpointSettings. Users have to specify checkpoint type on a per checkpoint basis. * fix build break * Fix CTT to call PostSingleWriter. * Avoid double init of FasterLog * [C#] Fixing warnings (#615) * Fixing CI warnings * [C#] Updating dependent package versions in v2 (#616) * Updating dependent package versions * nit * [C#] Improved FasterKV and FasterLog settings API for v2 (#618) * Simpler config API for v2. Move FasterLog to its own folder. * Remove purgeEarlierCommits from reader. Instead: 1. writer retries file deletes (in device commit manager) if access denied, in a loop, until timeout 2. reader (user code) retries recover async if it fails due to file deleted, until timeout * [C#] FasterLog V2 Device error handling (#612) * prototype device * prototype failure handling * Add proposed error handling code * Basic error handling tasks * Fault tolerant devices * Change to failure handler based approach instead of just throwing an exception * Remove brittle error handling code * make sure to read pages from flaky device on recovery in test * fix warnings * code review comments * See if we can enforce clean shutdown * Add extensions to enqueue SpanByte to FasterLog, and unsafely iterate without memory copy. (#621) * [C#] FasterLog v2 Add ability to explicitly terminate a log (#620) * Add ability to explicitly terminate a log * remove special 0-length return on eof * Add LogCompleted in iterator * Change comment and test * fix async iteration logic * fixes Co-authored-by: Badrish Chandramouli <badrishc@microsoft.com> * Maybe fix SVS issue with atomic reads (#622) * [C#] FasterLog v2 iteration fix (#623) * First pass of fixes * undo local change * [C#] Updated docs for FasterLog v2 (#624) * some updates * Add missing documentation * Update 40-fasterlog-basics.md Co-authored-by: Badrish Chandramouli <badrish@gmail.com> * Fix logic for directory delete timeouts. * Speed up testcases * [C#] Lockable Unsafe Context (LUC) in FasterKV v2 (WIP) (#605) * WIP on ManualFasterOperations * fixes for v2 merge * Updates to locking (still in progress) - Remove User-defined locks - Move SupportsLocking up to FasterKV level - Skip Stub and Sealed in iterators - Change PendingContext.OperationFlags from byte to ushort - Add ReadFlags.SkipCopyToTail - Add IsLocked*, TranferLocks methods to RecordInfo - Add UnsafeCompletePending* to ManualOps - Track lock counts in ManualOps and throw if Dispose() is called with locks or epoch held - Add LockInfo for ManualOps.*Lock - Implementation and testing of Faster operations with ManualOps locks - Fix ReadAddressTests to reflect improved consistency of not returning readcache addresses * Locking docs * Update 30-fasterkv-manual-locking.md * Updated doc to GH review and discussions * WIP for LockableRawContext * Existing tests run * Rename to LockableRawContext, IFasterContext * Perf workaround for LockTable.IsActive * WIP on ReadCacheEvict and MemoryPageLockEvictionScan * Add ReadCache and LockTable-transfer tests; move ReadCache tests out to their own sub-hierarchy * Test MemoryPageLockEvictionScan * Add testing for two-phase upsert/copytotail * Remove manual locking bits in Recovery; minor refactorings in Recovery.cs to reduce duplication * Add manual locking to FASTER.benchmark * More LockTable testing and fixes, mostly around ocking nonexistent key while Upsert/RMW/Deleting that key * Add UnsafeContext and make it the default for FASTER.Benchmark * Updates from code review: - IsLocked returns shared lock count (added test) - Fix location of IsIntermediate checks in RecordInfo.Lock/Seal - Remove unused IEqualityComparer in LockTableEntry * Rename Take(Full|Index|HybridLog)Checkpoint to TryInitiate(Full|Index|HybridLog)Checkpoint, so it is obvious they need to complete it * - Remove SupportsPostOperations; this is now always done - Add SingleDeleter for symmetry with Upsert - Add DisposeKey and DisposeValue * Add CopyWriter, to distinguish "maintentance" copying (CopyToTail or copy to ReadCache) from API-parameter copies * merge fixes * Remove obsolete Functions-level locking and postOps specifications * Fix Remote build Co-authored-by: Badrish Chandramouli <badrishc@microsoft.com> * fix semantic merge conflict in MemoryPageScanIterator (#632) * [C#] Add WriteReason parameter to SingleWriter (#630) * Add Functions.PostCopyWriter; update MemOnlyCache to use Post(Single|Copy)Writer * Remove (Post)CopyWriter and replace with WriteReason parameter to (Post)SingleWriter * Move SingleWriter "reason" parameter * Move ReadFlags and WriteReason to their own files; rename SupportsLocking -> DisableLocking with default 'false' * Update Remote to disableLocking name and default change * [C#] Various Fixes (#635) * Fixes: - Fixed WriteReason when CTT overrides ReadCache - make DisableLocking a readonly member - Call SetTentativeAtomic after Post* - Make readcache and comparer private with internal accessors for test - FIx intermittent failure of BasicHighLatencyDeviceTest * back out changes to move from internal -> private for FKV.readcache and .comparer * [C#] Remove StrictCPR (#636) * Removed WAIT_PENDING * StrictCPR removal WIP * Fix bug in state machine test, as it was not using unsafe context for fine grained control over the state machine execution. * Remove PendingContext.HeldLatch and heldOperation local * Revise FASTER.Benchmark to replace --noaff with --safectx and integrate this into Ycsb and SpanbyteYcsb * check epoch protection for complete pending * *UnsafeContext: AnyInstanceProtected -> ThisInstanceProtected Co-authored-by: TedHartMS <15467143+TedHartMS@users.noreply.github.com> * [C#] Support int session ID for FasterKV (#641) * Support int session ID for FasterKV * fix remote solution, minor name updates * update FasterLog API for TryEnqueue of custom header * [C#] IEntry interface for FasterLog (#639) * enqueue with entries prototype * Add IEntry tests and method variants * Address code review comments * Rename + read entries * Add async versions of consumer * Make interfaces top-level * Correct header offset in FasterLog new API * [C#] Recover returns version we recovered to (#648) * add to FasterLog SpanByte API * fix breaking tests * Fix dispose loop * Update FasterServerBase.cs * do not remove ioPendingRequests in RMWAsync if there was no disk request (#653) * [C#] [WIP] Status return code v2 (#638) * Prototype of status as struct * improving status a bit * fix build break, expose underlying (raw) status code to user * misc * Update StatusCode * Update Remote to new Status(Code); fix test cases; fix StatusCode layout; fine-tune Status(Code) names; make StatusCode internal * Update StatusCode and Status to final spec * Update Remote to new Status spec * unrelated nit Co-authored-by: TedHartMS <15467143+TedHartMS@users.noreply.github.com> * [C#] Change IFunctions 'address' parameter to UpdateInfo or ReadInfo (#652) * Add UpdateInfo and ReadInfo to IFunctions calls * Update Remote IFunctions implementations to UpdateInfo/ReadInfo changes Co-authored-by: Badrish Chandramouli <badrishc@microsoft.com> * Wire status into remote v2 (#657) Add NotFound API for status * Status naming changes and UpdateInfo structure split for v2 preview (#658) * [C#] Add Status.Record (#659) * Add Status.Record; update OperationStatus with all Advanced Status codes * Update Remote for status.Pending => .IsPending * Update nuspecs * more updates * Update azure-pipelines.yml * Update azure-pipelines.yml * revert windows-2022 in yml * Rename StatusCode.OK to Found (#662) * nit * update SpanByte with API to get pointer including metadata * Fixing ranges in OnPagesReadyToClose * [C#] Websocket bug-fixes (#663) * Fixed nits in websockets: * Clean disconnection * Support correction for large packets * Small nit for correcting message length * changed status to new FASTER status codes * Modified status codes Co-authored-by: Rohan Kadekodi <kadekodirohan@gmail.com> * Revert THA * nits * Improving cache tracker * fix NET5_0 to NET5_0_OR_GREATER * [C#] Add CompletePending[WithOutputs] to IFasterContext (#664) * Move CompletePending(WithOutputs) into IFasterContext * Skip LockEvictionObserver entirely if no LUCs active * Make Decrement interlocked; inline one accessor; revert CMakeLists.txt * [C#] Upgrade blob tests to Azurite, enable blob tests on Linux, use windows-2022 for CI (#666) * install azurite * Change testcase to make sure commit completed before dispose, it is up to user to ensure no ongoing commits at time of dispose. * [C#] UnsealPhysicalAddress fix (#665) * Fix unsealPA going below HA; return SUCCESS instead of NOTFOUND from normal reads that find an obsolete record in ITCTT * Ensure InternalLock calls require epoch protection * WIP: Spin wait on Pending Reads/RMWs until ClosedUntilAddress catches up. Still needs to handle partial page evictions. * Ensure partial ClosedUntilAddress shifts occur correctly. * [C#] Cancellation, ReadOptions, ReadFlags refactor (#668) * Add DeleteRecord and CancelOperation to *Info structures and IFunctions * Added ReadOptions * Move IFunctions methods' "ref RecordInfo" parameter to an *Info property, as it does not need to be updated * Update ReadFlags * ReadFlags fixes * Change XxxInfo.DeleteRecord/.CancelAction to XxxAction enum * Fixing Expiration tests * Add Phase to ExpirationTests * Add ReadOnly region to expiration tests * Delete and Upsert search down to HeadAddress if active LUC * [C#] Misc v2 fixes (#675) Fix misc bugs in v2 * update spanbyte * Yield thread when unable to reserve epoch entry, move iteration count outside table loop. * remove exception from overloaded lightepoch * Fix benchmark to run on .net 6 and linux. * fix another place * [C#] Improvements to LightEpoch * Use AllocateArray in LightEpoch * LightEpoch: Use two hash functions + linear probe, cache last successful probe per thread. Adjust table size based on number of machine processors. * [C#] Use GC.AllocateArray (#683) * Use GC.AllocateArray where possible * update benchmark as well. * Update buffer pool to use GC.AllocateArray * fix debug assert * Make DisposeSession protected in FasterServerBase. * Added SetBytesRead to IServerSession * - update sample .csprojs to target net6 and remove platform-related conditionals from all .csprojs now that we've moved to VS 2022 (#687) - add Status.Expired - update FASTER.client's copies of Status(Code).cs - Replace a TODO with an explanatory comment * Slight refactor of network stack. * Use GC.AllocateArray in SeaaBuffer * Another GC.AllocateArray substitution * [C#] [WIP] Wire disposal into IFunctions v2 (#685) * Add hook for failed CAS during SingleWriter. Still need to support other failed CAS scenarios. * Implement Dispose() functions - (MemoryLogCompactionTests fails at this time) * Fix MemoryLogCompactionTests; move DisposeDeserializedFromDisk up to ICPRFC Co-authored-by: TedHartMS <15467143+TedHartMS@users.noreply.github.com> Co-authored-by: Ted Hart <15467143+TedHartMS@users.noreply.github.com> Co-authored-by: Tianyu Li <litianyu@mit.edu> Co-authored-by: Vasileios Zois <vazois@microsoft.com> Co-authored-by: Sebastian Burckhardt <sburckha@microsoft.com> Co-authored-by: rohankadekodi-msr <69916400+rohankadekodi-msr@users.noreply.github.com> Co-authored-by: Rohan Kadekodi <kadekodirohan@gmail.com>
2022-04-14 02:03:35 +03:00
if (!isSUT)
tester.sutGate.Release(2);
}
public override bool SingleWriter(ref MyKey key, ref MyInput input, ref MyValue src, ref MyValue dst, ref MyOutput output, ref UpsertInfo upsertInfo, WriteReason reason)
{
WaitForEvent();
dst = src;
SignalEvent();
return true;
}
public override bool InitialUpdater(ref MyKey key, ref MyInput input, ref MyValue value, ref MyOutput output, ref RMWInfo rmwInfo)
{
WaitForEvent();
value = new MyValue { value = input.value };
SignalEvent();
return true;
}
public override bool CopyUpdater(ref MyKey key, ref MyInput input, ref MyValue oldValue, ref MyValue newValue, ref MyOutput output, ref RMWInfo rmwInfo)
{
WaitForEvent();
newValue = new MyValue { value = oldValue.value + input.value };
SignalEvent();
return true;
}
public override bool SingleDeleter(ref MyKey key, ref MyValue value, ref DeleteInfo deleteInfo)
{
WaitForEvent();
base.SingleDeleter(ref key, ref value, ref deleteInfo);
SignalEvent();
return true;
}
public override bool InPlaceUpdater(ref MyKey key, ref MyInput input, ref MyValue value, ref MyOutput output, ref RMWInfo rmwInfo)
{
value.value += input.value;
return true;
}
public override bool NeedCopyUpdate(ref MyKey key, ref MyInput input, ref MyValue oldValue, ref MyOutput output, ref RMWInfo rmwInfo) => true;
public override bool ConcurrentReader(ref MyKey key, ref MyInput input, ref MyValue value, ref MyOutput dst, ref ReadInfo readInfo)
{
Assert.Fail("ConcurrentReader should not be called for this test");
return true;
}
public override bool ConcurrentWriter(ref MyKey key, ref MyInput input, ref MyValue src, ref MyValue dst, ref MyOutput output, ref UpsertInfo upsertInfo)
{
dst.value = src.value;
return true;
}
public override void RMWCompletionCallback(ref MyKey key, ref MyInput input, ref MyOutput output, Empty ctx, Status status, RecordMetadata recordMetadata)
{
if (isSUT)
{
Assert.IsTrue(status.Found, status.ToString());
Assert.IsTrue(status.Record.CopyUpdated, status.ToString()); // InPlace due to RETRY_NOW after CAS failure
}
else
{
Assert.IsTrue(status.NotFound, status.ToString());
Assert.IsTrue(status.Record.Created, status.ToString());
}
}
public override bool SingleReader(ref MyKey key, ref MyInput input, ref MyValue value, ref MyOutput dst, ref ReadInfo readInfo)
{
dst.value = value;
return true;
}
public override void DisposeSingleWriter(ref MyKey key, ref MyInput input, ref MyValue src, ref MyValue dst, ref MyOutput output, ref UpsertInfo upsertInfo, WriteReason reason)
{
Assert.AreEqual(TestKey, key.key);
Assert.AreEqual(TestInitialValue, src.value);
Assert.AreEqual(TestInitialValue, dst.value); // dst has been populated
handlerQueue.Enqueue(DisposeHandler.SingleWriter);
}
public override void DisposeCopyUpdater(ref MyKey key, ref MyInput input, ref MyValue oldValue, ref MyValue newValue, ref MyOutput output, ref RMWInfo rmwInfo)
{
Assert.AreEqual(TestKey, key.key);
Assert.AreEqual(TestInitialValue, oldValue.value);
Assert.AreEqual(TestInitialValue + TestUpdatedValue, newValue.value);
handlerQueue.Enqueue(DisposeHandler.CopyUpdater);
}
public override void DisposeInitialUpdater(ref MyKey key, ref MyInput input, ref MyValue value, ref MyOutput output, ref RMWInfo rmwInfo)
{
Assert.AreEqual(TestKey, key.key);
Assert.AreEqual(TestInitialValue, value.value);
handlerQueue.Enqueue(DisposeHandler.InitialUpdater);
}
public override void DisposeSingleDeleter(ref MyKey key, ref MyValue value, ref DeleteInfo deleteInfo)
{
Assert.AreEqual(TestKey, key.key);
Assert.IsNull(value); // This is the default value inserted for the Tombstoned record
handlerQueue.Enqueue(DisposeHandler.SingleDeleter);
}
public override void DisposeDeserializedFromDisk(ref MyKey key, ref MyValue value)
{
VerifyKeyValueCombo(ref key, ref value);
handlerQueue.Enqueue(DisposeHandler.DeserializedFromDisk);
}
}
static void VerifyKeyValueCombo(ref MyKey key, ref MyValue value)
{
switch (key.key)
{
case TestKey:
Assert.AreEqual(TestInitialValue, value.value);
break;
case TestCollidingKey:
Assert.AreEqual(TestCollidingValue, value.value);
break;
case TestCollidingKey2:
Assert.AreEqual(TestCollidingValue2, value.value);
break;
default:
Assert.Fail($"Unexpected key: {key.key}");
break;
}
}
// Override some things from MyFunctions for our purposes here
class DisposeFunctionsNoSync : MyFunctions
{
internal Queue<DisposeHandler> handlerQueue = new();
public override bool CopyUpdater(ref MyKey key, ref MyInput input, ref MyValue oldValue, ref MyValue newValue, ref MyOutput output, ref RMWInfo rmwInfo)
{
newValue = new MyValue { value = oldValue.value + input.value };
output.value = newValue;
return true;
}
public override void ReadCompletionCallback(ref MyKey key, ref MyInput input, ref MyOutput output, Empty ctx, Status status, RecordMetadata recordMetadata)
{
Assert.IsTrue(status.Found);
}
public override void DisposeDeserializedFromDisk(ref MyKey key, ref MyValue value)
{
VerifyKeyValueCombo(ref key, ref value);
handlerQueue.Enqueue(DisposeHandler.DeserializedFromDisk);
}
}
void DoFlush(FlushMode flushMode)
{
switch (flushMode)
{
case FlushMode.NoFlush:
return;
case FlushMode.ReadOnly:
fht.Log.ShiftReadOnlyAddress(fht.Log.TailAddress, wait: true);
return;
case FlushMode.OnDisk:
fht.Log.FlushAndEvict(wait: true);
return;
}
}
[Test]
[Category("FasterKV")]
[Category("Smoke")]
public void DisposeSingleWriter2Threads()
[C#] FASTER v2 release (#563) * various changes from indexing work (#562) * various changes from indexing work - Add BeginAddress and EndAddress to scan iterators - Allow null deltaFileDevice in HybridLogCheckpointInfo.Recover - Rename FoldOverSnapshot to useFoldOverCheckpoint - Make TakeHybridLogCheckpoint overload call through to overload to avoid duplication - Add default values to new scanDelta and recoverTo arguments - Add missing checkpointManager.OnRecovery call to IntenralRecoverAsync - Fix some comments * Fix shortened name in test to work on Linux * [C#] Record-expiration support in RMW (#545) * Add support for record-expiration management to RMW and I(Advanced)Functions * Update Remote to RMW changes for expiration support * moving remote to IAdvFun * LogDir semantics - minor update Co-authored-by: Badrish Chandramouli <badrishc@microsoft.com> * [C#] Added PostCopyUpdater to IAdvancedFunctions (#561) * Add support for record-expiration management to RMW and I(Advanced)Functions * Update Remote to RMW changes for expiration support * Added PCU * Fixing testcase so that RMW does not expect old address. * Fix PCU bugs * Extend PostCopyUpdate to IFunctions; fix a few comments in remote Co-authored-by: TedHartMS <15467143+TedHartMS@users.noreply.github.com> * [C#] Merge IAdvancedFunctions into IFunctions (#565) * Merge IAdvancedFunctions into IFunctions * Add SupportsPostOperations and Post(IU|CU|SD); expand "ref RecordInfo recordInfo, long address" on Functions * Add RecordMetadata to RMWCompletionCallback params; improve ReadAddressTests * Add tests of Upsert with Input * [C#] RecordInfo v2 (#577) * RecordInfo v2 * fix version jump in CPR. * Updated misc stuff * misc updates to SpanByte * Remove IntExclLocker * Add Try APIs to record locking * Remove FASTERLegacy (#581) * Add Output parameter to Upsert (#574) * Add overloads of Upsert that take "ref Output" and one that takes "out RecordMetadata"; Fix RMW setting pendingContext.RecordInfo/LA; add locking of PostCopyUpdater, PostInitalUpdater, PostSingleWriter; * Reorganize ClientSession IntenralFasterSession to group functions for a given area (Read, Upsert, RMW, etc.) together * Fix locking on Post* calls * Fixes for Post* locking * remove net461 and netcoreapp2.1; add net6.0 in <Choose> to work on later in VS2022 * Update to new RecordInfo locking calls * Update to new IFunctions Locking signatures and RecordInfo implementation * Add post operations to Faster.benchmark * [C#] Checkpoint, Recovery, RecordInfo updates (#588) * Removed WAIT_PENDING * * Use only 1 bit for newVersion in RecordInfo, for CPR. Semantics are that sessions in v+1 will create records in fuzzy region with this bit set. Recovery only scans fuzzy region to elide such records. * Add 1 Filler bit for future use with fillers in records * Increase read lock bits to 6 (64 parallel readers) * Use dirty bit for incremental checkpoints * fix ycsb to not delete data file if we are using --recover * Fix epoch re-entry violation * Move to long versions, for KV checkpoints. * Shuffle around stuff for better cache alignment in benchmark. * Updates based on review * [C#] FasterLog Commit Optimization (v2) (#587) * Checkpoint work * Add notion of manual commit * Recovery of commit cookie * alternative design of log-cookie * Implementation improvement * code review comments * Cleanup + testing * Add management utility for LogCommitManager * Handle race on manual commit code path where not the latest tail is written out * Add condition to only scan log in fastCommitMode * Rough draft to allow for 1. elided commit record when fastCommit turned off and 2. "loose" commits * checkpoint changes * fix bug with readonly log allocator initialization * disable fast commit temporarily for CI * fix MLSD and mem device fast commit behavior * fix AzureStorageDevice exception type and remove self-termination on failure * test case on concurrent inserts * Re-enable epoch protection on CommitInternal * Ensure that full flush list error callbacks do not break FlushedUntilAddress tracking * Fix unclean shutdown of stress test * update device log test to scan until tail instead * change error code used for full flush list to better distinguish from others * Minor updates. Co-authored-by: Badrish Chandramouli <badrishc@microsoft.com> * Remove legacy local log commit manager * [C#] FasterLog v2 - misc changes, removed OverWrite commits (#593) * Checkin misc changes, removed overWrite commits * simplify OnRecovery logic * Fix build after merge * fix alignment of device commit manager * [C#] v2 pending flush list (#596) * Make PendingFlushList never error out in stressful situations. Current implementation uses lock for ~5-10% perf degradation over prior structure. * [C#] FasterLog v2: Fix FasterLog missed final commit (#597) * Fix FasterLog missed final commit. * [C#] Log compaction v2 (#598) * initial checkin * New ShiftBeginAddress behavior -- only shifts BeginAddress variable and does not truncate physical log unless option is specified. Also added Log.Truncate API for physical log truncation. Truncate log until persisted BeginAddress after taking a checkpoint. * Fix epoch protection orderings. * minor improvement to TestUtils to avoid race exception. * update Program.cs * updates from master. * [C#] V2 Custom Commit Strategy (#599) * Add FasterLogCommitStrategy * Use Bakery algorithm for latch * Documentation + tests + improved threading performance * Fix initialization error * Revert to v2 synchronization scheme * Optimization around commit strategies * Refactor CommitPolicy only for normal commits * fix missing spin wait * [C#] Fix v2 CommitPolicy Warnings (#607) * fix warnings * fix broken test * update for code consistency * Merged PR 59053: Network Stack Refactoring into FASTER This pull request contains the necessary changes for the updated network stack interface used by FASTER. It adds INetworkSender.cs and NetworkSenderBase.cs that can be used to implement custom communication protocols. Currently only TcpNetworkSender is supported. * Create .dockerignore * Added TentativeHeadAddress - we first shift this, and when all threads agree, we can do some pre-closing work such as eviction. Then we can shift the actual HeadAddress, closing pages when all threads agree on this. (#608) * Cleanup and remove dead code + reuse base provider. * Code cleanup * [C#] minor cleanup of fasterlog v2 (#611) * minor cleanup of fasterlog * [C#] Remove CheckpointType from CheckpointSettings (v2) (#614) * Remove CheckpointType from CheckpointSettings. Users have to specify checkpoint type on a per checkpoint basis. * fix build break * Fix CTT to call PostSingleWriter. * Avoid double init of FasterLog * [C#] Fixing warnings (#615) * Fixing CI warnings * [C#] Updating dependent package versions in v2 (#616) * Updating dependent package versions * nit * [C#] Improved FasterKV and FasterLog settings API for v2 (#618) * Simpler config API for v2. Move FasterLog to its own folder. * Remove purgeEarlierCommits from reader. Instead: 1. writer retries file deletes (in device commit manager) if access denied, in a loop, until timeout 2. reader (user code) retries recover async if it fails due to file deleted, until timeout * [C#] FasterLog V2 Device error handling (#612) * prototype device * prototype failure handling * Add proposed error handling code * Basic error handling tasks * Fault tolerant devices * Change to failure handler based approach instead of just throwing an exception * Remove brittle error handling code * make sure to read pages from flaky device on recovery in test * fix warnings * code review comments * See if we can enforce clean shutdown * Add extensions to enqueue SpanByte to FasterLog, and unsafely iterate without memory copy. (#621) * [C#] FasterLog v2 Add ability to explicitly terminate a log (#620) * Add ability to explicitly terminate a log * remove special 0-length return on eof * Add LogCompleted in iterator * Change comment and test * fix async iteration logic * fixes Co-authored-by: Badrish Chandramouli <badrishc@microsoft.com> * Maybe fix SVS issue with atomic reads (#622) * [C#] FasterLog v2 iteration fix (#623) * First pass of fixes * undo local change * [C#] Updated docs for FasterLog v2 (#624) * some updates * Add missing documentation * Update 40-fasterlog-basics.md Co-authored-by: Badrish Chandramouli <badrish@gmail.com> * Fix logic for directory delete timeouts. * Speed up testcases * [C#] Lockable Unsafe Context (LUC) in FasterKV v2 (WIP) (#605) * WIP on ManualFasterOperations * fixes for v2 merge * Updates to locking (still in progress) - Remove User-defined locks - Move SupportsLocking up to FasterKV level - Skip Stub and Sealed in iterators - Change PendingContext.OperationFlags from byte to ushort - Add ReadFlags.SkipCopyToTail - Add IsLocked*, TranferLocks methods to RecordInfo - Add UnsafeCompletePending* to ManualOps - Track lock counts in ManualOps and throw if Dispose() is called with locks or epoch held - Add LockInfo for ManualOps.*Lock - Implementation and testing of Faster operations with ManualOps locks - Fix ReadAddressTests to reflect improved consistency of not returning readcache addresses * Locking docs * Update 30-fasterkv-manual-locking.md * Updated doc to GH review and discussions * WIP for LockableRawContext * Existing tests run * Rename to LockableRawContext, IFasterContext * Perf workaround for LockTable.IsActive * WIP on ReadCacheEvict and MemoryPageLockEvictionScan * Add ReadCache and LockTable-transfer tests; move ReadCache tests out to their own sub-hierarchy * Test MemoryPageLockEvictionScan * Add testing for two-phase upsert/copytotail * Remove manual locking bits in Recovery; minor refactorings in Recovery.cs to reduce duplication * Add manual locking to FASTER.benchmark * More LockTable testing and fixes, mostly around ocking nonexistent key while Upsert/RMW/Deleting that key * Add UnsafeContext and make it the default for FASTER.Benchmark * Updates from code review: - IsLocked returns shared lock count (added test) - Fix location of IsIntermediate checks in RecordInfo.Lock/Seal - Remove unused IEqualityComparer in LockTableEntry * Rename Take(Full|Index|HybridLog)Checkpoint to TryInitiate(Full|Index|HybridLog)Checkpoint, so it is obvious they need to complete it * - Remove SupportsPostOperations; this is now always done - Add SingleDeleter for symmetry with Upsert - Add DisposeKey and DisposeValue * Add CopyWriter, to distinguish "maintentance" copying (CopyToTail or copy to ReadCache) from API-parameter copies * merge fixes * Remove obsolete Functions-level locking and postOps specifications * Fix Remote build Co-authored-by: Badrish Chandramouli <badrishc@microsoft.com> * fix semantic merge conflict in MemoryPageScanIterator (#632) * [C#] Add WriteReason parameter to SingleWriter (#630) * Add Functions.PostCopyWriter; update MemOnlyCache to use Post(Single|Copy)Writer * Remove (Post)CopyWriter and replace with WriteReason parameter to (Post)SingleWriter * Move SingleWriter "reason" parameter * Move ReadFlags and WriteReason to their own files; rename SupportsLocking -> DisableLocking with default 'false' * Update Remote to disableLocking name and default change * [C#] Various Fixes (#635) * Fixes: - Fixed WriteReason when CTT overrides ReadCache - make DisableLocking a readonly member - Call SetTentativeAtomic after Post* - Make readcache and comparer private with internal accessors for test - FIx intermittent failure of BasicHighLatencyDeviceTest * back out changes to move from internal -> private for FKV.readcache and .comparer * [C#] Remove StrictCPR (#636) * Removed WAIT_PENDING * StrictCPR removal WIP * Fix bug in state machine test, as it was not using unsafe context for fine grained control over the state machine execution. * Remove PendingContext.HeldLatch and heldOperation local * Revise FASTER.Benchmark to replace --noaff with --safectx and integrate this into Ycsb and SpanbyteYcsb * check epoch protection for complete pending * *UnsafeContext: AnyInstanceProtected -> ThisInstanceProtected Co-authored-by: TedHartMS <15467143+TedHartMS@users.noreply.github.com> * [C#] Support int session ID for FasterKV (#641) * Support int session ID for FasterKV * fix remote solution, minor name updates * update FasterLog API for TryEnqueue of custom header * [C#] IEntry interface for FasterLog (#639) * enqueue with entries prototype * Add IEntry tests and method variants * Address code review comments * Rename + read entries * Add async versions of consumer * Make interfaces top-level * Correct header offset in FasterLog new API * [C#] Recover returns version we recovered to (#648) * add to FasterLog SpanByte API * fix breaking tests * Fix dispose loop * Update FasterServerBase.cs * do not remove ioPendingRequests in RMWAsync if there was no disk request (#653) * [C#] [WIP] Status return code v2 (#638) * Prototype of status as struct * improving status a bit * fix build break, expose underlying (raw) status code to user * misc * Update StatusCode * Update Remote to new Status(Code); fix test cases; fix StatusCode layout; fine-tune Status(Code) names; make StatusCode internal * Update StatusCode and Status to final spec * Update Remote to new Status spec * unrelated nit Co-authored-by: TedHartMS <15467143+TedHartMS@users.noreply.github.com> * [C#] Change IFunctions 'address' parameter to UpdateInfo or ReadInfo (#652) * Add UpdateInfo and ReadInfo to IFunctions calls * Update Remote IFunctions implementations to UpdateInfo/ReadInfo changes Co-authored-by: Badrish Chandramouli <badrishc@microsoft.com> * Wire status into remote v2 (#657) Add NotFound API for status * Status naming changes and UpdateInfo structure split for v2 preview (#658) * [C#] Add Status.Record (#659) * Add Status.Record; update OperationStatus with all Advanced Status codes * Update Remote for status.Pending => .IsPending * Update nuspecs * more updates * Update azure-pipelines.yml * Update azure-pipelines.yml * revert windows-2022 in yml * Rename StatusCode.OK to Found (#662) * nit * update SpanByte with API to get pointer including metadata * Fixing ranges in OnPagesReadyToClose * [C#] Websocket bug-fixes (#663) * Fixed nits in websockets: * Clean disconnection * Support correction for large packets * Small nit for correcting message length * changed status to new FASTER status codes * Modified status codes Co-authored-by: Rohan Kadekodi <kadekodirohan@gmail.com> * Revert THA * nits * Improving cache tracker * fix NET5_0 to NET5_0_OR_GREATER * [C#] Add CompletePending[WithOutputs] to IFasterContext (#664) * Move CompletePending(WithOutputs) into IFasterContext * Skip LockEvictionObserver entirely if no LUCs active * Make Decrement interlocked; inline one accessor; revert CMakeLists.txt * [C#] Upgrade blob tests to Azurite, enable blob tests on Linux, use windows-2022 for CI (#666) * install azurite * Change testcase to make sure commit completed before dispose, it is up to user to ensure no ongoing commits at time of dispose. * [C#] UnsealPhysicalAddress fix (#665) * Fix unsealPA going below HA; return SUCCESS instead of NOTFOUND from normal reads that find an obsolete record in ITCTT * Ensure InternalLock calls require epoch protection * WIP: Spin wait on Pending Reads/RMWs until ClosedUntilAddress catches up. Still needs to handle partial page evictions. * Ensure partial ClosedUntilAddress shifts occur correctly. * [C#] Cancellation, ReadOptions, ReadFlags refactor (#668) * Add DeleteRecord and CancelOperation to *Info structures and IFunctions * Added ReadOptions * Move IFunctions methods' "ref RecordInfo" parameter to an *Info property, as it does not need to be updated * Update ReadFlags * ReadFlags fixes * Change XxxInfo.DeleteRecord/.CancelAction to XxxAction enum * Fixing Expiration tests * Add Phase to ExpirationTests * Add ReadOnly region to expiration tests * Delete and Upsert search down to HeadAddress if active LUC * [C#] Misc v2 fixes (#675) Fix misc bugs in v2 * update spanbyte * Yield thread when unable to reserve epoch entry, move iteration count outside table loop. * remove exception from overloaded lightepoch * Fix benchmark to run on .net 6 and linux. * fix another place * [C#] Improvements to LightEpoch * Use AllocateArray in LightEpoch * LightEpoch: Use two hash functions + linear probe, cache last successful probe per thread. Adjust table size based on number of machine processors. * [C#] Use GC.AllocateArray (#683) * Use GC.AllocateArray where possible * update benchmark as well. * Update buffer pool to use GC.AllocateArray * fix debug assert * Make DisposeSession protected in FasterServerBase. * Added SetBytesRead to IServerSession * - update sample .csprojs to target net6 and remove platform-related conditionals from all .csprojs now that we've moved to VS 2022 (#687) - add Status.Expired - update FASTER.client's copies of Status(Code).cs - Replace a TODO with an explanatory comment * Slight refactor of network stack. * Use GC.AllocateArray in SeaaBuffer * Another GC.AllocateArray substitution * [C#] [WIP] Wire disposal into IFunctions v2 (#685) * Add hook for failed CAS during SingleWriter. Still need to support other failed CAS scenarios. * Implement Dispose() functions - (MemoryLogCompactionTests fails at this time) * Fix MemoryLogCompactionTests; move DisposeDeserializedFromDisk up to ICPRFC Co-authored-by: TedHartMS <15467143+TedHartMS@users.noreply.github.com> Co-authored-by: Ted Hart <15467143+TedHartMS@users.noreply.github.com> Co-authored-by: Tianyu Li <litianyu@mit.edu> Co-authored-by: Vasileios Zois <vazois@microsoft.com> Co-authored-by: Sebastian Burckhardt <sburckha@microsoft.com> Co-authored-by: rohankadekodi-msr <69916400+rohankadekodi-msr@users.noreply.github.com> Co-authored-by: Rohan Kadekodi <kadekodirohan@gmail.com>
2022-04-14 02:03:35 +03:00
{
var functions1 = new DisposeFunctions(this, sut: true);
var functions2 = new DisposeFunctions(this, sut: false);
MyKey key = new() { key = TestKey };
MyKey collidingKey = new() { key = TestCollidingKey };
MyValue value = new() { value = TestInitialValue };
MyValue collidingValue = new() { value = TestCollidingValue };
void DoUpsert(DisposeFunctions functions)
{
using var innerSession = fht.NewSession(functions);
if (functions.isSUT)
innerSession.Upsert(ref key, ref value);
else
{
otherGate.Wait();
innerSession.Upsert(ref collidingKey, ref collidingValue);
}
}
var tasks = new[]
{
Task.Factory.StartNew(() => DoUpsert(functions1)),
Task.Factory.StartNew(() => DoUpsert(functions2))
};
Task.WaitAll(tasks);
Assert.AreEqual(DisposeHandler.SingleWriter, functions1.handlerQueue.Dequeue());
Assert.IsEmpty(functions1.handlerQueue);
}
[Test]
[Category("FasterKV")]
[Category("Smoke")]
public void DisposeInitialUpdater2Threads([Values(FlushMode.NoFlush, FlushMode.OnDisk)] FlushMode flushMode)
[C#] FASTER v2 release (#563) * various changes from indexing work (#562) * various changes from indexing work - Add BeginAddress and EndAddress to scan iterators - Allow null deltaFileDevice in HybridLogCheckpointInfo.Recover - Rename FoldOverSnapshot to useFoldOverCheckpoint - Make TakeHybridLogCheckpoint overload call through to overload to avoid duplication - Add default values to new scanDelta and recoverTo arguments - Add missing checkpointManager.OnRecovery call to IntenralRecoverAsync - Fix some comments * Fix shortened name in test to work on Linux * [C#] Record-expiration support in RMW (#545) * Add support for record-expiration management to RMW and I(Advanced)Functions * Update Remote to RMW changes for expiration support * moving remote to IAdvFun * LogDir semantics - minor update Co-authored-by: Badrish Chandramouli <badrishc@microsoft.com> * [C#] Added PostCopyUpdater to IAdvancedFunctions (#561) * Add support for record-expiration management to RMW and I(Advanced)Functions * Update Remote to RMW changes for expiration support * Added PCU * Fixing testcase so that RMW does not expect old address. * Fix PCU bugs * Extend PostCopyUpdate to IFunctions; fix a few comments in remote Co-authored-by: TedHartMS <15467143+TedHartMS@users.noreply.github.com> * [C#] Merge IAdvancedFunctions into IFunctions (#565) * Merge IAdvancedFunctions into IFunctions * Add SupportsPostOperations and Post(IU|CU|SD); expand "ref RecordInfo recordInfo, long address" on Functions * Add RecordMetadata to RMWCompletionCallback params; improve ReadAddressTests * Add tests of Upsert with Input * [C#] RecordInfo v2 (#577) * RecordInfo v2 * fix version jump in CPR. * Updated misc stuff * misc updates to SpanByte * Remove IntExclLocker * Add Try APIs to record locking * Remove FASTERLegacy (#581) * Add Output parameter to Upsert (#574) * Add overloads of Upsert that take "ref Output" and one that takes "out RecordMetadata"; Fix RMW setting pendingContext.RecordInfo/LA; add locking of PostCopyUpdater, PostInitalUpdater, PostSingleWriter; * Reorganize ClientSession IntenralFasterSession to group functions for a given area (Read, Upsert, RMW, etc.) together * Fix locking on Post* calls * Fixes for Post* locking * remove net461 and netcoreapp2.1; add net6.0 in <Choose> to work on later in VS2022 * Update to new RecordInfo locking calls * Update to new IFunctions Locking signatures and RecordInfo implementation * Add post operations to Faster.benchmark * [C#] Checkpoint, Recovery, RecordInfo updates (#588) * Removed WAIT_PENDING * * Use only 1 bit for newVersion in RecordInfo, for CPR. Semantics are that sessions in v+1 will create records in fuzzy region with this bit set. Recovery only scans fuzzy region to elide such records. * Add 1 Filler bit for future use with fillers in records * Increase read lock bits to 6 (64 parallel readers) * Use dirty bit for incremental checkpoints * fix ycsb to not delete data file if we are using --recover * Fix epoch re-entry violation * Move to long versions, for KV checkpoints. * Shuffle around stuff for better cache alignment in benchmark. * Updates based on review * [C#] FasterLog Commit Optimization (v2) (#587) * Checkpoint work * Add notion of manual commit * Recovery of commit cookie * alternative design of log-cookie * Implementation improvement * code review comments * Cleanup + testing * Add management utility for LogCommitManager * Handle race on manual commit code path where not the latest tail is written out * Add condition to only scan log in fastCommitMode * Rough draft to allow for 1. elided commit record when fastCommit turned off and 2. "loose" commits * checkpoint changes * fix bug with readonly log allocator initialization * disable fast commit temporarily for CI * fix MLSD and mem device fast commit behavior * fix AzureStorageDevice exception type and remove self-termination on failure * test case on concurrent inserts * Re-enable epoch protection on CommitInternal * Ensure that full flush list error callbacks do not break FlushedUntilAddress tracking * Fix unclean shutdown of stress test * update device log test to scan until tail instead * change error code used for full flush list to better distinguish from others * Minor updates. Co-authored-by: Badrish Chandramouli <badrishc@microsoft.com> * Remove legacy local log commit manager * [C#] FasterLog v2 - misc changes, removed OverWrite commits (#593) * Checkin misc changes, removed overWrite commits * simplify OnRecovery logic * Fix build after merge * fix alignment of device commit manager * [C#] v2 pending flush list (#596) * Make PendingFlushList never error out in stressful situations. Current implementation uses lock for ~5-10% perf degradation over prior structure. * [C#] FasterLog v2: Fix FasterLog missed final commit (#597) * Fix FasterLog missed final commit. * [C#] Log compaction v2 (#598) * initial checkin * New ShiftBeginAddress behavior -- only shifts BeginAddress variable and does not truncate physical log unless option is specified. Also added Log.Truncate API for physical log truncation. Truncate log until persisted BeginAddress after taking a checkpoint. * Fix epoch protection orderings. * minor improvement to TestUtils to avoid race exception. * update Program.cs * updates from master. * [C#] V2 Custom Commit Strategy (#599) * Add FasterLogCommitStrategy * Use Bakery algorithm for latch * Documentation + tests + improved threading performance * Fix initialization error * Revert to v2 synchronization scheme * Optimization around commit strategies * Refactor CommitPolicy only for normal commits * fix missing spin wait * [C#] Fix v2 CommitPolicy Warnings (#607) * fix warnings * fix broken test * update for code consistency * Merged PR 59053: Network Stack Refactoring into FASTER This pull request contains the necessary changes for the updated network stack interface used by FASTER. It adds INetworkSender.cs and NetworkSenderBase.cs that can be used to implement custom communication protocols. Currently only TcpNetworkSender is supported. * Create .dockerignore * Added TentativeHeadAddress - we first shift this, and when all threads agree, we can do some pre-closing work such as eviction. Then we can shift the actual HeadAddress, closing pages when all threads agree on this. (#608) * Cleanup and remove dead code + reuse base provider. * Code cleanup * [C#] minor cleanup of fasterlog v2 (#611) * minor cleanup of fasterlog * [C#] Remove CheckpointType from CheckpointSettings (v2) (#614) * Remove CheckpointType from CheckpointSettings. Users have to specify checkpoint type on a per checkpoint basis. * fix build break * Fix CTT to call PostSingleWriter. * Avoid double init of FasterLog * [C#] Fixing warnings (#615) * Fixing CI warnings * [C#] Updating dependent package versions in v2 (#616) * Updating dependent package versions * nit * [C#] Improved FasterKV and FasterLog settings API for v2 (#618) * Simpler config API for v2. Move FasterLog to its own folder. * Remove purgeEarlierCommits from reader. Instead: 1. writer retries file deletes (in device commit manager) if access denied, in a loop, until timeout 2. reader (user code) retries recover async if it fails due to file deleted, until timeout * [C#] FasterLog V2 Device error handling (#612) * prototype device * prototype failure handling * Add proposed error handling code * Basic error handling tasks * Fault tolerant devices * Change to failure handler based approach instead of just throwing an exception * Remove brittle error handling code * make sure to read pages from flaky device on recovery in test * fix warnings * code review comments * See if we can enforce clean shutdown * Add extensions to enqueue SpanByte to FasterLog, and unsafely iterate without memory copy. (#621) * [C#] FasterLog v2 Add ability to explicitly terminate a log (#620) * Add ability to explicitly terminate a log * remove special 0-length return on eof * Add LogCompleted in iterator * Change comment and test * fix async iteration logic * fixes Co-authored-by: Badrish Chandramouli <badrishc@microsoft.com> * Maybe fix SVS issue with atomic reads (#622) * [C#] FasterLog v2 iteration fix (#623) * First pass of fixes * undo local change * [C#] Updated docs for FasterLog v2 (#624) * some updates * Add missing documentation * Update 40-fasterlog-basics.md Co-authored-by: Badrish Chandramouli <badrish@gmail.com> * Fix logic for directory delete timeouts. * Speed up testcases * [C#] Lockable Unsafe Context (LUC) in FasterKV v2 (WIP) (#605) * WIP on ManualFasterOperations * fixes for v2 merge * Updates to locking (still in progress) - Remove User-defined locks - Move SupportsLocking up to FasterKV level - Skip Stub and Sealed in iterators - Change PendingContext.OperationFlags from byte to ushort - Add ReadFlags.SkipCopyToTail - Add IsLocked*, TranferLocks methods to RecordInfo - Add UnsafeCompletePending* to ManualOps - Track lock counts in ManualOps and throw if Dispose() is called with locks or epoch held - Add LockInfo for ManualOps.*Lock - Implementation and testing of Faster operations with ManualOps locks - Fix ReadAddressTests to reflect improved consistency of not returning readcache addresses * Locking docs * Update 30-fasterkv-manual-locking.md * Updated doc to GH review and discussions * WIP for LockableRawContext * Existing tests run * Rename to LockableRawContext, IFasterContext * Perf workaround for LockTable.IsActive * WIP on ReadCacheEvict and MemoryPageLockEvictionScan * Add ReadCache and LockTable-transfer tests; move ReadCache tests out to their own sub-hierarchy * Test MemoryPageLockEvictionScan * Add testing for two-phase upsert/copytotail * Remove manual locking bits in Recovery; minor refactorings in Recovery.cs to reduce duplication * Add manual locking to FASTER.benchmark * More LockTable testing and fixes, mostly around ocking nonexistent key while Upsert/RMW/Deleting that key * Add UnsafeContext and make it the default for FASTER.Benchmark * Updates from code review: - IsLocked returns shared lock count (added test) - Fix location of IsIntermediate checks in RecordInfo.Lock/Seal - Remove unused IEqualityComparer in LockTableEntry * Rename Take(Full|Index|HybridLog)Checkpoint to TryInitiate(Full|Index|HybridLog)Checkpoint, so it is obvious they need to complete it * - Remove SupportsPostOperations; this is now always done - Add SingleDeleter for symmetry with Upsert - Add DisposeKey and DisposeValue * Add CopyWriter, to distinguish "maintentance" copying (CopyToTail or copy to ReadCache) from API-parameter copies * merge fixes * Remove obsolete Functions-level locking and postOps specifications * Fix Remote build Co-authored-by: Badrish Chandramouli <badrishc@microsoft.com> * fix semantic merge conflict in MemoryPageScanIterator (#632) * [C#] Add WriteReason parameter to SingleWriter (#630) * Add Functions.PostCopyWriter; update MemOnlyCache to use Post(Single|Copy)Writer * Remove (Post)CopyWriter and replace with WriteReason parameter to (Post)SingleWriter * Move SingleWriter "reason" parameter * Move ReadFlags and WriteReason to their own files; rename SupportsLocking -> DisableLocking with default 'false' * Update Remote to disableLocking name and default change * [C#] Various Fixes (#635) * Fixes: - Fixed WriteReason when CTT overrides ReadCache - make DisableLocking a readonly member - Call SetTentativeAtomic after Post* - Make readcache and comparer private with internal accessors for test - FIx intermittent failure of BasicHighLatencyDeviceTest * back out changes to move from internal -> private for FKV.readcache and .comparer * [C#] Remove StrictCPR (#636) * Removed WAIT_PENDING * StrictCPR removal WIP * Fix bug in state machine test, as it was not using unsafe context for fine grained control over the state machine execution. * Remove PendingContext.HeldLatch and heldOperation local * Revise FASTER.Benchmark to replace --noaff with --safectx and integrate this into Ycsb and SpanbyteYcsb * check epoch protection for complete pending * *UnsafeContext: AnyInstanceProtected -> ThisInstanceProtected Co-authored-by: TedHartMS <15467143+TedHartMS@users.noreply.github.com> * [C#] Support int session ID for FasterKV (#641) * Support int session ID for FasterKV * fix remote solution, minor name updates * update FasterLog API for TryEnqueue of custom header * [C#] IEntry interface for FasterLog (#639) * enqueue with entries prototype * Add IEntry tests and method variants * Address code review comments * Rename + read entries * Add async versions of consumer * Make interfaces top-level * Correct header offset in FasterLog new API * [C#] Recover returns version we recovered to (#648) * add to FasterLog SpanByte API * fix breaking tests * Fix dispose loop * Update FasterServerBase.cs * do not remove ioPendingRequests in RMWAsync if there was no disk request (#653) * [C#] [WIP] Status return code v2 (#638) * Prototype of status as struct * improving status a bit * fix build break, expose underlying (raw) status code to user * misc * Update StatusCode * Update Remote to new Status(Code); fix test cases; fix StatusCode layout; fine-tune Status(Code) names; make StatusCode internal * Update StatusCode and Status to final spec * Update Remote to new Status spec * unrelated nit Co-authored-by: TedHartMS <15467143+TedHartMS@users.noreply.github.com> * [C#] Change IFunctions 'address' parameter to UpdateInfo or ReadInfo (#652) * Add UpdateInfo and ReadInfo to IFunctions calls * Update Remote IFunctions implementations to UpdateInfo/ReadInfo changes Co-authored-by: Badrish Chandramouli <badrishc@microsoft.com> * Wire status into remote v2 (#657) Add NotFound API for status * Status naming changes and UpdateInfo structure split for v2 preview (#658) * [C#] Add Status.Record (#659) * Add Status.Record; update OperationStatus with all Advanced Status codes * Update Remote for status.Pending => .IsPending * Update nuspecs * more updates * Update azure-pipelines.yml * Update azure-pipelines.yml * revert windows-2022 in yml * Rename StatusCode.OK to Found (#662) * nit * update SpanByte with API to get pointer including metadata * Fixing ranges in OnPagesReadyToClose * [C#] Websocket bug-fixes (#663) * Fixed nits in websockets: * Clean disconnection * Support correction for large packets * Small nit for correcting message length * changed status to new FASTER status codes * Modified status codes Co-authored-by: Rohan Kadekodi <kadekodirohan@gmail.com> * Revert THA * nits * Improving cache tracker * fix NET5_0 to NET5_0_OR_GREATER * [C#] Add CompletePending[WithOutputs] to IFasterContext (#664) * Move CompletePending(WithOutputs) into IFasterContext * Skip LockEvictionObserver entirely if no LUCs active * Make Decrement interlocked; inline one accessor; revert CMakeLists.txt * [C#] Upgrade blob tests to Azurite, enable blob tests on Linux, use windows-2022 for CI (#666) * install azurite * Change testcase to make sure commit completed before dispose, it is up to user to ensure no ongoing commits at time of dispose. * [C#] UnsealPhysicalAddress fix (#665) * Fix unsealPA going below HA; return SUCCESS instead of NOTFOUND from normal reads that find an obsolete record in ITCTT * Ensure InternalLock calls require epoch protection * WIP: Spin wait on Pending Reads/RMWs until ClosedUntilAddress catches up. Still needs to handle partial page evictions. * Ensure partial ClosedUntilAddress shifts occur correctly. * [C#] Cancellation, ReadOptions, ReadFlags refactor (#668) * Add DeleteRecord and CancelOperation to *Info structures and IFunctions * Added ReadOptions * Move IFunctions methods' "ref RecordInfo" parameter to an *Info property, as it does not need to be updated * Update ReadFlags * ReadFlags fixes * Change XxxInfo.DeleteRecord/.CancelAction to XxxAction enum * Fixing Expiration tests * Add Phase to ExpirationTests * Add ReadOnly region to expiration tests * Delete and Upsert search down to HeadAddress if active LUC * [C#] Misc v2 fixes (#675) Fix misc bugs in v2 * update spanbyte * Yield thread when unable to reserve epoch entry, move iteration count outside table loop. * remove exception from overloaded lightepoch * Fix benchmark to run on .net 6 and linux. * fix another place * [C#] Improvements to LightEpoch * Use AllocateArray in LightEpoch * LightEpoch: Use two hash functions + linear probe, cache last successful probe per thread. Adjust table size based on number of machine processors. * [C#] Use GC.AllocateArray (#683) * Use GC.AllocateArray where possible * update benchmark as well. * Update buffer pool to use GC.AllocateArray * fix debug assert * Make DisposeSession protected in FasterServerBase. * Added SetBytesRead to IServerSession * - update sample .csprojs to target net6 and remove platform-related conditionals from all .csprojs now that we've moved to VS 2022 (#687) - add Status.Expired - update FASTER.client's copies of Status(Code).cs - Replace a TODO with an explanatory comment * Slight refactor of network stack. * Use GC.AllocateArray in SeaaBuffer * Another GC.AllocateArray substitution * [C#] [WIP] Wire disposal into IFunctions v2 (#685) * Add hook for failed CAS during SingleWriter. Still need to support other failed CAS scenarios. * Implement Dispose() functions - (MemoryLogCompactionTests fails at this time) * Fix MemoryLogCompactionTests; move DisposeDeserializedFromDisk up to ICPRFC Co-authored-by: TedHartMS <15467143+TedHartMS@users.noreply.github.com> Co-authored-by: Ted Hart <15467143+TedHartMS@users.noreply.github.com> Co-authored-by: Tianyu Li <litianyu@mit.edu> Co-authored-by: Vasileios Zois <vazois@microsoft.com> Co-authored-by: Sebastian Burckhardt <sburckha@microsoft.com> Co-authored-by: rohankadekodi-msr <69916400+rohankadekodi-msr@users.noreply.github.com> Co-authored-by: Rohan Kadekodi <kadekodirohan@gmail.com>
2022-04-14 02:03:35 +03:00
{
var functions1 = new DisposeFunctions(this, sut: true);
var functions2 = new DisposeFunctions(this, sut: false);
MyKey key = new() { key = TestKey };
MyKey collidingKey = new() { key = TestCollidingKey };
MyInput input = new() { value = TestInitialValue };
MyInput collidingInput = new() { value = TestCollidingValue };
DoFlush(flushMode);
void DoInsert(DisposeFunctions functions)
{
using var session = fht.NewSession(functions);
if (functions.isSUT)
session.RMW(ref key, ref input);
else
{
otherGate.Wait();
session.RMW(ref collidingKey, ref collidingInput);
}
}
var tasks = new[]
{
Task.Factory.StartNew(() => DoInsert(functions1)),
Task.Factory.StartNew(() => DoInsert(functions2))
};
Task.WaitAll(tasks);
Assert.AreEqual(DisposeHandler.InitialUpdater, functions1.handlerQueue.Dequeue());
Assert.IsEmpty(functions1.handlerQueue);
}
[Test]
[Category("FasterKV")]
[Category("Smoke")]
public void DisposeCopyUpdater2Threads([Values(FlushMode.ReadOnly, FlushMode.OnDisk)] FlushMode flushMode)
[C#] FASTER v2 release (#563) * various changes from indexing work (#562) * various changes from indexing work - Add BeginAddress and EndAddress to scan iterators - Allow null deltaFileDevice in HybridLogCheckpointInfo.Recover - Rename FoldOverSnapshot to useFoldOverCheckpoint - Make TakeHybridLogCheckpoint overload call through to overload to avoid duplication - Add default values to new scanDelta and recoverTo arguments - Add missing checkpointManager.OnRecovery call to IntenralRecoverAsync - Fix some comments * Fix shortened name in test to work on Linux * [C#] Record-expiration support in RMW (#545) * Add support for record-expiration management to RMW and I(Advanced)Functions * Update Remote to RMW changes for expiration support * moving remote to IAdvFun * LogDir semantics - minor update Co-authored-by: Badrish Chandramouli <badrishc@microsoft.com> * [C#] Added PostCopyUpdater to IAdvancedFunctions (#561) * Add support for record-expiration management to RMW and I(Advanced)Functions * Update Remote to RMW changes for expiration support * Added PCU * Fixing testcase so that RMW does not expect old address. * Fix PCU bugs * Extend PostCopyUpdate to IFunctions; fix a few comments in remote Co-authored-by: TedHartMS <15467143+TedHartMS@users.noreply.github.com> * [C#] Merge IAdvancedFunctions into IFunctions (#565) * Merge IAdvancedFunctions into IFunctions * Add SupportsPostOperations and Post(IU|CU|SD); expand "ref RecordInfo recordInfo, long address" on Functions * Add RecordMetadata to RMWCompletionCallback params; improve ReadAddressTests * Add tests of Upsert with Input * [C#] RecordInfo v2 (#577) * RecordInfo v2 * fix version jump in CPR. * Updated misc stuff * misc updates to SpanByte * Remove IntExclLocker * Add Try APIs to record locking * Remove FASTERLegacy (#581) * Add Output parameter to Upsert (#574) * Add overloads of Upsert that take "ref Output" and one that takes "out RecordMetadata"; Fix RMW setting pendingContext.RecordInfo/LA; add locking of PostCopyUpdater, PostInitalUpdater, PostSingleWriter; * Reorganize ClientSession IntenralFasterSession to group functions for a given area (Read, Upsert, RMW, etc.) together * Fix locking on Post* calls * Fixes for Post* locking * remove net461 and netcoreapp2.1; add net6.0 in <Choose> to work on later in VS2022 * Update to new RecordInfo locking calls * Update to new IFunctions Locking signatures and RecordInfo implementation * Add post operations to Faster.benchmark * [C#] Checkpoint, Recovery, RecordInfo updates (#588) * Removed WAIT_PENDING * * Use only 1 bit for newVersion in RecordInfo, for CPR. Semantics are that sessions in v+1 will create records in fuzzy region with this bit set. Recovery only scans fuzzy region to elide such records. * Add 1 Filler bit for future use with fillers in records * Increase read lock bits to 6 (64 parallel readers) * Use dirty bit for incremental checkpoints * fix ycsb to not delete data file if we are using --recover * Fix epoch re-entry violation * Move to long versions, for KV checkpoints. * Shuffle around stuff for better cache alignment in benchmark. * Updates based on review * [C#] FasterLog Commit Optimization (v2) (#587) * Checkpoint work * Add notion of manual commit * Recovery of commit cookie * alternative design of log-cookie * Implementation improvement * code review comments * Cleanup + testing * Add management utility for LogCommitManager * Handle race on manual commit code path where not the latest tail is written out * Add condition to only scan log in fastCommitMode * Rough draft to allow for 1. elided commit record when fastCommit turned off and 2. "loose" commits * checkpoint changes * fix bug with readonly log allocator initialization * disable fast commit temporarily for CI * fix MLSD and mem device fast commit behavior * fix AzureStorageDevice exception type and remove self-termination on failure * test case on concurrent inserts * Re-enable epoch protection on CommitInternal * Ensure that full flush list error callbacks do not break FlushedUntilAddress tracking * Fix unclean shutdown of stress test * update device log test to scan until tail instead * change error code used for full flush list to better distinguish from others * Minor updates. Co-authored-by: Badrish Chandramouli <badrishc@microsoft.com> * Remove legacy local log commit manager * [C#] FasterLog v2 - misc changes, removed OverWrite commits (#593) * Checkin misc changes, removed overWrite commits * simplify OnRecovery logic * Fix build after merge * fix alignment of device commit manager * [C#] v2 pending flush list (#596) * Make PendingFlushList never error out in stressful situations. Current implementation uses lock for ~5-10% perf degradation over prior structure. * [C#] FasterLog v2: Fix FasterLog missed final commit (#597) * Fix FasterLog missed final commit. * [C#] Log compaction v2 (#598) * initial checkin * New ShiftBeginAddress behavior -- only shifts BeginAddress variable and does not truncate physical log unless option is specified. Also added Log.Truncate API for physical log truncation. Truncate log until persisted BeginAddress after taking a checkpoint. * Fix epoch protection orderings. * minor improvement to TestUtils to avoid race exception. * update Program.cs * updates from master. * [C#] V2 Custom Commit Strategy (#599) * Add FasterLogCommitStrategy * Use Bakery algorithm for latch * Documentation + tests + improved threading performance * Fix initialization error * Revert to v2 synchronization scheme * Optimization around commit strategies * Refactor CommitPolicy only for normal commits * fix missing spin wait * [C#] Fix v2 CommitPolicy Warnings (#607) * fix warnings * fix broken test * update for code consistency * Merged PR 59053: Network Stack Refactoring into FASTER This pull request contains the necessary changes for the updated network stack interface used by FASTER. It adds INetworkSender.cs and NetworkSenderBase.cs that can be used to implement custom communication protocols. Currently only TcpNetworkSender is supported. * Create .dockerignore * Added TentativeHeadAddress - we first shift this, and when all threads agree, we can do some pre-closing work such as eviction. Then we can shift the actual HeadAddress, closing pages when all threads agree on this. (#608) * Cleanup and remove dead code + reuse base provider. * Code cleanup * [C#] minor cleanup of fasterlog v2 (#611) * minor cleanup of fasterlog * [C#] Remove CheckpointType from CheckpointSettings (v2) (#614) * Remove CheckpointType from CheckpointSettings. Users have to specify checkpoint type on a per checkpoint basis. * fix build break * Fix CTT to call PostSingleWriter. * Avoid double init of FasterLog * [C#] Fixing warnings (#615) * Fixing CI warnings * [C#] Updating dependent package versions in v2 (#616) * Updating dependent package versions * nit * [C#] Improved FasterKV and FasterLog settings API for v2 (#618) * Simpler config API for v2. Move FasterLog to its own folder. * Remove purgeEarlierCommits from reader. Instead: 1. writer retries file deletes (in device commit manager) if access denied, in a loop, until timeout 2. reader (user code) retries recover async if it fails due to file deleted, until timeout * [C#] FasterLog V2 Device error handling (#612) * prototype device * prototype failure handling * Add proposed error handling code * Basic error handling tasks * Fault tolerant devices * Change to failure handler based approach instead of just throwing an exception * Remove brittle error handling code * make sure to read pages from flaky device on recovery in test * fix warnings * code review comments * See if we can enforce clean shutdown * Add extensions to enqueue SpanByte to FasterLog, and unsafely iterate without memory copy. (#621) * [C#] FasterLog v2 Add ability to explicitly terminate a log (#620) * Add ability to explicitly terminate a log * remove special 0-length return on eof * Add LogCompleted in iterator * Change comment and test * fix async iteration logic * fixes Co-authored-by: Badrish Chandramouli <badrishc@microsoft.com> * Maybe fix SVS issue with atomic reads (#622) * [C#] FasterLog v2 iteration fix (#623) * First pass of fixes * undo local change * [C#] Updated docs for FasterLog v2 (#624) * some updates * Add missing documentation * Update 40-fasterlog-basics.md Co-authored-by: Badrish Chandramouli <badrish@gmail.com> * Fix logic for directory delete timeouts. * Speed up testcases * [C#] Lockable Unsafe Context (LUC) in FasterKV v2 (WIP) (#605) * WIP on ManualFasterOperations * fixes for v2 merge * Updates to locking (still in progress) - Remove User-defined locks - Move SupportsLocking up to FasterKV level - Skip Stub and Sealed in iterators - Change PendingContext.OperationFlags from byte to ushort - Add ReadFlags.SkipCopyToTail - Add IsLocked*, TranferLocks methods to RecordInfo - Add UnsafeCompletePending* to ManualOps - Track lock counts in ManualOps and throw if Dispose() is called with locks or epoch held - Add LockInfo for ManualOps.*Lock - Implementation and testing of Faster operations with ManualOps locks - Fix ReadAddressTests to reflect improved consistency of not returning readcache addresses * Locking docs * Update 30-fasterkv-manual-locking.md * Updated doc to GH review and discussions * WIP for LockableRawContext * Existing tests run * Rename to LockableRawContext, IFasterContext * Perf workaround for LockTable.IsActive * WIP on ReadCacheEvict and MemoryPageLockEvictionScan * Add ReadCache and LockTable-transfer tests; move ReadCache tests out to their own sub-hierarchy * Test MemoryPageLockEvictionScan * Add testing for two-phase upsert/copytotail * Remove manual locking bits in Recovery; minor refactorings in Recovery.cs to reduce duplication * Add manual locking to FASTER.benchmark * More LockTable testing and fixes, mostly around ocking nonexistent key while Upsert/RMW/Deleting that key * Add UnsafeContext and make it the default for FASTER.Benchmark * Updates from code review: - IsLocked returns shared lock count (added test) - Fix location of IsIntermediate checks in RecordInfo.Lock/Seal - Remove unused IEqualityComparer in LockTableEntry * Rename Take(Full|Index|HybridLog)Checkpoint to TryInitiate(Full|Index|HybridLog)Checkpoint, so it is obvious they need to complete it * - Remove SupportsPostOperations; this is now always done - Add SingleDeleter for symmetry with Upsert - Add DisposeKey and DisposeValue * Add CopyWriter, to distinguish "maintentance" copying (CopyToTail or copy to ReadCache) from API-parameter copies * merge fixes * Remove obsolete Functions-level locking and postOps specifications * Fix Remote build Co-authored-by: Badrish Chandramouli <badrishc@microsoft.com> * fix semantic merge conflict in MemoryPageScanIterator (#632) * [C#] Add WriteReason parameter to SingleWriter (#630) * Add Functions.PostCopyWriter; update MemOnlyCache to use Post(Single|Copy)Writer * Remove (Post)CopyWriter and replace with WriteReason parameter to (Post)SingleWriter * Move SingleWriter "reason" parameter * Move ReadFlags and WriteReason to their own files; rename SupportsLocking -> DisableLocking with default 'false' * Update Remote to disableLocking name and default change * [C#] Various Fixes (#635) * Fixes: - Fixed WriteReason when CTT overrides ReadCache - make DisableLocking a readonly member - Call SetTentativeAtomic after Post* - Make readcache and comparer private with internal accessors for test - FIx intermittent failure of BasicHighLatencyDeviceTest * back out changes to move from internal -> private for FKV.readcache and .comparer * [C#] Remove StrictCPR (#636) * Removed WAIT_PENDING * StrictCPR removal WIP * Fix bug in state machine test, as it was not using unsafe context for fine grained control over the state machine execution. * Remove PendingContext.HeldLatch and heldOperation local * Revise FASTER.Benchmark to replace --noaff with --safectx and integrate this into Ycsb and SpanbyteYcsb * check epoch protection for complete pending * *UnsafeContext: AnyInstanceProtected -> ThisInstanceProtected Co-authored-by: TedHartMS <15467143+TedHartMS@users.noreply.github.com> * [C#] Support int session ID for FasterKV (#641) * Support int session ID for FasterKV * fix remote solution, minor name updates * update FasterLog API for TryEnqueue of custom header * [C#] IEntry interface for FasterLog (#639) * enqueue with entries prototype * Add IEntry tests and method variants * Address code review comments * Rename + read entries * Add async versions of consumer * Make interfaces top-level * Correct header offset in FasterLog new API * [C#] Recover returns version we recovered to (#648) * add to FasterLog SpanByte API * fix breaking tests * Fix dispose loop * Update FasterServerBase.cs * do not remove ioPendingRequests in RMWAsync if there was no disk request (#653) * [C#] [WIP] Status return code v2 (#638) * Prototype of status as struct * improving status a bit * fix build break, expose underlying (raw) status code to user * misc * Update StatusCode * Update Remote to new Status(Code); fix test cases; fix StatusCode layout; fine-tune Status(Code) names; make StatusCode internal * Update StatusCode and Status to final spec * Update Remote to new Status spec * unrelated nit Co-authored-by: TedHartMS <15467143+TedHartMS@users.noreply.github.com> * [C#] Change IFunctions 'address' parameter to UpdateInfo or ReadInfo (#652) * Add UpdateInfo and ReadInfo to IFunctions calls * Update Remote IFunctions implementations to UpdateInfo/ReadInfo changes Co-authored-by: Badrish Chandramouli <badrishc@microsoft.com> * Wire status into remote v2 (#657) Add NotFound API for status * Status naming changes and UpdateInfo structure split for v2 preview (#658) * [C#] Add Status.Record (#659) * Add Status.Record; update OperationStatus with all Advanced Status codes * Update Remote for status.Pending => .IsPending * Update nuspecs * more updates * Update azure-pipelines.yml * Update azure-pipelines.yml * revert windows-2022 in yml * Rename StatusCode.OK to Found (#662) * nit * update SpanByte with API to get pointer including metadata * Fixing ranges in OnPagesReadyToClose * [C#] Websocket bug-fixes (#663) * Fixed nits in websockets: * Clean disconnection * Support correction for large packets * Small nit for correcting message length * changed status to new FASTER status codes * Modified status codes Co-authored-by: Rohan Kadekodi <kadekodirohan@gmail.com> * Revert THA * nits * Improving cache tracker * fix NET5_0 to NET5_0_OR_GREATER * [C#] Add CompletePending[WithOutputs] to IFasterContext (#664) * Move CompletePending(WithOutputs) into IFasterContext * Skip LockEvictionObserver entirely if no LUCs active * Make Decrement interlocked; inline one accessor; revert CMakeLists.txt * [C#] Upgrade blob tests to Azurite, enable blob tests on Linux, use windows-2022 for CI (#666) * install azurite * Change testcase to make sure commit completed before dispose, it is up to user to ensure no ongoing commits at time of dispose. * [C#] UnsealPhysicalAddress fix (#665) * Fix unsealPA going below HA; return SUCCESS instead of NOTFOUND from normal reads that find an obsolete record in ITCTT * Ensure InternalLock calls require epoch protection * WIP: Spin wait on Pending Reads/RMWs until ClosedUntilAddress catches up. Still needs to handle partial page evictions. * Ensure partial ClosedUntilAddress shifts occur correctly. * [C#] Cancellation, ReadOptions, ReadFlags refactor (#668) * Add DeleteRecord and CancelOperation to *Info structures and IFunctions * Added ReadOptions * Move IFunctions methods' "ref RecordInfo" parameter to an *Info property, as it does not need to be updated * Update ReadFlags * ReadFlags fixes * Change XxxInfo.DeleteRecord/.CancelAction to XxxAction enum * Fixing Expiration tests * Add Phase to ExpirationTests * Add ReadOnly region to expiration tests * Delete and Upsert search down to HeadAddress if active LUC * [C#] Misc v2 fixes (#675) Fix misc bugs in v2 * update spanbyte * Yield thread when unable to reserve epoch entry, move iteration count outside table loop. * remove exception from overloaded lightepoch * Fix benchmark to run on .net 6 and linux. * fix another place * [C#] Improvements to LightEpoch * Use AllocateArray in LightEpoch * LightEpoch: Use two hash functions + linear probe, cache last successful probe per thread. Adjust table size based on number of machine processors. * [C#] Use GC.AllocateArray (#683) * Use GC.AllocateArray where possible * update benchmark as well. * Update buffer pool to use GC.AllocateArray * fix debug assert * Make DisposeSession protected in FasterServerBase. * Added SetBytesRead to IServerSession * - update sample .csprojs to target net6 and remove platform-related conditionals from all .csprojs now that we've moved to VS 2022 (#687) - add Status.Expired - update FASTER.client's copies of Status(Code).cs - Replace a TODO with an explanatory comment * Slight refactor of network stack. * Use GC.AllocateArray in SeaaBuffer * Another GC.AllocateArray substitution * [C#] [WIP] Wire disposal into IFunctions v2 (#685) * Add hook for failed CAS during SingleWriter. Still need to support other failed CAS scenarios. * Implement Dispose() functions - (MemoryLogCompactionTests fails at this time) * Fix MemoryLogCompactionTests; move DisposeDeserializedFromDisk up to ICPRFC Co-authored-by: TedHartMS <15467143+TedHartMS@users.noreply.github.com> Co-authored-by: Ted Hart <15467143+TedHartMS@users.noreply.github.com> Co-authored-by: Tianyu Li <litianyu@mit.edu> Co-authored-by: Vasileios Zois <vazois@microsoft.com> Co-authored-by: Sebastian Burckhardt <sburckha@microsoft.com> Co-authored-by: rohankadekodi-msr <69916400+rohankadekodi-msr@users.noreply.github.com> Co-authored-by: Rohan Kadekodi <kadekodirohan@gmail.com>
2022-04-14 02:03:35 +03:00
{
var functions1 = new DisposeFunctions(this, sut: true);
var functions2 = new DisposeFunctions(this, sut: false);
MyKey key = new() { key = TestKey };
MyKey collidingKey = new() { key = TestCollidingKey };
{
using var session = fht.NewSession(new DisposeFunctionsNoSync());
MyValue value = new() { value = TestInitialValue };
session.Upsert(ref key, ref value);
}
// Make it immutable so CopyUpdater is called.
DoFlush(flushMode);
void DoUpdate(DisposeFunctions functions)
{
using var session = fht.NewSession(functions);
MyInput input = new() { value = functions.isSUT ? TestUpdatedValue : TestCollidingValue };
if (functions.isSUT)
session.RMW(ref key, ref input);
else
{
otherGate.Wait();
session.RMW(ref collidingKey, ref input);
}
session.CompletePending(true);
[C#] FASTER v2 release (#563) * various changes from indexing work (#562) * various changes from indexing work - Add BeginAddress and EndAddress to scan iterators - Allow null deltaFileDevice in HybridLogCheckpointInfo.Recover - Rename FoldOverSnapshot to useFoldOverCheckpoint - Make TakeHybridLogCheckpoint overload call through to overload to avoid duplication - Add default values to new scanDelta and recoverTo arguments - Add missing checkpointManager.OnRecovery call to IntenralRecoverAsync - Fix some comments * Fix shortened name in test to work on Linux * [C#] Record-expiration support in RMW (#545) * Add support for record-expiration management to RMW and I(Advanced)Functions * Update Remote to RMW changes for expiration support * moving remote to IAdvFun * LogDir semantics - minor update Co-authored-by: Badrish Chandramouli <badrishc@microsoft.com> * [C#] Added PostCopyUpdater to IAdvancedFunctions (#561) * Add support for record-expiration management to RMW and I(Advanced)Functions * Update Remote to RMW changes for expiration support * Added PCU * Fixing testcase so that RMW does not expect old address. * Fix PCU bugs * Extend PostCopyUpdate to IFunctions; fix a few comments in remote Co-authored-by: TedHartMS <15467143+TedHartMS@users.noreply.github.com> * [C#] Merge IAdvancedFunctions into IFunctions (#565) * Merge IAdvancedFunctions into IFunctions * Add SupportsPostOperations and Post(IU|CU|SD); expand "ref RecordInfo recordInfo, long address" on Functions * Add RecordMetadata to RMWCompletionCallback params; improve ReadAddressTests * Add tests of Upsert with Input * [C#] RecordInfo v2 (#577) * RecordInfo v2 * fix version jump in CPR. * Updated misc stuff * misc updates to SpanByte * Remove IntExclLocker * Add Try APIs to record locking * Remove FASTERLegacy (#581) * Add Output parameter to Upsert (#574) * Add overloads of Upsert that take "ref Output" and one that takes "out RecordMetadata"; Fix RMW setting pendingContext.RecordInfo/LA; add locking of PostCopyUpdater, PostInitalUpdater, PostSingleWriter; * Reorganize ClientSession IntenralFasterSession to group functions for a given area (Read, Upsert, RMW, etc.) together * Fix locking on Post* calls * Fixes for Post* locking * remove net461 and netcoreapp2.1; add net6.0 in <Choose> to work on later in VS2022 * Update to new RecordInfo locking calls * Update to new IFunctions Locking signatures and RecordInfo implementation * Add post operations to Faster.benchmark * [C#] Checkpoint, Recovery, RecordInfo updates (#588) * Removed WAIT_PENDING * * Use only 1 bit for newVersion in RecordInfo, for CPR. Semantics are that sessions in v+1 will create records in fuzzy region with this bit set. Recovery only scans fuzzy region to elide such records. * Add 1 Filler bit for future use with fillers in records * Increase read lock bits to 6 (64 parallel readers) * Use dirty bit for incremental checkpoints * fix ycsb to not delete data file if we are using --recover * Fix epoch re-entry violation * Move to long versions, for KV checkpoints. * Shuffle around stuff for better cache alignment in benchmark. * Updates based on review * [C#] FasterLog Commit Optimization (v2) (#587) * Checkpoint work * Add notion of manual commit * Recovery of commit cookie * alternative design of log-cookie * Implementation improvement * code review comments * Cleanup + testing * Add management utility for LogCommitManager * Handle race on manual commit code path where not the latest tail is written out * Add condition to only scan log in fastCommitMode * Rough draft to allow for 1. elided commit record when fastCommit turned off and 2. "loose" commits * checkpoint changes * fix bug with readonly log allocator initialization * disable fast commit temporarily for CI * fix MLSD and mem device fast commit behavior * fix AzureStorageDevice exception type and remove self-termination on failure * test case on concurrent inserts * Re-enable epoch protection on CommitInternal * Ensure that full flush list error callbacks do not break FlushedUntilAddress tracking * Fix unclean shutdown of stress test * update device log test to scan until tail instead * change error code used for full flush list to better distinguish from others * Minor updates. Co-authored-by: Badrish Chandramouli <badrishc@microsoft.com> * Remove legacy local log commit manager * [C#] FasterLog v2 - misc changes, removed OverWrite commits (#593) * Checkin misc changes, removed overWrite commits * simplify OnRecovery logic * Fix build after merge * fix alignment of device commit manager * [C#] v2 pending flush list (#596) * Make PendingFlushList never error out in stressful situations. Current implementation uses lock for ~5-10% perf degradation over prior structure. * [C#] FasterLog v2: Fix FasterLog missed final commit (#597) * Fix FasterLog missed final commit. * [C#] Log compaction v2 (#598) * initial checkin * New ShiftBeginAddress behavior -- only shifts BeginAddress variable and does not truncate physical log unless option is specified. Also added Log.Truncate API for physical log truncation. Truncate log until persisted BeginAddress after taking a checkpoint. * Fix epoch protection orderings. * minor improvement to TestUtils to avoid race exception. * update Program.cs * updates from master. * [C#] V2 Custom Commit Strategy (#599) * Add FasterLogCommitStrategy * Use Bakery algorithm for latch * Documentation + tests + improved threading performance * Fix initialization error * Revert to v2 synchronization scheme * Optimization around commit strategies * Refactor CommitPolicy only for normal commits * fix missing spin wait * [C#] Fix v2 CommitPolicy Warnings (#607) * fix warnings * fix broken test * update for code consistency * Merged PR 59053: Network Stack Refactoring into FASTER This pull request contains the necessary changes for the updated network stack interface used by FASTER. It adds INetworkSender.cs and NetworkSenderBase.cs that can be used to implement custom communication protocols. Currently only TcpNetworkSender is supported. * Create .dockerignore * Added TentativeHeadAddress - we first shift this, and when all threads agree, we can do some pre-closing work such as eviction. Then we can shift the actual HeadAddress, closing pages when all threads agree on this. (#608) * Cleanup and remove dead code + reuse base provider. * Code cleanup * [C#] minor cleanup of fasterlog v2 (#611) * minor cleanup of fasterlog * [C#] Remove CheckpointType from CheckpointSettings (v2) (#614) * Remove CheckpointType from CheckpointSettings. Users have to specify checkpoint type on a per checkpoint basis. * fix build break * Fix CTT to call PostSingleWriter. * Avoid double init of FasterLog * [C#] Fixing warnings (#615) * Fixing CI warnings * [C#] Updating dependent package versions in v2 (#616) * Updating dependent package versions * nit * [C#] Improved FasterKV and FasterLog settings API for v2 (#618) * Simpler config API for v2. Move FasterLog to its own folder. * Remove purgeEarlierCommits from reader. Instead: 1. writer retries file deletes (in device commit manager) if access denied, in a loop, until timeout 2. reader (user code) retries recover async if it fails due to file deleted, until timeout * [C#] FasterLog V2 Device error handling (#612) * prototype device * prototype failure handling * Add proposed error handling code * Basic error handling tasks * Fault tolerant devices * Change to failure handler based approach instead of just throwing an exception * Remove brittle error handling code * make sure to read pages from flaky device on recovery in test * fix warnings * code review comments * See if we can enforce clean shutdown * Add extensions to enqueue SpanByte to FasterLog, and unsafely iterate without memory copy. (#621) * [C#] FasterLog v2 Add ability to explicitly terminate a log (#620) * Add ability to explicitly terminate a log * remove special 0-length return on eof * Add LogCompleted in iterator * Change comment and test * fix async iteration logic * fixes Co-authored-by: Badrish Chandramouli <badrishc@microsoft.com> * Maybe fix SVS issue with atomic reads (#622) * [C#] FasterLog v2 iteration fix (#623) * First pass of fixes * undo local change * [C#] Updated docs for FasterLog v2 (#624) * some updates * Add missing documentation * Update 40-fasterlog-basics.md Co-authored-by: Badrish Chandramouli <badrish@gmail.com> * Fix logic for directory delete timeouts. * Speed up testcases * [C#] Lockable Unsafe Context (LUC) in FasterKV v2 (WIP) (#605) * WIP on ManualFasterOperations * fixes for v2 merge * Updates to locking (still in progress) - Remove User-defined locks - Move SupportsLocking up to FasterKV level - Skip Stub and Sealed in iterators - Change PendingContext.OperationFlags from byte to ushort - Add ReadFlags.SkipCopyToTail - Add IsLocked*, TranferLocks methods to RecordInfo - Add UnsafeCompletePending* to ManualOps - Track lock counts in ManualOps and throw if Dispose() is called with locks or epoch held - Add LockInfo for ManualOps.*Lock - Implementation and testing of Faster operations with ManualOps locks - Fix ReadAddressTests to reflect improved consistency of not returning readcache addresses * Locking docs * Update 30-fasterkv-manual-locking.md * Updated doc to GH review and discussions * WIP for LockableRawContext * Existing tests run * Rename to LockableRawContext, IFasterContext * Perf workaround for LockTable.IsActive * WIP on ReadCacheEvict and MemoryPageLockEvictionScan * Add ReadCache and LockTable-transfer tests; move ReadCache tests out to their own sub-hierarchy * Test MemoryPageLockEvictionScan * Add testing for two-phase upsert/copytotail * Remove manual locking bits in Recovery; minor refactorings in Recovery.cs to reduce duplication * Add manual locking to FASTER.benchmark * More LockTable testing and fixes, mostly around ocking nonexistent key while Upsert/RMW/Deleting that key * Add UnsafeContext and make it the default for FASTER.Benchmark * Updates from code review: - IsLocked returns shared lock count (added test) - Fix location of IsIntermediate checks in RecordInfo.Lock/Seal - Remove unused IEqualityComparer in LockTableEntry * Rename Take(Full|Index|HybridLog)Checkpoint to TryInitiate(Full|Index|HybridLog)Checkpoint, so it is obvious they need to complete it * - Remove SupportsPostOperations; this is now always done - Add SingleDeleter for symmetry with Upsert - Add DisposeKey and DisposeValue * Add CopyWriter, to distinguish "maintentance" copying (CopyToTail or copy to ReadCache) from API-parameter copies * merge fixes * Remove obsolete Functions-level locking and postOps specifications * Fix Remote build Co-authored-by: Badrish Chandramouli <badrishc@microsoft.com> * fix semantic merge conflict in MemoryPageScanIterator (#632) * [C#] Add WriteReason parameter to SingleWriter (#630) * Add Functions.PostCopyWriter; update MemOnlyCache to use Post(Single|Copy)Writer * Remove (Post)CopyWriter and replace with WriteReason parameter to (Post)SingleWriter * Move SingleWriter "reason" parameter * Move ReadFlags and WriteReason to their own files; rename SupportsLocking -> DisableLocking with default 'false' * Update Remote to disableLocking name and default change * [C#] Various Fixes (#635) * Fixes: - Fixed WriteReason when CTT overrides ReadCache - make DisableLocking a readonly member - Call SetTentativeAtomic after Post* - Make readcache and comparer private with internal accessors for test - FIx intermittent failure of BasicHighLatencyDeviceTest * back out changes to move from internal -> private for FKV.readcache and .comparer * [C#] Remove StrictCPR (#636) * Removed WAIT_PENDING * StrictCPR removal WIP * Fix bug in state machine test, as it was not using unsafe context for fine grained control over the state machine execution. * Remove PendingContext.HeldLatch and heldOperation local * Revise FASTER.Benchmark to replace --noaff with --safectx and integrate this into Ycsb and SpanbyteYcsb * check epoch protection for complete pending * *UnsafeContext: AnyInstanceProtected -> ThisInstanceProtected Co-authored-by: TedHartMS <15467143+TedHartMS@users.noreply.github.com> * [C#] Support int session ID for FasterKV (#641) * Support int session ID for FasterKV * fix remote solution, minor name updates * update FasterLog API for TryEnqueue of custom header * [C#] IEntry interface for FasterLog (#639) * enqueue with entries prototype * Add IEntry tests and method variants * Address code review comments * Rename + read entries * Add async versions of consumer * Make interfaces top-level * Correct header offset in FasterLog new API * [C#] Recover returns version we recovered to (#648) * add to FasterLog SpanByte API * fix breaking tests * Fix dispose loop * Update FasterServerBase.cs * do not remove ioPendingRequests in RMWAsync if there was no disk request (#653) * [C#] [WIP] Status return code v2 (#638) * Prototype of status as struct * improving status a bit * fix build break, expose underlying (raw) status code to user * misc * Update StatusCode * Update Remote to new Status(Code); fix test cases; fix StatusCode layout; fine-tune Status(Code) names; make StatusCode internal * Update StatusCode and Status to final spec * Update Remote to new Status spec * unrelated nit Co-authored-by: TedHartMS <15467143+TedHartMS@users.noreply.github.com> * [C#] Change IFunctions 'address' parameter to UpdateInfo or ReadInfo (#652) * Add UpdateInfo and ReadInfo to IFunctions calls * Update Remote IFunctions implementations to UpdateInfo/ReadInfo changes Co-authored-by: Badrish Chandramouli <badrishc@microsoft.com> * Wire status into remote v2 (#657) Add NotFound API for status * Status naming changes and UpdateInfo structure split for v2 preview (#658) * [C#] Add Status.Record (#659) * Add Status.Record; update OperationStatus with all Advanced Status codes * Update Remote for status.Pending => .IsPending * Update nuspecs * more updates * Update azure-pipelines.yml * Update azure-pipelines.yml * revert windows-2022 in yml * Rename StatusCode.OK to Found (#662) * nit * update SpanByte with API to get pointer including metadata * Fixing ranges in OnPagesReadyToClose * [C#] Websocket bug-fixes (#663) * Fixed nits in websockets: * Clean disconnection * Support correction for large packets * Small nit for correcting message length * changed status to new FASTER status codes * Modified status codes Co-authored-by: Rohan Kadekodi <kadekodirohan@gmail.com> * Revert THA * nits * Improving cache tracker * fix NET5_0 to NET5_0_OR_GREATER * [C#] Add CompletePending[WithOutputs] to IFasterContext (#664) * Move CompletePending(WithOutputs) into IFasterContext * Skip LockEvictionObserver entirely if no LUCs active * Make Decrement interlocked; inline one accessor; revert CMakeLists.txt * [C#] Upgrade blob tests to Azurite, enable blob tests on Linux, use windows-2022 for CI (#666) * install azurite * Change testcase to make sure commit completed before dispose, it is up to user to ensure no ongoing commits at time of dispose. * [C#] UnsealPhysicalAddress fix (#665) * Fix unsealPA going below HA; return SUCCESS instead of NOTFOUND from normal reads that find an obsolete record in ITCTT * Ensure InternalLock calls require epoch protection * WIP: Spin wait on Pending Reads/RMWs until ClosedUntilAddress catches up. Still needs to handle partial page evictions. * Ensure partial ClosedUntilAddress shifts occur correctly. * [C#] Cancellation, ReadOptions, ReadFlags refactor (#668) * Add DeleteRecord and CancelOperation to *Info structures and IFunctions * Added ReadOptions * Move IFunctions methods' "ref RecordInfo" parameter to an *Info property, as it does not need to be updated * Update ReadFlags * ReadFlags fixes * Change XxxInfo.DeleteRecord/.CancelAction to XxxAction enum * Fixing Expiration tests * Add Phase to ExpirationTests * Add ReadOnly region to expiration tests * Delete and Upsert search down to HeadAddress if active LUC * [C#] Misc v2 fixes (#675) Fix misc bugs in v2 * update spanbyte * Yield thread when unable to reserve epoch entry, move iteration count outside table loop. * remove exception from overloaded lightepoch * Fix benchmark to run on .net 6 and linux. * fix another place * [C#] Improvements to LightEpoch * Use AllocateArray in LightEpoch * LightEpoch: Use two hash functions + linear probe, cache last successful probe per thread. Adjust table size based on number of machine processors. * [C#] Use GC.AllocateArray (#683) * Use GC.AllocateArray where possible * update benchmark as well. * Update buffer pool to use GC.AllocateArray * fix debug assert * Make DisposeSession protected in FasterServerBase. * Added SetBytesRead to IServerSession * - update sample .csprojs to target net6 and remove platform-related conditionals from all .csprojs now that we've moved to VS 2022 (#687) - add Status.Expired - update FASTER.client's copies of Status(Code).cs - Replace a TODO with an explanatory comment * Slight refactor of network stack. * Use GC.AllocateArray in SeaaBuffer * Another GC.AllocateArray substitution * [C#] [WIP] Wire disposal into IFunctions v2 (#685) * Add hook for failed CAS during SingleWriter. Still need to support other failed CAS scenarios. * Implement Dispose() functions - (MemoryLogCompactionTests fails at this time) * Fix MemoryLogCompactionTests; move DisposeDeserializedFromDisk up to ICPRFC Co-authored-by: TedHartMS <15467143+TedHartMS@users.noreply.github.com> Co-authored-by: Ted Hart <15467143+TedHartMS@users.noreply.github.com> Co-authored-by: Tianyu Li <litianyu@mit.edu> Co-authored-by: Vasileios Zois <vazois@microsoft.com> Co-authored-by: Sebastian Burckhardt <sburckha@microsoft.com> Co-authored-by: rohankadekodi-msr <69916400+rohankadekodi-msr@users.noreply.github.com> Co-authored-by: Rohan Kadekodi <kadekodirohan@gmail.com>
2022-04-14 02:03:35 +03:00
}
var tasks = new[]
{
Task.Factory.StartNew(() => DoUpdate(functions1)),
Task.Factory.StartNew(() => DoUpdate(functions2))
};
Task.WaitAll(tasks);
// The way this works for OnDisk is:
// SUT sees that the address in the hash entry is below HeadAddress (because everything has been flushed to disk)
// SUT goes pending, gets to InternalContinuePendingRMW, calls CreateNewRecordRMW, which calls CopyUpdater
// SUT (in CopyUpdater) signals Other, then blocks
// SUT has recorded prevHighestKeyHashAddress with the original hash entry address
// Other calls InternalRMW and also sees that the address in the hash entry is below HeadAddress, so it goes pending
// Other gets to InternalContinuePendingRMW, sees its key does not exist, and calls InitialUpdater, which signals SUT
// Other returns from InternalContinuePendingRMW, which enqueues DeserializedFromDisk into functions2.handlerQueue
// SUT is now unblocked and returns from CopyUpdater. CAS fails due to Other's insertion
// SUT does the RETRY loop in InternalContinuePendingRMW
// This second loop iteration sees that prevHighestKeyHashAddress is less than the current hash table entry, so drops down to do InternalRMW.
// InternalRMW does TracebackForKeyMatch, which passes Other's inserted collision and goes below HeadAddress
// InternalRMW thus enqueues another pending IO
// InternalContinuePendingRMW returns, which enqueues DeserializedFromDisk into functions1.handlerQueue
// The final pending IO calls InternalContinuePendingRMW, which operates normally now as there is no conflict.
// InternalContinuePendingRMW returns, which enqueues another DeserializedFromDisk into functions1.handlerQueue
[C#] FASTER v2 release (#563) * various changes from indexing work (#562) * various changes from indexing work - Add BeginAddress and EndAddress to scan iterators - Allow null deltaFileDevice in HybridLogCheckpointInfo.Recover - Rename FoldOverSnapshot to useFoldOverCheckpoint - Make TakeHybridLogCheckpoint overload call through to overload to avoid duplication - Add default values to new scanDelta and recoverTo arguments - Add missing checkpointManager.OnRecovery call to IntenralRecoverAsync - Fix some comments * Fix shortened name in test to work on Linux * [C#] Record-expiration support in RMW (#545) * Add support for record-expiration management to RMW and I(Advanced)Functions * Update Remote to RMW changes for expiration support * moving remote to IAdvFun * LogDir semantics - minor update Co-authored-by: Badrish Chandramouli <badrishc@microsoft.com> * [C#] Added PostCopyUpdater to IAdvancedFunctions (#561) * Add support for record-expiration management to RMW and I(Advanced)Functions * Update Remote to RMW changes for expiration support * Added PCU * Fixing testcase so that RMW does not expect old address. * Fix PCU bugs * Extend PostCopyUpdate to IFunctions; fix a few comments in remote Co-authored-by: TedHartMS <15467143+TedHartMS@users.noreply.github.com> * [C#] Merge IAdvancedFunctions into IFunctions (#565) * Merge IAdvancedFunctions into IFunctions * Add SupportsPostOperations and Post(IU|CU|SD); expand "ref RecordInfo recordInfo, long address" on Functions * Add RecordMetadata to RMWCompletionCallback params; improve ReadAddressTests * Add tests of Upsert with Input * [C#] RecordInfo v2 (#577) * RecordInfo v2 * fix version jump in CPR. * Updated misc stuff * misc updates to SpanByte * Remove IntExclLocker * Add Try APIs to record locking * Remove FASTERLegacy (#581) * Add Output parameter to Upsert (#574) * Add overloads of Upsert that take "ref Output" and one that takes "out RecordMetadata"; Fix RMW setting pendingContext.RecordInfo/LA; add locking of PostCopyUpdater, PostInitalUpdater, PostSingleWriter; * Reorganize ClientSession IntenralFasterSession to group functions for a given area (Read, Upsert, RMW, etc.) together * Fix locking on Post* calls * Fixes for Post* locking * remove net461 and netcoreapp2.1; add net6.0 in <Choose> to work on later in VS2022 * Update to new RecordInfo locking calls * Update to new IFunctions Locking signatures and RecordInfo implementation * Add post operations to Faster.benchmark * [C#] Checkpoint, Recovery, RecordInfo updates (#588) * Removed WAIT_PENDING * * Use only 1 bit for newVersion in RecordInfo, for CPR. Semantics are that sessions in v+1 will create records in fuzzy region with this bit set. Recovery only scans fuzzy region to elide such records. * Add 1 Filler bit for future use with fillers in records * Increase read lock bits to 6 (64 parallel readers) * Use dirty bit for incremental checkpoints * fix ycsb to not delete data file if we are using --recover * Fix epoch re-entry violation * Move to long versions, for KV checkpoints. * Shuffle around stuff for better cache alignment in benchmark. * Updates based on review * [C#] FasterLog Commit Optimization (v2) (#587) * Checkpoint work * Add notion of manual commit * Recovery of commit cookie * alternative design of log-cookie * Implementation improvement * code review comments * Cleanup + testing * Add management utility for LogCommitManager * Handle race on manual commit code path where not the latest tail is written out * Add condition to only scan log in fastCommitMode * Rough draft to allow for 1. elided commit record when fastCommit turned off and 2. "loose" commits * checkpoint changes * fix bug with readonly log allocator initialization * disable fast commit temporarily for CI * fix MLSD and mem device fast commit behavior * fix AzureStorageDevice exception type and remove self-termination on failure * test case on concurrent inserts * Re-enable epoch protection on CommitInternal * Ensure that full flush list error callbacks do not break FlushedUntilAddress tracking * Fix unclean shutdown of stress test * update device log test to scan until tail instead * change error code used for full flush list to better distinguish from others * Minor updates. Co-authored-by: Badrish Chandramouli <badrishc@microsoft.com> * Remove legacy local log commit manager * [C#] FasterLog v2 - misc changes, removed OverWrite commits (#593) * Checkin misc changes, removed overWrite commits * simplify OnRecovery logic * Fix build after merge * fix alignment of device commit manager * [C#] v2 pending flush list (#596) * Make PendingFlushList never error out in stressful situations. Current implementation uses lock for ~5-10% perf degradation over prior structure. * [C#] FasterLog v2: Fix FasterLog missed final commit (#597) * Fix FasterLog missed final commit. * [C#] Log compaction v2 (#598) * initial checkin * New ShiftBeginAddress behavior -- only shifts BeginAddress variable and does not truncate physical log unless option is specified. Also added Log.Truncate API for physical log truncation. Truncate log until persisted BeginAddress after taking a checkpoint. * Fix epoch protection orderings. * minor improvement to TestUtils to avoid race exception. * update Program.cs * updates from master. * [C#] V2 Custom Commit Strategy (#599) * Add FasterLogCommitStrategy * Use Bakery algorithm for latch * Documentation + tests + improved threading performance * Fix initialization error * Revert to v2 synchronization scheme * Optimization around commit strategies * Refactor CommitPolicy only for normal commits * fix missing spin wait * [C#] Fix v2 CommitPolicy Warnings (#607) * fix warnings * fix broken test * update for code consistency * Merged PR 59053: Network Stack Refactoring into FASTER This pull request contains the necessary changes for the updated network stack interface used by FASTER. It adds INetworkSender.cs and NetworkSenderBase.cs that can be used to implement custom communication protocols. Currently only TcpNetworkSender is supported. * Create .dockerignore * Added TentativeHeadAddress - we first shift this, and when all threads agree, we can do some pre-closing work such as eviction. Then we can shift the actual HeadAddress, closing pages when all threads agree on this. (#608) * Cleanup and remove dead code + reuse base provider. * Code cleanup * [C#] minor cleanup of fasterlog v2 (#611) * minor cleanup of fasterlog * [C#] Remove CheckpointType from CheckpointSettings (v2) (#614) * Remove CheckpointType from CheckpointSettings. Users have to specify checkpoint type on a per checkpoint basis. * fix build break * Fix CTT to call PostSingleWriter. * Avoid double init of FasterLog * [C#] Fixing warnings (#615) * Fixing CI warnings * [C#] Updating dependent package versions in v2 (#616) * Updating dependent package versions * nit * [C#] Improved FasterKV and FasterLog settings API for v2 (#618) * Simpler config API for v2. Move FasterLog to its own folder. * Remove purgeEarlierCommits from reader. Instead: 1. writer retries file deletes (in device commit manager) if access denied, in a loop, until timeout 2. reader (user code) retries recover async if it fails due to file deleted, until timeout * [C#] FasterLog V2 Device error handling (#612) * prototype device * prototype failure handling * Add proposed error handling code * Basic error handling tasks * Fault tolerant devices * Change to failure handler based approach instead of just throwing an exception * Remove brittle error handling code * make sure to read pages from flaky device on recovery in test * fix warnings * code review comments * See if we can enforce clean shutdown * Add extensions to enqueue SpanByte to FasterLog, and unsafely iterate without memory copy. (#621) * [C#] FasterLog v2 Add ability to explicitly terminate a log (#620) * Add ability to explicitly terminate a log * remove special 0-length return on eof * Add LogCompleted in iterator * Change comment and test * fix async iteration logic * fixes Co-authored-by: Badrish Chandramouli <badrishc@microsoft.com> * Maybe fix SVS issue with atomic reads (#622) * [C#] FasterLog v2 iteration fix (#623) * First pass of fixes * undo local change * [C#] Updated docs for FasterLog v2 (#624) * some updates * Add missing documentation * Update 40-fasterlog-basics.md Co-authored-by: Badrish Chandramouli <badrish@gmail.com> * Fix logic for directory delete timeouts. * Speed up testcases * [C#] Lockable Unsafe Context (LUC) in FasterKV v2 (WIP) (#605) * WIP on ManualFasterOperations * fixes for v2 merge * Updates to locking (still in progress) - Remove User-defined locks - Move SupportsLocking up to FasterKV level - Skip Stub and Sealed in iterators - Change PendingContext.OperationFlags from byte to ushort - Add ReadFlags.SkipCopyToTail - Add IsLocked*, TranferLocks methods to RecordInfo - Add UnsafeCompletePending* to ManualOps - Track lock counts in ManualOps and throw if Dispose() is called with locks or epoch held - Add LockInfo for ManualOps.*Lock - Implementation and testing of Faster operations with ManualOps locks - Fix ReadAddressTests to reflect improved consistency of not returning readcache addresses * Locking docs * Update 30-fasterkv-manual-locking.md * Updated doc to GH review and discussions * WIP for LockableRawContext * Existing tests run * Rename to LockableRawContext, IFasterContext * Perf workaround for LockTable.IsActive * WIP on ReadCacheEvict and MemoryPageLockEvictionScan * Add ReadCache and LockTable-transfer tests; move ReadCache tests out to their own sub-hierarchy * Test MemoryPageLockEvictionScan * Add testing for two-phase upsert/copytotail * Remove manual locking bits in Recovery; minor refactorings in Recovery.cs to reduce duplication * Add manual locking to FASTER.benchmark * More LockTable testing and fixes, mostly around ocking nonexistent key while Upsert/RMW/Deleting that key * Add UnsafeContext and make it the default for FASTER.Benchmark * Updates from code review: - IsLocked returns shared lock count (added test) - Fix location of IsIntermediate checks in RecordInfo.Lock/Seal - Remove unused IEqualityComparer in LockTableEntry * Rename Take(Full|Index|HybridLog)Checkpoint to TryInitiate(Full|Index|HybridLog)Checkpoint, so it is obvious they need to complete it * - Remove SupportsPostOperations; this is now always done - Add SingleDeleter for symmetry with Upsert - Add DisposeKey and DisposeValue * Add CopyWriter, to distinguish "maintentance" copying (CopyToTail or copy to ReadCache) from API-parameter copies * merge fixes * Remove obsolete Functions-level locking and postOps specifications * Fix Remote build Co-authored-by: Badrish Chandramouli <badrishc@microsoft.com> * fix semantic merge conflict in MemoryPageScanIterator (#632) * [C#] Add WriteReason parameter to SingleWriter (#630) * Add Functions.PostCopyWriter; update MemOnlyCache to use Post(Single|Copy)Writer * Remove (Post)CopyWriter and replace with WriteReason parameter to (Post)SingleWriter * Move SingleWriter "reason" parameter * Move ReadFlags and WriteReason to their own files; rename SupportsLocking -> DisableLocking with default 'false' * Update Remote to disableLocking name and default change * [C#] Various Fixes (#635) * Fixes: - Fixed WriteReason when CTT overrides ReadCache - make DisableLocking a readonly member - Call SetTentativeAtomic after Post* - Make readcache and comparer private with internal accessors for test - FIx intermittent failure of BasicHighLatencyDeviceTest * back out changes to move from internal -> private for FKV.readcache and .comparer * [C#] Remove StrictCPR (#636) * Removed WAIT_PENDING * StrictCPR removal WIP * Fix bug in state machine test, as it was not using unsafe context for fine grained control over the state machine execution. * Remove PendingContext.HeldLatch and heldOperation local * Revise FASTER.Benchmark to replace --noaff with --safectx and integrate this into Ycsb and SpanbyteYcsb * check epoch protection for complete pending * *UnsafeContext: AnyInstanceProtected -> ThisInstanceProtected Co-authored-by: TedHartMS <15467143+TedHartMS@users.noreply.github.com> * [C#] Support int session ID for FasterKV (#641) * Support int session ID for FasterKV * fix remote solution, minor name updates * update FasterLog API for TryEnqueue of custom header * [C#] IEntry interface for FasterLog (#639) * enqueue with entries prototype * Add IEntry tests and method variants * Address code review comments * Rename + read entries * Add async versions of consumer * Make interfaces top-level * Correct header offset in FasterLog new API * [C#] Recover returns version we recovered to (#648) * add to FasterLog SpanByte API * fix breaking tests * Fix dispose loop * Update FasterServerBase.cs * do not remove ioPendingRequests in RMWAsync if there was no disk request (#653) * [C#] [WIP] Status return code v2 (#638) * Prototype of status as struct * improving status a bit * fix build break, expose underlying (raw) status code to user * misc * Update StatusCode * Update Remote to new Status(Code); fix test cases; fix StatusCode layout; fine-tune Status(Code) names; make StatusCode internal * Update StatusCode and Status to final spec * Update Remote to new Status spec * unrelated nit Co-authored-by: TedHartMS <15467143+TedHartMS@users.noreply.github.com> * [C#] Change IFunctions 'address' parameter to UpdateInfo or ReadInfo (#652) * Add UpdateInfo and ReadInfo to IFunctions calls * Update Remote IFunctions implementations to UpdateInfo/ReadInfo changes Co-authored-by: Badrish Chandramouli <badrishc@microsoft.com> * Wire status into remote v2 (#657) Add NotFound API for status * Status naming changes and UpdateInfo structure split for v2 preview (#658) * [C#] Add Status.Record (#659) * Add Status.Record; update OperationStatus with all Advanced Status codes * Update Remote for status.Pending => .IsPending * Update nuspecs * more updates * Update azure-pipelines.yml * Update azure-pipelines.yml * revert windows-2022 in yml * Rename StatusCode.OK to Found (#662) * nit * update SpanByte with API to get pointer including metadata * Fixing ranges in OnPagesReadyToClose * [C#] Websocket bug-fixes (#663) * Fixed nits in websockets: * Clean disconnection * Support correction for large packets * Small nit for correcting message length * changed status to new FASTER status codes * Modified status codes Co-authored-by: Rohan Kadekodi <kadekodirohan@gmail.com> * Revert THA * nits * Improving cache tracker * fix NET5_0 to NET5_0_OR_GREATER * [C#] Add CompletePending[WithOutputs] to IFasterContext (#664) * Move CompletePending(WithOutputs) into IFasterContext * Skip LockEvictionObserver entirely if no LUCs active * Make Decrement interlocked; inline one accessor; revert CMakeLists.txt * [C#] Upgrade blob tests to Azurite, enable blob tests on Linux, use windows-2022 for CI (#666) * install azurite * Change testcase to make sure commit completed before dispose, it is up to user to ensure no ongoing commits at time of dispose. * [C#] UnsealPhysicalAddress fix (#665) * Fix unsealPA going below HA; return SUCCESS instead of NOTFOUND from normal reads that find an obsolete record in ITCTT * Ensure InternalLock calls require epoch protection * WIP: Spin wait on Pending Reads/RMWs until ClosedUntilAddress catches up. Still needs to handle partial page evictions. * Ensure partial ClosedUntilAddress shifts occur correctly. * [C#] Cancellation, ReadOptions, ReadFlags refactor (#668) * Add DeleteRecord and CancelOperation to *Info structures and IFunctions * Added ReadOptions * Move IFunctions methods' "ref RecordInfo" parameter to an *Info property, as it does not need to be updated * Update ReadFlags * ReadFlags fixes * Change XxxInfo.DeleteRecord/.CancelAction to XxxAction enum * Fixing Expiration tests * Add Phase to ExpirationTests * Add ReadOnly region to expiration tests * Delete and Upsert search down to HeadAddress if active LUC * [C#] Misc v2 fixes (#675) Fix misc bugs in v2 * update spanbyte * Yield thread when unable to reserve epoch entry, move iteration count outside table loop. * remove exception from overloaded lightepoch * Fix benchmark to run on .net 6 and linux. * fix another place * [C#] Improvements to LightEpoch * Use AllocateArray in LightEpoch * LightEpoch: Use two hash functions + linear probe, cache last successful probe per thread. Adjust table size based on number of machine processors. * [C#] Use GC.AllocateArray (#683) * Use GC.AllocateArray where possible * update benchmark as well. * Update buffer pool to use GC.AllocateArray * fix debug assert * Make DisposeSession protected in FasterServerBase. * Added SetBytesRead to IServerSession * - update sample .csprojs to target net6 and remove platform-related conditionals from all .csprojs now that we've moved to VS 2022 (#687) - add Status.Expired - update FASTER.client's copies of Status(Code).cs - Replace a TODO with an explanatory comment * Slight refactor of network stack. * Use GC.AllocateArray in SeaaBuffer * Another GC.AllocateArray substitution * [C#] [WIP] Wire disposal into IFunctions v2 (#685) * Add hook for failed CAS during SingleWriter. Still need to support other failed CAS scenarios. * Implement Dispose() functions - (MemoryLogCompactionTests fails at this time) * Fix MemoryLogCompactionTests; move DisposeDeserializedFromDisk up to ICPRFC Co-authored-by: TedHartMS <15467143+TedHartMS@users.noreply.github.com> Co-authored-by: Ted Hart <15467143+TedHartMS@users.noreply.github.com> Co-authored-by: Tianyu Li <litianyu@mit.edu> Co-authored-by: Vasileios Zois <vazois@microsoft.com> Co-authored-by: Sebastian Burckhardt <sburckha@microsoft.com> Co-authored-by: rohankadekodi-msr <69916400+rohankadekodi-msr@users.noreply.github.com> Co-authored-by: Rohan Kadekodi <kadekodirohan@gmail.com>
2022-04-14 02:03:35 +03:00
Assert.AreEqual(DisposeHandler.CopyUpdater, functions1.handlerQueue.Dequeue());
if (flushMode == FlushMode.OnDisk)
{
Assert.AreEqual(DisposeHandler.DeserializedFromDisk, functions1.handlerQueue.Dequeue());
[C#] FASTER v2 release (#563) * various changes from indexing work (#562) * various changes from indexing work - Add BeginAddress and EndAddress to scan iterators - Allow null deltaFileDevice in HybridLogCheckpointInfo.Recover - Rename FoldOverSnapshot to useFoldOverCheckpoint - Make TakeHybridLogCheckpoint overload call through to overload to avoid duplication - Add default values to new scanDelta and recoverTo arguments - Add missing checkpointManager.OnRecovery call to IntenralRecoverAsync - Fix some comments * Fix shortened name in test to work on Linux * [C#] Record-expiration support in RMW (#545) * Add support for record-expiration management to RMW and I(Advanced)Functions * Update Remote to RMW changes for expiration support * moving remote to IAdvFun * LogDir semantics - minor update Co-authored-by: Badrish Chandramouli <badrishc@microsoft.com> * [C#] Added PostCopyUpdater to IAdvancedFunctions (#561) * Add support for record-expiration management to RMW and I(Advanced)Functions * Update Remote to RMW changes for expiration support * Added PCU * Fixing testcase so that RMW does not expect old address. * Fix PCU bugs * Extend PostCopyUpdate to IFunctions; fix a few comments in remote Co-authored-by: TedHartMS <15467143+TedHartMS@users.noreply.github.com> * [C#] Merge IAdvancedFunctions into IFunctions (#565) * Merge IAdvancedFunctions into IFunctions * Add SupportsPostOperations and Post(IU|CU|SD); expand "ref RecordInfo recordInfo, long address" on Functions * Add RecordMetadata to RMWCompletionCallback params; improve ReadAddressTests * Add tests of Upsert with Input * [C#] RecordInfo v2 (#577) * RecordInfo v2 * fix version jump in CPR. * Updated misc stuff * misc updates to SpanByte * Remove IntExclLocker * Add Try APIs to record locking * Remove FASTERLegacy (#581) * Add Output parameter to Upsert (#574) * Add overloads of Upsert that take "ref Output" and one that takes "out RecordMetadata"; Fix RMW setting pendingContext.RecordInfo/LA; add locking of PostCopyUpdater, PostInitalUpdater, PostSingleWriter; * Reorganize ClientSession IntenralFasterSession to group functions for a given area (Read, Upsert, RMW, etc.) together * Fix locking on Post* calls * Fixes for Post* locking * remove net461 and netcoreapp2.1; add net6.0 in <Choose> to work on later in VS2022 * Update to new RecordInfo locking calls * Update to new IFunctions Locking signatures and RecordInfo implementation * Add post operations to Faster.benchmark * [C#] Checkpoint, Recovery, RecordInfo updates (#588) * Removed WAIT_PENDING * * Use only 1 bit for newVersion in RecordInfo, for CPR. Semantics are that sessions in v+1 will create records in fuzzy region with this bit set. Recovery only scans fuzzy region to elide such records. * Add 1 Filler bit for future use with fillers in records * Increase read lock bits to 6 (64 parallel readers) * Use dirty bit for incremental checkpoints * fix ycsb to not delete data file if we are using --recover * Fix epoch re-entry violation * Move to long versions, for KV checkpoints. * Shuffle around stuff for better cache alignment in benchmark. * Updates based on review * [C#] FasterLog Commit Optimization (v2) (#587) * Checkpoint work * Add notion of manual commit * Recovery of commit cookie * alternative design of log-cookie * Implementation improvement * code review comments * Cleanup + testing * Add management utility for LogCommitManager * Handle race on manual commit code path where not the latest tail is written out * Add condition to only scan log in fastCommitMode * Rough draft to allow for 1. elided commit record when fastCommit turned off and 2. "loose" commits * checkpoint changes * fix bug with readonly log allocator initialization * disable fast commit temporarily for CI * fix MLSD and mem device fast commit behavior * fix AzureStorageDevice exception type and remove self-termination on failure * test case on concurrent inserts * Re-enable epoch protection on CommitInternal * Ensure that full flush list error callbacks do not break FlushedUntilAddress tracking * Fix unclean shutdown of stress test * update device log test to scan until tail instead * change error code used for full flush list to better distinguish from others * Minor updates. Co-authored-by: Badrish Chandramouli <badrishc@microsoft.com> * Remove legacy local log commit manager * [C#] FasterLog v2 - misc changes, removed OverWrite commits (#593) * Checkin misc changes, removed overWrite commits * simplify OnRecovery logic * Fix build after merge * fix alignment of device commit manager * [C#] v2 pending flush list (#596) * Make PendingFlushList never error out in stressful situations. Current implementation uses lock for ~5-10% perf degradation over prior structure. * [C#] FasterLog v2: Fix FasterLog missed final commit (#597) * Fix FasterLog missed final commit. * [C#] Log compaction v2 (#598) * initial checkin * New ShiftBeginAddress behavior -- only shifts BeginAddress variable and does not truncate physical log unless option is specified. Also added Log.Truncate API for physical log truncation. Truncate log until persisted BeginAddress after taking a checkpoint. * Fix epoch protection orderings. * minor improvement to TestUtils to avoid race exception. * update Program.cs * updates from master. * [C#] V2 Custom Commit Strategy (#599) * Add FasterLogCommitStrategy * Use Bakery algorithm for latch * Documentation + tests + improved threading performance * Fix initialization error * Revert to v2 synchronization scheme * Optimization around commit strategies * Refactor CommitPolicy only for normal commits * fix missing spin wait * [C#] Fix v2 CommitPolicy Warnings (#607) * fix warnings * fix broken test * update for code consistency * Merged PR 59053: Network Stack Refactoring into FASTER This pull request contains the necessary changes for the updated network stack interface used by FASTER. It adds INetworkSender.cs and NetworkSenderBase.cs that can be used to implement custom communication protocols. Currently only TcpNetworkSender is supported. * Create .dockerignore * Added TentativeHeadAddress - we first shift this, and when all threads agree, we can do some pre-closing work such as eviction. Then we can shift the actual HeadAddress, closing pages when all threads agree on this. (#608) * Cleanup and remove dead code + reuse base provider. * Code cleanup * [C#] minor cleanup of fasterlog v2 (#611) * minor cleanup of fasterlog * [C#] Remove CheckpointType from CheckpointSettings (v2) (#614) * Remove CheckpointType from CheckpointSettings. Users have to specify checkpoint type on a per checkpoint basis. * fix build break * Fix CTT to call PostSingleWriter. * Avoid double init of FasterLog * [C#] Fixing warnings (#615) * Fixing CI warnings * [C#] Updating dependent package versions in v2 (#616) * Updating dependent package versions * nit * [C#] Improved FasterKV and FasterLog settings API for v2 (#618) * Simpler config API for v2. Move FasterLog to its own folder. * Remove purgeEarlierCommits from reader. Instead: 1. writer retries file deletes (in device commit manager) if access denied, in a loop, until timeout 2. reader (user code) retries recover async if it fails due to file deleted, until timeout * [C#] FasterLog V2 Device error handling (#612) * prototype device * prototype failure handling * Add proposed error handling code * Basic error handling tasks * Fault tolerant devices * Change to failure handler based approach instead of just throwing an exception * Remove brittle error handling code * make sure to read pages from flaky device on recovery in test * fix warnings * code review comments * See if we can enforce clean shutdown * Add extensions to enqueue SpanByte to FasterLog, and unsafely iterate without memory copy. (#621) * [C#] FasterLog v2 Add ability to explicitly terminate a log (#620) * Add ability to explicitly terminate a log * remove special 0-length return on eof * Add LogCompleted in iterator * Change comment and test * fix async iteration logic * fixes Co-authored-by: Badrish Chandramouli <badrishc@microsoft.com> * Maybe fix SVS issue with atomic reads (#622) * [C#] FasterLog v2 iteration fix (#623) * First pass of fixes * undo local change * [C#] Updated docs for FasterLog v2 (#624) * some updates * Add missing documentation * Update 40-fasterlog-basics.md Co-authored-by: Badrish Chandramouli <badrish@gmail.com> * Fix logic for directory delete timeouts. * Speed up testcases * [C#] Lockable Unsafe Context (LUC) in FasterKV v2 (WIP) (#605) * WIP on ManualFasterOperations * fixes for v2 merge * Updates to locking (still in progress) - Remove User-defined locks - Move SupportsLocking up to FasterKV level - Skip Stub and Sealed in iterators - Change PendingContext.OperationFlags from byte to ushort - Add ReadFlags.SkipCopyToTail - Add IsLocked*, TranferLocks methods to RecordInfo - Add UnsafeCompletePending* to ManualOps - Track lock counts in ManualOps and throw if Dispose() is called with locks or epoch held - Add LockInfo for ManualOps.*Lock - Implementation and testing of Faster operations with ManualOps locks - Fix ReadAddressTests to reflect improved consistency of not returning readcache addresses * Locking docs * Update 30-fasterkv-manual-locking.md * Updated doc to GH review and discussions * WIP for LockableRawContext * Existing tests run * Rename to LockableRawContext, IFasterContext * Perf workaround for LockTable.IsActive * WIP on ReadCacheEvict and MemoryPageLockEvictionScan * Add ReadCache and LockTable-transfer tests; move ReadCache tests out to their own sub-hierarchy * Test MemoryPageLockEvictionScan * Add testing for two-phase upsert/copytotail * Remove manual locking bits in Recovery; minor refactorings in Recovery.cs to reduce duplication * Add manual locking to FASTER.benchmark * More LockTable testing and fixes, mostly around ocking nonexistent key while Upsert/RMW/Deleting that key * Add UnsafeContext and make it the default for FASTER.Benchmark * Updates from code review: - IsLocked returns shared lock count (added test) - Fix location of IsIntermediate checks in RecordInfo.Lock/Seal - Remove unused IEqualityComparer in LockTableEntry * Rename Take(Full|Index|HybridLog)Checkpoint to TryInitiate(Full|Index|HybridLog)Checkpoint, so it is obvious they need to complete it * - Remove SupportsPostOperations; this is now always done - Add SingleDeleter for symmetry with Upsert - Add DisposeKey and DisposeValue * Add CopyWriter, to distinguish "maintentance" copying (CopyToTail or copy to ReadCache) from API-parameter copies * merge fixes * Remove obsolete Functions-level locking and postOps specifications * Fix Remote build Co-authored-by: Badrish Chandramouli <badrishc@microsoft.com> * fix semantic merge conflict in MemoryPageScanIterator (#632) * [C#] Add WriteReason parameter to SingleWriter (#630) * Add Functions.PostCopyWriter; update MemOnlyCache to use Post(Single|Copy)Writer * Remove (Post)CopyWriter and replace with WriteReason parameter to (Post)SingleWriter * Move SingleWriter "reason" parameter * Move ReadFlags and WriteReason to their own files; rename SupportsLocking -> DisableLocking with default 'false' * Update Remote to disableLocking name and default change * [C#] Various Fixes (#635) * Fixes: - Fixed WriteReason when CTT overrides ReadCache - make DisableLocking a readonly member - Call SetTentativeAtomic after Post* - Make readcache and comparer private with internal accessors for test - FIx intermittent failure of BasicHighLatencyDeviceTest * back out changes to move from internal -> private for FKV.readcache and .comparer * [C#] Remove StrictCPR (#636) * Removed WAIT_PENDING * StrictCPR removal WIP * Fix bug in state machine test, as it was not using unsafe context for fine grained control over the state machine execution. * Remove PendingContext.HeldLatch and heldOperation local * Revise FASTER.Benchmark to replace --noaff with --safectx and integrate this into Ycsb and SpanbyteYcsb * check epoch protection for complete pending * *UnsafeContext: AnyInstanceProtected -> ThisInstanceProtected Co-authored-by: TedHartMS <15467143+TedHartMS@users.noreply.github.com> * [C#] Support int session ID for FasterKV (#641) * Support int session ID for FasterKV * fix remote solution, minor name updates * update FasterLog API for TryEnqueue of custom header * [C#] IEntry interface for FasterLog (#639) * enqueue with entries prototype * Add IEntry tests and method variants * Address code review comments * Rename + read entries * Add async versions of consumer * Make interfaces top-level * Correct header offset in FasterLog new API * [C#] Recover returns version we recovered to (#648) * add to FasterLog SpanByte API * fix breaking tests * Fix dispose loop * Update FasterServerBase.cs * do not remove ioPendingRequests in RMWAsync if there was no disk request (#653) * [C#] [WIP] Status return code v2 (#638) * Prototype of status as struct * improving status a bit * fix build break, expose underlying (raw) status code to user * misc * Update StatusCode * Update Remote to new Status(Code); fix test cases; fix StatusCode layout; fine-tune Status(Code) names; make StatusCode internal * Update StatusCode and Status to final spec * Update Remote to new Status spec * unrelated nit Co-authored-by: TedHartMS <15467143+TedHartMS@users.noreply.github.com> * [C#] Change IFunctions 'address' parameter to UpdateInfo or ReadInfo (#652) * Add UpdateInfo and ReadInfo to IFunctions calls * Update Remote IFunctions implementations to UpdateInfo/ReadInfo changes Co-authored-by: Badrish Chandramouli <badrishc@microsoft.com> * Wire status into remote v2 (#657) Add NotFound API for status * Status naming changes and UpdateInfo structure split for v2 preview (#658) * [C#] Add Status.Record (#659) * Add Status.Record; update OperationStatus with all Advanced Status codes * Update Remote for status.Pending => .IsPending * Update nuspecs * more updates * Update azure-pipelines.yml * Update azure-pipelines.yml * revert windows-2022 in yml * Rename StatusCode.OK to Found (#662) * nit * update SpanByte with API to get pointer including metadata * Fixing ranges in OnPagesReadyToClose * [C#] Websocket bug-fixes (#663) * Fixed nits in websockets: * Clean disconnection * Support correction for large packets * Small nit for correcting message length * changed status to new FASTER status codes * Modified status codes Co-authored-by: Rohan Kadekodi <kadekodirohan@gmail.com> * Revert THA * nits * Improving cache tracker * fix NET5_0 to NET5_0_OR_GREATER * [C#] Add CompletePending[WithOutputs] to IFasterContext (#664) * Move CompletePending(WithOutputs) into IFasterContext * Skip LockEvictionObserver entirely if no LUCs active * Make Decrement interlocked; inline one accessor; revert CMakeLists.txt * [C#] Upgrade blob tests to Azurite, enable blob tests on Linux, use windows-2022 for CI (#666) * install azurite * Change testcase to make sure commit completed before dispose, it is up to user to ensure no ongoing commits at time of dispose. * [C#] UnsealPhysicalAddress fix (#665) * Fix unsealPA going below HA; return SUCCESS instead of NOTFOUND from normal reads that find an obsolete record in ITCTT * Ensure InternalLock calls require epoch protection * WIP: Spin wait on Pending Reads/RMWs until ClosedUntilAddress catches up. Still needs to handle partial page evictions. * Ensure partial ClosedUntilAddress shifts occur correctly. * [C#] Cancellation, ReadOptions, ReadFlags refactor (#668) * Add DeleteRecord and CancelOperation to *Info structures and IFunctions * Added ReadOptions * Move IFunctions methods' "ref RecordInfo" parameter to an *Info property, as it does not need to be updated * Update ReadFlags * ReadFlags fixes * Change XxxInfo.DeleteRecord/.CancelAction to XxxAction enum * Fixing Expiration tests * Add Phase to ExpirationTests * Add ReadOnly region to expiration tests * Delete and Upsert search down to HeadAddress if active LUC * [C#] Misc v2 fixes (#675) Fix misc bugs in v2 * update spanbyte * Yield thread when unable to reserve epoch entry, move iteration count outside table loop. * remove exception from overloaded lightepoch * Fix benchmark to run on .net 6 and linux. * fix another place * [C#] Improvements to LightEpoch * Use AllocateArray in LightEpoch * LightEpoch: Use two hash functions + linear probe, cache last successful probe per thread. Adjust table size based on number of machine processors. * [C#] Use GC.AllocateArray (#683) * Use GC.AllocateArray where possible * update benchmark as well. * Update buffer pool to use GC.AllocateArray * fix debug assert * Make DisposeSession protected in FasterServerBase. * Added SetBytesRead to IServerSession * - update sample .csprojs to target net6 and remove platform-related conditionals from all .csprojs now that we've moved to VS 2022 (#687) - add Status.Expired - update FASTER.client's copies of Status(Code).cs - Replace a TODO with an explanatory comment * Slight refactor of network stack. * Use GC.AllocateArray in SeaaBuffer * Another GC.AllocateArray substitution * [C#] [WIP] Wire disposal into IFunctions v2 (#685) * Add hook for failed CAS during SingleWriter. Still need to support other failed CAS scenarios. * Implement Dispose() functions - (MemoryLogCompactionTests fails at this time) * Fix MemoryLogCompactionTests; move DisposeDeserializedFromDisk up to ICPRFC Co-authored-by: TedHartMS <15467143+TedHartMS@users.noreply.github.com> Co-authored-by: Ted Hart <15467143+TedHartMS@users.noreply.github.com> Co-authored-by: Tianyu Li <litianyu@mit.edu> Co-authored-by: Vasileios Zois <vazois@microsoft.com> Co-authored-by: Sebastian Burckhardt <sburckha@microsoft.com> Co-authored-by: rohankadekodi-msr <69916400+rohankadekodi-msr@users.noreply.github.com> Co-authored-by: Rohan Kadekodi <kadekodirohan@gmail.com>
2022-04-14 02:03:35 +03:00
Assert.AreEqual(DisposeHandler.DeserializedFromDisk, functions1.handlerQueue.Dequeue());
Assert.AreEqual(DisposeHandler.DeserializedFromDisk, functions2.handlerQueue.Dequeue());
}
[C#] FASTER v2 release (#563) * various changes from indexing work (#562) * various changes from indexing work - Add BeginAddress and EndAddress to scan iterators - Allow null deltaFileDevice in HybridLogCheckpointInfo.Recover - Rename FoldOverSnapshot to useFoldOverCheckpoint - Make TakeHybridLogCheckpoint overload call through to overload to avoid duplication - Add default values to new scanDelta and recoverTo arguments - Add missing checkpointManager.OnRecovery call to IntenralRecoverAsync - Fix some comments * Fix shortened name in test to work on Linux * [C#] Record-expiration support in RMW (#545) * Add support for record-expiration management to RMW and I(Advanced)Functions * Update Remote to RMW changes for expiration support * moving remote to IAdvFun * LogDir semantics - minor update Co-authored-by: Badrish Chandramouli <badrishc@microsoft.com> * [C#] Added PostCopyUpdater to IAdvancedFunctions (#561) * Add support for record-expiration management to RMW and I(Advanced)Functions * Update Remote to RMW changes for expiration support * Added PCU * Fixing testcase so that RMW does not expect old address. * Fix PCU bugs * Extend PostCopyUpdate to IFunctions; fix a few comments in remote Co-authored-by: TedHartMS <15467143+TedHartMS@users.noreply.github.com> * [C#] Merge IAdvancedFunctions into IFunctions (#565) * Merge IAdvancedFunctions into IFunctions * Add SupportsPostOperations and Post(IU|CU|SD); expand "ref RecordInfo recordInfo, long address" on Functions * Add RecordMetadata to RMWCompletionCallback params; improve ReadAddressTests * Add tests of Upsert with Input * [C#] RecordInfo v2 (#577) * RecordInfo v2 * fix version jump in CPR. * Updated misc stuff * misc updates to SpanByte * Remove IntExclLocker * Add Try APIs to record locking * Remove FASTERLegacy (#581) * Add Output parameter to Upsert (#574) * Add overloads of Upsert that take "ref Output" and one that takes "out RecordMetadata"; Fix RMW setting pendingContext.RecordInfo/LA; add locking of PostCopyUpdater, PostInitalUpdater, PostSingleWriter; * Reorganize ClientSession IntenralFasterSession to group functions for a given area (Read, Upsert, RMW, etc.) together * Fix locking on Post* calls * Fixes for Post* locking * remove net461 and netcoreapp2.1; add net6.0 in <Choose> to work on later in VS2022 * Update to new RecordInfo locking calls * Update to new IFunctions Locking signatures and RecordInfo implementation * Add post operations to Faster.benchmark * [C#] Checkpoint, Recovery, RecordInfo updates (#588) * Removed WAIT_PENDING * * Use only 1 bit for newVersion in RecordInfo, for CPR. Semantics are that sessions in v+1 will create records in fuzzy region with this bit set. Recovery only scans fuzzy region to elide such records. * Add 1 Filler bit for future use with fillers in records * Increase read lock bits to 6 (64 parallel readers) * Use dirty bit for incremental checkpoints * fix ycsb to not delete data file if we are using --recover * Fix epoch re-entry violation * Move to long versions, for KV checkpoints. * Shuffle around stuff for better cache alignment in benchmark. * Updates based on review * [C#] FasterLog Commit Optimization (v2) (#587) * Checkpoint work * Add notion of manual commit * Recovery of commit cookie * alternative design of log-cookie * Implementation improvement * code review comments * Cleanup + testing * Add management utility for LogCommitManager * Handle race on manual commit code path where not the latest tail is written out * Add condition to only scan log in fastCommitMode * Rough draft to allow for 1. elided commit record when fastCommit turned off and 2. "loose" commits * checkpoint changes * fix bug with readonly log allocator initialization * disable fast commit temporarily for CI * fix MLSD and mem device fast commit behavior * fix AzureStorageDevice exception type and remove self-termination on failure * test case on concurrent inserts * Re-enable epoch protection on CommitInternal * Ensure that full flush list error callbacks do not break FlushedUntilAddress tracking * Fix unclean shutdown of stress test * update device log test to scan until tail instead * change error code used for full flush list to better distinguish from others * Minor updates. Co-authored-by: Badrish Chandramouli <badrishc@microsoft.com> * Remove legacy local log commit manager * [C#] FasterLog v2 - misc changes, removed OverWrite commits (#593) * Checkin misc changes, removed overWrite commits * simplify OnRecovery logic * Fix build after merge * fix alignment of device commit manager * [C#] v2 pending flush list (#596) * Make PendingFlushList never error out in stressful situations. Current implementation uses lock for ~5-10% perf degradation over prior structure. * [C#] FasterLog v2: Fix FasterLog missed final commit (#597) * Fix FasterLog missed final commit. * [C#] Log compaction v2 (#598) * initial checkin * New ShiftBeginAddress behavior -- only shifts BeginAddress variable and does not truncate physical log unless option is specified. Also added Log.Truncate API for physical log truncation. Truncate log until persisted BeginAddress after taking a checkpoint. * Fix epoch protection orderings. * minor improvement to TestUtils to avoid race exception. * update Program.cs * updates from master. * [C#] V2 Custom Commit Strategy (#599) * Add FasterLogCommitStrategy * Use Bakery algorithm for latch * Documentation + tests + improved threading performance * Fix initialization error * Revert to v2 synchronization scheme * Optimization around commit strategies * Refactor CommitPolicy only for normal commits * fix missing spin wait * [C#] Fix v2 CommitPolicy Warnings (#607) * fix warnings * fix broken test * update for code consistency * Merged PR 59053: Network Stack Refactoring into FASTER This pull request contains the necessary changes for the updated network stack interface used by FASTER. It adds INetworkSender.cs and NetworkSenderBase.cs that can be used to implement custom communication protocols. Currently only TcpNetworkSender is supported. * Create .dockerignore * Added TentativeHeadAddress - we first shift this, and when all threads agree, we can do some pre-closing work such as eviction. Then we can shift the actual HeadAddress, closing pages when all threads agree on this. (#608) * Cleanup and remove dead code + reuse base provider. * Code cleanup * [C#] minor cleanup of fasterlog v2 (#611) * minor cleanup of fasterlog * [C#] Remove CheckpointType from CheckpointSettings (v2) (#614) * Remove CheckpointType from CheckpointSettings. Users have to specify checkpoint type on a per checkpoint basis. * fix build break * Fix CTT to call PostSingleWriter. * Avoid double init of FasterLog * [C#] Fixing warnings (#615) * Fixing CI warnings * [C#] Updating dependent package versions in v2 (#616) * Updating dependent package versions * nit * [C#] Improved FasterKV and FasterLog settings API for v2 (#618) * Simpler config API for v2. Move FasterLog to its own folder. * Remove purgeEarlierCommits from reader. Instead: 1. writer retries file deletes (in device commit manager) if access denied, in a loop, until timeout 2. reader (user code) retries recover async if it fails due to file deleted, until timeout * [C#] FasterLog V2 Device error handling (#612) * prototype device * prototype failure handling * Add proposed error handling code * Basic error handling tasks * Fault tolerant devices * Change to failure handler based approach instead of just throwing an exception * Remove brittle error handling code * make sure to read pages from flaky device on recovery in test * fix warnings * code review comments * See if we can enforce clean shutdown * Add extensions to enqueue SpanByte to FasterLog, and unsafely iterate without memory copy. (#621) * [C#] FasterLog v2 Add ability to explicitly terminate a log (#620) * Add ability to explicitly terminate a log * remove special 0-length return on eof * Add LogCompleted in iterator * Change comment and test * fix async iteration logic * fixes Co-authored-by: Badrish Chandramouli <badrishc@microsoft.com> * Maybe fix SVS issue with atomic reads (#622) * [C#] FasterLog v2 iteration fix (#623) * First pass of fixes * undo local change * [C#] Updated docs for FasterLog v2 (#624) * some updates * Add missing documentation * Update 40-fasterlog-basics.md Co-authored-by: Badrish Chandramouli <badrish@gmail.com> * Fix logic for directory delete timeouts. * Speed up testcases * [C#] Lockable Unsafe Context (LUC) in FasterKV v2 (WIP) (#605) * WIP on ManualFasterOperations * fixes for v2 merge * Updates to locking (still in progress) - Remove User-defined locks - Move SupportsLocking up to FasterKV level - Skip Stub and Sealed in iterators - Change PendingContext.OperationFlags from byte to ushort - Add ReadFlags.SkipCopyToTail - Add IsLocked*, TranferLocks methods to RecordInfo - Add UnsafeCompletePending* to ManualOps - Track lock counts in ManualOps and throw if Dispose() is called with locks or epoch held - Add LockInfo for ManualOps.*Lock - Implementation and testing of Faster operations with ManualOps locks - Fix ReadAddressTests to reflect improved consistency of not returning readcache addresses * Locking docs * Update 30-fasterkv-manual-locking.md * Updated doc to GH review and discussions * WIP for LockableRawContext * Existing tests run * Rename to LockableRawContext, IFasterContext * Perf workaround for LockTable.IsActive * WIP on ReadCacheEvict and MemoryPageLockEvictionScan * Add ReadCache and LockTable-transfer tests; move ReadCache tests out to their own sub-hierarchy * Test MemoryPageLockEvictionScan * Add testing for two-phase upsert/copytotail * Remove manual locking bits in Recovery; minor refactorings in Recovery.cs to reduce duplication * Add manual locking to FASTER.benchmark * More LockTable testing and fixes, mostly around ocking nonexistent key while Upsert/RMW/Deleting that key * Add UnsafeContext and make it the default for FASTER.Benchmark * Updates from code review: - IsLocked returns shared lock count (added test) - Fix location of IsIntermediate checks in RecordInfo.Lock/Seal - Remove unused IEqualityComparer in LockTableEntry * Rename Take(Full|Index|HybridLog)Checkpoint to TryInitiate(Full|Index|HybridLog)Checkpoint, so it is obvious they need to complete it * - Remove SupportsPostOperations; this is now always done - Add SingleDeleter for symmetry with Upsert - Add DisposeKey and DisposeValue * Add CopyWriter, to distinguish "maintentance" copying (CopyToTail or copy to ReadCache) from API-parameter copies * merge fixes * Remove obsolete Functions-level locking and postOps specifications * Fix Remote build Co-authored-by: Badrish Chandramouli <badrishc@microsoft.com> * fix semantic merge conflict in MemoryPageScanIterator (#632) * [C#] Add WriteReason parameter to SingleWriter (#630) * Add Functions.PostCopyWriter; update MemOnlyCache to use Post(Single|Copy)Writer * Remove (Post)CopyWriter and replace with WriteReason parameter to (Post)SingleWriter * Move SingleWriter "reason" parameter * Move ReadFlags and WriteReason to their own files; rename SupportsLocking -> DisableLocking with default 'false' * Update Remote to disableLocking name and default change * [C#] Various Fixes (#635) * Fixes: - Fixed WriteReason when CTT overrides ReadCache - make DisableLocking a readonly member - Call SetTentativeAtomic after Post* - Make readcache and comparer private with internal accessors for test - FIx intermittent failure of BasicHighLatencyDeviceTest * back out changes to move from internal -> private for FKV.readcache and .comparer * [C#] Remove StrictCPR (#636) * Removed WAIT_PENDING * StrictCPR removal WIP * Fix bug in state machine test, as it was not using unsafe context for fine grained control over the state machine execution. * Remove PendingContext.HeldLatch and heldOperation local * Revise FASTER.Benchmark to replace --noaff with --safectx and integrate this into Ycsb and SpanbyteYcsb * check epoch protection for complete pending * *UnsafeContext: AnyInstanceProtected -> ThisInstanceProtected Co-authored-by: TedHartMS <15467143+TedHartMS@users.noreply.github.com> * [C#] Support int session ID for FasterKV (#641) * Support int session ID for FasterKV * fix remote solution, minor name updates * update FasterLog API for TryEnqueue of custom header * [C#] IEntry interface for FasterLog (#639) * enqueue with entries prototype * Add IEntry tests and method variants * Address code review comments * Rename + read entries * Add async versions of consumer * Make interfaces top-level * Correct header offset in FasterLog new API * [C#] Recover returns version we recovered to (#648) * add to FasterLog SpanByte API * fix breaking tests * Fix dispose loop * Update FasterServerBase.cs * do not remove ioPendingRequests in RMWAsync if there was no disk request (#653) * [C#] [WIP] Status return code v2 (#638) * Prototype of status as struct * improving status a bit * fix build break, expose underlying (raw) status code to user * misc * Update StatusCode * Update Remote to new Status(Code); fix test cases; fix StatusCode layout; fine-tune Status(Code) names; make StatusCode internal * Update StatusCode and Status to final spec * Update Remote to new Status spec * unrelated nit Co-authored-by: TedHartMS <15467143+TedHartMS@users.noreply.github.com> * [C#] Change IFunctions 'address' parameter to UpdateInfo or ReadInfo (#652) * Add UpdateInfo and ReadInfo to IFunctions calls * Update Remote IFunctions implementations to UpdateInfo/ReadInfo changes Co-authored-by: Badrish Chandramouli <badrishc@microsoft.com> * Wire status into remote v2 (#657) Add NotFound API for status * Status naming changes and UpdateInfo structure split for v2 preview (#658) * [C#] Add Status.Record (#659) * Add Status.Record; update OperationStatus with all Advanced Status codes * Update Remote for status.Pending => .IsPending * Update nuspecs * more updates * Update azure-pipelines.yml * Update azure-pipelines.yml * revert windows-2022 in yml * Rename StatusCode.OK to Found (#662) * nit * update SpanByte with API to get pointer including metadata * Fixing ranges in OnPagesReadyToClose * [C#] Websocket bug-fixes (#663) * Fixed nits in websockets: * Clean disconnection * Support correction for large packets * Small nit for correcting message length * changed status to new FASTER status codes * Modified status codes Co-authored-by: Rohan Kadekodi <kadekodirohan@gmail.com> * Revert THA * nits * Improving cache tracker * fix NET5_0 to NET5_0_OR_GREATER * [C#] Add CompletePending[WithOutputs] to IFasterContext (#664) * Move CompletePending(WithOutputs) into IFasterContext * Skip LockEvictionObserver entirely if no LUCs active * Make Decrement interlocked; inline one accessor; revert CMakeLists.txt * [C#] Upgrade blob tests to Azurite, enable blob tests on Linux, use windows-2022 for CI (#666) * install azurite * Change testcase to make sure commit completed before dispose, it is up to user to ensure no ongoing commits at time of dispose. * [C#] UnsealPhysicalAddress fix (#665) * Fix unsealPA going below HA; return SUCCESS instead of NOTFOUND from normal reads that find an obsolete record in ITCTT * Ensure InternalLock calls require epoch protection * WIP: Spin wait on Pending Reads/RMWs until ClosedUntilAddress catches up. Still needs to handle partial page evictions. * Ensure partial ClosedUntilAddress shifts occur correctly. * [C#] Cancellation, ReadOptions, ReadFlags refactor (#668) * Add DeleteRecord and CancelOperation to *Info structures and IFunctions * Added ReadOptions * Move IFunctions methods' "ref RecordInfo" parameter to an *Info property, as it does not need to be updated * Update ReadFlags * ReadFlags fixes * Change XxxInfo.DeleteRecord/.CancelAction to XxxAction enum * Fixing Expiration tests * Add Phase to ExpirationTests * Add ReadOnly region to expiration tests * Delete and Upsert search down to HeadAddress if active LUC * [C#] Misc v2 fixes (#675) Fix misc bugs in v2 * update spanbyte * Yield thread when unable to reserve epoch entry, move iteration count outside table loop. * remove exception from overloaded lightepoch * Fix benchmark to run on .net 6 and linux. * fix another place * [C#] Improvements to LightEpoch * Use AllocateArray in LightEpoch * LightEpoch: Use two hash functions + linear probe, cache last successful probe per thread. Adjust table size based on number of machine processors. * [C#] Use GC.AllocateArray (#683) * Use GC.AllocateArray where possible * update benchmark as well. * Update buffer pool to use GC.AllocateArray * fix debug assert * Make DisposeSession protected in FasterServerBase. * Added SetBytesRead to IServerSession * - update sample .csprojs to target net6 and remove platform-related conditionals from all .csprojs now that we've moved to VS 2022 (#687) - add Status.Expired - update FASTER.client's copies of Status(Code).cs - Replace a TODO with an explanatory comment * Slight refactor of network stack. * Use GC.AllocateArray in SeaaBuffer * Another GC.AllocateArray substitution * [C#] [WIP] Wire disposal into IFunctions v2 (#685) * Add hook for failed CAS during SingleWriter. Still need to support other failed CAS scenarios. * Implement Dispose() functions - (MemoryLogCompactionTests fails at this time) * Fix MemoryLogCompactionTests; move DisposeDeserializedFromDisk up to ICPRFC Co-authored-by: TedHartMS <15467143+TedHartMS@users.noreply.github.com> Co-authored-by: Ted Hart <15467143+TedHartMS@users.noreply.github.com> Co-authored-by: Tianyu Li <litianyu@mit.edu> Co-authored-by: Vasileios Zois <vazois@microsoft.com> Co-authored-by: Sebastian Burckhardt <sburckha@microsoft.com> Co-authored-by: rohankadekodi-msr <69916400+rohankadekodi-msr@users.noreply.github.com> Co-authored-by: Rohan Kadekodi <kadekodirohan@gmail.com>
2022-04-14 02:03:35 +03:00
Assert.IsEmpty(functions1.handlerQueue);
}
[Test]
[Category("FasterKV")]
[Category("Smoke")]
public void DisposeSingleDeleter2Threads([Values(FlushMode.ReadOnly, FlushMode.OnDisk)] FlushMode flushMode)
[C#] FASTER v2 release (#563) * various changes from indexing work (#562) * various changes from indexing work - Add BeginAddress and EndAddress to scan iterators - Allow null deltaFileDevice in HybridLogCheckpointInfo.Recover - Rename FoldOverSnapshot to useFoldOverCheckpoint - Make TakeHybridLogCheckpoint overload call through to overload to avoid duplication - Add default values to new scanDelta and recoverTo arguments - Add missing checkpointManager.OnRecovery call to IntenralRecoverAsync - Fix some comments * Fix shortened name in test to work on Linux * [C#] Record-expiration support in RMW (#545) * Add support for record-expiration management to RMW and I(Advanced)Functions * Update Remote to RMW changes for expiration support * moving remote to IAdvFun * LogDir semantics - minor update Co-authored-by: Badrish Chandramouli <badrishc@microsoft.com> * [C#] Added PostCopyUpdater to IAdvancedFunctions (#561) * Add support for record-expiration management to RMW and I(Advanced)Functions * Update Remote to RMW changes for expiration support * Added PCU * Fixing testcase so that RMW does not expect old address. * Fix PCU bugs * Extend PostCopyUpdate to IFunctions; fix a few comments in remote Co-authored-by: TedHartMS <15467143+TedHartMS@users.noreply.github.com> * [C#] Merge IAdvancedFunctions into IFunctions (#565) * Merge IAdvancedFunctions into IFunctions * Add SupportsPostOperations and Post(IU|CU|SD); expand "ref RecordInfo recordInfo, long address" on Functions * Add RecordMetadata to RMWCompletionCallback params; improve ReadAddressTests * Add tests of Upsert with Input * [C#] RecordInfo v2 (#577) * RecordInfo v2 * fix version jump in CPR. * Updated misc stuff * misc updates to SpanByte * Remove IntExclLocker * Add Try APIs to record locking * Remove FASTERLegacy (#581) * Add Output parameter to Upsert (#574) * Add overloads of Upsert that take "ref Output" and one that takes "out RecordMetadata"; Fix RMW setting pendingContext.RecordInfo/LA; add locking of PostCopyUpdater, PostInitalUpdater, PostSingleWriter; * Reorganize ClientSession IntenralFasterSession to group functions for a given area (Read, Upsert, RMW, etc.) together * Fix locking on Post* calls * Fixes for Post* locking * remove net461 and netcoreapp2.1; add net6.0 in <Choose> to work on later in VS2022 * Update to new RecordInfo locking calls * Update to new IFunctions Locking signatures and RecordInfo implementation * Add post operations to Faster.benchmark * [C#] Checkpoint, Recovery, RecordInfo updates (#588) * Removed WAIT_PENDING * * Use only 1 bit for newVersion in RecordInfo, for CPR. Semantics are that sessions in v+1 will create records in fuzzy region with this bit set. Recovery only scans fuzzy region to elide such records. * Add 1 Filler bit for future use with fillers in records * Increase read lock bits to 6 (64 parallel readers) * Use dirty bit for incremental checkpoints * fix ycsb to not delete data file if we are using --recover * Fix epoch re-entry violation * Move to long versions, for KV checkpoints. * Shuffle around stuff for better cache alignment in benchmark. * Updates based on review * [C#] FasterLog Commit Optimization (v2) (#587) * Checkpoint work * Add notion of manual commit * Recovery of commit cookie * alternative design of log-cookie * Implementation improvement * code review comments * Cleanup + testing * Add management utility for LogCommitManager * Handle race on manual commit code path where not the latest tail is written out * Add condition to only scan log in fastCommitMode * Rough draft to allow for 1. elided commit record when fastCommit turned off and 2. "loose" commits * checkpoint changes * fix bug with readonly log allocator initialization * disable fast commit temporarily for CI * fix MLSD and mem device fast commit behavior * fix AzureStorageDevice exception type and remove self-termination on failure * test case on concurrent inserts * Re-enable epoch protection on CommitInternal * Ensure that full flush list error callbacks do not break FlushedUntilAddress tracking * Fix unclean shutdown of stress test * update device log test to scan until tail instead * change error code used for full flush list to better distinguish from others * Minor updates. Co-authored-by: Badrish Chandramouli <badrishc@microsoft.com> * Remove legacy local log commit manager * [C#] FasterLog v2 - misc changes, removed OverWrite commits (#593) * Checkin misc changes, removed overWrite commits * simplify OnRecovery logic * Fix build after merge * fix alignment of device commit manager * [C#] v2 pending flush list (#596) * Make PendingFlushList never error out in stressful situations. Current implementation uses lock for ~5-10% perf degradation over prior structure. * [C#] FasterLog v2: Fix FasterLog missed final commit (#597) * Fix FasterLog missed final commit. * [C#] Log compaction v2 (#598) * initial checkin * New ShiftBeginAddress behavior -- only shifts BeginAddress variable and does not truncate physical log unless option is specified. Also added Log.Truncate API for physical log truncation. Truncate log until persisted BeginAddress after taking a checkpoint. * Fix epoch protection orderings. * minor improvement to TestUtils to avoid race exception. * update Program.cs * updates from master. * [C#] V2 Custom Commit Strategy (#599) * Add FasterLogCommitStrategy * Use Bakery algorithm for latch * Documentation + tests + improved threading performance * Fix initialization error * Revert to v2 synchronization scheme * Optimization around commit strategies * Refactor CommitPolicy only for normal commits * fix missing spin wait * [C#] Fix v2 CommitPolicy Warnings (#607) * fix warnings * fix broken test * update for code consistency * Merged PR 59053: Network Stack Refactoring into FASTER This pull request contains the necessary changes for the updated network stack interface used by FASTER. It adds INetworkSender.cs and NetworkSenderBase.cs that can be used to implement custom communication protocols. Currently only TcpNetworkSender is supported. * Create .dockerignore * Added TentativeHeadAddress - we first shift this, and when all threads agree, we can do some pre-closing work such as eviction. Then we can shift the actual HeadAddress, closing pages when all threads agree on this. (#608) * Cleanup and remove dead code + reuse base provider. * Code cleanup * [C#] minor cleanup of fasterlog v2 (#611) * minor cleanup of fasterlog * [C#] Remove CheckpointType from CheckpointSettings (v2) (#614) * Remove CheckpointType from CheckpointSettings. Users have to specify checkpoint type on a per checkpoint basis. * fix build break * Fix CTT to call PostSingleWriter. * Avoid double init of FasterLog * [C#] Fixing warnings (#615) * Fixing CI warnings * [C#] Updating dependent package versions in v2 (#616) * Updating dependent package versions * nit * [C#] Improved FasterKV and FasterLog settings API for v2 (#618) * Simpler config API for v2. Move FasterLog to its own folder. * Remove purgeEarlierCommits from reader. Instead: 1. writer retries file deletes (in device commit manager) if access denied, in a loop, until timeout 2. reader (user code) retries recover async if it fails due to file deleted, until timeout * [C#] FasterLog V2 Device error handling (#612) * prototype device * prototype failure handling * Add proposed error handling code * Basic error handling tasks * Fault tolerant devices * Change to failure handler based approach instead of just throwing an exception * Remove brittle error handling code * make sure to read pages from flaky device on recovery in test * fix warnings * code review comments * See if we can enforce clean shutdown * Add extensions to enqueue SpanByte to FasterLog, and unsafely iterate without memory copy. (#621) * [C#] FasterLog v2 Add ability to explicitly terminate a log (#620) * Add ability to explicitly terminate a log * remove special 0-length return on eof * Add LogCompleted in iterator * Change comment and test * fix async iteration logic * fixes Co-authored-by: Badrish Chandramouli <badrishc@microsoft.com> * Maybe fix SVS issue with atomic reads (#622) * [C#] FasterLog v2 iteration fix (#623) * First pass of fixes * undo local change * [C#] Updated docs for FasterLog v2 (#624) * some updates * Add missing documentation * Update 40-fasterlog-basics.md Co-authored-by: Badrish Chandramouli <badrish@gmail.com> * Fix logic for directory delete timeouts. * Speed up testcases * [C#] Lockable Unsafe Context (LUC) in FasterKV v2 (WIP) (#605) * WIP on ManualFasterOperations * fixes for v2 merge * Updates to locking (still in progress) - Remove User-defined locks - Move SupportsLocking up to FasterKV level - Skip Stub and Sealed in iterators - Change PendingContext.OperationFlags from byte to ushort - Add ReadFlags.SkipCopyToTail - Add IsLocked*, TranferLocks methods to RecordInfo - Add UnsafeCompletePending* to ManualOps - Track lock counts in ManualOps and throw if Dispose() is called with locks or epoch held - Add LockInfo for ManualOps.*Lock - Implementation and testing of Faster operations with ManualOps locks - Fix ReadAddressTests to reflect improved consistency of not returning readcache addresses * Locking docs * Update 30-fasterkv-manual-locking.md * Updated doc to GH review and discussions * WIP for LockableRawContext * Existing tests run * Rename to LockableRawContext, IFasterContext * Perf workaround for LockTable.IsActive * WIP on ReadCacheEvict and MemoryPageLockEvictionScan * Add ReadCache and LockTable-transfer tests; move ReadCache tests out to their own sub-hierarchy * Test MemoryPageLockEvictionScan * Add testing for two-phase upsert/copytotail * Remove manual locking bits in Recovery; minor refactorings in Recovery.cs to reduce duplication * Add manual locking to FASTER.benchmark * More LockTable testing and fixes, mostly around ocking nonexistent key while Upsert/RMW/Deleting that key * Add UnsafeContext and make it the default for FASTER.Benchmark * Updates from code review: - IsLocked returns shared lock count (added test) - Fix location of IsIntermediate checks in RecordInfo.Lock/Seal - Remove unused IEqualityComparer in LockTableEntry * Rename Take(Full|Index|HybridLog)Checkpoint to TryInitiate(Full|Index|HybridLog)Checkpoint, so it is obvious they need to complete it * - Remove SupportsPostOperations; this is now always done - Add SingleDeleter for symmetry with Upsert - Add DisposeKey and DisposeValue * Add CopyWriter, to distinguish "maintentance" copying (CopyToTail or copy to ReadCache) from API-parameter copies * merge fixes * Remove obsolete Functions-level locking and postOps specifications * Fix Remote build Co-authored-by: Badrish Chandramouli <badrishc@microsoft.com> * fix semantic merge conflict in MemoryPageScanIterator (#632) * [C#] Add WriteReason parameter to SingleWriter (#630) * Add Functions.PostCopyWriter; update MemOnlyCache to use Post(Single|Copy)Writer * Remove (Post)CopyWriter and replace with WriteReason parameter to (Post)SingleWriter * Move SingleWriter "reason" parameter * Move ReadFlags and WriteReason to their own files; rename SupportsLocking -> DisableLocking with default 'false' * Update Remote to disableLocking name and default change * [C#] Various Fixes (#635) * Fixes: - Fixed WriteReason when CTT overrides ReadCache - make DisableLocking a readonly member - Call SetTentativeAtomic after Post* - Make readcache and comparer private with internal accessors for test - FIx intermittent failure of BasicHighLatencyDeviceTest * back out changes to move from internal -> private for FKV.readcache and .comparer * [C#] Remove StrictCPR (#636) * Removed WAIT_PENDING * StrictCPR removal WIP * Fix bug in state machine test, as it was not using unsafe context for fine grained control over the state machine execution. * Remove PendingContext.HeldLatch and heldOperation local * Revise FASTER.Benchmark to replace --noaff with --safectx and integrate this into Ycsb and SpanbyteYcsb * check epoch protection for complete pending * *UnsafeContext: AnyInstanceProtected -> ThisInstanceProtected Co-authored-by: TedHartMS <15467143+TedHartMS@users.noreply.github.com> * [C#] Support int session ID for FasterKV (#641) * Support int session ID for FasterKV * fix remote solution, minor name updates * update FasterLog API for TryEnqueue of custom header * [C#] IEntry interface for FasterLog (#639) * enqueue with entries prototype * Add IEntry tests and method variants * Address code review comments * Rename + read entries * Add async versions of consumer * Make interfaces top-level * Correct header offset in FasterLog new API * [C#] Recover returns version we recovered to (#648) * add to FasterLog SpanByte API * fix breaking tests * Fix dispose loop * Update FasterServerBase.cs * do not remove ioPendingRequests in RMWAsync if there was no disk request (#653) * [C#] [WIP] Status return code v2 (#638) * Prototype of status as struct * improving status a bit * fix build break, expose underlying (raw) status code to user * misc * Update StatusCode * Update Remote to new Status(Code); fix test cases; fix StatusCode layout; fine-tune Status(Code) names; make StatusCode internal * Update StatusCode and Status to final spec * Update Remote to new Status spec * unrelated nit Co-authored-by: TedHartMS <15467143+TedHartMS@users.noreply.github.com> * [C#] Change IFunctions 'address' parameter to UpdateInfo or ReadInfo (#652) * Add UpdateInfo and ReadInfo to IFunctions calls * Update Remote IFunctions implementations to UpdateInfo/ReadInfo changes Co-authored-by: Badrish Chandramouli <badrishc@microsoft.com> * Wire status into remote v2 (#657) Add NotFound API for status * Status naming changes and UpdateInfo structure split for v2 preview (#658) * [C#] Add Status.Record (#659) * Add Status.Record; update OperationStatus with all Advanced Status codes * Update Remote for status.Pending => .IsPending * Update nuspecs * more updates * Update azure-pipelines.yml * Update azure-pipelines.yml * revert windows-2022 in yml * Rename StatusCode.OK to Found (#662) * nit * update SpanByte with API to get pointer including metadata * Fixing ranges in OnPagesReadyToClose * [C#] Websocket bug-fixes (#663) * Fixed nits in websockets: * Clean disconnection * Support correction for large packets * Small nit for correcting message length * changed status to new FASTER status codes * Modified status codes Co-authored-by: Rohan Kadekodi <kadekodirohan@gmail.com> * Revert THA * nits * Improving cache tracker * fix NET5_0 to NET5_0_OR_GREATER * [C#] Add CompletePending[WithOutputs] to IFasterContext (#664) * Move CompletePending(WithOutputs) into IFasterContext * Skip LockEvictionObserver entirely if no LUCs active * Make Decrement interlocked; inline one accessor; revert CMakeLists.txt * [C#] Upgrade blob tests to Azurite, enable blob tests on Linux, use windows-2022 for CI (#666) * install azurite * Change testcase to make sure commit completed before dispose, it is up to user to ensure no ongoing commits at time of dispose. * [C#] UnsealPhysicalAddress fix (#665) * Fix unsealPA going below HA; return SUCCESS instead of NOTFOUND from normal reads that find an obsolete record in ITCTT * Ensure InternalLock calls require epoch protection * WIP: Spin wait on Pending Reads/RMWs until ClosedUntilAddress catches up. Still needs to handle partial page evictions. * Ensure partial ClosedUntilAddress shifts occur correctly. * [C#] Cancellation, ReadOptions, ReadFlags refactor (#668) * Add DeleteRecord and CancelOperation to *Info structures and IFunctions * Added ReadOptions * Move IFunctions methods' "ref RecordInfo" parameter to an *Info property, as it does not need to be updated * Update ReadFlags * ReadFlags fixes * Change XxxInfo.DeleteRecord/.CancelAction to XxxAction enum * Fixing Expiration tests * Add Phase to ExpirationTests * Add ReadOnly region to expiration tests * Delete and Upsert search down to HeadAddress if active LUC * [C#] Misc v2 fixes (#675) Fix misc bugs in v2 * update spanbyte * Yield thread when unable to reserve epoch entry, move iteration count outside table loop. * remove exception from overloaded lightepoch * Fix benchmark to run on .net 6 and linux. * fix another place * [C#] Improvements to LightEpoch * Use AllocateArray in LightEpoch * LightEpoch: Use two hash functions + linear probe, cache last successful probe per thread. Adjust table size based on number of machine processors. * [C#] Use GC.AllocateArray (#683) * Use GC.AllocateArray where possible * update benchmark as well. * Update buffer pool to use GC.AllocateArray * fix debug assert * Make DisposeSession protected in FasterServerBase. * Added SetBytesRead to IServerSession * - update sample .csprojs to target net6 and remove platform-related conditionals from all .csprojs now that we've moved to VS 2022 (#687) - add Status.Expired - update FASTER.client's copies of Status(Code).cs - Replace a TODO with an explanatory comment * Slight refactor of network stack. * Use GC.AllocateArray in SeaaBuffer * Another GC.AllocateArray substitution * [C#] [WIP] Wire disposal into IFunctions v2 (#685) * Add hook for failed CAS during SingleWriter. Still need to support other failed CAS scenarios. * Implement Dispose() functions - (MemoryLogCompactionTests fails at this time) * Fix MemoryLogCompactionTests; move DisposeDeserializedFromDisk up to ICPRFC Co-authored-by: TedHartMS <15467143+TedHartMS@users.noreply.github.com> Co-authored-by: Ted Hart <15467143+TedHartMS@users.noreply.github.com> Co-authored-by: Tianyu Li <litianyu@mit.edu> Co-authored-by: Vasileios Zois <vazois@microsoft.com> Co-authored-by: Sebastian Burckhardt <sburckha@microsoft.com> Co-authored-by: rohankadekodi-msr <69916400+rohankadekodi-msr@users.noreply.github.com> Co-authored-by: Rohan Kadekodi <kadekodirohan@gmail.com>
2022-04-14 02:03:35 +03:00
{
var functions1 = new DisposeFunctions(this, sut: true);
var functions2 = new DisposeFunctions(this, sut: false);
MyKey key = new() { key = TestKey };
MyKey collidingKey = new() { key = TestCollidingKey };
{
using var session = fht.NewSession(new DisposeFunctionsNoSync());
MyValue value = new() { value = TestInitialValue };
session.Upsert(ref key, ref value);
MyValue collidingValue = new() { value = TestCollidingValue };
session.Upsert(ref collidingKey, ref collidingValue);
}
// Make it immutable so we don't simply set Tombstone.
DoFlush(flushMode);
// This is necessary for FlushMode.ReadOnly to test the readonly range in Delete() (otherwise we can't test SingleDeleter there)
var luc = fht.NewSession(new DisposeFunctionsNoSync()).LockableUnsafeContext;
[C#] FASTER v2 release (#563) * various changes from indexing work (#562) * various changes from indexing work - Add BeginAddress and EndAddress to scan iterators - Allow null deltaFileDevice in HybridLogCheckpointInfo.Recover - Rename FoldOverSnapshot to useFoldOverCheckpoint - Make TakeHybridLogCheckpoint overload call through to overload to avoid duplication - Add default values to new scanDelta and recoverTo arguments - Add missing checkpointManager.OnRecovery call to IntenralRecoverAsync - Fix some comments * Fix shortened name in test to work on Linux * [C#] Record-expiration support in RMW (#545) * Add support for record-expiration management to RMW and I(Advanced)Functions * Update Remote to RMW changes for expiration support * moving remote to IAdvFun * LogDir semantics - minor update Co-authored-by: Badrish Chandramouli <badrishc@microsoft.com> * [C#] Added PostCopyUpdater to IAdvancedFunctions (#561) * Add support for record-expiration management to RMW and I(Advanced)Functions * Update Remote to RMW changes for expiration support * Added PCU * Fixing testcase so that RMW does not expect old address. * Fix PCU bugs * Extend PostCopyUpdate to IFunctions; fix a few comments in remote Co-authored-by: TedHartMS <15467143+TedHartMS@users.noreply.github.com> * [C#] Merge IAdvancedFunctions into IFunctions (#565) * Merge IAdvancedFunctions into IFunctions * Add SupportsPostOperations and Post(IU|CU|SD); expand "ref RecordInfo recordInfo, long address" on Functions * Add RecordMetadata to RMWCompletionCallback params; improve ReadAddressTests * Add tests of Upsert with Input * [C#] RecordInfo v2 (#577) * RecordInfo v2 * fix version jump in CPR. * Updated misc stuff * misc updates to SpanByte * Remove IntExclLocker * Add Try APIs to record locking * Remove FASTERLegacy (#581) * Add Output parameter to Upsert (#574) * Add overloads of Upsert that take "ref Output" and one that takes "out RecordMetadata"; Fix RMW setting pendingContext.RecordInfo/LA; add locking of PostCopyUpdater, PostInitalUpdater, PostSingleWriter; * Reorganize ClientSession IntenralFasterSession to group functions for a given area (Read, Upsert, RMW, etc.) together * Fix locking on Post* calls * Fixes for Post* locking * remove net461 and netcoreapp2.1; add net6.0 in <Choose> to work on later in VS2022 * Update to new RecordInfo locking calls * Update to new IFunctions Locking signatures and RecordInfo implementation * Add post operations to Faster.benchmark * [C#] Checkpoint, Recovery, RecordInfo updates (#588) * Removed WAIT_PENDING * * Use only 1 bit for newVersion in RecordInfo, for CPR. Semantics are that sessions in v+1 will create records in fuzzy region with this bit set. Recovery only scans fuzzy region to elide such records. * Add 1 Filler bit for future use with fillers in records * Increase read lock bits to 6 (64 parallel readers) * Use dirty bit for incremental checkpoints * fix ycsb to not delete data file if we are using --recover * Fix epoch re-entry violation * Move to long versions, for KV checkpoints. * Shuffle around stuff for better cache alignment in benchmark. * Updates based on review * [C#] FasterLog Commit Optimization (v2) (#587) * Checkpoint work * Add notion of manual commit * Recovery of commit cookie * alternative design of log-cookie * Implementation improvement * code review comments * Cleanup + testing * Add management utility for LogCommitManager * Handle race on manual commit code path where not the latest tail is written out * Add condition to only scan log in fastCommitMode * Rough draft to allow for 1. elided commit record when fastCommit turned off and 2. "loose" commits * checkpoint changes * fix bug with readonly log allocator initialization * disable fast commit temporarily for CI * fix MLSD and mem device fast commit behavior * fix AzureStorageDevice exception type and remove self-termination on failure * test case on concurrent inserts * Re-enable epoch protection on CommitInternal * Ensure that full flush list error callbacks do not break FlushedUntilAddress tracking * Fix unclean shutdown of stress test * update device log test to scan until tail instead * change error code used for full flush list to better distinguish from others * Minor updates. Co-authored-by: Badrish Chandramouli <badrishc@microsoft.com> * Remove legacy local log commit manager * [C#] FasterLog v2 - misc changes, removed OverWrite commits (#593) * Checkin misc changes, removed overWrite commits * simplify OnRecovery logic * Fix build after merge * fix alignment of device commit manager * [C#] v2 pending flush list (#596) * Make PendingFlushList never error out in stressful situations. Current implementation uses lock for ~5-10% perf degradation over prior structure. * [C#] FasterLog v2: Fix FasterLog missed final commit (#597) * Fix FasterLog missed final commit. * [C#] Log compaction v2 (#598) * initial checkin * New ShiftBeginAddress behavior -- only shifts BeginAddress variable and does not truncate physical log unless option is specified. Also added Log.Truncate API for physical log truncation. Truncate log until persisted BeginAddress after taking a checkpoint. * Fix epoch protection orderings. * minor improvement to TestUtils to avoid race exception. * update Program.cs * updates from master. * [C#] V2 Custom Commit Strategy (#599) * Add FasterLogCommitStrategy * Use Bakery algorithm for latch * Documentation + tests + improved threading performance * Fix initialization error * Revert to v2 synchronization scheme * Optimization around commit strategies * Refactor CommitPolicy only for normal commits * fix missing spin wait * [C#] Fix v2 CommitPolicy Warnings (#607) * fix warnings * fix broken test * update for code consistency * Merged PR 59053: Network Stack Refactoring into FASTER This pull request contains the necessary changes for the updated network stack interface used by FASTER. It adds INetworkSender.cs and NetworkSenderBase.cs that can be used to implement custom communication protocols. Currently only TcpNetworkSender is supported. * Create .dockerignore * Added TentativeHeadAddress - we first shift this, and when all threads agree, we can do some pre-closing work such as eviction. Then we can shift the actual HeadAddress, closing pages when all threads agree on this. (#608) * Cleanup and remove dead code + reuse base provider. * Code cleanup * [C#] minor cleanup of fasterlog v2 (#611) * minor cleanup of fasterlog * [C#] Remove CheckpointType from CheckpointSettings (v2) (#614) * Remove CheckpointType from CheckpointSettings. Users have to specify checkpoint type on a per checkpoint basis. * fix build break * Fix CTT to call PostSingleWriter. * Avoid double init of FasterLog * [C#] Fixing warnings (#615) * Fixing CI warnings * [C#] Updating dependent package versions in v2 (#616) * Updating dependent package versions * nit * [C#] Improved FasterKV and FasterLog settings API for v2 (#618) * Simpler config API for v2. Move FasterLog to its own folder. * Remove purgeEarlierCommits from reader. Instead: 1. writer retries file deletes (in device commit manager) if access denied, in a loop, until timeout 2. reader (user code) retries recover async if it fails due to file deleted, until timeout * [C#] FasterLog V2 Device error handling (#612) * prototype device * prototype failure handling * Add proposed error handling code * Basic error handling tasks * Fault tolerant devices * Change to failure handler based approach instead of just throwing an exception * Remove brittle error handling code * make sure to read pages from flaky device on recovery in test * fix warnings * code review comments * See if we can enforce clean shutdown * Add extensions to enqueue SpanByte to FasterLog, and unsafely iterate without memory copy. (#621) * [C#] FasterLog v2 Add ability to explicitly terminate a log (#620) * Add ability to explicitly terminate a log * remove special 0-length return on eof * Add LogCompleted in iterator * Change comment and test * fix async iteration logic * fixes Co-authored-by: Badrish Chandramouli <badrishc@microsoft.com> * Maybe fix SVS issue with atomic reads (#622) * [C#] FasterLog v2 iteration fix (#623) * First pass of fixes * undo local change * [C#] Updated docs for FasterLog v2 (#624) * some updates * Add missing documentation * Update 40-fasterlog-basics.md Co-authored-by: Badrish Chandramouli <badrish@gmail.com> * Fix logic for directory delete timeouts. * Speed up testcases * [C#] Lockable Unsafe Context (LUC) in FasterKV v2 (WIP) (#605) * WIP on ManualFasterOperations * fixes for v2 merge * Updates to locking (still in progress) - Remove User-defined locks - Move SupportsLocking up to FasterKV level - Skip Stub and Sealed in iterators - Change PendingContext.OperationFlags from byte to ushort - Add ReadFlags.SkipCopyToTail - Add IsLocked*, TranferLocks methods to RecordInfo - Add UnsafeCompletePending* to ManualOps - Track lock counts in ManualOps and throw if Dispose() is called with locks or epoch held - Add LockInfo for ManualOps.*Lock - Implementation and testing of Faster operations with ManualOps locks - Fix ReadAddressTests to reflect improved consistency of not returning readcache addresses * Locking docs * Update 30-fasterkv-manual-locking.md * Updated doc to GH review and discussions * WIP for LockableRawContext * Existing tests run * Rename to LockableRawContext, IFasterContext * Perf workaround for LockTable.IsActive * WIP on ReadCacheEvict and MemoryPageLockEvictionScan * Add ReadCache and LockTable-transfer tests; move ReadCache tests out to their own sub-hierarchy * Test MemoryPageLockEvictionScan * Add testing for two-phase upsert/copytotail * Remove manual locking bits in Recovery; minor refactorings in Recovery.cs to reduce duplication * Add manual locking to FASTER.benchmark * More LockTable testing and fixes, mostly around ocking nonexistent key while Upsert/RMW/Deleting that key * Add UnsafeContext and make it the default for FASTER.Benchmark * Updates from code review: - IsLocked returns shared lock count (added test) - Fix location of IsIntermediate checks in RecordInfo.Lock/Seal - Remove unused IEqualityComparer in LockTableEntry * Rename Take(Full|Index|HybridLog)Checkpoint to TryInitiate(Full|Index|HybridLog)Checkpoint, so it is obvious they need to complete it * - Remove SupportsPostOperations; this is now always done - Add SingleDeleter for symmetry with Upsert - Add DisposeKey and DisposeValue * Add CopyWriter, to distinguish "maintentance" copying (CopyToTail or copy to ReadCache) from API-parameter copies * merge fixes * Remove obsolete Functions-level locking and postOps specifications * Fix Remote build Co-authored-by: Badrish Chandramouli <badrishc@microsoft.com> * fix semantic merge conflict in MemoryPageScanIterator (#632) * [C#] Add WriteReason parameter to SingleWriter (#630) * Add Functions.PostCopyWriter; update MemOnlyCache to use Post(Single|Copy)Writer * Remove (Post)CopyWriter and replace with WriteReason parameter to (Post)SingleWriter * Move SingleWriter "reason" parameter * Move ReadFlags and WriteReason to their own files; rename SupportsLocking -> DisableLocking with default 'false' * Update Remote to disableLocking name and default change * [C#] Various Fixes (#635) * Fixes: - Fixed WriteReason when CTT overrides ReadCache - make DisableLocking a readonly member - Call SetTentativeAtomic after Post* - Make readcache and comparer private with internal accessors for test - FIx intermittent failure of BasicHighLatencyDeviceTest * back out changes to move from internal -> private for FKV.readcache and .comparer * [C#] Remove StrictCPR (#636) * Removed WAIT_PENDING * StrictCPR removal WIP * Fix bug in state machine test, as it was not using unsafe context for fine grained control over the state machine execution. * Remove PendingContext.HeldLatch and heldOperation local * Revise FASTER.Benchmark to replace --noaff with --safectx and integrate this into Ycsb and SpanbyteYcsb * check epoch protection for complete pending * *UnsafeContext: AnyInstanceProtected -> ThisInstanceProtected Co-authored-by: TedHartMS <15467143+TedHartMS@users.noreply.github.com> * [C#] Support int session ID for FasterKV (#641) * Support int session ID for FasterKV * fix remote solution, minor name updates * update FasterLog API for TryEnqueue of custom header * [C#] IEntry interface for FasterLog (#639) * enqueue with entries prototype * Add IEntry tests and method variants * Address code review comments * Rename + read entries * Add async versions of consumer * Make interfaces top-level * Correct header offset in FasterLog new API * [C#] Recover returns version we recovered to (#648) * add to FasterLog SpanByte API * fix breaking tests * Fix dispose loop * Update FasterServerBase.cs * do not remove ioPendingRequests in RMWAsync if there was no disk request (#653) * [C#] [WIP] Status return code v2 (#638) * Prototype of status as struct * improving status a bit * fix build break, expose underlying (raw) status code to user * misc * Update StatusCode * Update Remote to new Status(Code); fix test cases; fix StatusCode layout; fine-tune Status(Code) names; make StatusCode internal * Update StatusCode and Status to final spec * Update Remote to new Status spec * unrelated nit Co-authored-by: TedHartMS <15467143+TedHartMS@users.noreply.github.com> * [C#] Change IFunctions 'address' parameter to UpdateInfo or ReadInfo (#652) * Add UpdateInfo and ReadInfo to IFunctions calls * Update Remote IFunctions implementations to UpdateInfo/ReadInfo changes Co-authored-by: Badrish Chandramouli <badrishc@microsoft.com> * Wire status into remote v2 (#657) Add NotFound API for status * Status naming changes and UpdateInfo structure split for v2 preview (#658) * [C#] Add Status.Record (#659) * Add Status.Record; update OperationStatus with all Advanced Status codes * Update Remote for status.Pending => .IsPending * Update nuspecs * more updates * Update azure-pipelines.yml * Update azure-pipelines.yml * revert windows-2022 in yml * Rename StatusCode.OK to Found (#662) * nit * update SpanByte with API to get pointer including metadata * Fixing ranges in OnPagesReadyToClose * [C#] Websocket bug-fixes (#663) * Fixed nits in websockets: * Clean disconnection * Support correction for large packets * Small nit for correcting message length * changed status to new FASTER status codes * Modified status codes Co-authored-by: Rohan Kadekodi <kadekodirohan@gmail.com> * Revert THA * nits * Improving cache tracker * fix NET5_0 to NET5_0_OR_GREATER * [C#] Add CompletePending[WithOutputs] to IFasterContext (#664) * Move CompletePending(WithOutputs) into IFasterContext * Skip LockEvictionObserver entirely if no LUCs active * Make Decrement interlocked; inline one accessor; revert CMakeLists.txt * [C#] Upgrade blob tests to Azurite, enable blob tests on Linux, use windows-2022 for CI (#666) * install azurite * Change testcase to make sure commit completed before dispose, it is up to user to ensure no ongoing commits at time of dispose. * [C#] UnsealPhysicalAddress fix (#665) * Fix unsealPA going below HA; return SUCCESS instead of NOTFOUND from normal reads that find an obsolete record in ITCTT * Ensure InternalLock calls require epoch protection * WIP: Spin wait on Pending Reads/RMWs until ClosedUntilAddress catches up. Still needs to handle partial page evictions. * Ensure partial ClosedUntilAddress shifts occur correctly. * [C#] Cancellation, ReadOptions, ReadFlags refactor (#668) * Add DeleteRecord and CancelOperation to *Info structures and IFunctions * Added ReadOptions * Move IFunctions methods' "ref RecordInfo" parameter to an *Info property, as it does not need to be updated * Update ReadFlags * ReadFlags fixes * Change XxxInfo.DeleteRecord/.CancelAction to XxxAction enum * Fixing Expiration tests * Add Phase to ExpirationTests * Add ReadOnly region to expiration tests * Delete and Upsert search down to HeadAddress if active LUC * [C#] Misc v2 fixes (#675) Fix misc bugs in v2 * update spanbyte * Yield thread when unable to reserve epoch entry, move iteration count outside table loop. * remove exception from overloaded lightepoch * Fix benchmark to run on .net 6 and linux. * fix another place * [C#] Improvements to LightEpoch * Use AllocateArray in LightEpoch * LightEpoch: Use two hash functions + linear probe, cache last successful probe per thread. Adjust table size based on number of machine processors. * [C#] Use GC.AllocateArray (#683) * Use GC.AllocateArray where possible * update benchmark as well. * Update buffer pool to use GC.AllocateArray * fix debug assert * Make DisposeSession protected in FasterServerBase. * Added SetBytesRead to IServerSession * - update sample .csprojs to target net6 and remove platform-related conditionals from all .csprojs now that we've moved to VS 2022 (#687) - add Status.Expired - update FASTER.client's copies of Status(Code).cs - Replace a TODO with an explanatory comment * Slight refactor of network stack. * Use GC.AllocateArray in SeaaBuffer * Another GC.AllocateArray substitution * [C#] [WIP] Wire disposal into IFunctions v2 (#685) * Add hook for failed CAS during SingleWriter. Still need to support other failed CAS scenarios. * Implement Dispose() functions - (MemoryLogCompactionTests fails at this time) * Fix MemoryLogCompactionTests; move DisposeDeserializedFromDisk up to ICPRFC Co-authored-by: TedHartMS <15467143+TedHartMS@users.noreply.github.com> Co-authored-by: Ted Hart <15467143+TedHartMS@users.noreply.github.com> Co-authored-by: Tianyu Li <litianyu@mit.edu> Co-authored-by: Vasileios Zois <vazois@microsoft.com> Co-authored-by: Sebastian Burckhardt <sburckha@microsoft.com> Co-authored-by: rohankadekodi-msr <69916400+rohankadekodi-msr@users.noreply.github.com> Co-authored-by: Rohan Kadekodi <kadekodirohan@gmail.com>
2022-04-14 02:03:35 +03:00
void DoDelete(DisposeFunctions functions)
{
using var innerSession = fht.NewSession(functions);
if (functions.isSUT)
innerSession.Delete(ref key);
else
{
otherGate.Wait();
innerSession.Delete(ref collidingKey);
}
}
var tasks = new[]
{
Task.Factory.StartNew(() => DoDelete(functions1)),
Task.Factory.StartNew(() => DoDelete(functions2))
};
Task.WaitAll(tasks);
Assert.AreEqual(DisposeHandler.SingleDeleter, functions1.handlerQueue.Dequeue());
Assert.IsEmpty(functions1.handlerQueue);
}
[Test]
[Category("FasterKV")]
[Category("Smoke")]
public void PendingRead([Values] ReadCopyDestination copyDest)
[C#] FASTER v2 release (#563) * various changes from indexing work (#562) * various changes from indexing work - Add BeginAddress and EndAddress to scan iterators - Allow null deltaFileDevice in HybridLogCheckpointInfo.Recover - Rename FoldOverSnapshot to useFoldOverCheckpoint - Make TakeHybridLogCheckpoint overload call through to overload to avoid duplication - Add default values to new scanDelta and recoverTo arguments - Add missing checkpointManager.OnRecovery call to IntenralRecoverAsync - Fix some comments * Fix shortened name in test to work on Linux * [C#] Record-expiration support in RMW (#545) * Add support for record-expiration management to RMW and I(Advanced)Functions * Update Remote to RMW changes for expiration support * moving remote to IAdvFun * LogDir semantics - minor update Co-authored-by: Badrish Chandramouli <badrishc@microsoft.com> * [C#] Added PostCopyUpdater to IAdvancedFunctions (#561) * Add support for record-expiration management to RMW and I(Advanced)Functions * Update Remote to RMW changes for expiration support * Added PCU * Fixing testcase so that RMW does not expect old address. * Fix PCU bugs * Extend PostCopyUpdate to IFunctions; fix a few comments in remote Co-authored-by: TedHartMS <15467143+TedHartMS@users.noreply.github.com> * [C#] Merge IAdvancedFunctions into IFunctions (#565) * Merge IAdvancedFunctions into IFunctions * Add SupportsPostOperations and Post(IU|CU|SD); expand "ref RecordInfo recordInfo, long address" on Functions * Add RecordMetadata to RMWCompletionCallback params; improve ReadAddressTests * Add tests of Upsert with Input * [C#] RecordInfo v2 (#577) * RecordInfo v2 * fix version jump in CPR. * Updated misc stuff * misc updates to SpanByte * Remove IntExclLocker * Add Try APIs to record locking * Remove FASTERLegacy (#581) * Add Output parameter to Upsert (#574) * Add overloads of Upsert that take "ref Output" and one that takes "out RecordMetadata"; Fix RMW setting pendingContext.RecordInfo/LA; add locking of PostCopyUpdater, PostInitalUpdater, PostSingleWriter; * Reorganize ClientSession IntenralFasterSession to group functions for a given area (Read, Upsert, RMW, etc.) together * Fix locking on Post* calls * Fixes for Post* locking * remove net461 and netcoreapp2.1; add net6.0 in <Choose> to work on later in VS2022 * Update to new RecordInfo locking calls * Update to new IFunctions Locking signatures and RecordInfo implementation * Add post operations to Faster.benchmark * [C#] Checkpoint, Recovery, RecordInfo updates (#588) * Removed WAIT_PENDING * * Use only 1 bit for newVersion in RecordInfo, for CPR. Semantics are that sessions in v+1 will create records in fuzzy region with this bit set. Recovery only scans fuzzy region to elide such records. * Add 1 Filler bit for future use with fillers in records * Increase read lock bits to 6 (64 parallel readers) * Use dirty bit for incremental checkpoints * fix ycsb to not delete data file if we are using --recover * Fix epoch re-entry violation * Move to long versions, for KV checkpoints. * Shuffle around stuff for better cache alignment in benchmark. * Updates based on review * [C#] FasterLog Commit Optimization (v2) (#587) * Checkpoint work * Add notion of manual commit * Recovery of commit cookie * alternative design of log-cookie * Implementation improvement * code review comments * Cleanup + testing * Add management utility for LogCommitManager * Handle race on manual commit code path where not the latest tail is written out * Add condition to only scan log in fastCommitMode * Rough draft to allow for 1. elided commit record when fastCommit turned off and 2. "loose" commits * checkpoint changes * fix bug with readonly log allocator initialization * disable fast commit temporarily for CI * fix MLSD and mem device fast commit behavior * fix AzureStorageDevice exception type and remove self-termination on failure * test case on concurrent inserts * Re-enable epoch protection on CommitInternal * Ensure that full flush list error callbacks do not break FlushedUntilAddress tracking * Fix unclean shutdown of stress test * update device log test to scan until tail instead * change error code used for full flush list to better distinguish from others * Minor updates. Co-authored-by: Badrish Chandramouli <badrishc@microsoft.com> * Remove legacy local log commit manager * [C#] FasterLog v2 - misc changes, removed OverWrite commits (#593) * Checkin misc changes, removed overWrite commits * simplify OnRecovery logic * Fix build after merge * fix alignment of device commit manager * [C#] v2 pending flush list (#596) * Make PendingFlushList never error out in stressful situations. Current implementation uses lock for ~5-10% perf degradation over prior structure. * [C#] FasterLog v2: Fix FasterLog missed final commit (#597) * Fix FasterLog missed final commit. * [C#] Log compaction v2 (#598) * initial checkin * New ShiftBeginAddress behavior -- only shifts BeginAddress variable and does not truncate physical log unless option is specified. Also added Log.Truncate API for physical log truncation. Truncate log until persisted BeginAddress after taking a checkpoint. * Fix epoch protection orderings. * minor improvement to TestUtils to avoid race exception. * update Program.cs * updates from master. * [C#] V2 Custom Commit Strategy (#599) * Add FasterLogCommitStrategy * Use Bakery algorithm for latch * Documentation + tests + improved threading performance * Fix initialization error * Revert to v2 synchronization scheme * Optimization around commit strategies * Refactor CommitPolicy only for normal commits * fix missing spin wait * [C#] Fix v2 CommitPolicy Warnings (#607) * fix warnings * fix broken test * update for code consistency * Merged PR 59053: Network Stack Refactoring into FASTER This pull request contains the necessary changes for the updated network stack interface used by FASTER. It adds INetworkSender.cs and NetworkSenderBase.cs that can be used to implement custom communication protocols. Currently only TcpNetworkSender is supported. * Create .dockerignore * Added TentativeHeadAddress - we first shift this, and when all threads agree, we can do some pre-closing work such as eviction. Then we can shift the actual HeadAddress, closing pages when all threads agree on this. (#608) * Cleanup and remove dead code + reuse base provider. * Code cleanup * [C#] minor cleanup of fasterlog v2 (#611) * minor cleanup of fasterlog * [C#] Remove CheckpointType from CheckpointSettings (v2) (#614) * Remove CheckpointType from CheckpointSettings. Users have to specify checkpoint type on a per checkpoint basis. * fix build break * Fix CTT to call PostSingleWriter. * Avoid double init of FasterLog * [C#] Fixing warnings (#615) * Fixing CI warnings * [C#] Updating dependent package versions in v2 (#616) * Updating dependent package versions * nit * [C#] Improved FasterKV and FasterLog settings API for v2 (#618) * Simpler config API for v2. Move FasterLog to its own folder. * Remove purgeEarlierCommits from reader. Instead: 1. writer retries file deletes (in device commit manager) if access denied, in a loop, until timeout 2. reader (user code) retries recover async if it fails due to file deleted, until timeout * [C#] FasterLog V2 Device error handling (#612) * prototype device * prototype failure handling * Add proposed error handling code * Basic error handling tasks * Fault tolerant devices * Change to failure handler based approach instead of just throwing an exception * Remove brittle error handling code * make sure to read pages from flaky device on recovery in test * fix warnings * code review comments * See if we can enforce clean shutdown * Add extensions to enqueue SpanByte to FasterLog, and unsafely iterate without memory copy. (#621) * [C#] FasterLog v2 Add ability to explicitly terminate a log (#620) * Add ability to explicitly terminate a log * remove special 0-length return on eof * Add LogCompleted in iterator * Change comment and test * fix async iteration logic * fixes Co-authored-by: Badrish Chandramouli <badrishc@microsoft.com> * Maybe fix SVS issue with atomic reads (#622) * [C#] FasterLog v2 iteration fix (#623) * First pass of fixes * undo local change * [C#] Updated docs for FasterLog v2 (#624) * some updates * Add missing documentation * Update 40-fasterlog-basics.md Co-authored-by: Badrish Chandramouli <badrish@gmail.com> * Fix logic for directory delete timeouts. * Speed up testcases * [C#] Lockable Unsafe Context (LUC) in FasterKV v2 (WIP) (#605) * WIP on ManualFasterOperations * fixes for v2 merge * Updates to locking (still in progress) - Remove User-defined locks - Move SupportsLocking up to FasterKV level - Skip Stub and Sealed in iterators - Change PendingContext.OperationFlags from byte to ushort - Add ReadFlags.SkipCopyToTail - Add IsLocked*, TranferLocks methods to RecordInfo - Add UnsafeCompletePending* to ManualOps - Track lock counts in ManualOps and throw if Dispose() is called with locks or epoch held - Add LockInfo for ManualOps.*Lock - Implementation and testing of Faster operations with ManualOps locks - Fix ReadAddressTests to reflect improved consistency of not returning readcache addresses * Locking docs * Update 30-fasterkv-manual-locking.md * Updated doc to GH review and discussions * WIP for LockableRawContext * Existing tests run * Rename to LockableRawContext, IFasterContext * Perf workaround for LockTable.IsActive * WIP on ReadCacheEvict and MemoryPageLockEvictionScan * Add ReadCache and LockTable-transfer tests; move ReadCache tests out to their own sub-hierarchy * Test MemoryPageLockEvictionScan * Add testing for two-phase upsert/copytotail * Remove manual locking bits in Recovery; minor refactorings in Recovery.cs to reduce duplication * Add manual locking to FASTER.benchmark * More LockTable testing and fixes, mostly around ocking nonexistent key while Upsert/RMW/Deleting that key * Add UnsafeContext and make it the default for FASTER.Benchmark * Updates from code review: - IsLocked returns shared lock count (added test) - Fix location of IsIntermediate checks in RecordInfo.Lock/Seal - Remove unused IEqualityComparer in LockTableEntry * Rename Take(Full|Index|HybridLog)Checkpoint to TryInitiate(Full|Index|HybridLog)Checkpoint, so it is obvious they need to complete it * - Remove SupportsPostOperations; this is now always done - Add SingleDeleter for symmetry with Upsert - Add DisposeKey and DisposeValue * Add CopyWriter, to distinguish "maintentance" copying (CopyToTail or copy to ReadCache) from API-parameter copies * merge fixes * Remove obsolete Functions-level locking and postOps specifications * Fix Remote build Co-authored-by: Badrish Chandramouli <badrishc@microsoft.com> * fix semantic merge conflict in MemoryPageScanIterator (#632) * [C#] Add WriteReason parameter to SingleWriter (#630) * Add Functions.PostCopyWriter; update MemOnlyCache to use Post(Single|Copy)Writer * Remove (Post)CopyWriter and replace with WriteReason parameter to (Post)SingleWriter * Move SingleWriter "reason" parameter * Move ReadFlags and WriteReason to their own files; rename SupportsLocking -> DisableLocking with default 'false' * Update Remote to disableLocking name and default change * [C#] Various Fixes (#635) * Fixes: - Fixed WriteReason when CTT overrides ReadCache - make DisableLocking a readonly member - Call SetTentativeAtomic after Post* - Make readcache and comparer private with internal accessors for test - FIx intermittent failure of BasicHighLatencyDeviceTest * back out changes to move from internal -> private for FKV.readcache and .comparer * [C#] Remove StrictCPR (#636) * Removed WAIT_PENDING * StrictCPR removal WIP * Fix bug in state machine test, as it was not using unsafe context for fine grained control over the state machine execution. * Remove PendingContext.HeldLatch and heldOperation local * Revise FASTER.Benchmark to replace --noaff with --safectx and integrate this into Ycsb and SpanbyteYcsb * check epoch protection for complete pending * *UnsafeContext: AnyInstanceProtected -> ThisInstanceProtected Co-authored-by: TedHartMS <15467143+TedHartMS@users.noreply.github.com> * [C#] Support int session ID for FasterKV (#641) * Support int session ID for FasterKV * fix remote solution, minor name updates * update FasterLog API for TryEnqueue of custom header * [C#] IEntry interface for FasterLog (#639) * enqueue with entries prototype * Add IEntry tests and method variants * Address code review comments * Rename + read entries * Add async versions of consumer * Make interfaces top-level * Correct header offset in FasterLog new API * [C#] Recover returns version we recovered to (#648) * add to FasterLog SpanByte API * fix breaking tests * Fix dispose loop * Update FasterServerBase.cs * do not remove ioPendingRequests in RMWAsync if there was no disk request (#653) * [C#] [WIP] Status return code v2 (#638) * Prototype of status as struct * improving status a bit * fix build break, expose underlying (raw) status code to user * misc * Update StatusCode * Update Remote to new Status(Code); fix test cases; fix StatusCode layout; fine-tune Status(Code) names; make StatusCode internal * Update StatusCode and Status to final spec * Update Remote to new Status spec * unrelated nit Co-authored-by: TedHartMS <15467143+TedHartMS@users.noreply.github.com> * [C#] Change IFunctions 'address' parameter to UpdateInfo or ReadInfo (#652) * Add UpdateInfo and ReadInfo to IFunctions calls * Update Remote IFunctions implementations to UpdateInfo/ReadInfo changes Co-authored-by: Badrish Chandramouli <badrishc@microsoft.com> * Wire status into remote v2 (#657) Add NotFound API for status * Status naming changes and UpdateInfo structure split for v2 preview (#658) * [C#] Add Status.Record (#659) * Add Status.Record; update OperationStatus with all Advanced Status codes * Update Remote for status.Pending => .IsPending * Update nuspecs * more updates * Update azure-pipelines.yml * Update azure-pipelines.yml * revert windows-2022 in yml * Rename StatusCode.OK to Found (#662) * nit * update SpanByte with API to get pointer including metadata * Fixing ranges in OnPagesReadyToClose * [C#] Websocket bug-fixes (#663) * Fixed nits in websockets: * Clean disconnection * Support correction for large packets * Small nit for correcting message length * changed status to new FASTER status codes * Modified status codes Co-authored-by: Rohan Kadekodi <kadekodirohan@gmail.com> * Revert THA * nits * Improving cache tracker * fix NET5_0 to NET5_0_OR_GREATER * [C#] Add CompletePending[WithOutputs] to IFasterContext (#664) * Move CompletePending(WithOutputs) into IFasterContext * Skip LockEvictionObserver entirely if no LUCs active * Make Decrement interlocked; inline one accessor; revert CMakeLists.txt * [C#] Upgrade blob tests to Azurite, enable blob tests on Linux, use windows-2022 for CI (#666) * install azurite * Change testcase to make sure commit completed before dispose, it is up to user to ensure no ongoing commits at time of dispose. * [C#] UnsealPhysicalAddress fix (#665) * Fix unsealPA going below HA; return SUCCESS instead of NOTFOUND from normal reads that find an obsolete record in ITCTT * Ensure InternalLock calls require epoch protection * WIP: Spin wait on Pending Reads/RMWs until ClosedUntilAddress catches up. Still needs to handle partial page evictions. * Ensure partial ClosedUntilAddress shifts occur correctly. * [C#] Cancellation, ReadOptions, ReadFlags refactor (#668) * Add DeleteRecord and CancelOperation to *Info structures and IFunctions * Added ReadOptions * Move IFunctions methods' "ref RecordInfo" parameter to an *Info property, as it does not need to be updated * Update ReadFlags * ReadFlags fixes * Change XxxInfo.DeleteRecord/.CancelAction to XxxAction enum * Fixing Expiration tests * Add Phase to ExpirationTests * Add ReadOnly region to expiration tests * Delete and Upsert search down to HeadAddress if active LUC * [C#] Misc v2 fixes (#675) Fix misc bugs in v2 * update spanbyte * Yield thread when unable to reserve epoch entry, move iteration count outside table loop. * remove exception from overloaded lightepoch * Fix benchmark to run on .net 6 and linux. * fix another place * [C#] Improvements to LightEpoch * Use AllocateArray in LightEpoch * LightEpoch: Use two hash functions + linear probe, cache last successful probe per thread. Adjust table size based on number of machine processors. * [C#] Use GC.AllocateArray (#683) * Use GC.AllocateArray where possible * update benchmark as well. * Update buffer pool to use GC.AllocateArray * fix debug assert * Make DisposeSession protected in FasterServerBase. * Added SetBytesRead to IServerSession * - update sample .csprojs to target net6 and remove platform-related conditionals from all .csprojs now that we've moved to VS 2022 (#687) - add Status.Expired - update FASTER.client's copies of Status(Code).cs - Replace a TODO with an explanatory comment * Slight refactor of network stack. * Use GC.AllocateArray in SeaaBuffer * Another GC.AllocateArray substitution * [C#] [WIP] Wire disposal into IFunctions v2 (#685) * Add hook for failed CAS during SingleWriter. Still need to support other failed CAS scenarios. * Implement Dispose() functions - (MemoryLogCompactionTests fails at this time) * Fix MemoryLogCompactionTests; move DisposeDeserializedFromDisk up to ICPRFC Co-authored-by: TedHartMS <15467143+TedHartMS@users.noreply.github.com> Co-authored-by: Ted Hart <15467143+TedHartMS@users.noreply.github.com> Co-authored-by: Tianyu Li <litianyu@mit.edu> Co-authored-by: Vasileios Zois <vazois@microsoft.com> Co-authored-by: Sebastian Burckhardt <sburckha@microsoft.com> Co-authored-by: rohankadekodi-msr <69916400+rohankadekodi-msr@users.noreply.github.com> Co-authored-by: Rohan Kadekodi <kadekodirohan@gmail.com>
2022-04-14 02:03:35 +03:00
{
DoPendingReadInsertTest(copyDest, initialReadCacheInsert: false);
}
[Test]
[Category("FasterKV")]
[Category("Smoke")]
public void CopyToTailWithInitialReadCache([Values(ReadCopyDestination.ReadCache)] ReadCopyDestination copyDest)
[C#] FASTER v2 release (#563) * various changes from indexing work (#562) * various changes from indexing work - Add BeginAddress and EndAddress to scan iterators - Allow null deltaFileDevice in HybridLogCheckpointInfo.Recover - Rename FoldOverSnapshot to useFoldOverCheckpoint - Make TakeHybridLogCheckpoint overload call through to overload to avoid duplication - Add default values to new scanDelta and recoverTo arguments - Add missing checkpointManager.OnRecovery call to IntenralRecoverAsync - Fix some comments * Fix shortened name in test to work on Linux * [C#] Record-expiration support in RMW (#545) * Add support for record-expiration management to RMW and I(Advanced)Functions * Update Remote to RMW changes for expiration support * moving remote to IAdvFun * LogDir semantics - minor update Co-authored-by: Badrish Chandramouli <badrishc@microsoft.com> * [C#] Added PostCopyUpdater to IAdvancedFunctions (#561) * Add support for record-expiration management to RMW and I(Advanced)Functions * Update Remote to RMW changes for expiration support * Added PCU * Fixing testcase so that RMW does not expect old address. * Fix PCU bugs * Extend PostCopyUpdate to IFunctions; fix a few comments in remote Co-authored-by: TedHartMS <15467143+TedHartMS@users.noreply.github.com> * [C#] Merge IAdvancedFunctions into IFunctions (#565) * Merge IAdvancedFunctions into IFunctions * Add SupportsPostOperations and Post(IU|CU|SD); expand "ref RecordInfo recordInfo, long address" on Functions * Add RecordMetadata to RMWCompletionCallback params; improve ReadAddressTests * Add tests of Upsert with Input * [C#] RecordInfo v2 (#577) * RecordInfo v2 * fix version jump in CPR. * Updated misc stuff * misc updates to SpanByte * Remove IntExclLocker * Add Try APIs to record locking * Remove FASTERLegacy (#581) * Add Output parameter to Upsert (#574) * Add overloads of Upsert that take "ref Output" and one that takes "out RecordMetadata"; Fix RMW setting pendingContext.RecordInfo/LA; add locking of PostCopyUpdater, PostInitalUpdater, PostSingleWriter; * Reorganize ClientSession IntenralFasterSession to group functions for a given area (Read, Upsert, RMW, etc.) together * Fix locking on Post* calls * Fixes for Post* locking * remove net461 and netcoreapp2.1; add net6.0 in <Choose> to work on later in VS2022 * Update to new RecordInfo locking calls * Update to new IFunctions Locking signatures and RecordInfo implementation * Add post operations to Faster.benchmark * [C#] Checkpoint, Recovery, RecordInfo updates (#588) * Removed WAIT_PENDING * * Use only 1 bit for newVersion in RecordInfo, for CPR. Semantics are that sessions in v+1 will create records in fuzzy region with this bit set. Recovery only scans fuzzy region to elide such records. * Add 1 Filler bit for future use with fillers in records * Increase read lock bits to 6 (64 parallel readers) * Use dirty bit for incremental checkpoints * fix ycsb to not delete data file if we are using --recover * Fix epoch re-entry violation * Move to long versions, for KV checkpoints. * Shuffle around stuff for better cache alignment in benchmark. * Updates based on review * [C#] FasterLog Commit Optimization (v2) (#587) * Checkpoint work * Add notion of manual commit * Recovery of commit cookie * alternative design of log-cookie * Implementation improvement * code review comments * Cleanup + testing * Add management utility for LogCommitManager * Handle race on manual commit code path where not the latest tail is written out * Add condition to only scan log in fastCommitMode * Rough draft to allow for 1. elided commit record when fastCommit turned off and 2. "loose" commits * checkpoint changes * fix bug with readonly log allocator initialization * disable fast commit temporarily for CI * fix MLSD and mem device fast commit behavior * fix AzureStorageDevice exception type and remove self-termination on failure * test case on concurrent inserts * Re-enable epoch protection on CommitInternal * Ensure that full flush list error callbacks do not break FlushedUntilAddress tracking * Fix unclean shutdown of stress test * update device log test to scan until tail instead * change error code used for full flush list to better distinguish from others * Minor updates. Co-authored-by: Badrish Chandramouli <badrishc@microsoft.com> * Remove legacy local log commit manager * [C#] FasterLog v2 - misc changes, removed OverWrite commits (#593) * Checkin misc changes, removed overWrite commits * simplify OnRecovery logic * Fix build after merge * fix alignment of device commit manager * [C#] v2 pending flush list (#596) * Make PendingFlushList never error out in stressful situations. Current implementation uses lock for ~5-10% perf degradation over prior structure. * [C#] FasterLog v2: Fix FasterLog missed final commit (#597) * Fix FasterLog missed final commit. * [C#] Log compaction v2 (#598) * initial checkin * New ShiftBeginAddress behavior -- only shifts BeginAddress variable and does not truncate physical log unless option is specified. Also added Log.Truncate API for physical log truncation. Truncate log until persisted BeginAddress after taking a checkpoint. * Fix epoch protection orderings. * minor improvement to TestUtils to avoid race exception. * update Program.cs * updates from master. * [C#] V2 Custom Commit Strategy (#599) * Add FasterLogCommitStrategy * Use Bakery algorithm for latch * Documentation + tests + improved threading performance * Fix initialization error * Revert to v2 synchronization scheme * Optimization around commit strategies * Refactor CommitPolicy only for normal commits * fix missing spin wait * [C#] Fix v2 CommitPolicy Warnings (#607) * fix warnings * fix broken test * update for code consistency * Merged PR 59053: Network Stack Refactoring into FASTER This pull request contains the necessary changes for the updated network stack interface used by FASTER. It adds INetworkSender.cs and NetworkSenderBase.cs that can be used to implement custom communication protocols. Currently only TcpNetworkSender is supported. * Create .dockerignore * Added TentativeHeadAddress - we first shift this, and when all threads agree, we can do some pre-closing work such as eviction. Then we can shift the actual HeadAddress, closing pages when all threads agree on this. (#608) * Cleanup and remove dead code + reuse base provider. * Code cleanup * [C#] minor cleanup of fasterlog v2 (#611) * minor cleanup of fasterlog * [C#] Remove CheckpointType from CheckpointSettings (v2) (#614) * Remove CheckpointType from CheckpointSettings. Users have to specify checkpoint type on a per checkpoint basis. * fix build break * Fix CTT to call PostSingleWriter. * Avoid double init of FasterLog * [C#] Fixing warnings (#615) * Fixing CI warnings * [C#] Updating dependent package versions in v2 (#616) * Updating dependent package versions * nit * [C#] Improved FasterKV and FasterLog settings API for v2 (#618) * Simpler config API for v2. Move FasterLog to its own folder. * Remove purgeEarlierCommits from reader. Instead: 1. writer retries file deletes (in device commit manager) if access denied, in a loop, until timeout 2. reader (user code) retries recover async if it fails due to file deleted, until timeout * [C#] FasterLog V2 Device error handling (#612) * prototype device * prototype failure handling * Add proposed error handling code * Basic error handling tasks * Fault tolerant devices * Change to failure handler based approach instead of just throwing an exception * Remove brittle error handling code * make sure to read pages from flaky device on recovery in test * fix warnings * code review comments * See if we can enforce clean shutdown * Add extensions to enqueue SpanByte to FasterLog, and unsafely iterate without memory copy. (#621) * [C#] FasterLog v2 Add ability to explicitly terminate a log (#620) * Add ability to explicitly terminate a log * remove special 0-length return on eof * Add LogCompleted in iterator * Change comment and test * fix async iteration logic * fixes Co-authored-by: Badrish Chandramouli <badrishc@microsoft.com> * Maybe fix SVS issue with atomic reads (#622) * [C#] FasterLog v2 iteration fix (#623) * First pass of fixes * undo local change * [C#] Updated docs for FasterLog v2 (#624) * some updates * Add missing documentation * Update 40-fasterlog-basics.md Co-authored-by: Badrish Chandramouli <badrish@gmail.com> * Fix logic for directory delete timeouts. * Speed up testcases * [C#] Lockable Unsafe Context (LUC) in FasterKV v2 (WIP) (#605) * WIP on ManualFasterOperations * fixes for v2 merge * Updates to locking (still in progress) - Remove User-defined locks - Move SupportsLocking up to FasterKV level - Skip Stub and Sealed in iterators - Change PendingContext.OperationFlags from byte to ushort - Add ReadFlags.SkipCopyToTail - Add IsLocked*, TranferLocks methods to RecordInfo - Add UnsafeCompletePending* to ManualOps - Track lock counts in ManualOps and throw if Dispose() is called with locks or epoch held - Add LockInfo for ManualOps.*Lock - Implementation and testing of Faster operations with ManualOps locks - Fix ReadAddressTests to reflect improved consistency of not returning readcache addresses * Locking docs * Update 30-fasterkv-manual-locking.md * Updated doc to GH review and discussions * WIP for LockableRawContext * Existing tests run * Rename to LockableRawContext, IFasterContext * Perf workaround for LockTable.IsActive * WIP on ReadCacheEvict and MemoryPageLockEvictionScan * Add ReadCache and LockTable-transfer tests; move ReadCache tests out to their own sub-hierarchy * Test MemoryPageLockEvictionScan * Add testing for two-phase upsert/copytotail * Remove manual locking bits in Recovery; minor refactorings in Recovery.cs to reduce duplication * Add manual locking to FASTER.benchmark * More LockTable testing and fixes, mostly around ocking nonexistent key while Upsert/RMW/Deleting that key * Add UnsafeContext and make it the default for FASTER.Benchmark * Updates from code review: - IsLocked returns shared lock count (added test) - Fix location of IsIntermediate checks in RecordInfo.Lock/Seal - Remove unused IEqualityComparer in LockTableEntry * Rename Take(Full|Index|HybridLog)Checkpoint to TryInitiate(Full|Index|HybridLog)Checkpoint, so it is obvious they need to complete it * - Remove SupportsPostOperations; this is now always done - Add SingleDeleter for symmetry with Upsert - Add DisposeKey and DisposeValue * Add CopyWriter, to distinguish "maintentance" copying (CopyToTail or copy to ReadCache) from API-parameter copies * merge fixes * Remove obsolete Functions-level locking and postOps specifications * Fix Remote build Co-authored-by: Badrish Chandramouli <badrishc@microsoft.com> * fix semantic merge conflict in MemoryPageScanIterator (#632) * [C#] Add WriteReason parameter to SingleWriter (#630) * Add Functions.PostCopyWriter; update MemOnlyCache to use Post(Single|Copy)Writer * Remove (Post)CopyWriter and replace with WriteReason parameter to (Post)SingleWriter * Move SingleWriter "reason" parameter * Move ReadFlags and WriteReason to their own files; rename SupportsLocking -> DisableLocking with default 'false' * Update Remote to disableLocking name and default change * [C#] Various Fixes (#635) * Fixes: - Fixed WriteReason when CTT overrides ReadCache - make DisableLocking a readonly member - Call SetTentativeAtomic after Post* - Make readcache and comparer private with internal accessors for test - FIx intermittent failure of BasicHighLatencyDeviceTest * back out changes to move from internal -> private for FKV.readcache and .comparer * [C#] Remove StrictCPR (#636) * Removed WAIT_PENDING * StrictCPR removal WIP * Fix bug in state machine test, as it was not using unsafe context for fine grained control over the state machine execution. * Remove PendingContext.HeldLatch and heldOperation local * Revise FASTER.Benchmark to replace --noaff with --safectx and integrate this into Ycsb and SpanbyteYcsb * check epoch protection for complete pending * *UnsafeContext: AnyInstanceProtected -> ThisInstanceProtected Co-authored-by: TedHartMS <15467143+TedHartMS@users.noreply.github.com> * [C#] Support int session ID for FasterKV (#641) * Support int session ID for FasterKV * fix remote solution, minor name updates * update FasterLog API for TryEnqueue of custom header * [C#] IEntry interface for FasterLog (#639) * enqueue with entries prototype * Add IEntry tests and method variants * Address code review comments * Rename + read entries * Add async versions of consumer * Make interfaces top-level * Correct header offset in FasterLog new API * [C#] Recover returns version we recovered to (#648) * add to FasterLog SpanByte API * fix breaking tests * Fix dispose loop * Update FasterServerBase.cs * do not remove ioPendingRequests in RMWAsync if there was no disk request (#653) * [C#] [WIP] Status return code v2 (#638) * Prototype of status as struct * improving status a bit * fix build break, expose underlying (raw) status code to user * misc * Update StatusCode * Update Remote to new Status(Code); fix test cases; fix StatusCode layout; fine-tune Status(Code) names; make StatusCode internal * Update StatusCode and Status to final spec * Update Remote to new Status spec * unrelated nit Co-authored-by: TedHartMS <15467143+TedHartMS@users.noreply.github.com> * [C#] Change IFunctions 'address' parameter to UpdateInfo or ReadInfo (#652) * Add UpdateInfo and ReadInfo to IFunctions calls * Update Remote IFunctions implementations to UpdateInfo/ReadInfo changes Co-authored-by: Badrish Chandramouli <badrishc@microsoft.com> * Wire status into remote v2 (#657) Add NotFound API for status * Status naming changes and UpdateInfo structure split for v2 preview (#658) * [C#] Add Status.Record (#659) * Add Status.Record; update OperationStatus with all Advanced Status codes * Update Remote for status.Pending => .IsPending * Update nuspecs * more updates * Update azure-pipelines.yml * Update azure-pipelines.yml * revert windows-2022 in yml * Rename StatusCode.OK to Found (#662) * nit * update SpanByte with API to get pointer including metadata * Fixing ranges in OnPagesReadyToClose * [C#] Websocket bug-fixes (#663) * Fixed nits in websockets: * Clean disconnection * Support correction for large packets * Small nit for correcting message length * changed status to new FASTER status codes * Modified status codes Co-authored-by: Rohan Kadekodi <kadekodirohan@gmail.com> * Revert THA * nits * Improving cache tracker * fix NET5_0 to NET5_0_OR_GREATER * [C#] Add CompletePending[WithOutputs] to IFasterContext (#664) * Move CompletePending(WithOutputs) into IFasterContext * Skip LockEvictionObserver entirely if no LUCs active * Make Decrement interlocked; inline one accessor; revert CMakeLists.txt * [C#] Upgrade blob tests to Azurite, enable blob tests on Linux, use windows-2022 for CI (#666) * install azurite * Change testcase to make sure commit completed before dispose, it is up to user to ensure no ongoing commits at time of dispose. * [C#] UnsealPhysicalAddress fix (#665) * Fix unsealPA going below HA; return SUCCESS instead of NOTFOUND from normal reads that find an obsolete record in ITCTT * Ensure InternalLock calls require epoch protection * WIP: Spin wait on Pending Reads/RMWs until ClosedUntilAddress catches up. Still needs to handle partial page evictions. * Ensure partial ClosedUntilAddress shifts occur correctly. * [C#] Cancellation, ReadOptions, ReadFlags refactor (#668) * Add DeleteRecord and CancelOperation to *Info structures and IFunctions * Added ReadOptions * Move IFunctions methods' "ref RecordInfo" parameter to an *Info property, as it does not need to be updated * Update ReadFlags * ReadFlags fixes * Change XxxInfo.DeleteRecord/.CancelAction to XxxAction enum * Fixing Expiration tests * Add Phase to ExpirationTests * Add ReadOnly region to expiration tests * Delete and Upsert search down to HeadAddress if active LUC * [C#] Misc v2 fixes (#675) Fix misc bugs in v2 * update spanbyte * Yield thread when unable to reserve epoch entry, move iteration count outside table loop. * remove exception from overloaded lightepoch * Fix benchmark to run on .net 6 and linux. * fix another place * [C#] Improvements to LightEpoch * Use AllocateArray in LightEpoch * LightEpoch: Use two hash functions + linear probe, cache last successful probe per thread. Adjust table size based on number of machine processors. * [C#] Use GC.AllocateArray (#683) * Use GC.AllocateArray where possible * update benchmark as well. * Update buffer pool to use GC.AllocateArray * fix debug assert * Make DisposeSession protected in FasterServerBase. * Added SetBytesRead to IServerSession * - update sample .csprojs to target net6 and remove platform-related conditionals from all .csprojs now that we've moved to VS 2022 (#687) - add Status.Expired - update FASTER.client's copies of Status(Code).cs - Replace a TODO with an explanatory comment * Slight refactor of network stack. * Use GC.AllocateArray in SeaaBuffer * Another GC.AllocateArray substitution * [C#] [WIP] Wire disposal into IFunctions v2 (#685) * Add hook for failed CAS during SingleWriter. Still need to support other failed CAS scenarios. * Implement Dispose() functions - (MemoryLogCompactionTests fails at this time) * Fix MemoryLogCompactionTests; move DisposeDeserializedFromDisk up to ICPRFC Co-authored-by: TedHartMS <15467143+TedHartMS@users.noreply.github.com> Co-authored-by: Ted Hart <15467143+TedHartMS@users.noreply.github.com> Co-authored-by: Tianyu Li <litianyu@mit.edu> Co-authored-by: Vasileios Zois <vazois@microsoft.com> Co-authored-by: Sebastian Burckhardt <sburckha@microsoft.com> Co-authored-by: rohankadekodi-msr <69916400+rohankadekodi-msr@users.noreply.github.com> Co-authored-by: Rohan Kadekodi <kadekodirohan@gmail.com>
2022-04-14 02:03:35 +03:00
{
// We use the ReadCopyDestination.ReadCache parameter so Setup() knows to set up the readcache, but
// for the actual test it is used only for setup; we execute CopyToTail.
DoPendingReadInsertTest(ReadCopyDestination.Tail, initialReadCacheInsert: true);
}
void DoPendingReadInsertTest(ReadCopyDestination copyDest, bool initialReadCacheInsert)
{
MyKey key = new() { key = TestKey };
MyKey collidingKey2 = new() { key = TestCollidingKey2 };
MyValue collidingValue2 = new() { value = TestCollidingValue2 };
using var session = fht.NewSession(new DisposeFunctionsNoSync());
// Do initial insert(s) to set things up
{
MyValue value = new() { value = TestInitialValue };
session.Upsert(ref key, ref value);
if (initialReadCacheInsert)
session.Upsert(ref collidingKey2, ref collidingValue2);
}
// FlushAndEvict so we go pending
DoFlush(FlushMode.OnDisk);
MyOutput output = new();
MyInput input = new();
if (initialReadCacheInsert)
{
Assert.IsTrue(session.Read(ref collidingKey2, ref output).IsPending);
session.CompletePending(wait: true);
}
ReadOptions readOptions = default;
if (copyDest == ReadCopyDestination.Tail)
readOptions.ReadFlags = ReadFlags.CopyReadsToTail;
var status = session.Read(ref key, ref input, ref output, ref readOptions, out _);
Assert.IsTrue(status.IsPending, status.ToString());
session.CompletePendingWithOutputs(out var completedOutputs, wait: true);
(status, output) = GetSinglePendingResult(completedOutputs);
Assert.AreEqual(TestInitialValue, output.value.value);
}
[Test]
[Category("FasterKV")]
[Category("Smoke")]
public void DisposePendingRead2Threads([Values] ReadCopyDestination copyDest)
{
DoDisposePendingReadInsertTest2Threads(copyDest, initialReadCacheInsert: false);
}
[Test]
[Category("FasterKV")]
[Category("Smoke")]
public void DisposeCopyToTailWithInitialReadCache2Threads([Values(ReadCopyDestination.ReadCache)] ReadCopyDestination copyDest)
{
// We use the ReadCopyDestination.ReadCache parameter so Setup() knows to set up the readcache, but
// for the actual test it is used only for setup; we execute CopyToTail.
DoDisposePendingReadInsertTest2Threads(ReadCopyDestination.Tail, initialReadCacheInsert: true);
}
void DoDisposePendingReadInsertTest2Threads(ReadCopyDestination copyDest, bool initialReadCacheInsert)
[C#] FASTER v2 release (#563) * various changes from indexing work (#562) * various changes from indexing work - Add BeginAddress and EndAddress to scan iterators - Allow null deltaFileDevice in HybridLogCheckpointInfo.Recover - Rename FoldOverSnapshot to useFoldOverCheckpoint - Make TakeHybridLogCheckpoint overload call through to overload to avoid duplication - Add default values to new scanDelta and recoverTo arguments - Add missing checkpointManager.OnRecovery call to IntenralRecoverAsync - Fix some comments * Fix shortened name in test to work on Linux * [C#] Record-expiration support in RMW (#545) * Add support for record-expiration management to RMW and I(Advanced)Functions * Update Remote to RMW changes for expiration support * moving remote to IAdvFun * LogDir semantics - minor update Co-authored-by: Badrish Chandramouli <badrishc@microsoft.com> * [C#] Added PostCopyUpdater to IAdvancedFunctions (#561) * Add support for record-expiration management to RMW and I(Advanced)Functions * Update Remote to RMW changes for expiration support * Added PCU * Fixing testcase so that RMW does not expect old address. * Fix PCU bugs * Extend PostCopyUpdate to IFunctions; fix a few comments in remote Co-authored-by: TedHartMS <15467143+TedHartMS@users.noreply.github.com> * [C#] Merge IAdvancedFunctions into IFunctions (#565) * Merge IAdvancedFunctions into IFunctions * Add SupportsPostOperations and Post(IU|CU|SD); expand "ref RecordInfo recordInfo, long address" on Functions * Add RecordMetadata to RMWCompletionCallback params; improve ReadAddressTests * Add tests of Upsert with Input * [C#] RecordInfo v2 (#577) * RecordInfo v2 * fix version jump in CPR. * Updated misc stuff * misc updates to SpanByte * Remove IntExclLocker * Add Try APIs to record locking * Remove FASTERLegacy (#581) * Add Output parameter to Upsert (#574) * Add overloads of Upsert that take "ref Output" and one that takes "out RecordMetadata"; Fix RMW setting pendingContext.RecordInfo/LA; add locking of PostCopyUpdater, PostInitalUpdater, PostSingleWriter; * Reorganize ClientSession IntenralFasterSession to group functions for a given area (Read, Upsert, RMW, etc.) together * Fix locking on Post* calls * Fixes for Post* locking * remove net461 and netcoreapp2.1; add net6.0 in <Choose> to work on later in VS2022 * Update to new RecordInfo locking calls * Update to new IFunctions Locking signatures and RecordInfo implementation * Add post operations to Faster.benchmark * [C#] Checkpoint, Recovery, RecordInfo updates (#588) * Removed WAIT_PENDING * * Use only 1 bit for newVersion in RecordInfo, for CPR. Semantics are that sessions in v+1 will create records in fuzzy region with this bit set. Recovery only scans fuzzy region to elide such records. * Add 1 Filler bit for future use with fillers in records * Increase read lock bits to 6 (64 parallel readers) * Use dirty bit for incremental checkpoints * fix ycsb to not delete data file if we are using --recover * Fix epoch re-entry violation * Move to long versions, for KV checkpoints. * Shuffle around stuff for better cache alignment in benchmark. * Updates based on review * [C#] FasterLog Commit Optimization (v2) (#587) * Checkpoint work * Add notion of manual commit * Recovery of commit cookie * alternative design of log-cookie * Implementation improvement * code review comments * Cleanup + testing * Add management utility for LogCommitManager * Handle race on manual commit code path where not the latest tail is written out * Add condition to only scan log in fastCommitMode * Rough draft to allow for 1. elided commit record when fastCommit turned off and 2. "loose" commits * checkpoint changes * fix bug with readonly log allocator initialization * disable fast commit temporarily for CI * fix MLSD and mem device fast commit behavior * fix AzureStorageDevice exception type and remove self-termination on failure * test case on concurrent inserts * Re-enable epoch protection on CommitInternal * Ensure that full flush list error callbacks do not break FlushedUntilAddress tracking * Fix unclean shutdown of stress test * update device log test to scan until tail instead * change error code used for full flush list to better distinguish from others * Minor updates. Co-authored-by: Badrish Chandramouli <badrishc@microsoft.com> * Remove legacy local log commit manager * [C#] FasterLog v2 - misc changes, removed OverWrite commits (#593) * Checkin misc changes, removed overWrite commits * simplify OnRecovery logic * Fix build after merge * fix alignment of device commit manager * [C#] v2 pending flush list (#596) * Make PendingFlushList never error out in stressful situations. Current implementation uses lock for ~5-10% perf degradation over prior structure. * [C#] FasterLog v2: Fix FasterLog missed final commit (#597) * Fix FasterLog missed final commit. * [C#] Log compaction v2 (#598) * initial checkin * New ShiftBeginAddress behavior -- only shifts BeginAddress variable and does not truncate physical log unless option is specified. Also added Log.Truncate API for physical log truncation. Truncate log until persisted BeginAddress after taking a checkpoint. * Fix epoch protection orderings. * minor improvement to TestUtils to avoid race exception. * update Program.cs * updates from master. * [C#] V2 Custom Commit Strategy (#599) * Add FasterLogCommitStrategy * Use Bakery algorithm for latch * Documentation + tests + improved threading performance * Fix initialization error * Revert to v2 synchronization scheme * Optimization around commit strategies * Refactor CommitPolicy only for normal commits * fix missing spin wait * [C#] Fix v2 CommitPolicy Warnings (#607) * fix warnings * fix broken test * update for code consistency * Merged PR 59053: Network Stack Refactoring into FASTER This pull request contains the necessary changes for the updated network stack interface used by FASTER. It adds INetworkSender.cs and NetworkSenderBase.cs that can be used to implement custom communication protocols. Currently only TcpNetworkSender is supported. * Create .dockerignore * Added TentativeHeadAddress - we first shift this, and when all threads agree, we can do some pre-closing work such as eviction. Then we can shift the actual HeadAddress, closing pages when all threads agree on this. (#608) * Cleanup and remove dead code + reuse base provider. * Code cleanup * [C#] minor cleanup of fasterlog v2 (#611) * minor cleanup of fasterlog * [C#] Remove CheckpointType from CheckpointSettings (v2) (#614) * Remove CheckpointType from CheckpointSettings. Users have to specify checkpoint type on a per checkpoint basis. * fix build break * Fix CTT to call PostSingleWriter. * Avoid double init of FasterLog * [C#] Fixing warnings (#615) * Fixing CI warnings * [C#] Updating dependent package versions in v2 (#616) * Updating dependent package versions * nit * [C#] Improved FasterKV and FasterLog settings API for v2 (#618) * Simpler config API for v2. Move FasterLog to its own folder. * Remove purgeEarlierCommits from reader. Instead: 1. writer retries file deletes (in device commit manager) if access denied, in a loop, until timeout 2. reader (user code) retries recover async if it fails due to file deleted, until timeout * [C#] FasterLog V2 Device error handling (#612) * prototype device * prototype failure handling * Add proposed error handling code * Basic error handling tasks * Fault tolerant devices * Change to failure handler based approach instead of just throwing an exception * Remove brittle error handling code * make sure to read pages from flaky device on recovery in test * fix warnings * code review comments * See if we can enforce clean shutdown * Add extensions to enqueue SpanByte to FasterLog, and unsafely iterate without memory copy. (#621) * [C#] FasterLog v2 Add ability to explicitly terminate a log (#620) * Add ability to explicitly terminate a log * remove special 0-length return on eof * Add LogCompleted in iterator * Change comment and test * fix async iteration logic * fixes Co-authored-by: Badrish Chandramouli <badrishc@microsoft.com> * Maybe fix SVS issue with atomic reads (#622) * [C#] FasterLog v2 iteration fix (#623) * First pass of fixes * undo local change * [C#] Updated docs for FasterLog v2 (#624) * some updates * Add missing documentation * Update 40-fasterlog-basics.md Co-authored-by: Badrish Chandramouli <badrish@gmail.com> * Fix logic for directory delete timeouts. * Speed up testcases * [C#] Lockable Unsafe Context (LUC) in FasterKV v2 (WIP) (#605) * WIP on ManualFasterOperations * fixes for v2 merge * Updates to locking (still in progress) - Remove User-defined locks - Move SupportsLocking up to FasterKV level - Skip Stub and Sealed in iterators - Change PendingContext.OperationFlags from byte to ushort - Add ReadFlags.SkipCopyToTail - Add IsLocked*, TranferLocks methods to RecordInfo - Add UnsafeCompletePending* to ManualOps - Track lock counts in ManualOps and throw if Dispose() is called with locks or epoch held - Add LockInfo for ManualOps.*Lock - Implementation and testing of Faster operations with ManualOps locks - Fix ReadAddressTests to reflect improved consistency of not returning readcache addresses * Locking docs * Update 30-fasterkv-manual-locking.md * Updated doc to GH review and discussions * WIP for LockableRawContext * Existing tests run * Rename to LockableRawContext, IFasterContext * Perf workaround for LockTable.IsActive * WIP on ReadCacheEvict and MemoryPageLockEvictionScan * Add ReadCache and LockTable-transfer tests; move ReadCache tests out to their own sub-hierarchy * Test MemoryPageLockEvictionScan * Add testing for two-phase upsert/copytotail * Remove manual locking bits in Recovery; minor refactorings in Recovery.cs to reduce duplication * Add manual locking to FASTER.benchmark * More LockTable testing and fixes, mostly around ocking nonexistent key while Upsert/RMW/Deleting that key * Add UnsafeContext and make it the default for FASTER.Benchmark * Updates from code review: - IsLocked returns shared lock count (added test) - Fix location of IsIntermediate checks in RecordInfo.Lock/Seal - Remove unused IEqualityComparer in LockTableEntry * Rename Take(Full|Index|HybridLog)Checkpoint to TryInitiate(Full|Index|HybridLog)Checkpoint, so it is obvious they need to complete it * - Remove SupportsPostOperations; this is now always done - Add SingleDeleter for symmetry with Upsert - Add DisposeKey and DisposeValue * Add CopyWriter, to distinguish "maintentance" copying (CopyToTail or copy to ReadCache) from API-parameter copies * merge fixes * Remove obsolete Functions-level locking and postOps specifications * Fix Remote build Co-authored-by: Badrish Chandramouli <badrishc@microsoft.com> * fix semantic merge conflict in MemoryPageScanIterator (#632) * [C#] Add WriteReason parameter to SingleWriter (#630) * Add Functions.PostCopyWriter; update MemOnlyCache to use Post(Single|Copy)Writer * Remove (Post)CopyWriter and replace with WriteReason parameter to (Post)SingleWriter * Move SingleWriter "reason" parameter * Move ReadFlags and WriteReason to their own files; rename SupportsLocking -> DisableLocking with default 'false' * Update Remote to disableLocking name and default change * [C#] Various Fixes (#635) * Fixes: - Fixed WriteReason when CTT overrides ReadCache - make DisableLocking a readonly member - Call SetTentativeAtomic after Post* - Make readcache and comparer private with internal accessors for test - FIx intermittent failure of BasicHighLatencyDeviceTest * back out changes to move from internal -> private for FKV.readcache and .comparer * [C#] Remove StrictCPR (#636) * Removed WAIT_PENDING * StrictCPR removal WIP * Fix bug in state machine test, as it was not using unsafe context for fine grained control over the state machine execution. * Remove PendingContext.HeldLatch and heldOperation local * Revise FASTER.Benchmark to replace --noaff with --safectx and integrate this into Ycsb and SpanbyteYcsb * check epoch protection for complete pending * *UnsafeContext: AnyInstanceProtected -> ThisInstanceProtected Co-authored-by: TedHartMS <15467143+TedHartMS@users.noreply.github.com> * [C#] Support int session ID for FasterKV (#641) * Support int session ID for FasterKV * fix remote solution, minor name updates * update FasterLog API for TryEnqueue of custom header * [C#] IEntry interface for FasterLog (#639) * enqueue with entries prototype * Add IEntry tests and method variants * Address code review comments * Rename + read entries * Add async versions of consumer * Make interfaces top-level * Correct header offset in FasterLog new API * [C#] Recover returns version we recovered to (#648) * add to FasterLog SpanByte API * fix breaking tests * Fix dispose loop * Update FasterServerBase.cs * do not remove ioPendingRequests in RMWAsync if there was no disk request (#653) * [C#] [WIP] Status return code v2 (#638) * Prototype of status as struct * improving status a bit * fix build break, expose underlying (raw) status code to user * misc * Update StatusCode * Update Remote to new Status(Code); fix test cases; fix StatusCode layout; fine-tune Status(Code) names; make StatusCode internal * Update StatusCode and Status to final spec * Update Remote to new Status spec * unrelated nit Co-authored-by: TedHartMS <15467143+TedHartMS@users.noreply.github.com> * [C#] Change IFunctions 'address' parameter to UpdateInfo or ReadInfo (#652) * Add UpdateInfo and ReadInfo to IFunctions calls * Update Remote IFunctions implementations to UpdateInfo/ReadInfo changes Co-authored-by: Badrish Chandramouli <badrishc@microsoft.com> * Wire status into remote v2 (#657) Add NotFound API for status * Status naming changes and UpdateInfo structure split for v2 preview (#658) * [C#] Add Status.Record (#659) * Add Status.Record; update OperationStatus with all Advanced Status codes * Update Remote for status.Pending => .IsPending * Update nuspecs * more updates * Update azure-pipelines.yml * Update azure-pipelines.yml * revert windows-2022 in yml * Rename StatusCode.OK to Found (#662) * nit * update SpanByte with API to get pointer including metadata * Fixing ranges in OnPagesReadyToClose * [C#] Websocket bug-fixes (#663) * Fixed nits in websockets: * Clean disconnection * Support correction for large packets * Small nit for correcting message length * changed status to new FASTER status codes * Modified status codes Co-authored-by: Rohan Kadekodi <kadekodirohan@gmail.com> * Revert THA * nits * Improving cache tracker * fix NET5_0 to NET5_0_OR_GREATER * [C#] Add CompletePending[WithOutputs] to IFasterContext (#664) * Move CompletePending(WithOutputs) into IFasterContext * Skip LockEvictionObserver entirely if no LUCs active * Make Decrement interlocked; inline one accessor; revert CMakeLists.txt * [C#] Upgrade blob tests to Azurite, enable blob tests on Linux, use windows-2022 for CI (#666) * install azurite * Change testcase to make sure commit completed before dispose, it is up to user to ensure no ongoing commits at time of dispose. * [C#] UnsealPhysicalAddress fix (#665) * Fix unsealPA going below HA; return SUCCESS instead of NOTFOUND from normal reads that find an obsolete record in ITCTT * Ensure InternalLock calls require epoch protection * WIP: Spin wait on Pending Reads/RMWs until ClosedUntilAddress catches up. Still needs to handle partial page evictions. * Ensure partial ClosedUntilAddress shifts occur correctly. * [C#] Cancellation, ReadOptions, ReadFlags refactor (#668) * Add DeleteRecord and CancelOperation to *Info structures and IFunctions * Added ReadOptions * Move IFunctions methods' "ref RecordInfo" parameter to an *Info property, as it does not need to be updated * Update ReadFlags * ReadFlags fixes * Change XxxInfo.DeleteRecord/.CancelAction to XxxAction enum * Fixing Expiration tests * Add Phase to ExpirationTests * Add ReadOnly region to expiration tests * Delete and Upsert search down to HeadAddress if active LUC * [C#] Misc v2 fixes (#675) Fix misc bugs in v2 * update spanbyte * Yield thread when unable to reserve epoch entry, move iteration count outside table loop. * remove exception from overloaded lightepoch * Fix benchmark to run on .net 6 and linux. * fix another place * [C#] Improvements to LightEpoch * Use AllocateArray in LightEpoch * LightEpoch: Use two hash functions + linear probe, cache last successful probe per thread. Adjust table size based on number of machine processors. * [C#] Use GC.AllocateArray (#683) * Use GC.AllocateArray where possible * update benchmark as well. * Update buffer pool to use GC.AllocateArray * fix debug assert * Make DisposeSession protected in FasterServerBase. * Added SetBytesRead to IServerSession * - update sample .csprojs to target net6 and remove platform-related conditionals from all .csprojs now that we've moved to VS 2022 (#687) - add Status.Expired - update FASTER.client's copies of Status(Code).cs - Replace a TODO with an explanatory comment * Slight refactor of network stack. * Use GC.AllocateArray in SeaaBuffer * Another GC.AllocateArray substitution * [C#] [WIP] Wire disposal into IFunctions v2 (#685) * Add hook for failed CAS during SingleWriter. Still need to support other failed CAS scenarios. * Implement Dispose() functions - (MemoryLogCompactionTests fails at this time) * Fix MemoryLogCompactionTests; move DisposeDeserializedFromDisk up to ICPRFC Co-authored-by: TedHartMS <15467143+TedHartMS@users.noreply.github.com> Co-authored-by: Ted Hart <15467143+TedHartMS@users.noreply.github.com> Co-authored-by: Tianyu Li <litianyu@mit.edu> Co-authored-by: Vasileios Zois <vazois@microsoft.com> Co-authored-by: Sebastian Burckhardt <sburckha@microsoft.com> Co-authored-by: rohankadekodi-msr <69916400+rohankadekodi-msr@users.noreply.github.com> Co-authored-by: Rohan Kadekodi <kadekodirohan@gmail.com>
2022-04-14 02:03:35 +03:00
{
var functions1 = new DisposeFunctions(this, sut: true, splice: initialReadCacheInsert);
var functions2 = new DisposeFunctions(this, sut: false);
MyKey key = new() { key = TestKey };
MyKey collidingKey2 = new() { key = TestCollidingKey2 };
MyValue collidingValue2 = new() { value = TestCollidingValue2 };
// Do initial insert(s) to set things up
{
using var session = fht.NewSession(new DisposeFunctionsNoSync());
MyValue value = new() { value = TestInitialValue };
session.Upsert(ref key, ref value);
if (initialReadCacheInsert)
session.Upsert(ref collidingKey2, ref collidingValue2);
}
// FlushAndEvict so we go pending
DoFlush(FlushMode.OnDisk);
if (initialReadCacheInsert)
{
using var session = fht.NewSession(new DisposeFunctionsNoSync());
MyOutput output = new();
var status = session.Read(ref collidingKey2, ref output);
session.CompletePending(wait: true);
}
void DoRead(DisposeFunctions functions)
{
using var session = fht.NewSession(functions);
if (functions.isSUT)
{
MyOutput output = new();
MyInput input = new();
ReadOptions readOptions = default;
if (copyDest == ReadCopyDestination.Tail)
readOptions.ReadFlags = ReadFlags.CopyReadsToTail;
var status = session.Read(ref key, ref input, ref output, ref readOptions, out _);
Assert.IsTrue(status.IsPending, status.ToString());
session.CompletePendingWithOutputs(out var completedOutputs, wait: true);
(status, output) = GetSinglePendingResult(completedOutputs);
Assert.AreEqual(TestInitialValue, output.value.value);
}
else
{
// Do an upsert here to cause the collision (it will blindly insert)
otherGate.Wait();
MyKey collidingKey = new() { key = TestCollidingKey };
MyValue collidingValue = new() { value = TestCollidingValue };
session.Upsert(ref collidingKey, ref collidingValue);
}
}
var tasks = new[]
{
Task.Factory.StartNew(() => DoRead(functions1)),
Task.Factory.StartNew(() => DoRead(functions2))
};
Task.WaitAll(tasks);
Assert.AreEqual(DisposeHandler.SingleWriter, functions1.handlerQueue.Dequeue());
Assert.AreEqual(DisposeHandler.DeserializedFromDisk, functions1.handlerQueue.Dequeue());
Assert.IsEmpty(functions1.handlerQueue);
}
[Test]
[Category("FasterKV")]
[Category("Smoke")]
public void DisposePendingReadWithNoInsertTest()
{
var functions = new DisposeFunctionsNoSync();
MyKey key = new() { key = TestKey };
MyValue value = new() { value = TestInitialValue };
// Do initial insert
using var session = fht.NewSession(functions);
session.Upsert(ref key, ref value);
// FlushAndEvict so we go pending
DoFlush(FlushMode.OnDisk);
MyOutput output = new();
var status = session.Read(ref key, ref output);
Assert.IsTrue(status.IsPending, status.ToString());
session.CompletePendingWithOutputs(out var completedOutputs, wait: true);
(status, output) = GetSinglePendingResult(completedOutputs);
Assert.AreEqual(TestInitialValue, output.value.value);
Assert.AreEqual(DisposeHandler.DeserializedFromDisk, functions.handlerQueue.Dequeue());
}
[Test]
[Category("FasterKV")]
[Category("Smoke")]
public void DisposePendingRmwWithNoConflictTest()
{
var functions = new DisposeFunctionsNoSync();
MyKey key = new() { key = TestKey };
MyValue value = new() { value = TestInitialValue };
// Do initial insert
using var session = fht.NewSession(functions);
session.Upsert(ref key, ref value);
// FlushAndEvict so we go pending
DoFlush(FlushMode.OnDisk);
MyInput input = new() { value = TestUpdatedValue };
MyOutput output = new();
var status = session.RMW(ref key, ref input, ref output);
Assert.IsTrue(status.IsPending, status.ToString());
session.CompletePendingWithOutputs(out var completedOutputs, wait: true);
(status, output) = GetSinglePendingResult(completedOutputs);
Assert.AreEqual(TestInitialValue + TestUpdatedValue, output.value.value);
Assert.AreEqual(DisposeHandler.DeserializedFromDisk, functions.handlerQueue.Dequeue());
}
}
}
#endif