FASTER/cs/test/DisposeTests.cs

760 строки
34 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;
[C#] Change locking to use FasterBase hash buckets (#799) * Locking fixes - CompletePending* must also check to lock non-auxiliary records - Ephemeral locking must look for lock evictions as well - InternalLock must check for SpinWaitUntilRecordIsClosed - Replace oneMiss handling in InternalLock - EphemeralSUnlock must follow unlock failures - LockTable should have its own bufferPool - Ensure OnPagesClosed does eviction scans in address order * More locking fixes: - Fix missing unlock of a Tombstoned record in InternalContinuePendingRead - Add more Asserts where ManualLocking requires a locked record - Update and remove obsolete comments * - Remove key-present optimization for SpinWaitUntilRecordIsClosed - Better checking on following records transferred from LockTable in InternalLock(unlock) - Add some additional comments * Fix hash bucket overflow pointer during recovery Fix debug assert logic * WIP on locktable implemented via mainhash overflow buckets * unstaged files missed in previous push * Updates to EphemeralOnly locking for transfer-from-RO/RC * Change LockTableTests to OverflowBucketlockTableTests * Remove RecordInfo.Tentative, .IsIntermediate* * More locking WIP: session.NeedKeyLockCode, test cleanup * WIP locking: Tests build * WIP on mainhash locking: - Add KeyCode creation and sorting and methods public and internal - Remove unnecessary IsLocked (it does not make work with EphemeralOnly and SessionControlled may map to multiple keys) - More tests run now * Most UTs run * More UTs succeed * Still some UT failures * - use XLocks as Tentative indicator for insertions/splices at log tail and readcache insertions - improve readcache consistency checking - clear HasInMemoryLock when HeadAddress goes above srcRecord address following BlockAllocate - rename LockingMode.SessionControlled -> Mixed and other renaming for clarity - remove some unused methods - fix locking sequences in InternalContinuePendingR(ead|MW) * More fixes - Missing 'ref' on recordInfo var in FindAndUnlockTransferredRecord - Improve record allocation checking for below-HA in-memory source and RecordInfo lock clearing if so - Add LockCode to HashEntryInfo in DEBUG * Remove SpinWaitUntilRecordIsClosed; it was only used in ReadCache and in the relevant case we just need to wait for ReadCacheEvict to complete. * - MixedModeTentativeOrClosed is not needed - Add/Improve some ToString()s - Remove unused RecSrc.ClearSrc() - Rename to HasRecordInfoLock - Move ICPRead HandleImmediateRetryStatus outside the lock scope - Consoldiate EphemeralSUnlock(AfterPendingIO) * Streamline locking and FindInMemory calls in InternalXxx * - Change names to pendingContext.Initial*Address and improve setting of these in InternalXxx and handling of these in CompletePending*() and TryFindRecordInMemory. - Also consistentize related param names for readcache and log search to minAddress. * Clean up pending RMW call to CreateNewRecordRMW, per prior changes that make the inputSrc unnecessary. * - Fix stale readcache assignment to recSrc.Log - make searches after pendingIO completion non-inclusive of minAddress - Some ToString() and naming changes for consistency - Remove RecordInfo.IsValidUpdateOrLockSource (superseded by direct call to .IsClosed) * Allow length specification on KeyCode array operations * - Fix check for lock having escaped to eviction zone following BlockAllocate - Add some comments for SafeHeadAddress et al. * - Make sure the readcache bit is set when needed on addresses put into stackCtx.newLogicalAddress. - Rename to HandleNewRecordOnException for clarity * Update remote project * - Make sure FindAndUnlockTransferredRecord can go to SafeHeadAddress - Add non-ref overload of GetLockCode * Tweaks for benchmark with Mixed locking * Add ILockableKey.CompareLockCodes * Change LockCode to just be hashcode, since we may grow the hash table. * - Make CPR consistency check work without conflict with the key latches in the HashBuckets. - Change some names for clarity. - Pending read completion should return values from any in-memory record, as they are the latest * Remove duplicate opCtx param and removed sessionCtx (aka currentCtx, aka ctx) from calls where FasterSession was also passed (in favor of (new) FasterSession.SessionCtx), where the called method has a type constraint of "where FasterSession : IFasterSession<Key, Value, Input, Output, Context>". Not yet done: converting "whereFasterSession : IFasterSession" constraints to generic to remove the duplicate ctx parameter. * Fix DoLockOp to compare bucket indexes, not KeyCodes * Finish removal of duplicate sessionCtx param from calls where FasterSession was also passed (in favor of (new) FasterSession.SessionCtx), where the called method has a type constraint of "where FasterSession : IFasterSession" (non-generic). This cannot be done in Synchronization (the state machines) due to their use of NullFasterSession. * Fix key duplication in readcache and log: - VerifyInMemoryAddresses should not refresh hei if no splice point is present - FindRecordInMemory checks pendingContext.InitialHash - Move CompleteCopyToTail in ITCTT into the non-readcache section - TryFindRecordInMemory needs to check pc.InitialEntryIndex's readcache bit - Updaters need to scan down to hlog.ReadOnlyAddress to ensure the "key is not at or below LatestLogicalAddress" logic holds - ReadCacheCheckTailAfterSplice needs to check hei.*Address readcache bit * Replace use of SafeHeadAddress with SpinWaitUntilClosed in FindInReadCache * Remove LockingMode.EphemeralOnly add --hashpack arg to FASTER.benchmark * Tweaks for the Standard locking change * fix remote to use LockingMode.Standard * Add DisposeTest comments and more Asserts * Use calls on RecordSource to make it easier to verify correct matching of log and physicalAddress * Temporarily disable LocalMemoryDevice tests for investigation * test removal of DisposeTests * - Fix for CTT to address SameKeyInsertAndCTTTest failure - Add missing arg parsing for MemOnlyCache - Re-enable DeviceType.LocalMemory in tests * [C#] MemOnlyCache sample: improved size tracking, including read cache (#800) * Improved cache size tracking, including read cache * Rename MemOnlyCache to ResizableCacheStore. * update doc * fixes * Updates * ClearBitsForDiskImages should unseal record as well (Q: why was it sealed to begin with?) * Correct clearing of index bits during recovery * Remove RecordInfo sealing * WIP Ephemeral locking at IFunctions-level only, part 1 * Remove unused SessionType enumeration; consolidate duplicate IFasterSession implementations * - Add EphemeralLocking readcache detach/reattach logic - Remove unused ReadFlags.ResetModifiedBit * Rename a couple files * re-add RecordInfo.Seal for Ephemeral locking; remove unused (RMW|Upsert)Action.NeedMoreSpace (this is the default 'false' behavior) * Remove single-key overloads of Lock() and Unlock() * - Update a too-aggressive assert. - CreateLogDevice errors on Windows if path > MAX_PATH minus room for segment#. * Improve previous MAX_PATH fix * Chnge Read of an expired to just return NOTFOUND | Expired rather than tombstoning * RETRY_LATER rather than trying to re-find splice point directly in VerifyInMemoryAddresses --------- Co-authored-by: Badrish Chandramouli <badrishc@microsoft.com>
2023-03-23 21:49:12 +03:00
using static FASTER.core.Utility;
#pragma warning disable IDE0060 // Remove unused parameter; used for Setup only
[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
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 };
var concurrencyControlMode = ConcurrencyControlMode.None;
[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
foreach (var arg in TestContext.CurrentContext.Test.Arguments)
{
if (arg is ReadCopyDestination dest)
{
if (dest == ReadCopyDestination.ReadCache)
logSettings.ReadCacheSettings = new() { PageSizeBits = 12, MemorySizeBits = 22 };
[C#] Change locking to use FasterBase hash buckets (#799) * Locking fixes - CompletePending* must also check to lock non-auxiliary records - Ephemeral locking must look for lock evictions as well - InternalLock must check for SpinWaitUntilRecordIsClosed - Replace oneMiss handling in InternalLock - EphemeralSUnlock must follow unlock failures - LockTable should have its own bufferPool - Ensure OnPagesClosed does eviction scans in address order * More locking fixes: - Fix missing unlock of a Tombstoned record in InternalContinuePendingRead - Add more Asserts where ManualLocking requires a locked record - Update and remove obsolete comments * - Remove key-present optimization for SpinWaitUntilRecordIsClosed - Better checking on following records transferred from LockTable in InternalLock(unlock) - Add some additional comments * Fix hash bucket overflow pointer during recovery Fix debug assert logic * WIP on locktable implemented via mainhash overflow buckets * unstaged files missed in previous push * Updates to EphemeralOnly locking for transfer-from-RO/RC * Change LockTableTests to OverflowBucketlockTableTests * Remove RecordInfo.Tentative, .IsIntermediate* * More locking WIP: session.NeedKeyLockCode, test cleanup * WIP locking: Tests build * WIP on mainhash locking: - Add KeyCode creation and sorting and methods public and internal - Remove unnecessary IsLocked (it does not make work with EphemeralOnly and SessionControlled may map to multiple keys) - More tests run now * Most UTs run * More UTs succeed * Still some UT failures * - use XLocks as Tentative indicator for insertions/splices at log tail and readcache insertions - improve readcache consistency checking - clear HasInMemoryLock when HeadAddress goes above srcRecord address following BlockAllocate - rename LockingMode.SessionControlled -> Mixed and other renaming for clarity - remove some unused methods - fix locking sequences in InternalContinuePendingR(ead|MW) * More fixes - Missing 'ref' on recordInfo var in FindAndUnlockTransferredRecord - Improve record allocation checking for below-HA in-memory source and RecordInfo lock clearing if so - Add LockCode to HashEntryInfo in DEBUG * Remove SpinWaitUntilRecordIsClosed; it was only used in ReadCache and in the relevant case we just need to wait for ReadCacheEvict to complete. * - MixedModeTentativeOrClosed is not needed - Add/Improve some ToString()s - Remove unused RecSrc.ClearSrc() - Rename to HasRecordInfoLock - Move ICPRead HandleImmediateRetryStatus outside the lock scope - Consoldiate EphemeralSUnlock(AfterPendingIO) * Streamline locking and FindInMemory calls in InternalXxx * - Change names to pendingContext.Initial*Address and improve setting of these in InternalXxx and handling of these in CompletePending*() and TryFindRecordInMemory. - Also consistentize related param names for readcache and log search to minAddress. * Clean up pending RMW call to CreateNewRecordRMW, per prior changes that make the inputSrc unnecessary. * - Fix stale readcache assignment to recSrc.Log - make searches after pendingIO completion non-inclusive of minAddress - Some ToString() and naming changes for consistency - Remove RecordInfo.IsValidUpdateOrLockSource (superseded by direct call to .IsClosed) * Allow length specification on KeyCode array operations * - Fix check for lock having escaped to eviction zone following BlockAllocate - Add some comments for SafeHeadAddress et al. * - Make sure the readcache bit is set when needed on addresses put into stackCtx.newLogicalAddress. - Rename to HandleNewRecordOnException for clarity * Update remote project * - Make sure FindAndUnlockTransferredRecord can go to SafeHeadAddress - Add non-ref overload of GetLockCode * Tweaks for benchmark with Mixed locking * Add ILockableKey.CompareLockCodes * Change LockCode to just be hashcode, since we may grow the hash table. * - Make CPR consistency check work without conflict with the key latches in the HashBuckets. - Change some names for clarity. - Pending read completion should return values from any in-memory record, as they are the latest * Remove duplicate opCtx param and removed sessionCtx (aka currentCtx, aka ctx) from calls where FasterSession was also passed (in favor of (new) FasterSession.SessionCtx), where the called method has a type constraint of "where FasterSession : IFasterSession<Key, Value, Input, Output, Context>". Not yet done: converting "whereFasterSession : IFasterSession" constraints to generic to remove the duplicate ctx parameter. * Fix DoLockOp to compare bucket indexes, not KeyCodes * Finish removal of duplicate sessionCtx param from calls where FasterSession was also passed (in favor of (new) FasterSession.SessionCtx), where the called method has a type constraint of "where FasterSession : IFasterSession" (non-generic). This cannot be done in Synchronization (the state machines) due to their use of NullFasterSession. * Fix key duplication in readcache and log: - VerifyInMemoryAddresses should not refresh hei if no splice point is present - FindRecordInMemory checks pendingContext.InitialHash - Move CompleteCopyToTail in ITCTT into the non-readcache section - TryFindRecordInMemory needs to check pc.InitialEntryIndex's readcache bit - Updaters need to scan down to hlog.ReadOnlyAddress to ensure the "key is not at or below LatestLogicalAddress" logic holds - ReadCacheCheckTailAfterSplice needs to check hei.*Address readcache bit * Replace use of SafeHeadAddress with SpinWaitUntilClosed in FindInReadCache * Remove LockingMode.EphemeralOnly add --hashpack arg to FASTER.benchmark * Tweaks for the Standard locking change * fix remote to use LockingMode.Standard * Add DisposeTest comments and more Asserts * Use calls on RecordSource to make it easier to verify correct matching of log and physicalAddress * Temporarily disable LocalMemoryDevice tests for investigation * test removal of DisposeTests * - Fix for CTT to address SameKeyInsertAndCTTTest failure - Add missing arg parsing for MemOnlyCache - Re-enable DeviceType.LocalMemory in tests * [C#] MemOnlyCache sample: improved size tracking, including read cache (#800) * Improved cache size tracking, including read cache * Rename MemOnlyCache to ResizableCacheStore. * update doc * fixes * Updates * ClearBitsForDiskImages should unseal record as well (Q: why was it sealed to begin with?) * Correct clearing of index bits during recovery * Remove RecordInfo sealing * WIP Ephemeral locking at IFunctions-level only, part 1 * Remove unused SessionType enumeration; consolidate duplicate IFasterSession implementations * - Add EphemeralLocking readcache detach/reattach logic - Remove unused ReadFlags.ResetModifiedBit * Rename a couple files * re-add RecordInfo.Seal for Ephemeral locking; remove unused (RMW|Upsert)Action.NeedMoreSpace (this is the default 'false' behavior) * Remove single-key overloads of Lock() and Unlock() * - Update a too-aggressive assert. - CreateLogDevice errors on Windows if path > MAX_PATH minus room for segment#. * Improve previous MAX_PATH fix * Chnge Read of an expired to just return NOTFOUND | Expired rather than tombstoning * RETRY_LATER rather than trying to re-find splice point directly in VerifyInMemoryAddresses --------- Co-authored-by: Badrish Chandramouli <badrishc@microsoft.com>
2023-03-23 21:49:12 +03:00
continue;
}
if (arg is ConcurrencyControlMode lm)
[C#] Change locking to use FasterBase hash buckets (#799) * Locking fixes - CompletePending* must also check to lock non-auxiliary records - Ephemeral locking must look for lock evictions as well - InternalLock must check for SpinWaitUntilRecordIsClosed - Replace oneMiss handling in InternalLock - EphemeralSUnlock must follow unlock failures - LockTable should have its own bufferPool - Ensure OnPagesClosed does eviction scans in address order * More locking fixes: - Fix missing unlock of a Tombstoned record in InternalContinuePendingRead - Add more Asserts where ManualLocking requires a locked record - Update and remove obsolete comments * - Remove key-present optimization for SpinWaitUntilRecordIsClosed - Better checking on following records transferred from LockTable in InternalLock(unlock) - Add some additional comments * Fix hash bucket overflow pointer during recovery Fix debug assert logic * WIP on locktable implemented via mainhash overflow buckets * unstaged files missed in previous push * Updates to EphemeralOnly locking for transfer-from-RO/RC * Change LockTableTests to OverflowBucketlockTableTests * Remove RecordInfo.Tentative, .IsIntermediate* * More locking WIP: session.NeedKeyLockCode, test cleanup * WIP locking: Tests build * WIP on mainhash locking: - Add KeyCode creation and sorting and methods public and internal - Remove unnecessary IsLocked (it does not make work with EphemeralOnly and SessionControlled may map to multiple keys) - More tests run now * Most UTs run * More UTs succeed * Still some UT failures * - use XLocks as Tentative indicator for insertions/splices at log tail and readcache insertions - improve readcache consistency checking - clear HasInMemoryLock when HeadAddress goes above srcRecord address following BlockAllocate - rename LockingMode.SessionControlled -> Mixed and other renaming for clarity - remove some unused methods - fix locking sequences in InternalContinuePendingR(ead|MW) * More fixes - Missing 'ref' on recordInfo var in FindAndUnlockTransferredRecord - Improve record allocation checking for below-HA in-memory source and RecordInfo lock clearing if so - Add LockCode to HashEntryInfo in DEBUG * Remove SpinWaitUntilRecordIsClosed; it was only used in ReadCache and in the relevant case we just need to wait for ReadCacheEvict to complete. * - MixedModeTentativeOrClosed is not needed - Add/Improve some ToString()s - Remove unused RecSrc.ClearSrc() - Rename to HasRecordInfoLock - Move ICPRead HandleImmediateRetryStatus outside the lock scope - Consoldiate EphemeralSUnlock(AfterPendingIO) * Streamline locking and FindInMemory calls in InternalXxx * - Change names to pendingContext.Initial*Address and improve setting of these in InternalXxx and handling of these in CompletePending*() and TryFindRecordInMemory. - Also consistentize related param names for readcache and log search to minAddress. * Clean up pending RMW call to CreateNewRecordRMW, per prior changes that make the inputSrc unnecessary. * - Fix stale readcache assignment to recSrc.Log - make searches after pendingIO completion non-inclusive of minAddress - Some ToString() and naming changes for consistency - Remove RecordInfo.IsValidUpdateOrLockSource (superseded by direct call to .IsClosed) * Allow length specification on KeyCode array operations * - Fix check for lock having escaped to eviction zone following BlockAllocate - Add some comments for SafeHeadAddress et al. * - Make sure the readcache bit is set when needed on addresses put into stackCtx.newLogicalAddress. - Rename to HandleNewRecordOnException for clarity * Update remote project * - Make sure FindAndUnlockTransferredRecord can go to SafeHeadAddress - Add non-ref overload of GetLockCode * Tweaks for benchmark with Mixed locking * Add ILockableKey.CompareLockCodes * Change LockCode to just be hashcode, since we may grow the hash table. * - Make CPR consistency check work without conflict with the key latches in the HashBuckets. - Change some names for clarity. - Pending read completion should return values from any in-memory record, as they are the latest * Remove duplicate opCtx param and removed sessionCtx (aka currentCtx, aka ctx) from calls where FasterSession was also passed (in favor of (new) FasterSession.SessionCtx), where the called method has a type constraint of "where FasterSession : IFasterSession<Key, Value, Input, Output, Context>". Not yet done: converting "whereFasterSession : IFasterSession" constraints to generic to remove the duplicate ctx parameter. * Fix DoLockOp to compare bucket indexes, not KeyCodes * Finish removal of duplicate sessionCtx param from calls where FasterSession was also passed (in favor of (new) FasterSession.SessionCtx), where the called method has a type constraint of "where FasterSession : IFasterSession" (non-generic). This cannot be done in Synchronization (the state machines) due to their use of NullFasterSession. * Fix key duplication in readcache and log: - VerifyInMemoryAddresses should not refresh hei if no splice point is present - FindRecordInMemory checks pendingContext.InitialHash - Move CompleteCopyToTail in ITCTT into the non-readcache section - TryFindRecordInMemory needs to check pc.InitialEntryIndex's readcache bit - Updaters need to scan down to hlog.ReadOnlyAddress to ensure the "key is not at or below LatestLogicalAddress" logic holds - ReadCacheCheckTailAfterSplice needs to check hei.*Address readcache bit * Replace use of SafeHeadAddress with SpinWaitUntilClosed in FindInReadCache * Remove LockingMode.EphemeralOnly add --hashpack arg to FASTER.benchmark * Tweaks for the Standard locking change * fix remote to use LockingMode.Standard * Add DisposeTest comments and more Asserts * Use calls on RecordSource to make it easier to verify correct matching of log and physicalAddress * Temporarily disable LocalMemoryDevice tests for investigation * test removal of DisposeTests * - Fix for CTT to address SameKeyInsertAndCTTTest failure - Add missing arg parsing for MemOnlyCache - Re-enable DeviceType.LocalMemory in tests * [C#] MemOnlyCache sample: improved size tracking, including read cache (#800) * Improved cache size tracking, including read cache * Rename MemOnlyCache to ResizableCacheStore. * update doc * fixes * Updates * ClearBitsForDiskImages should unseal record as well (Q: why was it sealed to begin with?) * Correct clearing of index bits during recovery * Remove RecordInfo sealing * WIP Ephemeral locking at IFunctions-level only, part 1 * Remove unused SessionType enumeration; consolidate duplicate IFasterSession implementations * - Add EphemeralLocking readcache detach/reattach logic - Remove unused ReadFlags.ResetModifiedBit * Rename a couple files * re-add RecordInfo.Seal for Ephemeral locking; remove unused (RMW|Upsert)Action.NeedMoreSpace (this is the default 'false' behavior) * Remove single-key overloads of Lock() and Unlock() * - Update a too-aggressive assert. - CreateLogDevice errors on Windows if path > MAX_PATH minus room for segment#. * Improve previous MAX_PATH fix * Chnge Read of an expired to just return NOTFOUND | Expired rather than tombstoning * RETRY_LATER rather than trying to re-find splice point directly in VerifyInMemoryAddresses --------- Co-authored-by: Badrish Chandramouli <badrishc@microsoft.com>
2023-03-23 21:49:12 +03:00
{
concurrencyControlMode = lm;
[C#] Change locking to use FasterBase hash buckets (#799) * Locking fixes - CompletePending* must also check to lock non-auxiliary records - Ephemeral locking must look for lock evictions as well - InternalLock must check for SpinWaitUntilRecordIsClosed - Replace oneMiss handling in InternalLock - EphemeralSUnlock must follow unlock failures - LockTable should have its own bufferPool - Ensure OnPagesClosed does eviction scans in address order * More locking fixes: - Fix missing unlock of a Tombstoned record in InternalContinuePendingRead - Add more Asserts where ManualLocking requires a locked record - Update and remove obsolete comments * - Remove key-present optimization for SpinWaitUntilRecordIsClosed - Better checking on following records transferred from LockTable in InternalLock(unlock) - Add some additional comments * Fix hash bucket overflow pointer during recovery Fix debug assert logic * WIP on locktable implemented via mainhash overflow buckets * unstaged files missed in previous push * Updates to EphemeralOnly locking for transfer-from-RO/RC * Change LockTableTests to OverflowBucketlockTableTests * Remove RecordInfo.Tentative, .IsIntermediate* * More locking WIP: session.NeedKeyLockCode, test cleanup * WIP locking: Tests build * WIP on mainhash locking: - Add KeyCode creation and sorting and methods public and internal - Remove unnecessary IsLocked (it does not make work with EphemeralOnly and SessionControlled may map to multiple keys) - More tests run now * Most UTs run * More UTs succeed * Still some UT failures * - use XLocks as Tentative indicator for insertions/splices at log tail and readcache insertions - improve readcache consistency checking - clear HasInMemoryLock when HeadAddress goes above srcRecord address following BlockAllocate - rename LockingMode.SessionControlled -> Mixed and other renaming for clarity - remove some unused methods - fix locking sequences in InternalContinuePendingR(ead|MW) * More fixes - Missing 'ref' on recordInfo var in FindAndUnlockTransferredRecord - Improve record allocation checking for below-HA in-memory source and RecordInfo lock clearing if so - Add LockCode to HashEntryInfo in DEBUG * Remove SpinWaitUntilRecordIsClosed; it was only used in ReadCache and in the relevant case we just need to wait for ReadCacheEvict to complete. * - MixedModeTentativeOrClosed is not needed - Add/Improve some ToString()s - Remove unused RecSrc.ClearSrc() - Rename to HasRecordInfoLock - Move ICPRead HandleImmediateRetryStatus outside the lock scope - Consoldiate EphemeralSUnlock(AfterPendingIO) * Streamline locking and FindInMemory calls in InternalXxx * - Change names to pendingContext.Initial*Address and improve setting of these in InternalXxx and handling of these in CompletePending*() and TryFindRecordInMemory. - Also consistentize related param names for readcache and log search to minAddress. * Clean up pending RMW call to CreateNewRecordRMW, per prior changes that make the inputSrc unnecessary. * - Fix stale readcache assignment to recSrc.Log - make searches after pendingIO completion non-inclusive of minAddress - Some ToString() and naming changes for consistency - Remove RecordInfo.IsValidUpdateOrLockSource (superseded by direct call to .IsClosed) * Allow length specification on KeyCode array operations * - Fix check for lock having escaped to eviction zone following BlockAllocate - Add some comments for SafeHeadAddress et al. * - Make sure the readcache bit is set when needed on addresses put into stackCtx.newLogicalAddress. - Rename to HandleNewRecordOnException for clarity * Update remote project * - Make sure FindAndUnlockTransferredRecord can go to SafeHeadAddress - Add non-ref overload of GetLockCode * Tweaks for benchmark with Mixed locking * Add ILockableKey.CompareLockCodes * Change LockCode to just be hashcode, since we may grow the hash table. * - Make CPR consistency check work without conflict with the key latches in the HashBuckets. - Change some names for clarity. - Pending read completion should return values from any in-memory record, as they are the latest * Remove duplicate opCtx param and removed sessionCtx (aka currentCtx, aka ctx) from calls where FasterSession was also passed (in favor of (new) FasterSession.SessionCtx), where the called method has a type constraint of "where FasterSession : IFasterSession<Key, Value, Input, Output, Context>". Not yet done: converting "whereFasterSession : IFasterSession" constraints to generic to remove the duplicate ctx parameter. * Fix DoLockOp to compare bucket indexes, not KeyCodes * Finish removal of duplicate sessionCtx param from calls where FasterSession was also passed (in favor of (new) FasterSession.SessionCtx), where the called method has a type constraint of "where FasterSession : IFasterSession" (non-generic). This cannot be done in Synchronization (the state machines) due to their use of NullFasterSession. * Fix key duplication in readcache and log: - VerifyInMemoryAddresses should not refresh hei if no splice point is present - FindRecordInMemory checks pendingContext.InitialHash - Move CompleteCopyToTail in ITCTT into the non-readcache section - TryFindRecordInMemory needs to check pc.InitialEntryIndex's readcache bit - Updaters need to scan down to hlog.ReadOnlyAddress to ensure the "key is not at or below LatestLogicalAddress" logic holds - ReadCacheCheckTailAfterSplice needs to check hei.*Address readcache bit * Replace use of SafeHeadAddress with SpinWaitUntilClosed in FindInReadCache * Remove LockingMode.EphemeralOnly add --hashpack arg to FASTER.benchmark * Tweaks for the Standard locking change * fix remote to use LockingMode.Standard * Add DisposeTest comments and more Asserts * Use calls on RecordSource to make it easier to verify correct matching of log and physicalAddress * Temporarily disable LocalMemoryDevice tests for investigation * test removal of DisposeTests * - Fix for CTT to address SameKeyInsertAndCTTTest failure - Add missing arg parsing for MemOnlyCache - Re-enable DeviceType.LocalMemory in tests * [C#] MemOnlyCache sample: improved size tracking, including read cache (#800) * Improved cache size tracking, including read cache * Rename MemOnlyCache to ResizableCacheStore. * update doc * fixes * Updates * ClearBitsForDiskImages should unseal record as well (Q: why was it sealed to begin with?) * Correct clearing of index bits during recovery * Remove RecordInfo sealing * WIP Ephemeral locking at IFunctions-level only, part 1 * Remove unused SessionType enumeration; consolidate duplicate IFasterSession implementations * - Add EphemeralLocking readcache detach/reattach logic - Remove unused ReadFlags.ResetModifiedBit * Rename a couple files * re-add RecordInfo.Seal for Ephemeral locking; remove unused (RMW|Upsert)Action.NeedMoreSpace (this is the default 'false' behavior) * Remove single-key overloads of Lock() and Unlock() * - Update a too-aggressive assert. - CreateLogDevice errors on Windows if path > MAX_PATH minus room for segment#. * Improve previous MAX_PATH fix * Chnge Read of an expired to just return NOTFOUND | Expired rather than tombstoning * RETRY_LATER rather than trying to re-find splice point directly in VerifyInMemoryAddresses --------- Co-authored-by: Badrish Chandramouli <badrishc@microsoft.com>
2023-03-23 21:49:12 +03:00
continue;
[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
}
}
fht = new FasterKV<MyKey, MyValue>(128, logSettings: logSettings, comparer: new MyKeyComparer(),
[C#] Change locking to use FasterBase hash buckets (#799) * Locking fixes - CompletePending* must also check to lock non-auxiliary records - Ephemeral locking must look for lock evictions as well - InternalLock must check for SpinWaitUntilRecordIsClosed - Replace oneMiss handling in InternalLock - EphemeralSUnlock must follow unlock failures - LockTable should have its own bufferPool - Ensure OnPagesClosed does eviction scans in address order * More locking fixes: - Fix missing unlock of a Tombstoned record in InternalContinuePendingRead - Add more Asserts where ManualLocking requires a locked record - Update and remove obsolete comments * - Remove key-present optimization for SpinWaitUntilRecordIsClosed - Better checking on following records transferred from LockTable in InternalLock(unlock) - Add some additional comments * Fix hash bucket overflow pointer during recovery Fix debug assert logic * WIP on locktable implemented via mainhash overflow buckets * unstaged files missed in previous push * Updates to EphemeralOnly locking for transfer-from-RO/RC * Change LockTableTests to OverflowBucketlockTableTests * Remove RecordInfo.Tentative, .IsIntermediate* * More locking WIP: session.NeedKeyLockCode, test cleanup * WIP locking: Tests build * WIP on mainhash locking: - Add KeyCode creation and sorting and methods public and internal - Remove unnecessary IsLocked (it does not make work with EphemeralOnly and SessionControlled may map to multiple keys) - More tests run now * Most UTs run * More UTs succeed * Still some UT failures * - use XLocks as Tentative indicator for insertions/splices at log tail and readcache insertions - improve readcache consistency checking - clear HasInMemoryLock when HeadAddress goes above srcRecord address following BlockAllocate - rename LockingMode.SessionControlled -> Mixed and other renaming for clarity - remove some unused methods - fix locking sequences in InternalContinuePendingR(ead|MW) * More fixes - Missing 'ref' on recordInfo var in FindAndUnlockTransferredRecord - Improve record allocation checking for below-HA in-memory source and RecordInfo lock clearing if so - Add LockCode to HashEntryInfo in DEBUG * Remove SpinWaitUntilRecordIsClosed; it was only used in ReadCache and in the relevant case we just need to wait for ReadCacheEvict to complete. * - MixedModeTentativeOrClosed is not needed - Add/Improve some ToString()s - Remove unused RecSrc.ClearSrc() - Rename to HasRecordInfoLock - Move ICPRead HandleImmediateRetryStatus outside the lock scope - Consoldiate EphemeralSUnlock(AfterPendingIO) * Streamline locking and FindInMemory calls in InternalXxx * - Change names to pendingContext.Initial*Address and improve setting of these in InternalXxx and handling of these in CompletePending*() and TryFindRecordInMemory. - Also consistentize related param names for readcache and log search to minAddress. * Clean up pending RMW call to CreateNewRecordRMW, per prior changes that make the inputSrc unnecessary. * - Fix stale readcache assignment to recSrc.Log - make searches after pendingIO completion non-inclusive of minAddress - Some ToString() and naming changes for consistency - Remove RecordInfo.IsValidUpdateOrLockSource (superseded by direct call to .IsClosed) * Allow length specification on KeyCode array operations * - Fix check for lock having escaped to eviction zone following BlockAllocate - Add some comments for SafeHeadAddress et al. * - Make sure the readcache bit is set when needed on addresses put into stackCtx.newLogicalAddress. - Rename to HandleNewRecordOnException for clarity * Update remote project * - Make sure FindAndUnlockTransferredRecord can go to SafeHeadAddress - Add non-ref overload of GetLockCode * Tweaks for benchmark with Mixed locking * Add ILockableKey.CompareLockCodes * Change LockCode to just be hashcode, since we may grow the hash table. * - Make CPR consistency check work without conflict with the key latches in the HashBuckets. - Change some names for clarity. - Pending read completion should return values from any in-memory record, as they are the latest * Remove duplicate opCtx param and removed sessionCtx (aka currentCtx, aka ctx) from calls where FasterSession was also passed (in favor of (new) FasterSession.SessionCtx), where the called method has a type constraint of "where FasterSession : IFasterSession<Key, Value, Input, Output, Context>". Not yet done: converting "whereFasterSession : IFasterSession" constraints to generic to remove the duplicate ctx parameter. * Fix DoLockOp to compare bucket indexes, not KeyCodes * Finish removal of duplicate sessionCtx param from calls where FasterSession was also passed (in favor of (new) FasterSession.SessionCtx), where the called method has a type constraint of "where FasterSession : IFasterSession" (non-generic). This cannot be done in Synchronization (the state machines) due to their use of NullFasterSession. * Fix key duplication in readcache and log: - VerifyInMemoryAddresses should not refresh hei if no splice point is present - FindRecordInMemory checks pendingContext.InitialHash - Move CompleteCopyToTail in ITCTT into the non-readcache section - TryFindRecordInMemory needs to check pc.InitialEntryIndex's readcache bit - Updaters need to scan down to hlog.ReadOnlyAddress to ensure the "key is not at or below LatestLogicalAddress" logic holds - ReadCacheCheckTailAfterSplice needs to check hei.*Address readcache bit * Replace use of SafeHeadAddress with SpinWaitUntilClosed in FindInReadCache * Remove LockingMode.EphemeralOnly add --hashpack arg to FASTER.benchmark * Tweaks for the Standard locking change * fix remote to use LockingMode.Standard * Add DisposeTest comments and more Asserts * Use calls on RecordSource to make it easier to verify correct matching of log and physicalAddress * Temporarily disable LocalMemoryDevice tests for investigation * test removal of DisposeTests * - Fix for CTT to address SameKeyInsertAndCTTTest failure - Add missing arg parsing for MemOnlyCache - Re-enable DeviceType.LocalMemory in tests * [C#] MemOnlyCache sample: improved size tracking, including read cache (#800) * Improved cache size tracking, including read cache * Rename MemOnlyCache to ResizableCacheStore. * update doc * fixes * Updates * ClearBitsForDiskImages should unseal record as well (Q: why was it sealed to begin with?) * Correct clearing of index bits during recovery * Remove RecordInfo sealing * WIP Ephemeral locking at IFunctions-level only, part 1 * Remove unused SessionType enumeration; consolidate duplicate IFasterSession implementations * - Add EphemeralLocking readcache detach/reattach logic - Remove unused ReadFlags.ResetModifiedBit * Rename a couple files * re-add RecordInfo.Seal for Ephemeral locking; remove unused (RMW|Upsert)Action.NeedMoreSpace (this is the default 'false' behavior) * Remove single-key overloads of Lock() and Unlock() * - Update a too-aggressive assert. - CreateLogDevice errors on Windows if path > MAX_PATH minus room for segment#. * Improve previous MAX_PATH fix * Chnge Read of an expired to just return NOTFOUND | Expired rather than tombstoning * RETRY_LATER rather than trying to re-find splice point directly in VerifyInMemoryAddresses --------- Co-authored-by: Badrish Chandramouli <badrishc@microsoft.com>
2023-03-23 21:49:12 +03:00
serializerSettings: new SerializerSettings<MyKey, MyValue> { keySerializer = () => new MyKeySerializer(), valueSerializer = () => new MyValueSerializer() },
concurrencyControlMode: concurrencyControlMode // Warning: ConcurrencyControlMode.LockTable will deadlock with X locks as both keys map to the same keyHash
[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
);
}
[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()
{
[C#] Change locking to use FasterBase hash buckets (#799) * Locking fixes - CompletePending* must also check to lock non-auxiliary records - Ephemeral locking must look for lock evictions as well - InternalLock must check for SpinWaitUntilRecordIsClosed - Replace oneMiss handling in InternalLock - EphemeralSUnlock must follow unlock failures - LockTable should have its own bufferPool - Ensure OnPagesClosed does eviction scans in address order * More locking fixes: - Fix missing unlock of a Tombstoned record in InternalContinuePendingRead - Add more Asserts where ManualLocking requires a locked record - Update and remove obsolete comments * - Remove key-present optimization for SpinWaitUntilRecordIsClosed - Better checking on following records transferred from LockTable in InternalLock(unlock) - Add some additional comments * Fix hash bucket overflow pointer during recovery Fix debug assert logic * WIP on locktable implemented via mainhash overflow buckets * unstaged files missed in previous push * Updates to EphemeralOnly locking for transfer-from-RO/RC * Change LockTableTests to OverflowBucketlockTableTests * Remove RecordInfo.Tentative, .IsIntermediate* * More locking WIP: session.NeedKeyLockCode, test cleanup * WIP locking: Tests build * WIP on mainhash locking: - Add KeyCode creation and sorting and methods public and internal - Remove unnecessary IsLocked (it does not make work with EphemeralOnly and SessionControlled may map to multiple keys) - More tests run now * Most UTs run * More UTs succeed * Still some UT failures * - use XLocks as Tentative indicator for insertions/splices at log tail and readcache insertions - improve readcache consistency checking - clear HasInMemoryLock when HeadAddress goes above srcRecord address following BlockAllocate - rename LockingMode.SessionControlled -> Mixed and other renaming for clarity - remove some unused methods - fix locking sequences in InternalContinuePendingR(ead|MW) * More fixes - Missing 'ref' on recordInfo var in FindAndUnlockTransferredRecord - Improve record allocation checking for below-HA in-memory source and RecordInfo lock clearing if so - Add LockCode to HashEntryInfo in DEBUG * Remove SpinWaitUntilRecordIsClosed; it was only used in ReadCache and in the relevant case we just need to wait for ReadCacheEvict to complete. * - MixedModeTentativeOrClosed is not needed - Add/Improve some ToString()s - Remove unused RecSrc.ClearSrc() - Rename to HasRecordInfoLock - Move ICPRead HandleImmediateRetryStatus outside the lock scope - Consoldiate EphemeralSUnlock(AfterPendingIO) * Streamline locking and FindInMemory calls in InternalXxx * - Change names to pendingContext.Initial*Address and improve setting of these in InternalXxx and handling of these in CompletePending*() and TryFindRecordInMemory. - Also consistentize related param names for readcache and log search to minAddress. * Clean up pending RMW call to CreateNewRecordRMW, per prior changes that make the inputSrc unnecessary. * - Fix stale readcache assignment to recSrc.Log - make searches after pendingIO completion non-inclusive of minAddress - Some ToString() and naming changes for consistency - Remove RecordInfo.IsValidUpdateOrLockSource (superseded by direct call to .IsClosed) * Allow length specification on KeyCode array operations * - Fix check for lock having escaped to eviction zone following BlockAllocate - Add some comments for SafeHeadAddress et al. * - Make sure the readcache bit is set when needed on addresses put into stackCtx.newLogicalAddress. - Rename to HandleNewRecordOnException for clarity * Update remote project * - Make sure FindAndUnlockTransferredRecord can go to SafeHeadAddress - Add non-ref overload of GetLockCode * Tweaks for benchmark with Mixed locking * Add ILockableKey.CompareLockCodes * Change LockCode to just be hashcode, since we may grow the hash table. * - Make CPR consistency check work without conflict with the key latches in the HashBuckets. - Change some names for clarity. - Pending read completion should return values from any in-memory record, as they are the latest * Remove duplicate opCtx param and removed sessionCtx (aka currentCtx, aka ctx) from calls where FasterSession was also passed (in favor of (new) FasterSession.SessionCtx), where the called method has a type constraint of "where FasterSession : IFasterSession<Key, Value, Input, Output, Context>". Not yet done: converting "whereFasterSession : IFasterSession" constraints to generic to remove the duplicate ctx parameter. * Fix DoLockOp to compare bucket indexes, not KeyCodes * Finish removal of duplicate sessionCtx param from calls where FasterSession was also passed (in favor of (new) FasterSession.SessionCtx), where the called method has a type constraint of "where FasterSession : IFasterSession" (non-generic). This cannot be done in Synchronization (the state machines) due to their use of NullFasterSession. * Fix key duplication in readcache and log: - VerifyInMemoryAddresses should not refresh hei if no splice point is present - FindRecordInMemory checks pendingContext.InitialHash - Move CompleteCopyToTail in ITCTT into the non-readcache section - TryFindRecordInMemory needs to check pc.InitialEntryIndex's readcache bit - Updaters need to scan down to hlog.ReadOnlyAddress to ensure the "key is not at or below LatestLogicalAddress" logic holds - ReadCacheCheckTailAfterSplice needs to check hei.*Address readcache bit * Replace use of SafeHeadAddress with SpinWaitUntilClosed in FindInReadCache * Remove LockingMode.EphemeralOnly add --hashpack arg to FASTER.benchmark * Tweaks for the Standard locking change * fix remote to use LockingMode.Standard * Add DisposeTest comments and more Asserts * Use calls on RecordSource to make it easier to verify correct matching of log and physicalAddress * Temporarily disable LocalMemoryDevice tests for investigation * test removal of DisposeTests * - Fix for CTT to address SameKeyInsertAndCTTTest failure - Add missing arg parsing for MemOnlyCache - Re-enable DeviceType.LocalMemory in tests * [C#] MemOnlyCache sample: improved size tracking, including read cache (#800) * Improved cache size tracking, including read cache * Rename MemOnlyCache to ResizableCacheStore. * update doc * fixes * Updates * ClearBitsForDiskImages should unseal record as well (Q: why was it sealed to begin with?) * Correct clearing of index bits during recovery * Remove RecordInfo sealing * WIP Ephemeral locking at IFunctions-level only, part 1 * Remove unused SessionType enumeration; consolidate duplicate IFasterSession implementations * - Add EphemeralLocking readcache detach/reattach logic - Remove unused ReadFlags.ResetModifiedBit * Rename a couple files * re-add RecordInfo.Seal for Ephemeral locking; remove unused (RMW|Upsert)Action.NeedMoreSpace (this is the default 'false' behavior) * Remove single-key overloads of Lock() and Unlock() * - Update a too-aggressive assert. - CreateLogDevice errors on Windows if path > MAX_PATH minus room for segment#. * Improve previous MAX_PATH fix * Chnge Read of an expired to just return NOTFOUND | Expired rather than tombstoning * RETRY_LATER rather than trying to re-find splice point directly in VerifyInMemoryAddresses --------- Co-authored-by: Badrish Chandramouli <badrishc@microsoft.com>
2023-03-23 21:49:12 +03:00
Assert.IsTrue(tester.fht.epoch.ThisInstanceProtected(), "This should only be called from IFunctions methods, which are under epoch protection");
[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)
{
MyKey key = new() { key = TestKey };
[C#] Change locking to use FasterBase hash buckets (#799) * Locking fixes - CompletePending* must also check to lock non-auxiliary records - Ephemeral locking must look for lock evictions as well - InternalLock must check for SpinWaitUntilRecordIsClosed - Replace oneMiss handling in InternalLock - EphemeralSUnlock must follow unlock failures - LockTable should have its own bufferPool - Ensure OnPagesClosed does eviction scans in address order * More locking fixes: - Fix missing unlock of a Tombstoned record in InternalContinuePendingRead - Add more Asserts where ManualLocking requires a locked record - Update and remove obsolete comments * - Remove key-present optimization for SpinWaitUntilRecordIsClosed - Better checking on following records transferred from LockTable in InternalLock(unlock) - Add some additional comments * Fix hash bucket overflow pointer during recovery Fix debug assert logic * WIP on locktable implemented via mainhash overflow buckets * unstaged files missed in previous push * Updates to EphemeralOnly locking for transfer-from-RO/RC * Change LockTableTests to OverflowBucketlockTableTests * Remove RecordInfo.Tentative, .IsIntermediate* * More locking WIP: session.NeedKeyLockCode, test cleanup * WIP locking: Tests build * WIP on mainhash locking: - Add KeyCode creation and sorting and methods public and internal - Remove unnecessary IsLocked (it does not make work with EphemeralOnly and SessionControlled may map to multiple keys) - More tests run now * Most UTs run * More UTs succeed * Still some UT failures * - use XLocks as Tentative indicator for insertions/splices at log tail and readcache insertions - improve readcache consistency checking - clear HasInMemoryLock when HeadAddress goes above srcRecord address following BlockAllocate - rename LockingMode.SessionControlled -> Mixed and other renaming for clarity - remove some unused methods - fix locking sequences in InternalContinuePendingR(ead|MW) * More fixes - Missing 'ref' on recordInfo var in FindAndUnlockTransferredRecord - Improve record allocation checking for below-HA in-memory source and RecordInfo lock clearing if so - Add LockCode to HashEntryInfo in DEBUG * Remove SpinWaitUntilRecordIsClosed; it was only used in ReadCache and in the relevant case we just need to wait for ReadCacheEvict to complete. * - MixedModeTentativeOrClosed is not needed - Add/Improve some ToString()s - Remove unused RecSrc.ClearSrc() - Rename to HasRecordInfoLock - Move ICPRead HandleImmediateRetryStatus outside the lock scope - Consoldiate EphemeralSUnlock(AfterPendingIO) * Streamline locking and FindInMemory calls in InternalXxx * - Change names to pendingContext.Initial*Address and improve setting of these in InternalXxx and handling of these in CompletePending*() and TryFindRecordInMemory. - Also consistentize related param names for readcache and log search to minAddress. * Clean up pending RMW call to CreateNewRecordRMW, per prior changes that make the inputSrc unnecessary. * - Fix stale readcache assignment to recSrc.Log - make searches after pendingIO completion non-inclusive of minAddress - Some ToString() and naming changes for consistency - Remove RecordInfo.IsValidUpdateOrLockSource (superseded by direct call to .IsClosed) * Allow length specification on KeyCode array operations * - Fix check for lock having escaped to eviction zone following BlockAllocate - Add some comments for SafeHeadAddress et al. * - Make sure the readcache bit is set when needed on addresses put into stackCtx.newLogicalAddress. - Rename to HandleNewRecordOnException for clarity * Update remote project * - Make sure FindAndUnlockTransferredRecord can go to SafeHeadAddress - Add non-ref overload of GetLockCode * Tweaks for benchmark with Mixed locking * Add ILockableKey.CompareLockCodes * Change LockCode to just be hashcode, since we may grow the hash table. * - Make CPR consistency check work without conflict with the key latches in the HashBuckets. - Change some names for clarity. - Pending read completion should return values from any in-memory record, as they are the latest * Remove duplicate opCtx param and removed sessionCtx (aka currentCtx, aka ctx) from calls where FasterSession was also passed (in favor of (new) FasterSession.SessionCtx), where the called method has a type constraint of "where FasterSession : IFasterSession<Key, Value, Input, Output, Context>". Not yet done: converting "whereFasterSession : IFasterSession" constraints to generic to remove the duplicate ctx parameter. * Fix DoLockOp to compare bucket indexes, not KeyCodes * Finish removal of duplicate sessionCtx param from calls where FasterSession was also passed (in favor of (new) FasterSession.SessionCtx), where the called method has a type constraint of "where FasterSession : IFasterSession" (non-generic). This cannot be done in Synchronization (the state machines) due to their use of NullFasterSession. * Fix key duplication in readcache and log: - VerifyInMemoryAddresses should not refresh hei if no splice point is present - FindRecordInMemory checks pendingContext.InitialHash - Move CompleteCopyToTail in ITCTT into the non-readcache section - TryFindRecordInMemory needs to check pc.InitialEntryIndex's readcache bit - Updaters need to scan down to hlog.ReadOnlyAddress to ensure the "key is not at or below LatestLogicalAddress" logic holds - ReadCacheCheckTailAfterSplice needs to check hei.*Address readcache bit * Replace use of SafeHeadAddress with SpinWaitUntilClosed in FindInReadCache * Remove LockingMode.EphemeralOnly add --hashpack arg to FASTER.benchmark * Tweaks for the Standard locking change * fix remote to use LockingMode.Standard * Add DisposeTest comments and more Asserts * Use calls on RecordSource to make it easier to verify correct matching of log and physicalAddress * Temporarily disable LocalMemoryDevice tests for investigation * test removal of DisposeTests * - Fix for CTT to address SameKeyInsertAndCTTTest failure - Add missing arg parsing for MemOnlyCache - Re-enable DeviceType.LocalMemory in tests * [C#] MemOnlyCache sample: improved size tracking, including read cache (#800) * Improved cache size tracking, including read cache * Rename MemOnlyCache to ResizableCacheStore. * update doc * fixes * Updates * ClearBitsForDiskImages should unseal record as well (Q: why was it sealed to begin with?) * Correct clearing of index bits during recovery * Remove RecordInfo sealing * WIP Ephemeral locking at IFunctions-level only, part 1 * Remove unused SessionType enumeration; consolidate duplicate IFasterSession implementations * - Add EphemeralLocking readcache detach/reattach logic - Remove unused ReadFlags.ResetModifiedBit * Rename a couple files * re-add RecordInfo.Seal for Ephemeral locking; remove unused (RMW|Upsert)Action.NeedMoreSpace (this is the default 'false' behavior) * Remove single-key overloads of Lock() and Unlock() * - Update a too-aggressive assert. - CreateLogDevice errors on Windows if path > MAX_PATH minus room for segment#. * Improve previous MAX_PATH fix * Chnge Read of an expired to just return NOTFOUND | Expired rather than tombstoning * RETRY_LATER rather than trying to re-find splice point directly in VerifyInMemoryAddresses --------- Co-authored-by: Badrish Chandramouli <badrishc@microsoft.com>
2023-03-23 21:49:12 +03:00
tester.fht.FindHashBucketEntryForKey(ref key, out var entry);
[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 address = entry.Address;
if (isSplice)
{
[C#] Change locking to use FasterBase hash buckets (#799) * Locking fixes - CompletePending* must also check to lock non-auxiliary records - Ephemeral locking must look for lock evictions as well - InternalLock must check for SpinWaitUntilRecordIsClosed - Replace oneMiss handling in InternalLock - EphemeralSUnlock must follow unlock failures - LockTable should have its own bufferPool - Ensure OnPagesClosed does eviction scans in address order * More locking fixes: - Fix missing unlock of a Tombstoned record in InternalContinuePendingRead - Add more Asserts where ManualLocking requires a locked record - Update and remove obsolete comments * - Remove key-present optimization for SpinWaitUntilRecordIsClosed - Better checking on following records transferred from LockTable in InternalLock(unlock) - Add some additional comments * Fix hash bucket overflow pointer during recovery Fix debug assert logic * WIP on locktable implemented via mainhash overflow buckets * unstaged files missed in previous push * Updates to EphemeralOnly locking for transfer-from-RO/RC * Change LockTableTests to OverflowBucketlockTableTests * Remove RecordInfo.Tentative, .IsIntermediate* * More locking WIP: session.NeedKeyLockCode, test cleanup * WIP locking: Tests build * WIP on mainhash locking: - Add KeyCode creation and sorting and methods public and internal - Remove unnecessary IsLocked (it does not make work with EphemeralOnly and SessionControlled may map to multiple keys) - More tests run now * Most UTs run * More UTs succeed * Still some UT failures * - use XLocks as Tentative indicator for insertions/splices at log tail and readcache insertions - improve readcache consistency checking - clear HasInMemoryLock when HeadAddress goes above srcRecord address following BlockAllocate - rename LockingMode.SessionControlled -> Mixed and other renaming for clarity - remove some unused methods - fix locking sequences in InternalContinuePendingR(ead|MW) * More fixes - Missing 'ref' on recordInfo var in FindAndUnlockTransferredRecord - Improve record allocation checking for below-HA in-memory source and RecordInfo lock clearing if so - Add LockCode to HashEntryInfo in DEBUG * Remove SpinWaitUntilRecordIsClosed; it was only used in ReadCache and in the relevant case we just need to wait for ReadCacheEvict to complete. * - MixedModeTentativeOrClosed is not needed - Add/Improve some ToString()s - Remove unused RecSrc.ClearSrc() - Rename to HasRecordInfoLock - Move ICPRead HandleImmediateRetryStatus outside the lock scope - Consoldiate EphemeralSUnlock(AfterPendingIO) * Streamline locking and FindInMemory calls in InternalXxx * - Change names to pendingContext.Initial*Address and improve setting of these in InternalXxx and handling of these in CompletePending*() and TryFindRecordInMemory. - Also consistentize related param names for readcache and log search to minAddress. * Clean up pending RMW call to CreateNewRecordRMW, per prior changes that make the inputSrc unnecessary. * - Fix stale readcache assignment to recSrc.Log - make searches after pendingIO completion non-inclusive of minAddress - Some ToString() and naming changes for consistency - Remove RecordInfo.IsValidUpdateOrLockSource (superseded by direct call to .IsClosed) * Allow length specification on KeyCode array operations * - Fix check for lock having escaped to eviction zone following BlockAllocate - Add some comments for SafeHeadAddress et al. * - Make sure the readcache bit is set when needed on addresses put into stackCtx.newLogicalAddress. - Rename to HandleNewRecordOnException for clarity * Update remote project * - Make sure FindAndUnlockTransferredRecord can go to SafeHeadAddress - Add non-ref overload of GetLockCode * Tweaks for benchmark with Mixed locking * Add ILockableKey.CompareLockCodes * Change LockCode to just be hashcode, since we may grow the hash table. * - Make CPR consistency check work without conflict with the key latches in the HashBuckets. - Change some names for clarity. - Pending read completion should return values from any in-memory record, as they are the latest * Remove duplicate opCtx param and removed sessionCtx (aka currentCtx, aka ctx) from calls where FasterSession was also passed (in favor of (new) FasterSession.SessionCtx), where the called method has a type constraint of "where FasterSession : IFasterSession<Key, Value, Input, Output, Context>". Not yet done: converting "whereFasterSession : IFasterSession" constraints to generic to remove the duplicate ctx parameter. * Fix DoLockOp to compare bucket indexes, not KeyCodes * Finish removal of duplicate sessionCtx param from calls where FasterSession was also passed (in favor of (new) FasterSession.SessionCtx), where the called method has a type constraint of "where FasterSession : IFasterSession" (non-generic). This cannot be done in Synchronization (the state machines) due to their use of NullFasterSession. * Fix key duplication in readcache and log: - VerifyInMemoryAddresses should not refresh hei if no splice point is present - FindRecordInMemory checks pendingContext.InitialHash - Move CompleteCopyToTail in ITCTT into the non-readcache section - TryFindRecordInMemory needs to check pc.InitialEntryIndex's readcache bit - Updaters need to scan down to hlog.ReadOnlyAddress to ensure the "key is not at or below LatestLogicalAddress" logic holds - ReadCacheCheckTailAfterSplice needs to check hei.*Address readcache bit * Replace use of SafeHeadAddress with SpinWaitUntilClosed in FindInReadCache * Remove LockingMode.EphemeralOnly add --hashpack arg to FASTER.benchmark * Tweaks for the Standard locking change * fix remote to use LockingMode.Standard * Add DisposeTest comments and more Asserts * Use calls on RecordSource to make it easier to verify correct matching of log and physicalAddress * Temporarily disable LocalMemoryDevice tests for investigation * test removal of DisposeTests * - Fix for CTT to address SameKeyInsertAndCTTTest failure - Add missing arg parsing for MemOnlyCache - Re-enable DeviceType.LocalMemory in tests * [C#] MemOnlyCache sample: improved size tracking, including read cache (#800) * Improved cache size tracking, including read cache * Rename MemOnlyCache to ResizableCacheStore. * update doc * fixes * Updates * ClearBitsForDiskImages should unseal record as well (Q: why was it sealed to begin with?) * Correct clearing of index bits during recovery * Remove RecordInfo sealing * WIP Ephemeral locking at IFunctions-level only, part 1 * Remove unused SessionType enumeration; consolidate duplicate IFasterSession implementations * - Add EphemeralLocking readcache detach/reattach logic - Remove unused ReadFlags.ResetModifiedBit * Rename a couple files * re-add RecordInfo.Seal for Ephemeral locking; remove unused (RMW|Upsert)Action.NeedMoreSpace (this is the default 'false' behavior) * Remove single-key overloads of Lock() and Unlock() * - Update a too-aggressive assert. - CreateLogDevice errors on Windows if path > MAX_PATH minus room for segment#. * Improve previous MAX_PATH fix * Chnge Read of an expired to just return NOTFOUND | Expired rather than tombstoning * RETRY_LATER rather than trying to re-find splice point directly in VerifyInMemoryAddresses --------- Co-authored-by: Badrish Chandramouli <badrishc@microsoft.com>
2023-03-23 21:49:12 +03:00
// Get the tail entry for this key's hash chain; there should be exactly one readcache entry for this test.
Assert.IsTrue(entry.ReadCache, "Expected readcache entry in WaitForEvent pt 1");
Assert.GreaterOrEqual(entry.AbsoluteAddress, 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;
[C#] Change locking to use FasterBase hash buckets (#799) * Locking fixes - CompletePending* must also check to lock non-auxiliary records - Ephemeral locking must look for lock evictions as well - InternalLock must check for SpinWaitUntilRecordIsClosed - Replace oneMiss handling in InternalLock - EphemeralSUnlock must follow unlock failures - LockTable should have its own bufferPool - Ensure OnPagesClosed does eviction scans in address order * More locking fixes: - Fix missing unlock of a Tombstoned record in InternalContinuePendingRead - Add more Asserts where ManualLocking requires a locked record - Update and remove obsolete comments * - Remove key-present optimization for SpinWaitUntilRecordIsClosed - Better checking on following records transferred from LockTable in InternalLock(unlock) - Add some additional comments * Fix hash bucket overflow pointer during recovery Fix debug assert logic * WIP on locktable implemented via mainhash overflow buckets * unstaged files missed in previous push * Updates to EphemeralOnly locking for transfer-from-RO/RC * Change LockTableTests to OverflowBucketlockTableTests * Remove RecordInfo.Tentative, .IsIntermediate* * More locking WIP: session.NeedKeyLockCode, test cleanup * WIP locking: Tests build * WIP on mainhash locking: - Add KeyCode creation and sorting and methods public and internal - Remove unnecessary IsLocked (it does not make work with EphemeralOnly and SessionControlled may map to multiple keys) - More tests run now * Most UTs run * More UTs succeed * Still some UT failures * - use XLocks as Tentative indicator for insertions/splices at log tail and readcache insertions - improve readcache consistency checking - clear HasInMemoryLock when HeadAddress goes above srcRecord address following BlockAllocate - rename LockingMode.SessionControlled -> Mixed and other renaming for clarity - remove some unused methods - fix locking sequences in InternalContinuePendingR(ead|MW) * More fixes - Missing 'ref' on recordInfo var in FindAndUnlockTransferredRecord - Improve record allocation checking for below-HA in-memory source and RecordInfo lock clearing if so - Add LockCode to HashEntryInfo in DEBUG * Remove SpinWaitUntilRecordIsClosed; it was only used in ReadCache and in the relevant case we just need to wait for ReadCacheEvict to complete. * - MixedModeTentativeOrClosed is not needed - Add/Improve some ToString()s - Remove unused RecSrc.ClearSrc() - Rename to HasRecordInfoLock - Move ICPRead HandleImmediateRetryStatus outside the lock scope - Consoldiate EphemeralSUnlock(AfterPendingIO) * Streamline locking and FindInMemory calls in InternalXxx * - Change names to pendingContext.Initial*Address and improve setting of these in InternalXxx and handling of these in CompletePending*() and TryFindRecordInMemory. - Also consistentize related param names for readcache and log search to minAddress. * Clean up pending RMW call to CreateNewRecordRMW, per prior changes that make the inputSrc unnecessary. * - Fix stale readcache assignment to recSrc.Log - make searches after pendingIO completion non-inclusive of minAddress - Some ToString() and naming changes for consistency - Remove RecordInfo.IsValidUpdateOrLockSource (superseded by direct call to .IsClosed) * Allow length specification on KeyCode array operations * - Fix check for lock having escaped to eviction zone following BlockAllocate - Add some comments for SafeHeadAddress et al. * - Make sure the readcache bit is set when needed on addresses put into stackCtx.newLogicalAddress. - Rename to HandleNewRecordOnException for clarity * Update remote project * - Make sure FindAndUnlockTransferredRecord can go to SafeHeadAddress - Add non-ref overload of GetLockCode * Tweaks for benchmark with Mixed locking * Add ILockableKey.CompareLockCodes * Change LockCode to just be hashcode, since we may grow the hash table. * - Make CPR consistency check work without conflict with the key latches in the HashBuckets. - Change some names for clarity. - Pending read completion should return values from any in-memory record, as they are the latest * Remove duplicate opCtx param and removed sessionCtx (aka currentCtx, aka ctx) from calls where FasterSession was also passed (in favor of (new) FasterSession.SessionCtx), where the called method has a type constraint of "where FasterSession : IFasterSession<Key, Value, Input, Output, Context>". Not yet done: converting "whereFasterSession : IFasterSession" constraints to generic to remove the duplicate ctx parameter. * Fix DoLockOp to compare bucket indexes, not KeyCodes * Finish removal of duplicate sessionCtx param from calls where FasterSession was also passed (in favor of (new) FasterSession.SessionCtx), where the called method has a type constraint of "where FasterSession : IFasterSession" (non-generic). This cannot be done in Synchronization (the state machines) due to their use of NullFasterSession. * Fix key duplication in readcache and log: - VerifyInMemoryAddresses should not refresh hei if no splice point is present - FindRecordInMemory checks pendingContext.InitialHash - Move CompleteCopyToTail in ITCTT into the non-readcache section - TryFindRecordInMemory needs to check pc.InitialEntryIndex's readcache bit - Updaters need to scan down to hlog.ReadOnlyAddress to ensure the "key is not at or below LatestLogicalAddress" logic holds - ReadCacheCheckTailAfterSplice needs to check hei.*Address readcache bit * Replace use of SafeHeadAddress with SpinWaitUntilClosed in FindInReadCache * Remove LockingMode.EphemeralOnly add --hashpack arg to FASTER.benchmark * Tweaks for the Standard locking change * fix remote to use LockingMode.Standard * Add DisposeTest comments and more Asserts * Use calls on RecordSource to make it easier to verify correct matching of log and physicalAddress * Temporarily disable LocalMemoryDevice tests for investigation * test removal of DisposeTests * - Fix for CTT to address SameKeyInsertAndCTTTest failure - Add missing arg parsing for MemOnlyCache - Re-enable DeviceType.LocalMemory in tests * [C#] MemOnlyCache sample: improved size tracking, including read cache (#800) * Improved cache size tracking, including read cache * Rename MemOnlyCache to ResizableCacheStore. * update doc * fixes * Updates * ClearBitsForDiskImages should unseal record as well (Q: why was it sealed to begin with?) * Correct clearing of index bits during recovery * Remove RecordInfo sealing * WIP Ephemeral locking at IFunctions-level only, part 1 * Remove unused SessionType enumeration; consolidate duplicate IFasterSession implementations * - Add EphemeralLocking readcache detach/reattach logic - Remove unused ReadFlags.ResetModifiedBit * Rename a couple files * re-add RecordInfo.Seal for Ephemeral locking; remove unused (RMW|Upsert)Action.NeedMoreSpace (this is the default 'false' behavior) * Remove single-key overloads of Lock() and Unlock() * - Update a too-aggressive assert. - CreateLogDevice errors on Windows if path > MAX_PATH minus room for segment#. * Improve previous MAX_PATH fix * Chnge Read of an expired to just return NOTFOUND | Expired rather than tombstoning * RETRY_LATER rather than trying to re-find splice point directly in VerifyInMemoryAddresses --------- Co-authored-by: Badrish Chandramouli <badrishc@microsoft.com>
2023-03-23 21:49:12 +03:00
// There should be only one readcache entry for this test. The address we just got may have been kTempInvalidAddress,
// and if not then it should have been a pre-FlushAndEvict()ed record.
Assert.IsFalse(IsReadCache(address));
// Retry will have already inserted something post-FlushAndEvict.
Assert.IsTrue(isRetry || address < tester.fht.hlog.HeadAddress);
[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
}
tester.otherGate.Release();
tester.sutGate.Wait();
[C#] Change locking to use FasterBase hash buckets (#799) * Locking fixes - CompletePending* must also check to lock non-auxiliary records - Ephemeral locking must look for lock evictions as well - InternalLock must check for SpinWaitUntilRecordIsClosed - Replace oneMiss handling in InternalLock - EphemeralSUnlock must follow unlock failures - LockTable should have its own bufferPool - Ensure OnPagesClosed does eviction scans in address order * More locking fixes: - Fix missing unlock of a Tombstoned record in InternalContinuePendingRead - Add more Asserts where ManualLocking requires a locked record - Update and remove obsolete comments * - Remove key-present optimization for SpinWaitUntilRecordIsClosed - Better checking on following records transferred from LockTable in InternalLock(unlock) - Add some additional comments * Fix hash bucket overflow pointer during recovery Fix debug assert logic * WIP on locktable implemented via mainhash overflow buckets * unstaged files missed in previous push * Updates to EphemeralOnly locking for transfer-from-RO/RC * Change LockTableTests to OverflowBucketlockTableTests * Remove RecordInfo.Tentative, .IsIntermediate* * More locking WIP: session.NeedKeyLockCode, test cleanup * WIP locking: Tests build * WIP on mainhash locking: - Add KeyCode creation and sorting and methods public and internal - Remove unnecessary IsLocked (it does not make work with EphemeralOnly and SessionControlled may map to multiple keys) - More tests run now * Most UTs run * More UTs succeed * Still some UT failures * - use XLocks as Tentative indicator for insertions/splices at log tail and readcache insertions - improve readcache consistency checking - clear HasInMemoryLock when HeadAddress goes above srcRecord address following BlockAllocate - rename LockingMode.SessionControlled -> Mixed and other renaming for clarity - remove some unused methods - fix locking sequences in InternalContinuePendingR(ead|MW) * More fixes - Missing 'ref' on recordInfo var in FindAndUnlockTransferredRecord - Improve record allocation checking for below-HA in-memory source and RecordInfo lock clearing if so - Add LockCode to HashEntryInfo in DEBUG * Remove SpinWaitUntilRecordIsClosed; it was only used in ReadCache and in the relevant case we just need to wait for ReadCacheEvict to complete. * - MixedModeTentativeOrClosed is not needed - Add/Improve some ToString()s - Remove unused RecSrc.ClearSrc() - Rename to HasRecordInfoLock - Move ICPRead HandleImmediateRetryStatus outside the lock scope - Consoldiate EphemeralSUnlock(AfterPendingIO) * Streamline locking and FindInMemory calls in InternalXxx * - Change names to pendingContext.Initial*Address and improve setting of these in InternalXxx and handling of these in CompletePending*() and TryFindRecordInMemory. - Also consistentize related param names for readcache and log search to minAddress. * Clean up pending RMW call to CreateNewRecordRMW, per prior changes that make the inputSrc unnecessary. * - Fix stale readcache assignment to recSrc.Log - make searches after pendingIO completion non-inclusive of minAddress - Some ToString() and naming changes for consistency - Remove RecordInfo.IsValidUpdateOrLockSource (superseded by direct call to .IsClosed) * Allow length specification on KeyCode array operations * - Fix check for lock having escaped to eviction zone following BlockAllocate - Add some comments for SafeHeadAddress et al. * - Make sure the readcache bit is set when needed on addresses put into stackCtx.newLogicalAddress. - Rename to HandleNewRecordOnException for clarity * Update remote project * - Make sure FindAndUnlockTransferredRecord can go to SafeHeadAddress - Add non-ref overload of GetLockCode * Tweaks for benchmark with Mixed locking * Add ILockableKey.CompareLockCodes * Change LockCode to just be hashcode, since we may grow the hash table. * - Make CPR consistency check work without conflict with the key latches in the HashBuckets. - Change some names for clarity. - Pending read completion should return values from any in-memory record, as they are the latest * Remove duplicate opCtx param and removed sessionCtx (aka currentCtx, aka ctx) from calls where FasterSession was also passed (in favor of (new) FasterSession.SessionCtx), where the called method has a type constraint of "where FasterSession : IFasterSession<Key, Value, Input, Output, Context>". Not yet done: converting "whereFasterSession : IFasterSession" constraints to generic to remove the duplicate ctx parameter. * Fix DoLockOp to compare bucket indexes, not KeyCodes * Finish removal of duplicate sessionCtx param from calls where FasterSession was also passed (in favor of (new) FasterSession.SessionCtx), where the called method has a type constraint of "where FasterSession : IFasterSession" (non-generic). This cannot be done in Synchronization (the state machines) due to their use of NullFasterSession. * Fix key duplication in readcache and log: - VerifyInMemoryAddresses should not refresh hei if no splice point is present - FindRecordInMemory checks pendingContext.InitialHash - Move CompleteCopyToTail in ITCTT into the non-readcache section - TryFindRecordInMemory needs to check pc.InitialEntryIndex's readcache bit - Updaters need to scan down to hlog.ReadOnlyAddress to ensure the "key is not at or below LatestLogicalAddress" logic holds - ReadCacheCheckTailAfterSplice needs to check hei.*Address readcache bit * Replace use of SafeHeadAddress with SpinWaitUntilClosed in FindInReadCache * Remove LockingMode.EphemeralOnly add --hashpack arg to FASTER.benchmark * Tweaks for the Standard locking change * fix remote to use LockingMode.Standard * Add DisposeTest comments and more Asserts * Use calls on RecordSource to make it easier to verify correct matching of log and physicalAddress * Temporarily disable LocalMemoryDevice tests for investigation * test removal of DisposeTests * - Fix for CTT to address SameKeyInsertAndCTTTest failure - Add missing arg parsing for MemOnlyCache - Re-enable DeviceType.LocalMemory in tests * [C#] MemOnlyCache sample: improved size tracking, including read cache (#800) * Improved cache size tracking, including read cache * Rename MemOnlyCache to ResizableCacheStore. * update doc * fixes * Updates * ClearBitsForDiskImages should unseal record as well (Q: why was it sealed to begin with?) * Correct clearing of index bits during recovery * Remove RecordInfo sealing * WIP Ephemeral locking at IFunctions-level only, part 1 * Remove unused SessionType enumeration; consolidate duplicate IFasterSession implementations * - Add EphemeralLocking readcache detach/reattach logic - Remove unused ReadFlags.ResetModifiedBit * Rename a couple files * re-add RecordInfo.Seal for Ephemeral locking; remove unused (RMW|Upsert)Action.NeedMoreSpace (this is the default 'false' behavior) * Remove single-key overloads of Lock() and Unlock() * - Update a too-aggressive assert. - CreateLogDevice errors on Windows if path > MAX_PATH minus room for segment#. * Improve previous MAX_PATH fix * Chnge Read of an expired to just return NOTFOUND | Expired rather than tombstoning * RETRY_LATER rather than trying to re-find splice point directly in VerifyInMemoryAddresses --------- Co-authored-by: Badrish Chandramouli <badrishc@microsoft.com>
2023-03-23 21:49:12 +03:00
tester.fht.FindHashBucketEntryForKey(ref key, out entry);
[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
// There's a little race where the SUT session could still beat the other session to the CAS
if (!isRetry)
{
[C#] Change locking to use FasterBase hash buckets (#799) * Locking fixes - CompletePending* must also check to lock non-auxiliary records - Ephemeral locking must look for lock evictions as well - InternalLock must check for SpinWaitUntilRecordIsClosed - Replace oneMiss handling in InternalLock - EphemeralSUnlock must follow unlock failures - LockTable should have its own bufferPool - Ensure OnPagesClosed does eviction scans in address order * More locking fixes: - Fix missing unlock of a Tombstoned record in InternalContinuePendingRead - Add more Asserts where ManualLocking requires a locked record - Update and remove obsolete comments * - Remove key-present optimization for SpinWaitUntilRecordIsClosed - Better checking on following records transferred from LockTable in InternalLock(unlock) - Add some additional comments * Fix hash bucket overflow pointer during recovery Fix debug assert logic * WIP on locktable implemented via mainhash overflow buckets * unstaged files missed in previous push * Updates to EphemeralOnly locking for transfer-from-RO/RC * Change LockTableTests to OverflowBucketlockTableTests * Remove RecordInfo.Tentative, .IsIntermediate* * More locking WIP: session.NeedKeyLockCode, test cleanup * WIP locking: Tests build * WIP on mainhash locking: - Add KeyCode creation and sorting and methods public and internal - Remove unnecessary IsLocked (it does not make work with EphemeralOnly and SessionControlled may map to multiple keys) - More tests run now * Most UTs run * More UTs succeed * Still some UT failures * - use XLocks as Tentative indicator for insertions/splices at log tail and readcache insertions - improve readcache consistency checking - clear HasInMemoryLock when HeadAddress goes above srcRecord address following BlockAllocate - rename LockingMode.SessionControlled -> Mixed and other renaming for clarity - remove some unused methods - fix locking sequences in InternalContinuePendingR(ead|MW) * More fixes - Missing 'ref' on recordInfo var in FindAndUnlockTransferredRecord - Improve record allocation checking for below-HA in-memory source and RecordInfo lock clearing if so - Add LockCode to HashEntryInfo in DEBUG * Remove SpinWaitUntilRecordIsClosed; it was only used in ReadCache and in the relevant case we just need to wait for ReadCacheEvict to complete. * - MixedModeTentativeOrClosed is not needed - Add/Improve some ToString()s - Remove unused RecSrc.ClearSrc() - Rename to HasRecordInfoLock - Move ICPRead HandleImmediateRetryStatus outside the lock scope - Consoldiate EphemeralSUnlock(AfterPendingIO) * Streamline locking and FindInMemory calls in InternalXxx * - Change names to pendingContext.Initial*Address and improve setting of these in InternalXxx and handling of these in CompletePending*() and TryFindRecordInMemory. - Also consistentize related param names for readcache and log search to minAddress. * Clean up pending RMW call to CreateNewRecordRMW, per prior changes that make the inputSrc unnecessary. * - Fix stale readcache assignment to recSrc.Log - make searches after pendingIO completion non-inclusive of minAddress - Some ToString() and naming changes for consistency - Remove RecordInfo.IsValidUpdateOrLockSource (superseded by direct call to .IsClosed) * Allow length specification on KeyCode array operations * - Fix check for lock having escaped to eviction zone following BlockAllocate - Add some comments for SafeHeadAddress et al. * - Make sure the readcache bit is set when needed on addresses put into stackCtx.newLogicalAddress. - Rename to HandleNewRecordOnException for clarity * Update remote project * - Make sure FindAndUnlockTransferredRecord can go to SafeHeadAddress - Add non-ref overload of GetLockCode * Tweaks for benchmark with Mixed locking * Add ILockableKey.CompareLockCodes * Change LockCode to just be hashcode, since we may grow the hash table. * - Make CPR consistency check work without conflict with the key latches in the HashBuckets. - Change some names for clarity. - Pending read completion should return values from any in-memory record, as they are the latest * Remove duplicate opCtx param and removed sessionCtx (aka currentCtx, aka ctx) from calls where FasterSession was also passed (in favor of (new) FasterSession.SessionCtx), where the called method has a type constraint of "where FasterSession : IFasterSession<Key, Value, Input, Output, Context>". Not yet done: converting "whereFasterSession : IFasterSession" constraints to generic to remove the duplicate ctx parameter. * Fix DoLockOp to compare bucket indexes, not KeyCodes * Finish removal of duplicate sessionCtx param from calls where FasterSession was also passed (in favor of (new) FasterSession.SessionCtx), where the called method has a type constraint of "where FasterSession : IFasterSession" (non-generic). This cannot be done in Synchronization (the state machines) due to their use of NullFasterSession. * Fix key duplication in readcache and log: - VerifyInMemoryAddresses should not refresh hei if no splice point is present - FindRecordInMemory checks pendingContext.InitialHash - Move CompleteCopyToTail in ITCTT into the non-readcache section - TryFindRecordInMemory needs to check pc.InitialEntryIndex's readcache bit - Updaters need to scan down to hlog.ReadOnlyAddress to ensure the "key is not at or below LatestLogicalAddress" logic holds - ReadCacheCheckTailAfterSplice needs to check hei.*Address readcache bit * Replace use of SafeHeadAddress with SpinWaitUntilClosed in FindInReadCache * Remove LockingMode.EphemeralOnly add --hashpack arg to FASTER.benchmark * Tweaks for the Standard locking change * fix remote to use LockingMode.Standard * Add DisposeTest comments and more Asserts * Use calls on RecordSource to make it easier to verify correct matching of log and physicalAddress * Temporarily disable LocalMemoryDevice tests for investigation * test removal of DisposeTests * - Fix for CTT to address SameKeyInsertAndCTTTest failure - Add missing arg parsing for MemOnlyCache - Re-enable DeviceType.LocalMemory in tests * [C#] MemOnlyCache sample: improved size tracking, including read cache (#800) * Improved cache size tracking, including read cache * Rename MemOnlyCache to ResizableCacheStore. * update doc * fixes * Updates * ClearBitsForDiskImages should unseal record as well (Q: why was it sealed to begin with?) * Correct clearing of index bits during recovery * Remove RecordInfo sealing * WIP Ephemeral locking at IFunctions-level only, part 1 * Remove unused SessionType enumeration; consolidate duplicate IFasterSession implementations * - Add EphemeralLocking readcache detach/reattach logic - Remove unused ReadFlags.ResetModifiedBit * Rename a couple files * re-add RecordInfo.Seal for Ephemeral locking; remove unused (RMW|Upsert)Action.NeedMoreSpace (this is the default 'false' behavior) * Remove single-key overloads of Lock() and Unlock() * - Update a too-aggressive assert. - CreateLogDevice errors on Windows if path > MAX_PATH minus room for segment#. * Improve previous MAX_PATH fix * Chnge Read of an expired to just return NOTFOUND | Expired rather than tombstoning * RETRY_LATER rather than trying to re-find splice point directly in VerifyInMemoryAddresses --------- Co-authored-by: Badrish Chandramouli <badrishc@microsoft.com>
2023-03-23 21:49:12 +03:00
if (isSplice)
[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
{
[C#] Change locking to use FasterBase hash buckets (#799) * Locking fixes - CompletePending* must also check to lock non-auxiliary records - Ephemeral locking must look for lock evictions as well - InternalLock must check for SpinWaitUntilRecordIsClosed - Replace oneMiss handling in InternalLock - EphemeralSUnlock must follow unlock failures - LockTable should have its own bufferPool - Ensure OnPagesClosed does eviction scans in address order * More locking fixes: - Fix missing unlock of a Tombstoned record in InternalContinuePendingRead - Add more Asserts where ManualLocking requires a locked record - Update and remove obsolete comments * - Remove key-present optimization for SpinWaitUntilRecordIsClosed - Better checking on following records transferred from LockTable in InternalLock(unlock) - Add some additional comments * Fix hash bucket overflow pointer during recovery Fix debug assert logic * WIP on locktable implemented via mainhash overflow buckets * unstaged files missed in previous push * Updates to EphemeralOnly locking for transfer-from-RO/RC * Change LockTableTests to OverflowBucketlockTableTests * Remove RecordInfo.Tentative, .IsIntermediate* * More locking WIP: session.NeedKeyLockCode, test cleanup * WIP locking: Tests build * WIP on mainhash locking: - Add KeyCode creation and sorting and methods public and internal - Remove unnecessary IsLocked (it does not make work with EphemeralOnly and SessionControlled may map to multiple keys) - More tests run now * Most UTs run * More UTs succeed * Still some UT failures * - use XLocks as Tentative indicator for insertions/splices at log tail and readcache insertions - improve readcache consistency checking - clear HasInMemoryLock when HeadAddress goes above srcRecord address following BlockAllocate - rename LockingMode.SessionControlled -> Mixed and other renaming for clarity - remove some unused methods - fix locking sequences in InternalContinuePendingR(ead|MW) * More fixes - Missing 'ref' on recordInfo var in FindAndUnlockTransferredRecord - Improve record allocation checking for below-HA in-memory source and RecordInfo lock clearing if so - Add LockCode to HashEntryInfo in DEBUG * Remove SpinWaitUntilRecordIsClosed; it was only used in ReadCache and in the relevant case we just need to wait for ReadCacheEvict to complete. * - MixedModeTentativeOrClosed is not needed - Add/Improve some ToString()s - Remove unused RecSrc.ClearSrc() - Rename to HasRecordInfoLock - Move ICPRead HandleImmediateRetryStatus outside the lock scope - Consoldiate EphemeralSUnlock(AfterPendingIO) * Streamline locking and FindInMemory calls in InternalXxx * - Change names to pendingContext.Initial*Address and improve setting of these in InternalXxx and handling of these in CompletePending*() and TryFindRecordInMemory. - Also consistentize related param names for readcache and log search to minAddress. * Clean up pending RMW call to CreateNewRecordRMW, per prior changes that make the inputSrc unnecessary. * - Fix stale readcache assignment to recSrc.Log - make searches after pendingIO completion non-inclusive of minAddress - Some ToString() and naming changes for consistency - Remove RecordInfo.IsValidUpdateOrLockSource (superseded by direct call to .IsClosed) * Allow length specification on KeyCode array operations * - Fix check for lock having escaped to eviction zone following BlockAllocate - Add some comments for SafeHeadAddress et al. * - Make sure the readcache bit is set when needed on addresses put into stackCtx.newLogicalAddress. - Rename to HandleNewRecordOnException for clarity * Update remote project * - Make sure FindAndUnlockTransferredRecord can go to SafeHeadAddress - Add non-ref overload of GetLockCode * Tweaks for benchmark with Mixed locking * Add ILockableKey.CompareLockCodes * Change LockCode to just be hashcode, since we may grow the hash table. * - Make CPR consistency check work without conflict with the key latches in the HashBuckets. - Change some names for clarity. - Pending read completion should return values from any in-memory record, as they are the latest * Remove duplicate opCtx param and removed sessionCtx (aka currentCtx, aka ctx) from calls where FasterSession was also passed (in favor of (new) FasterSession.SessionCtx), where the called method has a type constraint of "where FasterSession : IFasterSession<Key, Value, Input, Output, Context>". Not yet done: converting "whereFasterSession : IFasterSession" constraints to generic to remove the duplicate ctx parameter. * Fix DoLockOp to compare bucket indexes, not KeyCodes * Finish removal of duplicate sessionCtx param from calls where FasterSession was also passed (in favor of (new) FasterSession.SessionCtx), where the called method has a type constraint of "where FasterSession : IFasterSession" (non-generic). This cannot be done in Synchronization (the state machines) due to their use of NullFasterSession. * Fix key duplication in readcache and log: - VerifyInMemoryAddresses should not refresh hei if no splice point is present - FindRecordInMemory checks pendingContext.InitialHash - Move CompleteCopyToTail in ITCTT into the non-readcache section - TryFindRecordInMemory needs to check pc.InitialEntryIndex's readcache bit - Updaters need to scan down to hlog.ReadOnlyAddress to ensure the "key is not at or below LatestLogicalAddress" logic holds - ReadCacheCheckTailAfterSplice needs to check hei.*Address readcache bit * Replace use of SafeHeadAddress with SpinWaitUntilClosed in FindInReadCache * Remove LockingMode.EphemeralOnly add --hashpack arg to FASTER.benchmark * Tweaks for the Standard locking change * fix remote to use LockingMode.Standard * Add DisposeTest comments and more Asserts * Use calls on RecordSource to make it easier to verify correct matching of log and physicalAddress * Temporarily disable LocalMemoryDevice tests for investigation * test removal of DisposeTests * - Fix for CTT to address SameKeyInsertAndCTTTest failure - Add missing arg parsing for MemOnlyCache - Re-enable DeviceType.LocalMemory in tests * [C#] MemOnlyCache sample: improved size tracking, including read cache (#800) * Improved cache size tracking, including read cache * Rename MemOnlyCache to ResizableCacheStore. * update doc * fixes * Updates * ClearBitsForDiskImages should unseal record as well (Q: why was it sealed to begin with?) * Correct clearing of index bits during recovery * Remove RecordInfo sealing * WIP Ephemeral locking at IFunctions-level only, part 1 * Remove unused SessionType enumeration; consolidate duplicate IFasterSession implementations * - Add EphemeralLocking readcache detach/reattach logic - Remove unused ReadFlags.ResetModifiedBit * Rename a couple files * re-add RecordInfo.Seal for Ephemeral locking; remove unused (RMW|Upsert)Action.NeedMoreSpace (this is the default 'false' behavior) * Remove single-key overloads of Lock() and Unlock() * - Update a too-aggressive assert. - CreateLogDevice errors on Windows if path > MAX_PATH minus room for segment#. * Improve previous MAX_PATH fix * Chnge Read of an expired to just return NOTFOUND | Expired rather than tombstoning * RETRY_LATER rather than trying to re-find splice point directly in VerifyInMemoryAddresses --------- Co-authored-by: Badrish Chandramouli <badrishc@microsoft.com>
2023-03-23 21:49:12 +03:00
// If this is not Standard locking, then we use detach-and-reattach logic on the hash chain. That happens after SingleWriter,
// so 'other' thread may still be in progress . Wait for it.
while (!entry.ReadCache)
[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
{
[C#] Change locking to use FasterBase hash buckets (#799) * Locking fixes - CompletePending* must also check to lock non-auxiliary records - Ephemeral locking must look for lock evictions as well - InternalLock must check for SpinWaitUntilRecordIsClosed - Replace oneMiss handling in InternalLock - EphemeralSUnlock must follow unlock failures - LockTable should have its own bufferPool - Ensure OnPagesClosed does eviction scans in address order * More locking fixes: - Fix missing unlock of a Tombstoned record in InternalContinuePendingRead - Add more Asserts where ManualLocking requires a locked record - Update and remove obsolete comments * - Remove key-present optimization for SpinWaitUntilRecordIsClosed - Better checking on following records transferred from LockTable in InternalLock(unlock) - Add some additional comments * Fix hash bucket overflow pointer during recovery Fix debug assert logic * WIP on locktable implemented via mainhash overflow buckets * unstaged files missed in previous push * Updates to EphemeralOnly locking for transfer-from-RO/RC * Change LockTableTests to OverflowBucketlockTableTests * Remove RecordInfo.Tentative, .IsIntermediate* * More locking WIP: session.NeedKeyLockCode, test cleanup * WIP locking: Tests build * WIP on mainhash locking: - Add KeyCode creation and sorting and methods public and internal - Remove unnecessary IsLocked (it does not make work with EphemeralOnly and SessionControlled may map to multiple keys) - More tests run now * Most UTs run * More UTs succeed * Still some UT failures * - use XLocks as Tentative indicator for insertions/splices at log tail and readcache insertions - improve readcache consistency checking - clear HasInMemoryLock when HeadAddress goes above srcRecord address following BlockAllocate - rename LockingMode.SessionControlled -> Mixed and other renaming for clarity - remove some unused methods - fix locking sequences in InternalContinuePendingR(ead|MW) * More fixes - Missing 'ref' on recordInfo var in FindAndUnlockTransferredRecord - Improve record allocation checking for below-HA in-memory source and RecordInfo lock clearing if so - Add LockCode to HashEntryInfo in DEBUG * Remove SpinWaitUntilRecordIsClosed; it was only used in ReadCache and in the relevant case we just need to wait for ReadCacheEvict to complete. * - MixedModeTentativeOrClosed is not needed - Add/Improve some ToString()s - Remove unused RecSrc.ClearSrc() - Rename to HasRecordInfoLock - Move ICPRead HandleImmediateRetryStatus outside the lock scope - Consoldiate EphemeralSUnlock(AfterPendingIO) * Streamline locking and FindInMemory calls in InternalXxx * - Change names to pendingContext.Initial*Address and improve setting of these in InternalXxx and handling of these in CompletePending*() and TryFindRecordInMemory. - Also consistentize related param names for readcache and log search to minAddress. * Clean up pending RMW call to CreateNewRecordRMW, per prior changes that make the inputSrc unnecessary. * - Fix stale readcache assignment to recSrc.Log - make searches after pendingIO completion non-inclusive of minAddress - Some ToString() and naming changes for consistency - Remove RecordInfo.IsValidUpdateOrLockSource (superseded by direct call to .IsClosed) * Allow length specification on KeyCode array operations * - Fix check for lock having escaped to eviction zone following BlockAllocate - Add some comments for SafeHeadAddress et al. * - Make sure the readcache bit is set when needed on addresses put into stackCtx.newLogicalAddress. - Rename to HandleNewRecordOnException for clarity * Update remote project * - Make sure FindAndUnlockTransferredRecord can go to SafeHeadAddress - Add non-ref overload of GetLockCode * Tweaks for benchmark with Mixed locking * Add ILockableKey.CompareLockCodes * Change LockCode to just be hashcode, since we may grow the hash table. * - Make CPR consistency check work without conflict with the key latches in the HashBuckets. - Change some names for clarity. - Pending read completion should return values from any in-memory record, as they are the latest * Remove duplicate opCtx param and removed sessionCtx (aka currentCtx, aka ctx) from calls where FasterSession was also passed (in favor of (new) FasterSession.SessionCtx), where the called method has a type constraint of "where FasterSession : IFasterSession<Key, Value, Input, Output, Context>". Not yet done: converting "whereFasterSession : IFasterSession" constraints to generic to remove the duplicate ctx parameter. * Fix DoLockOp to compare bucket indexes, not KeyCodes * Finish removal of duplicate sessionCtx param from calls where FasterSession was also passed (in favor of (new) FasterSession.SessionCtx), where the called method has a type constraint of "where FasterSession : IFasterSession" (non-generic). This cannot be done in Synchronization (the state machines) due to their use of NullFasterSession. * Fix key duplication in readcache and log: - VerifyInMemoryAddresses should not refresh hei if no splice point is present - FindRecordInMemory checks pendingContext.InitialHash - Move CompleteCopyToTail in ITCTT into the non-readcache section - TryFindRecordInMemory needs to check pc.InitialEntryIndex's readcache bit - Updaters need to scan down to hlog.ReadOnlyAddress to ensure the "key is not at or below LatestLogicalAddress" logic holds - ReadCacheCheckTailAfterSplice needs to check hei.*Address readcache bit * Replace use of SafeHeadAddress with SpinWaitUntilClosed in FindInReadCache * Remove LockingMode.EphemeralOnly add --hashpack arg to FASTER.benchmark * Tweaks for the Standard locking change * fix remote to use LockingMode.Standard * Add DisposeTest comments and more Asserts * Use calls on RecordSource to make it easier to verify correct matching of log and physicalAddress * Temporarily disable LocalMemoryDevice tests for investigation * test removal of DisposeTests * - Fix for CTT to address SameKeyInsertAndCTTTest failure - Add missing arg parsing for MemOnlyCache - Re-enable DeviceType.LocalMemory in tests * [C#] MemOnlyCache sample: improved size tracking, including read cache (#800) * Improved cache size tracking, including read cache * Rename MemOnlyCache to ResizableCacheStore. * update doc * fixes * Updates * ClearBitsForDiskImages should unseal record as well (Q: why was it sealed to begin with?) * Correct clearing of index bits during recovery * Remove RecordInfo sealing * WIP Ephemeral locking at IFunctions-level only, part 1 * Remove unused SessionType enumeration; consolidate duplicate IFasterSession implementations * - Add EphemeralLocking readcache detach/reattach logic - Remove unused ReadFlags.ResetModifiedBit * Rename a couple files * re-add RecordInfo.Seal for Ephemeral locking; remove unused (RMW|Upsert)Action.NeedMoreSpace (this is the default 'false' behavior) * Remove single-key overloads of Lock() and Unlock() * - Update a too-aggressive assert. - CreateLogDevice errors on Windows if path > MAX_PATH minus room for segment#. * Improve previous MAX_PATH fix * Chnge Read of an expired to just return NOTFOUND | Expired rather than tombstoning * RETRY_LATER rather than trying to re-find splice point directly in VerifyInMemoryAddresses --------- Co-authored-by: Badrish Chandramouli <badrishc@microsoft.com>
2023-03-23 21:49:12 +03:00
Assert.IsFalse(tester.fht.LockTable.IsEnabled, "Standard locking should have spliced directly");
[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
Thread.Yield();
[C#] Change locking to use FasterBase hash buckets (#799) * Locking fixes - CompletePending* must also check to lock non-auxiliary records - Ephemeral locking must look for lock evictions as well - InternalLock must check for SpinWaitUntilRecordIsClosed - Replace oneMiss handling in InternalLock - EphemeralSUnlock must follow unlock failures - LockTable should have its own bufferPool - Ensure OnPagesClosed does eviction scans in address order * More locking fixes: - Fix missing unlock of a Tombstoned record in InternalContinuePendingRead - Add more Asserts where ManualLocking requires a locked record - Update and remove obsolete comments * - Remove key-present optimization for SpinWaitUntilRecordIsClosed - Better checking on following records transferred from LockTable in InternalLock(unlock) - Add some additional comments * Fix hash bucket overflow pointer during recovery Fix debug assert logic * WIP on locktable implemented via mainhash overflow buckets * unstaged files missed in previous push * Updates to EphemeralOnly locking for transfer-from-RO/RC * Change LockTableTests to OverflowBucketlockTableTests * Remove RecordInfo.Tentative, .IsIntermediate* * More locking WIP: session.NeedKeyLockCode, test cleanup * WIP locking: Tests build * WIP on mainhash locking: - Add KeyCode creation and sorting and methods public and internal - Remove unnecessary IsLocked (it does not make work with EphemeralOnly and SessionControlled may map to multiple keys) - More tests run now * Most UTs run * More UTs succeed * Still some UT failures * - use XLocks as Tentative indicator for insertions/splices at log tail and readcache insertions - improve readcache consistency checking - clear HasInMemoryLock when HeadAddress goes above srcRecord address following BlockAllocate - rename LockingMode.SessionControlled -> Mixed and other renaming for clarity - remove some unused methods - fix locking sequences in InternalContinuePendingR(ead|MW) * More fixes - Missing 'ref' on recordInfo var in FindAndUnlockTransferredRecord - Improve record allocation checking for below-HA in-memory source and RecordInfo lock clearing if so - Add LockCode to HashEntryInfo in DEBUG * Remove SpinWaitUntilRecordIsClosed; it was only used in ReadCache and in the relevant case we just need to wait for ReadCacheEvict to complete. * - MixedModeTentativeOrClosed is not needed - Add/Improve some ToString()s - Remove unused RecSrc.ClearSrc() - Rename to HasRecordInfoLock - Move ICPRead HandleImmediateRetryStatus outside the lock scope - Consoldiate EphemeralSUnlock(AfterPendingIO) * Streamline locking and FindInMemory calls in InternalXxx * - Change names to pendingContext.Initial*Address and improve setting of these in InternalXxx and handling of these in CompletePending*() and TryFindRecordInMemory. - Also consistentize related param names for readcache and log search to minAddress. * Clean up pending RMW call to CreateNewRecordRMW, per prior changes that make the inputSrc unnecessary. * - Fix stale readcache assignment to recSrc.Log - make searches after pendingIO completion non-inclusive of minAddress - Some ToString() and naming changes for consistency - Remove RecordInfo.IsValidUpdateOrLockSource (superseded by direct call to .IsClosed) * Allow length specification on KeyCode array operations * - Fix check for lock having escaped to eviction zone following BlockAllocate - Add some comments for SafeHeadAddress et al. * - Make sure the readcache bit is set when needed on addresses put into stackCtx.newLogicalAddress. - Rename to HandleNewRecordOnException for clarity * Update remote project * - Make sure FindAndUnlockTransferredRecord can go to SafeHeadAddress - Add non-ref overload of GetLockCode * Tweaks for benchmark with Mixed locking * Add ILockableKey.CompareLockCodes * Change LockCode to just be hashcode, since we may grow the hash table. * - Make CPR consistency check work without conflict with the key latches in the HashBuckets. - Change some names for clarity. - Pending read completion should return values from any in-memory record, as they are the latest * Remove duplicate opCtx param and removed sessionCtx (aka currentCtx, aka ctx) from calls where FasterSession was also passed (in favor of (new) FasterSession.SessionCtx), where the called method has a type constraint of "where FasterSession : IFasterSession<Key, Value, Input, Output, Context>". Not yet done: converting "whereFasterSession : IFasterSession" constraints to generic to remove the duplicate ctx parameter. * Fix DoLockOp to compare bucket indexes, not KeyCodes * Finish removal of duplicate sessionCtx param from calls where FasterSession was also passed (in favor of (new) FasterSession.SessionCtx), where the called method has a type constraint of "where FasterSession : IFasterSession" (non-generic). This cannot be done in Synchronization (the state machines) due to their use of NullFasterSession. * Fix key duplication in readcache and log: - VerifyInMemoryAddresses should not refresh hei if no splice point is present - FindRecordInMemory checks pendingContext.InitialHash - Move CompleteCopyToTail in ITCTT into the non-readcache section - TryFindRecordInMemory needs to check pc.InitialEntryIndex's readcache bit - Updaters need to scan down to hlog.ReadOnlyAddress to ensure the "key is not at or below LatestLogicalAddress" logic holds - ReadCacheCheckTailAfterSplice needs to check hei.*Address readcache bit * Replace use of SafeHeadAddress with SpinWaitUntilClosed in FindInReadCache * Remove LockingMode.EphemeralOnly add --hashpack arg to FASTER.benchmark * Tweaks for the Standard locking change * fix remote to use LockingMode.Standard * Add DisposeTest comments and more Asserts * Use calls on RecordSource to make it easier to verify correct matching of log and physicalAddress * Temporarily disable LocalMemoryDevice tests for investigation * test removal of DisposeTests * - Fix for CTT to address SameKeyInsertAndCTTTest failure - Add missing arg parsing for MemOnlyCache - Re-enable DeviceType.LocalMemory in tests * [C#] MemOnlyCache sample: improved size tracking, including read cache (#800) * Improved cache size tracking, including read cache * Rename MemOnlyCache to ResizableCacheStore. * update doc * fixes * Updates * ClearBitsForDiskImages should unseal record as well (Q: why was it sealed to begin with?) * Correct clearing of index bits during recovery * Remove RecordInfo sealing * WIP Ephemeral locking at IFunctions-level only, part 1 * Remove unused SessionType enumeration; consolidate duplicate IFasterSession implementations * - Add EphemeralLocking readcache detach/reattach logic - Remove unused ReadFlags.ResetModifiedBit * Rename a couple files * re-add RecordInfo.Seal for Ephemeral locking; remove unused (RMW|Upsert)Action.NeedMoreSpace (this is the default 'false' behavior) * Remove single-key overloads of Lock() and Unlock() * - Update a too-aggressive assert. - CreateLogDevice errors on Windows if path > MAX_PATH minus room for segment#. * Improve previous MAX_PATH fix * Chnge Read of an expired to just return NOTFOUND | Expired rather than tombstoning * RETRY_LATER rather than trying to re-find splice point directly in VerifyInMemoryAddresses --------- Co-authored-by: Badrish Chandramouli <badrishc@microsoft.com>
2023-03-23 21:49:12 +03:00
tester.fht.FindHashBucketEntryForKey(ref key, out entry);
[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
}
[C#] Change locking to use FasterBase hash buckets (#799) * Locking fixes - CompletePending* must also check to lock non-auxiliary records - Ephemeral locking must look for lock evictions as well - InternalLock must check for SpinWaitUntilRecordIsClosed - Replace oneMiss handling in InternalLock - EphemeralSUnlock must follow unlock failures - LockTable should have its own bufferPool - Ensure OnPagesClosed does eviction scans in address order * More locking fixes: - Fix missing unlock of a Tombstoned record in InternalContinuePendingRead - Add more Asserts where ManualLocking requires a locked record - Update and remove obsolete comments * - Remove key-present optimization for SpinWaitUntilRecordIsClosed - Better checking on following records transferred from LockTable in InternalLock(unlock) - Add some additional comments * Fix hash bucket overflow pointer during recovery Fix debug assert logic * WIP on locktable implemented via mainhash overflow buckets * unstaged files missed in previous push * Updates to EphemeralOnly locking for transfer-from-RO/RC * Change LockTableTests to OverflowBucketlockTableTests * Remove RecordInfo.Tentative, .IsIntermediate* * More locking WIP: session.NeedKeyLockCode, test cleanup * WIP locking: Tests build * WIP on mainhash locking: - Add KeyCode creation and sorting and methods public and internal - Remove unnecessary IsLocked (it does not make work with EphemeralOnly and SessionControlled may map to multiple keys) - More tests run now * Most UTs run * More UTs succeed * Still some UT failures * - use XLocks as Tentative indicator for insertions/splices at log tail and readcache insertions - improve readcache consistency checking - clear HasInMemoryLock when HeadAddress goes above srcRecord address following BlockAllocate - rename LockingMode.SessionControlled -> Mixed and other renaming for clarity - remove some unused methods - fix locking sequences in InternalContinuePendingR(ead|MW) * More fixes - Missing 'ref' on recordInfo var in FindAndUnlockTransferredRecord - Improve record allocation checking for below-HA in-memory source and RecordInfo lock clearing if so - Add LockCode to HashEntryInfo in DEBUG * Remove SpinWaitUntilRecordIsClosed; it was only used in ReadCache and in the relevant case we just need to wait for ReadCacheEvict to complete. * - MixedModeTentativeOrClosed is not needed - Add/Improve some ToString()s - Remove unused RecSrc.ClearSrc() - Rename to HasRecordInfoLock - Move ICPRead HandleImmediateRetryStatus outside the lock scope - Consoldiate EphemeralSUnlock(AfterPendingIO) * Streamline locking and FindInMemory calls in InternalXxx * - Change names to pendingContext.Initial*Address and improve setting of these in InternalXxx and handling of these in CompletePending*() and TryFindRecordInMemory. - Also consistentize related param names for readcache and log search to minAddress. * Clean up pending RMW call to CreateNewRecordRMW, per prior changes that make the inputSrc unnecessary. * - Fix stale readcache assignment to recSrc.Log - make searches after pendingIO completion non-inclusive of minAddress - Some ToString() and naming changes for consistency - Remove RecordInfo.IsValidUpdateOrLockSource (superseded by direct call to .IsClosed) * Allow length specification on KeyCode array operations * - Fix check for lock having escaped to eviction zone following BlockAllocate - Add some comments for SafeHeadAddress et al. * - Make sure the readcache bit is set when needed on addresses put into stackCtx.newLogicalAddress. - Rename to HandleNewRecordOnException for clarity * Update remote project * - Make sure FindAndUnlockTransferredRecord can go to SafeHeadAddress - Add non-ref overload of GetLockCode * Tweaks for benchmark with Mixed locking * Add ILockableKey.CompareLockCodes * Change LockCode to just be hashcode, since we may grow the hash table. * - Make CPR consistency check work without conflict with the key latches in the HashBuckets. - Change some names for clarity. - Pending read completion should return values from any in-memory record, as they are the latest * Remove duplicate opCtx param and removed sessionCtx (aka currentCtx, aka ctx) from calls where FasterSession was also passed (in favor of (new) FasterSession.SessionCtx), where the called method has a type constraint of "where FasterSession : IFasterSession<Key, Value, Input, Output, Context>". Not yet done: converting "whereFasterSession : IFasterSession" constraints to generic to remove the duplicate ctx parameter. * Fix DoLockOp to compare bucket indexes, not KeyCodes * Finish removal of duplicate sessionCtx param from calls where FasterSession was also passed (in favor of (new) FasterSession.SessionCtx), where the called method has a type constraint of "where FasterSession : IFasterSession" (non-generic). This cannot be done in Synchronization (the state machines) due to their use of NullFasterSession. * Fix key duplication in readcache and log: - VerifyInMemoryAddresses should not refresh hei if no splice point is present - FindRecordInMemory checks pendingContext.InitialHash - Move CompleteCopyToTail in ITCTT into the non-readcache section - TryFindRecordInMemory needs to check pc.InitialEntryIndex's readcache bit - Updaters need to scan down to hlog.ReadOnlyAddress to ensure the "key is not at or below LatestLogicalAddress" logic holds - ReadCacheCheckTailAfterSplice needs to check hei.*Address readcache bit * Replace use of SafeHeadAddress with SpinWaitUntilClosed in FindInReadCache * Remove LockingMode.EphemeralOnly add --hashpack arg to FASTER.benchmark * Tweaks for the Standard locking change * fix remote to use LockingMode.Standard * Add DisposeTest comments and more Asserts * Use calls on RecordSource to make it easier to verify correct matching of log and physicalAddress * Temporarily disable LocalMemoryDevice tests for investigation * test removal of DisposeTests * - Fix for CTT to address SameKeyInsertAndCTTTest failure - Add missing arg parsing for MemOnlyCache - Re-enable DeviceType.LocalMemory in tests * [C#] MemOnlyCache sample: improved size tracking, including read cache (#800) * Improved cache size tracking, including read cache * Rename MemOnlyCache to ResizableCacheStore. * update doc * fixes * Updates * ClearBitsForDiskImages should unseal record as well (Q: why was it sealed to begin with?) * Correct clearing of index bits during recovery * Remove RecordInfo sealing * WIP Ephemeral locking at IFunctions-level only, part 1 * Remove unused SessionType enumeration; consolidate duplicate IFasterSession implementations * - Add EphemeralLocking readcache detach/reattach logic - Remove unused ReadFlags.ResetModifiedBit * Rename a couple files * re-add RecordInfo.Seal for Ephemeral locking; remove unused (RMW|Upsert)Action.NeedMoreSpace (this is the default 'false' behavior) * Remove single-key overloads of Lock() and Unlock() * - Update a too-aggressive assert. - CreateLogDevice errors on Windows if path > MAX_PATH minus room for segment#. * Improve previous MAX_PATH fix * Chnge Read of an expired to just return NOTFOUND | Expired rather than tombstoning * RETRY_LATER rather than trying to re-find splice point directly in VerifyInMemoryAddresses --------- Co-authored-by: Badrish Chandramouli <badrishc@microsoft.com>
2023-03-23 21:49:12 +03:00
// We're the thread awaiting the splice, so wait until the address in the last readcache record changes.
Assert.IsTrue(entry.ReadCache, "Expected readcache entry in WaitForEvent pt 2");
Assert.GreaterOrEqual(entry.AbsoluteAddress, 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();
}
[C#] Change locking to use FasterBase hash buckets (#799) * Locking fixes - CompletePending* must also check to lock non-auxiliary records - Ephemeral locking must look for lock evictions as well - InternalLock must check for SpinWaitUntilRecordIsClosed - Replace oneMiss handling in InternalLock - EphemeralSUnlock must follow unlock failures - LockTable should have its own bufferPool - Ensure OnPagesClosed does eviction scans in address order * More locking fixes: - Fix missing unlock of a Tombstoned record in InternalContinuePendingRead - Add more Asserts where ManualLocking requires a locked record - Update and remove obsolete comments * - Remove key-present optimization for SpinWaitUntilRecordIsClosed - Better checking on following records transferred from LockTable in InternalLock(unlock) - Add some additional comments * Fix hash bucket overflow pointer during recovery Fix debug assert logic * WIP on locktable implemented via mainhash overflow buckets * unstaged files missed in previous push * Updates to EphemeralOnly locking for transfer-from-RO/RC * Change LockTableTests to OverflowBucketlockTableTests * Remove RecordInfo.Tentative, .IsIntermediate* * More locking WIP: session.NeedKeyLockCode, test cleanup * WIP locking: Tests build * WIP on mainhash locking: - Add KeyCode creation and sorting and methods public and internal - Remove unnecessary IsLocked (it does not make work with EphemeralOnly and SessionControlled may map to multiple keys) - More tests run now * Most UTs run * More UTs succeed * Still some UT failures * - use XLocks as Tentative indicator for insertions/splices at log tail and readcache insertions - improve readcache consistency checking - clear HasInMemoryLock when HeadAddress goes above srcRecord address following BlockAllocate - rename LockingMode.SessionControlled -> Mixed and other renaming for clarity - remove some unused methods - fix locking sequences in InternalContinuePendingR(ead|MW) * More fixes - Missing 'ref' on recordInfo var in FindAndUnlockTransferredRecord - Improve record allocation checking for below-HA in-memory source and RecordInfo lock clearing if so - Add LockCode to HashEntryInfo in DEBUG * Remove SpinWaitUntilRecordIsClosed; it was only used in ReadCache and in the relevant case we just need to wait for ReadCacheEvict to complete. * - MixedModeTentativeOrClosed is not needed - Add/Improve some ToString()s - Remove unused RecSrc.ClearSrc() - Rename to HasRecordInfoLock - Move ICPRead HandleImmediateRetryStatus outside the lock scope - Consoldiate EphemeralSUnlock(AfterPendingIO) * Streamline locking and FindInMemory calls in InternalXxx * - Change names to pendingContext.Initial*Address and improve setting of these in InternalXxx and handling of these in CompletePending*() and TryFindRecordInMemory. - Also consistentize related param names for readcache and log search to minAddress. * Clean up pending RMW call to CreateNewRecordRMW, per prior changes that make the inputSrc unnecessary. * - Fix stale readcache assignment to recSrc.Log - make searches after pendingIO completion non-inclusive of minAddress - Some ToString() and naming changes for consistency - Remove RecordInfo.IsValidUpdateOrLockSource (superseded by direct call to .IsClosed) * Allow length specification on KeyCode array operations * - Fix check for lock having escaped to eviction zone following BlockAllocate - Add some comments for SafeHeadAddress et al. * - Make sure the readcache bit is set when needed on addresses put into stackCtx.newLogicalAddress. - Rename to HandleNewRecordOnException for clarity * Update remote project * - Make sure FindAndUnlockTransferredRecord can go to SafeHeadAddress - Add non-ref overload of GetLockCode * Tweaks for benchmark with Mixed locking * Add ILockableKey.CompareLockCodes * Change LockCode to just be hashcode, since we may grow the hash table. * - Make CPR consistency check work without conflict with the key latches in the HashBuckets. - Change some names for clarity. - Pending read completion should return values from any in-memory record, as they are the latest * Remove duplicate opCtx param and removed sessionCtx (aka currentCtx, aka ctx) from calls where FasterSession was also passed (in favor of (new) FasterSession.SessionCtx), where the called method has a type constraint of "where FasterSession : IFasterSession<Key, Value, Input, Output, Context>". Not yet done: converting "whereFasterSession : IFasterSession" constraints to generic to remove the duplicate ctx parameter. * Fix DoLockOp to compare bucket indexes, not KeyCodes * Finish removal of duplicate sessionCtx param from calls where FasterSession was also passed (in favor of (new) FasterSession.SessionCtx), where the called method has a type constraint of "where FasterSession : IFasterSession" (non-generic). This cannot be done in Synchronization (the state machines) due to their use of NullFasterSession. * Fix key duplication in readcache and log: - VerifyInMemoryAddresses should not refresh hei if no splice point is present - FindRecordInMemory checks pendingContext.InitialHash - Move CompleteCopyToTail in ITCTT into the non-readcache section - TryFindRecordInMemory needs to check pc.InitialEntryIndex's readcache bit - Updaters need to scan down to hlog.ReadOnlyAddress to ensure the "key is not at or below LatestLogicalAddress" logic holds - ReadCacheCheckTailAfterSplice needs to check hei.*Address readcache bit * Replace use of SafeHeadAddress with SpinWaitUntilClosed in FindInReadCache * Remove LockingMode.EphemeralOnly add --hashpack arg to FASTER.benchmark * Tweaks for the Standard locking change * fix remote to use LockingMode.Standard * Add DisposeTest comments and more Asserts * Use calls on RecordSource to make it easier to verify correct matching of log and physicalAddress * Temporarily disable LocalMemoryDevice tests for investigation * test removal of DisposeTests * - Fix for CTT to address SameKeyInsertAndCTTTest failure - Add missing arg parsing for MemOnlyCache - Re-enable DeviceType.LocalMemory in tests * [C#] MemOnlyCache sample: improved size tracking, including read cache (#800) * Improved cache size tracking, including read cache * Rename MemOnlyCache to ResizableCacheStore. * update doc * fixes * Updates * ClearBitsForDiskImages should unseal record as well (Q: why was it sealed to begin with?) * Correct clearing of index bits during recovery * Remove RecordInfo sealing * WIP Ephemeral locking at IFunctions-level only, part 1 * Remove unused SessionType enumeration; consolidate duplicate IFasterSession implementations * - Add EphemeralLocking readcache detach/reattach logic - Remove unused ReadFlags.ResetModifiedBit * Rename a couple files * re-add RecordInfo.Seal for Ephemeral locking; remove unused (RMW|Upsert)Action.NeedMoreSpace (this is the default 'false' behavior) * Remove single-key overloads of Lock() and Unlock() * - Update a too-aggressive assert. - CreateLogDevice errors on Windows if path > MAX_PATH minus room for segment#. * Improve previous MAX_PATH fix * Chnge Read of an expired to just return NOTFOUND | Expired rather than tombstoning * RETRY_LATER rather than trying to re-find splice point directly in VerifyInMemoryAddresses --------- Co-authored-by: Badrish Chandramouli <badrishc@microsoft.com>
2023-03-23 21:49:12 +03:00
Assert.IsFalse(IsReadCache(recordInfo.PreviousAddress));
Assert.IsTrue(recordInfo.PreviousAddress >= tester.fht.hlog.HeadAddress);
}
else
{
// We're not the splice thread, so wait until the address in the hash entry changes.
while (entry.Address == address)
{
Thread.Yield();
tester.fht.FindHashBucketEntryForKey(ref key, out entry);
}
[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
}
}
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([Values(ConcurrencyControlMode.RecordIsolation, ConcurrencyControlMode.None)] ConcurrencyControlMode concurrencyControlMode)
[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")]
[C#] Change locking to use FasterBase hash buckets (#799) * Locking fixes - CompletePending* must also check to lock non-auxiliary records - Ephemeral locking must look for lock evictions as well - InternalLock must check for SpinWaitUntilRecordIsClosed - Replace oneMiss handling in InternalLock - EphemeralSUnlock must follow unlock failures - LockTable should have its own bufferPool - Ensure OnPagesClosed does eviction scans in address order * More locking fixes: - Fix missing unlock of a Tombstoned record in InternalContinuePendingRead - Add more Asserts where ManualLocking requires a locked record - Update and remove obsolete comments * - Remove key-present optimization for SpinWaitUntilRecordIsClosed - Better checking on following records transferred from LockTable in InternalLock(unlock) - Add some additional comments * Fix hash bucket overflow pointer during recovery Fix debug assert logic * WIP on locktable implemented via mainhash overflow buckets * unstaged files missed in previous push * Updates to EphemeralOnly locking for transfer-from-RO/RC * Change LockTableTests to OverflowBucketlockTableTests * Remove RecordInfo.Tentative, .IsIntermediate* * More locking WIP: session.NeedKeyLockCode, test cleanup * WIP locking: Tests build * WIP on mainhash locking: - Add KeyCode creation and sorting and methods public and internal - Remove unnecessary IsLocked (it does not make work with EphemeralOnly and SessionControlled may map to multiple keys) - More tests run now * Most UTs run * More UTs succeed * Still some UT failures * - use XLocks as Tentative indicator for insertions/splices at log tail and readcache insertions - improve readcache consistency checking - clear HasInMemoryLock when HeadAddress goes above srcRecord address following BlockAllocate - rename LockingMode.SessionControlled -> Mixed and other renaming for clarity - remove some unused methods - fix locking sequences in InternalContinuePendingR(ead|MW) * More fixes - Missing 'ref' on recordInfo var in FindAndUnlockTransferredRecord - Improve record allocation checking for below-HA in-memory source and RecordInfo lock clearing if so - Add LockCode to HashEntryInfo in DEBUG * Remove SpinWaitUntilRecordIsClosed; it was only used in ReadCache and in the relevant case we just need to wait for ReadCacheEvict to complete. * - MixedModeTentativeOrClosed is not needed - Add/Improve some ToString()s - Remove unused RecSrc.ClearSrc() - Rename to HasRecordInfoLock - Move ICPRead HandleImmediateRetryStatus outside the lock scope - Consoldiate EphemeralSUnlock(AfterPendingIO) * Streamline locking and FindInMemory calls in InternalXxx * - Change names to pendingContext.Initial*Address and improve setting of these in InternalXxx and handling of these in CompletePending*() and TryFindRecordInMemory. - Also consistentize related param names for readcache and log search to minAddress. * Clean up pending RMW call to CreateNewRecordRMW, per prior changes that make the inputSrc unnecessary. * - Fix stale readcache assignment to recSrc.Log - make searches after pendingIO completion non-inclusive of minAddress - Some ToString() and naming changes for consistency - Remove RecordInfo.IsValidUpdateOrLockSource (superseded by direct call to .IsClosed) * Allow length specification on KeyCode array operations * - Fix check for lock having escaped to eviction zone following BlockAllocate - Add some comments for SafeHeadAddress et al. * - Make sure the readcache bit is set when needed on addresses put into stackCtx.newLogicalAddress. - Rename to HandleNewRecordOnException for clarity * Update remote project * - Make sure FindAndUnlockTransferredRecord can go to SafeHeadAddress - Add non-ref overload of GetLockCode * Tweaks for benchmark with Mixed locking * Add ILockableKey.CompareLockCodes * Change LockCode to just be hashcode, since we may grow the hash table. * - Make CPR consistency check work without conflict with the key latches in the HashBuckets. - Change some names for clarity. - Pending read completion should return values from any in-memory record, as they are the latest * Remove duplicate opCtx param and removed sessionCtx (aka currentCtx, aka ctx) from calls where FasterSession was also passed (in favor of (new) FasterSession.SessionCtx), where the called method has a type constraint of "where FasterSession : IFasterSession<Key, Value, Input, Output, Context>". Not yet done: converting "whereFasterSession : IFasterSession" constraints to generic to remove the duplicate ctx parameter. * Fix DoLockOp to compare bucket indexes, not KeyCodes * Finish removal of duplicate sessionCtx param from calls where FasterSession was also passed (in favor of (new) FasterSession.SessionCtx), where the called method has a type constraint of "where FasterSession : IFasterSession" (non-generic). This cannot be done in Synchronization (the state machines) due to their use of NullFasterSession. * Fix key duplication in readcache and log: - VerifyInMemoryAddresses should not refresh hei if no splice point is present - FindRecordInMemory checks pendingContext.InitialHash - Move CompleteCopyToTail in ITCTT into the non-readcache section - TryFindRecordInMemory needs to check pc.InitialEntryIndex's readcache bit - Updaters need to scan down to hlog.ReadOnlyAddress to ensure the "key is not at or below LatestLogicalAddress" logic holds - ReadCacheCheckTailAfterSplice needs to check hei.*Address readcache bit * Replace use of SafeHeadAddress with SpinWaitUntilClosed in FindInReadCache * Remove LockingMode.EphemeralOnly add --hashpack arg to FASTER.benchmark * Tweaks for the Standard locking change * fix remote to use LockingMode.Standard * Add DisposeTest comments and more Asserts * Use calls on RecordSource to make it easier to verify correct matching of log and physicalAddress * Temporarily disable LocalMemoryDevice tests for investigation * test removal of DisposeTests * - Fix for CTT to address SameKeyInsertAndCTTTest failure - Add missing arg parsing for MemOnlyCache - Re-enable DeviceType.LocalMemory in tests * [C#] MemOnlyCache sample: improved size tracking, including read cache (#800) * Improved cache size tracking, including read cache * Rename MemOnlyCache to ResizableCacheStore. * update doc * fixes * Updates * ClearBitsForDiskImages should unseal record as well (Q: why was it sealed to begin with?) * Correct clearing of index bits during recovery * Remove RecordInfo sealing * WIP Ephemeral locking at IFunctions-level only, part 1 * Remove unused SessionType enumeration; consolidate duplicate IFasterSession implementations * - Add EphemeralLocking readcache detach/reattach logic - Remove unused ReadFlags.ResetModifiedBit * Rename a couple files * re-add RecordInfo.Seal for Ephemeral locking; remove unused (RMW|Upsert)Action.NeedMoreSpace (this is the default 'false' behavior) * Remove single-key overloads of Lock() and Unlock() * - Update a too-aggressive assert. - CreateLogDevice errors on Windows if path > MAX_PATH minus room for segment#. * Improve previous MAX_PATH fix * Chnge Read of an expired to just return NOTFOUND | Expired rather than tombstoning * RETRY_LATER rather than trying to re-find splice point directly in VerifyInMemoryAddresses --------- Co-authored-by: Badrish Chandramouli <badrishc@microsoft.com>
2023-03-23 21:49:12 +03:00
public void DisposeInitialUpdater2Threads([Values(FlushMode.NoFlush, FlushMode.OnDisk)] FlushMode flushMode,
[Values(ConcurrencyControlMode.RecordIsolation, ConcurrencyControlMode.None)] ConcurrencyControlMode concurrencyControlMode)
[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")]
[C#] Change locking to use FasterBase hash buckets (#799) * Locking fixes - CompletePending* must also check to lock non-auxiliary records - Ephemeral locking must look for lock evictions as well - InternalLock must check for SpinWaitUntilRecordIsClosed - Replace oneMiss handling in InternalLock - EphemeralSUnlock must follow unlock failures - LockTable should have its own bufferPool - Ensure OnPagesClosed does eviction scans in address order * More locking fixes: - Fix missing unlock of a Tombstoned record in InternalContinuePendingRead - Add more Asserts where ManualLocking requires a locked record - Update and remove obsolete comments * - Remove key-present optimization for SpinWaitUntilRecordIsClosed - Better checking on following records transferred from LockTable in InternalLock(unlock) - Add some additional comments * Fix hash bucket overflow pointer during recovery Fix debug assert logic * WIP on locktable implemented via mainhash overflow buckets * unstaged files missed in previous push * Updates to EphemeralOnly locking for transfer-from-RO/RC * Change LockTableTests to OverflowBucketlockTableTests * Remove RecordInfo.Tentative, .IsIntermediate* * More locking WIP: session.NeedKeyLockCode, test cleanup * WIP locking: Tests build * WIP on mainhash locking: - Add KeyCode creation and sorting and methods public and internal - Remove unnecessary IsLocked (it does not make work with EphemeralOnly and SessionControlled may map to multiple keys) - More tests run now * Most UTs run * More UTs succeed * Still some UT failures * - use XLocks as Tentative indicator for insertions/splices at log tail and readcache insertions - improve readcache consistency checking - clear HasInMemoryLock when HeadAddress goes above srcRecord address following BlockAllocate - rename LockingMode.SessionControlled -> Mixed and other renaming for clarity - remove some unused methods - fix locking sequences in InternalContinuePendingR(ead|MW) * More fixes - Missing 'ref' on recordInfo var in FindAndUnlockTransferredRecord - Improve record allocation checking for below-HA in-memory source and RecordInfo lock clearing if so - Add LockCode to HashEntryInfo in DEBUG * Remove SpinWaitUntilRecordIsClosed; it was only used in ReadCache and in the relevant case we just need to wait for ReadCacheEvict to complete. * - MixedModeTentativeOrClosed is not needed - Add/Improve some ToString()s - Remove unused RecSrc.ClearSrc() - Rename to HasRecordInfoLock - Move ICPRead HandleImmediateRetryStatus outside the lock scope - Consoldiate EphemeralSUnlock(AfterPendingIO) * Streamline locking and FindInMemory calls in InternalXxx * - Change names to pendingContext.Initial*Address and improve setting of these in InternalXxx and handling of these in CompletePending*() and TryFindRecordInMemory. - Also consistentize related param names for readcache and log search to minAddress. * Clean up pending RMW call to CreateNewRecordRMW, per prior changes that make the inputSrc unnecessary. * - Fix stale readcache assignment to recSrc.Log - make searches after pendingIO completion non-inclusive of minAddress - Some ToString() and naming changes for consistency - Remove RecordInfo.IsValidUpdateOrLockSource (superseded by direct call to .IsClosed) * Allow length specification on KeyCode array operations * - Fix check for lock having escaped to eviction zone following BlockAllocate - Add some comments for SafeHeadAddress et al. * - Make sure the readcache bit is set when needed on addresses put into stackCtx.newLogicalAddress. - Rename to HandleNewRecordOnException for clarity * Update remote project * - Make sure FindAndUnlockTransferredRecord can go to SafeHeadAddress - Add non-ref overload of GetLockCode * Tweaks for benchmark with Mixed locking * Add ILockableKey.CompareLockCodes * Change LockCode to just be hashcode, since we may grow the hash table. * - Make CPR consistency check work without conflict with the key latches in the HashBuckets. - Change some names for clarity. - Pending read completion should return values from any in-memory record, as they are the latest * Remove duplicate opCtx param and removed sessionCtx (aka currentCtx, aka ctx) from calls where FasterSession was also passed (in favor of (new) FasterSession.SessionCtx), where the called method has a type constraint of "where FasterSession : IFasterSession<Key, Value, Input, Output, Context>". Not yet done: converting "whereFasterSession : IFasterSession" constraints to generic to remove the duplicate ctx parameter. * Fix DoLockOp to compare bucket indexes, not KeyCodes * Finish removal of duplicate sessionCtx param from calls where FasterSession was also passed (in favor of (new) FasterSession.SessionCtx), where the called method has a type constraint of "where FasterSession : IFasterSession" (non-generic). This cannot be done in Synchronization (the state machines) due to their use of NullFasterSession. * Fix key duplication in readcache and log: - VerifyInMemoryAddresses should not refresh hei if no splice point is present - FindRecordInMemory checks pendingContext.InitialHash - Move CompleteCopyToTail in ITCTT into the non-readcache section - TryFindRecordInMemory needs to check pc.InitialEntryIndex's readcache bit - Updaters need to scan down to hlog.ReadOnlyAddress to ensure the "key is not at or below LatestLogicalAddress" logic holds - ReadCacheCheckTailAfterSplice needs to check hei.*Address readcache bit * Replace use of SafeHeadAddress with SpinWaitUntilClosed in FindInReadCache * Remove LockingMode.EphemeralOnly add --hashpack arg to FASTER.benchmark * Tweaks for the Standard locking change * fix remote to use LockingMode.Standard * Add DisposeTest comments and more Asserts * Use calls on RecordSource to make it easier to verify correct matching of log and physicalAddress * Temporarily disable LocalMemoryDevice tests for investigation * test removal of DisposeTests * - Fix for CTT to address SameKeyInsertAndCTTTest failure - Add missing arg parsing for MemOnlyCache - Re-enable DeviceType.LocalMemory in tests * [C#] MemOnlyCache sample: improved size tracking, including read cache (#800) * Improved cache size tracking, including read cache * Rename MemOnlyCache to ResizableCacheStore. * update doc * fixes * Updates * ClearBitsForDiskImages should unseal record as well (Q: why was it sealed to begin with?) * Correct clearing of index bits during recovery * Remove RecordInfo sealing * WIP Ephemeral locking at IFunctions-level only, part 1 * Remove unused SessionType enumeration; consolidate duplicate IFasterSession implementations * - Add EphemeralLocking readcache detach/reattach logic - Remove unused ReadFlags.ResetModifiedBit * Rename a couple files * re-add RecordInfo.Seal for Ephemeral locking; remove unused (RMW|Upsert)Action.NeedMoreSpace (this is the default 'false' behavior) * Remove single-key overloads of Lock() and Unlock() * - Update a too-aggressive assert. - CreateLogDevice errors on Windows if path > MAX_PATH minus room for segment#. * Improve previous MAX_PATH fix * Chnge Read of an expired to just return NOTFOUND | Expired rather than tombstoning * RETRY_LATER rather than trying to re-find splice point directly in VerifyInMemoryAddresses --------- Co-authored-by: Badrish Chandramouli <badrishc@microsoft.com>
2023-03-23 21:49:12 +03:00
public void DisposeCopyUpdater2Threads([Values(FlushMode.ReadOnly, FlushMode.OnDisk)] FlushMode flushMode,
[Values(ConcurrencyControlMode.RecordIsolation, ConcurrencyControlMode.None)] ConcurrencyControlMode concurrencyControlMode)
[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)
[C#] Change locking to use FasterBase hash buckets (#799) * Locking fixes - CompletePending* must also check to lock non-auxiliary records - Ephemeral locking must look for lock evictions as well - InternalLock must check for SpinWaitUntilRecordIsClosed - Replace oneMiss handling in InternalLock - EphemeralSUnlock must follow unlock failures - LockTable should have its own bufferPool - Ensure OnPagesClosed does eviction scans in address order * More locking fixes: - Fix missing unlock of a Tombstoned record in InternalContinuePendingRead - Add more Asserts where ManualLocking requires a locked record - Update and remove obsolete comments * - Remove key-present optimization for SpinWaitUntilRecordIsClosed - Better checking on following records transferred from LockTable in InternalLock(unlock) - Add some additional comments * Fix hash bucket overflow pointer during recovery Fix debug assert logic * WIP on locktable implemented via mainhash overflow buckets * unstaged files missed in previous push * Updates to EphemeralOnly locking for transfer-from-RO/RC * Change LockTableTests to OverflowBucketlockTableTests * Remove RecordInfo.Tentative, .IsIntermediate* * More locking WIP: session.NeedKeyLockCode, test cleanup * WIP locking: Tests build * WIP on mainhash locking: - Add KeyCode creation and sorting and methods public and internal - Remove unnecessary IsLocked (it does not make work with EphemeralOnly and SessionControlled may map to multiple keys) - More tests run now * Most UTs run * More UTs succeed * Still some UT failures * - use XLocks as Tentative indicator for insertions/splices at log tail and readcache insertions - improve readcache consistency checking - clear HasInMemoryLock when HeadAddress goes above srcRecord address following BlockAllocate - rename LockingMode.SessionControlled -> Mixed and other renaming for clarity - remove some unused methods - fix locking sequences in InternalContinuePendingR(ead|MW) * More fixes - Missing 'ref' on recordInfo var in FindAndUnlockTransferredRecord - Improve record allocation checking for below-HA in-memory source and RecordInfo lock clearing if so - Add LockCode to HashEntryInfo in DEBUG * Remove SpinWaitUntilRecordIsClosed; it was only used in ReadCache and in the relevant case we just need to wait for ReadCacheEvict to complete. * - MixedModeTentativeOrClosed is not needed - Add/Improve some ToString()s - Remove unused RecSrc.ClearSrc() - Rename to HasRecordInfoLock - Move ICPRead HandleImmediateRetryStatus outside the lock scope - Consoldiate EphemeralSUnlock(AfterPendingIO) * Streamline locking and FindInMemory calls in InternalXxx * - Change names to pendingContext.Initial*Address and improve setting of these in InternalXxx and handling of these in CompletePending*() and TryFindRecordInMemory. - Also consistentize related param names for readcache and log search to minAddress. * Clean up pending RMW call to CreateNewRecordRMW, per prior changes that make the inputSrc unnecessary. * - Fix stale readcache assignment to recSrc.Log - make searches after pendingIO completion non-inclusive of minAddress - Some ToString() and naming changes for consistency - Remove RecordInfo.IsValidUpdateOrLockSource (superseded by direct call to .IsClosed) * Allow length specification on KeyCode array operations * - Fix check for lock having escaped to eviction zone following BlockAllocate - Add some comments for SafeHeadAddress et al. * - Make sure the readcache bit is set when needed on addresses put into stackCtx.newLogicalAddress. - Rename to HandleNewRecordOnException for clarity * Update remote project * - Make sure FindAndUnlockTransferredRecord can go to SafeHeadAddress - Add non-ref overload of GetLockCode * Tweaks for benchmark with Mixed locking * Add ILockableKey.CompareLockCodes * Change LockCode to just be hashcode, since we may grow the hash table. * - Make CPR consistency check work without conflict with the key latches in the HashBuckets. - Change some names for clarity. - Pending read completion should return values from any in-memory record, as they are the latest * Remove duplicate opCtx param and removed sessionCtx (aka currentCtx, aka ctx) from calls where FasterSession was also passed (in favor of (new) FasterSession.SessionCtx), where the called method has a type constraint of "where FasterSession : IFasterSession<Key, Value, Input, Output, Context>". Not yet done: converting "whereFasterSession : IFasterSession" constraints to generic to remove the duplicate ctx parameter. * Fix DoLockOp to compare bucket indexes, not KeyCodes * Finish removal of duplicate sessionCtx param from calls where FasterSession was also passed (in favor of (new) FasterSession.SessionCtx), where the called method has a type constraint of "where FasterSession : IFasterSession" (non-generic). This cannot be done in Synchronization (the state machines) due to their use of NullFasterSession. * Fix key duplication in readcache and log: - VerifyInMemoryAddresses should not refresh hei if no splice point is present - FindRecordInMemory checks pendingContext.InitialHash - Move CompleteCopyToTail in ITCTT into the non-readcache section - TryFindRecordInMemory needs to check pc.InitialEntryIndex's readcache bit - Updaters need to scan down to hlog.ReadOnlyAddress to ensure the "key is not at or below LatestLogicalAddress" logic holds - ReadCacheCheckTailAfterSplice needs to check hei.*Address readcache bit * Replace use of SafeHeadAddress with SpinWaitUntilClosed in FindInReadCache * Remove LockingMode.EphemeralOnly add --hashpack arg to FASTER.benchmark * Tweaks for the Standard locking change * fix remote to use LockingMode.Standard * Add DisposeTest comments and more Asserts * Use calls on RecordSource to make it easier to verify correct matching of log and physicalAddress * Temporarily disable LocalMemoryDevice tests for investigation * test removal of DisposeTests * - Fix for CTT to address SameKeyInsertAndCTTTest failure - Add missing arg parsing for MemOnlyCache - Re-enable DeviceType.LocalMemory in tests * [C#] MemOnlyCache sample: improved size tracking, including read cache (#800) * Improved cache size tracking, including read cache * Rename MemOnlyCache to ResizableCacheStore. * update doc * fixes * Updates * ClearBitsForDiskImages should unseal record as well (Q: why was it sealed to begin with?) * Correct clearing of index bits during recovery * Remove RecordInfo sealing * WIP Ephemeral locking at IFunctions-level only, part 1 * Remove unused SessionType enumeration; consolidate duplicate IFasterSession implementations * - Add EphemeralLocking readcache detach/reattach logic - Remove unused ReadFlags.ResetModifiedBit * Rename a couple files * re-add RecordInfo.Seal for Ephemeral locking; remove unused (RMW|Upsert)Action.NeedMoreSpace (this is the default 'false' behavior) * Remove single-key overloads of Lock() and Unlock() * - Update a too-aggressive assert. - CreateLogDevice errors on Windows if path > MAX_PATH minus room for segment#. * Improve previous MAX_PATH fix * Chnge Read of an expired to just return NOTFOUND | Expired rather than tombstoning * RETRY_LATER rather than trying to re-find splice point directly in VerifyInMemoryAddresses --------- Co-authored-by: Badrish Chandramouli <badrishc@microsoft.com>
2023-03-23 21:49:12 +03:00
// SUT records InitialEntryAddress with the original hash entry address
// SUT goes pending, gets to InternalContinuePendingRMW, calls CreateNewRecordRMW, which calls CopyUpdater
// SUT (in CopyUpdater) signals Other, then blocks
// 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
[C#] Change locking to use FasterBase hash buckets (#799) * Locking fixes - CompletePending* must also check to lock non-auxiliary records - Ephemeral locking must look for lock evictions as well - InternalLock must check for SpinWaitUntilRecordIsClosed - Replace oneMiss handling in InternalLock - EphemeralSUnlock must follow unlock failures - LockTable should have its own bufferPool - Ensure OnPagesClosed does eviction scans in address order * More locking fixes: - Fix missing unlock of a Tombstoned record in InternalContinuePendingRead - Add more Asserts where ManualLocking requires a locked record - Update and remove obsolete comments * - Remove key-present optimization for SpinWaitUntilRecordIsClosed - Better checking on following records transferred from LockTable in InternalLock(unlock) - Add some additional comments * Fix hash bucket overflow pointer during recovery Fix debug assert logic * WIP on locktable implemented via mainhash overflow buckets * unstaged files missed in previous push * Updates to EphemeralOnly locking for transfer-from-RO/RC * Change LockTableTests to OverflowBucketlockTableTests * Remove RecordInfo.Tentative, .IsIntermediate* * More locking WIP: session.NeedKeyLockCode, test cleanup * WIP locking: Tests build * WIP on mainhash locking: - Add KeyCode creation and sorting and methods public and internal - Remove unnecessary IsLocked (it does not make work with EphemeralOnly and SessionControlled may map to multiple keys) - More tests run now * Most UTs run * More UTs succeed * Still some UT failures * - use XLocks as Tentative indicator for insertions/splices at log tail and readcache insertions - improve readcache consistency checking - clear HasInMemoryLock when HeadAddress goes above srcRecord address following BlockAllocate - rename LockingMode.SessionControlled -> Mixed and other renaming for clarity - remove some unused methods - fix locking sequences in InternalContinuePendingR(ead|MW) * More fixes - Missing 'ref' on recordInfo var in FindAndUnlockTransferredRecord - Improve record allocation checking for below-HA in-memory source and RecordInfo lock clearing if so - Add LockCode to HashEntryInfo in DEBUG * Remove SpinWaitUntilRecordIsClosed; it was only used in ReadCache and in the relevant case we just need to wait for ReadCacheEvict to complete. * - MixedModeTentativeOrClosed is not needed - Add/Improve some ToString()s - Remove unused RecSrc.ClearSrc() - Rename to HasRecordInfoLock - Move ICPRead HandleImmediateRetryStatus outside the lock scope - Consoldiate EphemeralSUnlock(AfterPendingIO) * Streamline locking and FindInMemory calls in InternalXxx * - Change names to pendingContext.Initial*Address and improve setting of these in InternalXxx and handling of these in CompletePending*() and TryFindRecordInMemory. - Also consistentize related param names for readcache and log search to minAddress. * Clean up pending RMW call to CreateNewRecordRMW, per prior changes that make the inputSrc unnecessary. * - Fix stale readcache assignment to recSrc.Log - make searches after pendingIO completion non-inclusive of minAddress - Some ToString() and naming changes for consistency - Remove RecordInfo.IsValidUpdateOrLockSource (superseded by direct call to .IsClosed) * Allow length specification on KeyCode array operations * - Fix check for lock having escaped to eviction zone following BlockAllocate - Add some comments for SafeHeadAddress et al. * - Make sure the readcache bit is set when needed on addresses put into stackCtx.newLogicalAddress. - Rename to HandleNewRecordOnException for clarity * Update remote project * - Make sure FindAndUnlockTransferredRecord can go to SafeHeadAddress - Add non-ref overload of GetLockCode * Tweaks for benchmark with Mixed locking * Add ILockableKey.CompareLockCodes * Change LockCode to just be hashcode, since we may grow the hash table. * - Make CPR consistency check work without conflict with the key latches in the HashBuckets. - Change some names for clarity. - Pending read completion should return values from any in-memory record, as they are the latest * Remove duplicate opCtx param and removed sessionCtx (aka currentCtx, aka ctx) from calls where FasterSession was also passed (in favor of (new) FasterSession.SessionCtx), where the called method has a type constraint of "where FasterSession : IFasterSession<Key, Value, Input, Output, Context>". Not yet done: converting "whereFasterSession : IFasterSession" constraints to generic to remove the duplicate ctx parameter. * Fix DoLockOp to compare bucket indexes, not KeyCodes * Finish removal of duplicate sessionCtx param from calls where FasterSession was also passed (in favor of (new) FasterSession.SessionCtx), where the called method has a type constraint of "where FasterSession : IFasterSession" (non-generic). This cannot be done in Synchronization (the state machines) due to their use of NullFasterSession. * Fix key duplication in readcache and log: - VerifyInMemoryAddresses should not refresh hei if no splice point is present - FindRecordInMemory checks pendingContext.InitialHash - Move CompleteCopyToTail in ITCTT into the non-readcache section - TryFindRecordInMemory needs to check pc.InitialEntryIndex's readcache bit - Updaters need to scan down to hlog.ReadOnlyAddress to ensure the "key is not at or below LatestLogicalAddress" logic holds - ReadCacheCheckTailAfterSplice needs to check hei.*Address readcache bit * Replace use of SafeHeadAddress with SpinWaitUntilClosed in FindInReadCache * Remove LockingMode.EphemeralOnly add --hashpack arg to FASTER.benchmark * Tweaks for the Standard locking change * fix remote to use LockingMode.Standard * Add DisposeTest comments and more Asserts * Use calls on RecordSource to make it easier to verify correct matching of log and physicalAddress * Temporarily disable LocalMemoryDevice tests for investigation * test removal of DisposeTests * - Fix for CTT to address SameKeyInsertAndCTTTest failure - Add missing arg parsing for MemOnlyCache - Re-enable DeviceType.LocalMemory in tests * [C#] MemOnlyCache sample: improved size tracking, including read cache (#800) * Improved cache size tracking, including read cache * Rename MemOnlyCache to ResizableCacheStore. * update doc * fixes * Updates * ClearBitsForDiskImages should unseal record as well (Q: why was it sealed to begin with?) * Correct clearing of index bits during recovery * Remove RecordInfo sealing * WIP Ephemeral locking at IFunctions-level only, part 1 * Remove unused SessionType enumeration; consolidate duplicate IFasterSession implementations * - Add EphemeralLocking readcache detach/reattach logic - Remove unused ReadFlags.ResetModifiedBit * Rename a couple files * re-add RecordInfo.Seal for Ephemeral locking; remove unused (RMW|Upsert)Action.NeedMoreSpace (this is the default 'false' behavior) * Remove single-key overloads of Lock() and Unlock() * - Update a too-aggressive assert. - CreateLogDevice errors on Windows if path > MAX_PATH minus room for segment#. * Improve previous MAX_PATH fix * Chnge Read of an expired to just return NOTFOUND | Expired rather than tombstoning * RETRY_LATER rather than trying to re-find splice point directly in VerifyInMemoryAddresses --------- Co-authored-by: Badrish Chandramouli <badrishc@microsoft.com>
2023-03-23 21:49:12 +03:00
// This second loop iteration searches for the record in-memory down to InitialEntryAddress and does not find it.
// It verifies that the lower bound of the search guarantees we searched all in-memory records.
// Therefore SUT calls CreateNewRecordRMW again, which succeeds.
// SUT returns from InternalContinuePendingRMW, which enqueues 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)
{
[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")]
[C#] Change locking to use FasterBase hash buckets (#799) * Locking fixes - CompletePending* must also check to lock non-auxiliary records - Ephemeral locking must look for lock evictions as well - InternalLock must check for SpinWaitUntilRecordIsClosed - Replace oneMiss handling in InternalLock - EphemeralSUnlock must follow unlock failures - LockTable should have its own bufferPool - Ensure OnPagesClosed does eviction scans in address order * More locking fixes: - Fix missing unlock of a Tombstoned record in InternalContinuePendingRead - Add more Asserts where ManualLocking requires a locked record - Update and remove obsolete comments * - Remove key-present optimization for SpinWaitUntilRecordIsClosed - Better checking on following records transferred from LockTable in InternalLock(unlock) - Add some additional comments * Fix hash bucket overflow pointer during recovery Fix debug assert logic * WIP on locktable implemented via mainhash overflow buckets * unstaged files missed in previous push * Updates to EphemeralOnly locking for transfer-from-RO/RC * Change LockTableTests to OverflowBucketlockTableTests * Remove RecordInfo.Tentative, .IsIntermediate* * More locking WIP: session.NeedKeyLockCode, test cleanup * WIP locking: Tests build * WIP on mainhash locking: - Add KeyCode creation and sorting and methods public and internal - Remove unnecessary IsLocked (it does not make work with EphemeralOnly and SessionControlled may map to multiple keys) - More tests run now * Most UTs run * More UTs succeed * Still some UT failures * - use XLocks as Tentative indicator for insertions/splices at log tail and readcache insertions - improve readcache consistency checking - clear HasInMemoryLock when HeadAddress goes above srcRecord address following BlockAllocate - rename LockingMode.SessionControlled -> Mixed and other renaming for clarity - remove some unused methods - fix locking sequences in InternalContinuePendingR(ead|MW) * More fixes - Missing 'ref' on recordInfo var in FindAndUnlockTransferredRecord - Improve record allocation checking for below-HA in-memory source and RecordInfo lock clearing if so - Add LockCode to HashEntryInfo in DEBUG * Remove SpinWaitUntilRecordIsClosed; it was only used in ReadCache and in the relevant case we just need to wait for ReadCacheEvict to complete. * - MixedModeTentativeOrClosed is not needed - Add/Improve some ToString()s - Remove unused RecSrc.ClearSrc() - Rename to HasRecordInfoLock - Move ICPRead HandleImmediateRetryStatus outside the lock scope - Consoldiate EphemeralSUnlock(AfterPendingIO) * Streamline locking and FindInMemory calls in InternalXxx * - Change names to pendingContext.Initial*Address and improve setting of these in InternalXxx and handling of these in CompletePending*() and TryFindRecordInMemory. - Also consistentize related param names for readcache and log search to minAddress. * Clean up pending RMW call to CreateNewRecordRMW, per prior changes that make the inputSrc unnecessary. * - Fix stale readcache assignment to recSrc.Log - make searches after pendingIO completion non-inclusive of minAddress - Some ToString() and naming changes for consistency - Remove RecordInfo.IsValidUpdateOrLockSource (superseded by direct call to .IsClosed) * Allow length specification on KeyCode array operations * - Fix check for lock having escaped to eviction zone following BlockAllocate - Add some comments for SafeHeadAddress et al. * - Make sure the readcache bit is set when needed on addresses put into stackCtx.newLogicalAddress. - Rename to HandleNewRecordOnException for clarity * Update remote project * - Make sure FindAndUnlockTransferredRecord can go to SafeHeadAddress - Add non-ref overload of GetLockCode * Tweaks for benchmark with Mixed locking * Add ILockableKey.CompareLockCodes * Change LockCode to just be hashcode, since we may grow the hash table. * - Make CPR consistency check work without conflict with the key latches in the HashBuckets. - Change some names for clarity. - Pending read completion should return values from any in-memory record, as they are the latest * Remove duplicate opCtx param and removed sessionCtx (aka currentCtx, aka ctx) from calls where FasterSession was also passed (in favor of (new) FasterSession.SessionCtx), where the called method has a type constraint of "where FasterSession : IFasterSession<Key, Value, Input, Output, Context>". Not yet done: converting "whereFasterSession : IFasterSession" constraints to generic to remove the duplicate ctx parameter. * Fix DoLockOp to compare bucket indexes, not KeyCodes * Finish removal of duplicate sessionCtx param from calls where FasterSession was also passed (in favor of (new) FasterSession.SessionCtx), where the called method has a type constraint of "where FasterSession : IFasterSession" (non-generic). This cannot be done in Synchronization (the state machines) due to their use of NullFasterSession. * Fix key duplication in readcache and log: - VerifyInMemoryAddresses should not refresh hei if no splice point is present - FindRecordInMemory checks pendingContext.InitialHash - Move CompleteCopyToTail in ITCTT into the non-readcache section - TryFindRecordInMemory needs to check pc.InitialEntryIndex's readcache bit - Updaters need to scan down to hlog.ReadOnlyAddress to ensure the "key is not at or below LatestLogicalAddress" logic holds - ReadCacheCheckTailAfterSplice needs to check hei.*Address readcache bit * Replace use of SafeHeadAddress with SpinWaitUntilClosed in FindInReadCache * Remove LockingMode.EphemeralOnly add --hashpack arg to FASTER.benchmark * Tweaks for the Standard locking change * fix remote to use LockingMode.Standard * Add DisposeTest comments and more Asserts * Use calls on RecordSource to make it easier to verify correct matching of log and physicalAddress * Temporarily disable LocalMemoryDevice tests for investigation * test removal of DisposeTests * - Fix for CTT to address SameKeyInsertAndCTTTest failure - Add missing arg parsing for MemOnlyCache - Re-enable DeviceType.LocalMemory in tests * [C#] MemOnlyCache sample: improved size tracking, including read cache (#800) * Improved cache size tracking, including read cache * Rename MemOnlyCache to ResizableCacheStore. * update doc * fixes * Updates * ClearBitsForDiskImages should unseal record as well (Q: why was it sealed to begin with?) * Correct clearing of index bits during recovery * Remove RecordInfo sealing * WIP Ephemeral locking at IFunctions-level only, part 1 * Remove unused SessionType enumeration; consolidate duplicate IFasterSession implementations * - Add EphemeralLocking readcache detach/reattach logic - Remove unused ReadFlags.ResetModifiedBit * Rename a couple files * re-add RecordInfo.Seal for Ephemeral locking; remove unused (RMW|Upsert)Action.NeedMoreSpace (this is the default 'false' behavior) * Remove single-key overloads of Lock() and Unlock() * - Update a too-aggressive assert. - CreateLogDevice errors on Windows if path > MAX_PATH minus room for segment#. * Improve previous MAX_PATH fix * Chnge Read of an expired to just return NOTFOUND | Expired rather than tombstoning * RETRY_LATER rather than trying to re-find splice point directly in VerifyInMemoryAddresses --------- Co-authored-by: Badrish Chandramouli <badrishc@microsoft.com>
2023-03-23 21:49:12 +03:00
public void DisposeSingleDeleter2Threads([Values(FlushMode.ReadOnly, FlushMode.OnDisk)] FlushMode flushMode,
[Values(ConcurrencyControlMode.RecordIsolation, ConcurrencyControlMode.None)] ConcurrencyControlMode concurrencyControlMode)
[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);
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, [Values(ConcurrencyControlMode.RecordIsolation, ConcurrencyControlMode.None)] ConcurrencyControlMode concurrencyControlMode)
[C#] Change locking to use FasterBase hash buckets (#799) * Locking fixes - CompletePending* must also check to lock non-auxiliary records - Ephemeral locking must look for lock evictions as well - InternalLock must check for SpinWaitUntilRecordIsClosed - Replace oneMiss handling in InternalLock - EphemeralSUnlock must follow unlock failures - LockTable should have its own bufferPool - Ensure OnPagesClosed does eviction scans in address order * More locking fixes: - Fix missing unlock of a Tombstoned record in InternalContinuePendingRead - Add more Asserts where ManualLocking requires a locked record - Update and remove obsolete comments * - Remove key-present optimization for SpinWaitUntilRecordIsClosed - Better checking on following records transferred from LockTable in InternalLock(unlock) - Add some additional comments * Fix hash bucket overflow pointer during recovery Fix debug assert logic * WIP on locktable implemented via mainhash overflow buckets * unstaged files missed in previous push * Updates to EphemeralOnly locking for transfer-from-RO/RC * Change LockTableTests to OverflowBucketlockTableTests * Remove RecordInfo.Tentative, .IsIntermediate* * More locking WIP: session.NeedKeyLockCode, test cleanup * WIP locking: Tests build * WIP on mainhash locking: - Add KeyCode creation and sorting and methods public and internal - Remove unnecessary IsLocked (it does not make work with EphemeralOnly and SessionControlled may map to multiple keys) - More tests run now * Most UTs run * More UTs succeed * Still some UT failures * - use XLocks as Tentative indicator for insertions/splices at log tail and readcache insertions - improve readcache consistency checking - clear HasInMemoryLock when HeadAddress goes above srcRecord address following BlockAllocate - rename LockingMode.SessionControlled -> Mixed and other renaming for clarity - remove some unused methods - fix locking sequences in InternalContinuePendingR(ead|MW) * More fixes - Missing 'ref' on recordInfo var in FindAndUnlockTransferredRecord - Improve record allocation checking for below-HA in-memory source and RecordInfo lock clearing if so - Add LockCode to HashEntryInfo in DEBUG * Remove SpinWaitUntilRecordIsClosed; it was only used in ReadCache and in the relevant case we just need to wait for ReadCacheEvict to complete. * - MixedModeTentativeOrClosed is not needed - Add/Improve some ToString()s - Remove unused RecSrc.ClearSrc() - Rename to HasRecordInfoLock - Move ICPRead HandleImmediateRetryStatus outside the lock scope - Consoldiate EphemeralSUnlock(AfterPendingIO) * Streamline locking and FindInMemory calls in InternalXxx * - Change names to pendingContext.Initial*Address and improve setting of these in InternalXxx and handling of these in CompletePending*() and TryFindRecordInMemory. - Also consistentize related param names for readcache and log search to minAddress. * Clean up pending RMW call to CreateNewRecordRMW, per prior changes that make the inputSrc unnecessary. * - Fix stale readcache assignment to recSrc.Log - make searches after pendingIO completion non-inclusive of minAddress - Some ToString() and naming changes for consistency - Remove RecordInfo.IsValidUpdateOrLockSource (superseded by direct call to .IsClosed) * Allow length specification on KeyCode array operations * - Fix check for lock having escaped to eviction zone following BlockAllocate - Add some comments for SafeHeadAddress et al. * - Make sure the readcache bit is set when needed on addresses put into stackCtx.newLogicalAddress. - Rename to HandleNewRecordOnException for clarity * Update remote project * - Make sure FindAndUnlockTransferredRecord can go to SafeHeadAddress - Add non-ref overload of GetLockCode * Tweaks for benchmark with Mixed locking * Add ILockableKey.CompareLockCodes * Change LockCode to just be hashcode, since we may grow the hash table. * - Make CPR consistency check work without conflict with the key latches in the HashBuckets. - Change some names for clarity. - Pending read completion should return values from any in-memory record, as they are the latest * Remove duplicate opCtx param and removed sessionCtx (aka currentCtx, aka ctx) from calls where FasterSession was also passed (in favor of (new) FasterSession.SessionCtx), where the called method has a type constraint of "where FasterSession : IFasterSession<Key, Value, Input, Output, Context>". Not yet done: converting "whereFasterSession : IFasterSession" constraints to generic to remove the duplicate ctx parameter. * Fix DoLockOp to compare bucket indexes, not KeyCodes * Finish removal of duplicate sessionCtx param from calls where FasterSession was also passed (in favor of (new) FasterSession.SessionCtx), where the called method has a type constraint of "where FasterSession : IFasterSession" (non-generic). This cannot be done in Synchronization (the state machines) due to their use of NullFasterSession. * Fix key duplication in readcache and log: - VerifyInMemoryAddresses should not refresh hei if no splice point is present - FindRecordInMemory checks pendingContext.InitialHash - Move CompleteCopyToTail in ITCTT into the non-readcache section - TryFindRecordInMemory needs to check pc.InitialEntryIndex's readcache bit - Updaters need to scan down to hlog.ReadOnlyAddress to ensure the "key is not at or below LatestLogicalAddress" logic holds - ReadCacheCheckTailAfterSplice needs to check hei.*Address readcache bit * Replace use of SafeHeadAddress with SpinWaitUntilClosed in FindInReadCache * Remove LockingMode.EphemeralOnly add --hashpack arg to FASTER.benchmark * Tweaks for the Standard locking change * fix remote to use LockingMode.Standard * Add DisposeTest comments and more Asserts * Use calls on RecordSource to make it easier to verify correct matching of log and physicalAddress * Temporarily disable LocalMemoryDevice tests for investigation * test removal of DisposeTests * - Fix for CTT to address SameKeyInsertAndCTTTest failure - Add missing arg parsing for MemOnlyCache - Re-enable DeviceType.LocalMemory in tests * [C#] MemOnlyCache sample: improved size tracking, including read cache (#800) * Improved cache size tracking, including read cache * Rename MemOnlyCache to ResizableCacheStore. * update doc * fixes * Updates * ClearBitsForDiskImages should unseal record as well (Q: why was it sealed to begin with?) * Correct clearing of index bits during recovery * Remove RecordInfo sealing * WIP Ephemeral locking at IFunctions-level only, part 1 * Remove unused SessionType enumeration; consolidate duplicate IFasterSession implementations * - Add EphemeralLocking readcache detach/reattach logic - Remove unused ReadFlags.ResetModifiedBit * Rename a couple files * re-add RecordInfo.Seal for Ephemeral locking; remove unused (RMW|Upsert)Action.NeedMoreSpace (this is the default 'false' behavior) * Remove single-key overloads of Lock() and Unlock() * - Update a too-aggressive assert. - CreateLogDevice errors on Windows if path > MAX_PATH minus room for segment#. * Improve previous MAX_PATH fix * Chnge Read of an expired to just return NOTFOUND | Expired rather than tombstoning * RETRY_LATER rather than trying to re-find splice point directly in VerifyInMemoryAddresses --------- Co-authored-by: Badrish Chandramouli <badrishc@microsoft.com>
2023-03-23 21:49:12 +03:00
[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")]
[C#] Change locking to use FasterBase hash buckets (#799) * Locking fixes - CompletePending* must also check to lock non-auxiliary records - Ephemeral locking must look for lock evictions as well - InternalLock must check for SpinWaitUntilRecordIsClosed - Replace oneMiss handling in InternalLock - EphemeralSUnlock must follow unlock failures - LockTable should have its own bufferPool - Ensure OnPagesClosed does eviction scans in address order * More locking fixes: - Fix missing unlock of a Tombstoned record in InternalContinuePendingRead - Add more Asserts where ManualLocking requires a locked record - Update and remove obsolete comments * - Remove key-present optimization for SpinWaitUntilRecordIsClosed - Better checking on following records transferred from LockTable in InternalLock(unlock) - Add some additional comments * Fix hash bucket overflow pointer during recovery Fix debug assert logic * WIP on locktable implemented via mainhash overflow buckets * unstaged files missed in previous push * Updates to EphemeralOnly locking for transfer-from-RO/RC * Change LockTableTests to OverflowBucketlockTableTests * Remove RecordInfo.Tentative, .IsIntermediate* * More locking WIP: session.NeedKeyLockCode, test cleanup * WIP locking: Tests build * WIP on mainhash locking: - Add KeyCode creation and sorting and methods public and internal - Remove unnecessary IsLocked (it does not make work with EphemeralOnly and SessionControlled may map to multiple keys) - More tests run now * Most UTs run * More UTs succeed * Still some UT failures * - use XLocks as Tentative indicator for insertions/splices at log tail and readcache insertions - improve readcache consistency checking - clear HasInMemoryLock when HeadAddress goes above srcRecord address following BlockAllocate - rename LockingMode.SessionControlled -> Mixed and other renaming for clarity - remove some unused methods - fix locking sequences in InternalContinuePendingR(ead|MW) * More fixes - Missing 'ref' on recordInfo var in FindAndUnlockTransferredRecord - Improve record allocation checking for below-HA in-memory source and RecordInfo lock clearing if so - Add LockCode to HashEntryInfo in DEBUG * Remove SpinWaitUntilRecordIsClosed; it was only used in ReadCache and in the relevant case we just need to wait for ReadCacheEvict to complete. * - MixedModeTentativeOrClosed is not needed - Add/Improve some ToString()s - Remove unused RecSrc.ClearSrc() - Rename to HasRecordInfoLock - Move ICPRead HandleImmediateRetryStatus outside the lock scope - Consoldiate EphemeralSUnlock(AfterPendingIO) * Streamline locking and FindInMemory calls in InternalXxx * - Change names to pendingContext.Initial*Address and improve setting of these in InternalXxx and handling of these in CompletePending*() and TryFindRecordInMemory. - Also consistentize related param names for readcache and log search to minAddress. * Clean up pending RMW call to CreateNewRecordRMW, per prior changes that make the inputSrc unnecessary. * - Fix stale readcache assignment to recSrc.Log - make searches after pendingIO completion non-inclusive of minAddress - Some ToString() and naming changes for consistency - Remove RecordInfo.IsValidUpdateOrLockSource (superseded by direct call to .IsClosed) * Allow length specification on KeyCode array operations * - Fix check for lock having escaped to eviction zone following BlockAllocate - Add some comments for SafeHeadAddress et al. * - Make sure the readcache bit is set when needed on addresses put into stackCtx.newLogicalAddress. - Rename to HandleNewRecordOnException for clarity * Update remote project * - Make sure FindAndUnlockTransferredRecord can go to SafeHeadAddress - Add non-ref overload of GetLockCode * Tweaks for benchmark with Mixed locking * Add ILockableKey.CompareLockCodes * Change LockCode to just be hashcode, since we may grow the hash table. * - Make CPR consistency check work without conflict with the key latches in the HashBuckets. - Change some names for clarity. - Pending read completion should return values from any in-memory record, as they are the latest * Remove duplicate opCtx param and removed sessionCtx (aka currentCtx, aka ctx) from calls where FasterSession was also passed (in favor of (new) FasterSession.SessionCtx), where the called method has a type constraint of "where FasterSession : IFasterSession<Key, Value, Input, Output, Context>". Not yet done: converting "whereFasterSession : IFasterSession" constraints to generic to remove the duplicate ctx parameter. * Fix DoLockOp to compare bucket indexes, not KeyCodes * Finish removal of duplicate sessionCtx param from calls where FasterSession was also passed (in favor of (new) FasterSession.SessionCtx), where the called method has a type constraint of "where FasterSession : IFasterSession" (non-generic). This cannot be done in Synchronization (the state machines) due to their use of NullFasterSession. * Fix key duplication in readcache and log: - VerifyInMemoryAddresses should not refresh hei if no splice point is present - FindRecordInMemory checks pendingContext.InitialHash - Move CompleteCopyToTail in ITCTT into the non-readcache section - TryFindRecordInMemory needs to check pc.InitialEntryIndex's readcache bit - Updaters need to scan down to hlog.ReadOnlyAddress to ensure the "key is not at or below LatestLogicalAddress" logic holds - ReadCacheCheckTailAfterSplice needs to check hei.*Address readcache bit * Replace use of SafeHeadAddress with SpinWaitUntilClosed in FindInReadCache * Remove LockingMode.EphemeralOnly add --hashpack arg to FASTER.benchmark * Tweaks for the Standard locking change * fix remote to use LockingMode.Standard * Add DisposeTest comments and more Asserts * Use calls on RecordSource to make it easier to verify correct matching of log and physicalAddress * Temporarily disable LocalMemoryDevice tests for investigation * test removal of DisposeTests * - Fix for CTT to address SameKeyInsertAndCTTTest failure - Add missing arg parsing for MemOnlyCache - Re-enable DeviceType.LocalMemory in tests * [C#] MemOnlyCache sample: improved size tracking, including read cache (#800) * Improved cache size tracking, including read cache * Rename MemOnlyCache to ResizableCacheStore. * update doc * fixes * Updates * ClearBitsForDiskImages should unseal record as well (Q: why was it sealed to begin with?) * Correct clearing of index bits during recovery * Remove RecordInfo sealing * WIP Ephemeral locking at IFunctions-level only, part 1 * Remove unused SessionType enumeration; consolidate duplicate IFasterSession implementations * - Add EphemeralLocking readcache detach/reattach logic - Remove unused ReadFlags.ResetModifiedBit * Rename a couple files * re-add RecordInfo.Seal for Ephemeral locking; remove unused (RMW|Upsert)Action.NeedMoreSpace (this is the default 'false' behavior) * Remove single-key overloads of Lock() and Unlock() * - Update a too-aggressive assert. - CreateLogDevice errors on Windows if path > MAX_PATH minus room for segment#. * Improve previous MAX_PATH fix * Chnge Read of an expired to just return NOTFOUND | Expired rather than tombstoning * RETRY_LATER rather than trying to re-find splice point directly in VerifyInMemoryAddresses --------- Co-authored-by: Badrish Chandramouli <badrishc@microsoft.com>
2023-03-23 21:49:12 +03:00
public void CopyToTailWithInitialReadCache([Values(ReadCopyDestination.ReadCache)] ReadCopyDestination copyDest,
[Values(ConcurrencyControlMode.RecordIsolation, ConcurrencyControlMode.None)] ConcurrencyControlMode concurrencyControlMode)
[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);
}
[C#] Add ConditionalCopyToTail (#807) * Locking fixes - CompletePending* must also check to lock non-auxiliary records - Ephemeral locking must look for lock evictions as well - InternalLock must check for SpinWaitUntilRecordIsClosed - Replace oneMiss handling in InternalLock - EphemeralSUnlock must follow unlock failures - LockTable should have its own bufferPool - Ensure OnPagesClosed does eviction scans in address order * More locking fixes: - Fix missing unlock of a Tombstoned record in InternalContinuePendingRead - Add more Asserts where ManualLocking requires a locked record - Update and remove obsolete comments * - Remove key-present optimization for SpinWaitUntilRecordIsClosed - Better checking on following records transferred from LockTable in InternalLock(unlock) - Add some additional comments * Fix hash bucket overflow pointer during recovery Fix debug assert logic * WIP on locktable implemented via mainhash overflow buckets * unstaged files missed in previous push * Updates to EphemeralOnly locking for transfer-from-RO/RC * Change LockTableTests to OverflowBucketlockTableTests * Remove RecordInfo.Tentative, .IsIntermediate* * More locking WIP: session.NeedKeyLockCode, test cleanup * WIP locking: Tests build * WIP on mainhash locking: - Add KeyCode creation and sorting and methods public and internal - Remove unnecessary IsLocked (it does not make work with EphemeralOnly and SessionControlled may map to multiple keys) - More tests run now * Most UTs run * More UTs succeed * Still some UT failures * - use XLocks as Tentative indicator for insertions/splices at log tail and readcache insertions - improve readcache consistency checking - clear HasInMemoryLock when HeadAddress goes above srcRecord address following BlockAllocate - rename LockingMode.SessionControlled -> Mixed and other renaming for clarity - remove some unused methods - fix locking sequences in InternalContinuePendingR(ead|MW) * More fixes - Missing 'ref' on recordInfo var in FindAndUnlockTransferredRecord - Improve record allocation checking for below-HA in-memory source and RecordInfo lock clearing if so - Add LockCode to HashEntryInfo in DEBUG * Remove SpinWaitUntilRecordIsClosed; it was only used in ReadCache and in the relevant case we just need to wait for ReadCacheEvict to complete. * - MixedModeTentativeOrClosed is not needed - Add/Improve some ToString()s - Remove unused RecSrc.ClearSrc() - Rename to HasRecordInfoLock - Move ICPRead HandleImmediateRetryStatus outside the lock scope - Consoldiate EphemeralSUnlock(AfterPendingIO) * Streamline locking and FindInMemory calls in InternalXxx * - Change names to pendingContext.Initial*Address and improve setting of these in InternalXxx and handling of these in CompletePending*() and TryFindRecordInMemory. - Also consistentize related param names for readcache and log search to minAddress. * Clean up pending RMW call to CreateNewRecordRMW, per prior changes that make the inputSrc unnecessary. * - Fix stale readcache assignment to recSrc.Log - make searches after pendingIO completion non-inclusive of minAddress - Some ToString() and naming changes for consistency - Remove RecordInfo.IsValidUpdateOrLockSource (superseded by direct call to .IsClosed) * Allow length specification on KeyCode array operations * - Fix check for lock having escaped to eviction zone following BlockAllocate - Add some comments for SafeHeadAddress et al. * - Make sure the readcache bit is set when needed on addresses put into stackCtx.newLogicalAddress. - Rename to HandleNewRecordOnException for clarity * Update remote project * - Make sure FindAndUnlockTransferredRecord can go to SafeHeadAddress - Add non-ref overload of GetLockCode * Tweaks for benchmark with Mixed locking * Add ILockableKey.CompareLockCodes * Change LockCode to just be hashcode, since we may grow the hash table. * - Make CPR consistency check work without conflict with the key latches in the HashBuckets. - Change some names for clarity. - Pending read completion should return values from any in-memory record, as they are the latest * Remove duplicate opCtx param and removed sessionCtx (aka currentCtx, aka ctx) from calls where FasterSession was also passed (in favor of (new) FasterSession.SessionCtx), where the called method has a type constraint of "where FasterSession : IFasterSession<Key, Value, Input, Output, Context>". Not yet done: converting "whereFasterSession : IFasterSession" constraints to generic to remove the duplicate ctx parameter. * Fix DoLockOp to compare bucket indexes, not KeyCodes * Finish removal of duplicate sessionCtx param from calls where FasterSession was also passed (in favor of (new) FasterSession.SessionCtx), where the called method has a type constraint of "where FasterSession : IFasterSession" (non-generic). This cannot be done in Synchronization (the state machines) due to their use of NullFasterSession. * Fix key duplication in readcache and log: - VerifyInMemoryAddresses should not refresh hei if no splice point is present - FindRecordInMemory checks pendingContext.InitialHash - Move CompleteCopyToTail in ITCTT into the non-readcache section - TryFindRecordInMemory needs to check pc.InitialEntryIndex's readcache bit - Updaters need to scan down to hlog.ReadOnlyAddress to ensure the "key is not at or below LatestLogicalAddress" logic holds - ReadCacheCheckTailAfterSplice needs to check hei.*Address readcache bit * Replace use of SafeHeadAddress with SpinWaitUntilClosed in FindInReadCache * Remove LockingMode.EphemeralOnly add --hashpack arg to FASTER.benchmark * Tweaks for the Standard locking change * fix remote to use LockingMode.Standard * Add DisposeTest comments and more Asserts * Use calls on RecordSource to make it easier to verify correct matching of log and physicalAddress * Temporarily disable LocalMemoryDevice tests for investigation * test removal of DisposeTests * - Fix for CTT to address SameKeyInsertAndCTTTest failure - Add missing arg parsing for MemOnlyCache - Re-enable DeviceType.LocalMemory in tests * WIP on ConditionalInsert * [C#] MemOnlyCache sample: improved size tracking, including read cache (#800) * Improved cache size tracking, including read cache * Rename MemOnlyCache to ResizableCacheStore. * update doc * fixes * Updates * ClearBitsForDiskImages should unseal record as well (Q: why was it sealed to begin with?) * Correct clearing of index bits during recovery * Remove RecordInfo sealing * WIP Ephemeral locking at IFunctions-level only, part 1 * Remove unused SessionType enumeration; consolidate duplicate IFasterSession implementations * - Add EphemeralLocking readcache detach/reattach logic - Remove unused ReadFlags.ResetModifiedBit * Rename a couple files * re-add RecordInfo.Seal for Ephemeral locking; remove unused (RMW|Upsert)Action.NeedMoreSpace (this is the default 'false' behavior) * Remove single-key overloads of Lock() and Unlock() * - Update a too-aggressive assert. - CreateLogDevice errors on Windows if path > MAX_PATH minus room for segment#. * Improve previous MAX_PATH fix * Chnge Read of an expired to just return NOTFOUND | Expired rather than tombstoning * - Replace ReadFlags with ReadCopyOptions - More WIP on ConditionalInsert * RETRY_LATER rather than trying to re-find splice point directly in VerifyInMemoryAddresses * More WIP on ConditionalInsert * WIP on ConditionalCopyToTail * change filename * - Fix Compact/ConditionalCopyToTail - Make TryCopyToReadCache bool - Tighten up DetachAndReattachReadCacheChain - Other minor tweaks * fix merge ---------
2023-03-28 04:23:17 +03:00
ReadOptions readOptions = new() { CopyFrom = ReadCopyFrom.Device };
if (copyDest == ReadCopyDestination.Tail)
[C#] Add ConditionalCopyToTail (#807) * Locking fixes - CompletePending* must also check to lock non-auxiliary records - Ephemeral locking must look for lock evictions as well - InternalLock must check for SpinWaitUntilRecordIsClosed - Replace oneMiss handling in InternalLock - EphemeralSUnlock must follow unlock failures - LockTable should have its own bufferPool - Ensure OnPagesClosed does eviction scans in address order * More locking fixes: - Fix missing unlock of a Tombstoned record in InternalContinuePendingRead - Add more Asserts where ManualLocking requires a locked record - Update and remove obsolete comments * - Remove key-present optimization for SpinWaitUntilRecordIsClosed - Better checking on following records transferred from LockTable in InternalLock(unlock) - Add some additional comments * Fix hash bucket overflow pointer during recovery Fix debug assert logic * WIP on locktable implemented via mainhash overflow buckets * unstaged files missed in previous push * Updates to EphemeralOnly locking for transfer-from-RO/RC * Change LockTableTests to OverflowBucketlockTableTests * Remove RecordInfo.Tentative, .IsIntermediate* * More locking WIP: session.NeedKeyLockCode, test cleanup * WIP locking: Tests build * WIP on mainhash locking: - Add KeyCode creation and sorting and methods public and internal - Remove unnecessary IsLocked (it does not make work with EphemeralOnly and SessionControlled may map to multiple keys) - More tests run now * Most UTs run * More UTs succeed * Still some UT failures * - use XLocks as Tentative indicator for insertions/splices at log tail and readcache insertions - improve readcache consistency checking - clear HasInMemoryLock when HeadAddress goes above srcRecord address following BlockAllocate - rename LockingMode.SessionControlled -> Mixed and other renaming for clarity - remove some unused methods - fix locking sequences in InternalContinuePendingR(ead|MW) * More fixes - Missing 'ref' on recordInfo var in FindAndUnlockTransferredRecord - Improve record allocation checking for below-HA in-memory source and RecordInfo lock clearing if so - Add LockCode to HashEntryInfo in DEBUG * Remove SpinWaitUntilRecordIsClosed; it was only used in ReadCache and in the relevant case we just need to wait for ReadCacheEvict to complete. * - MixedModeTentativeOrClosed is not needed - Add/Improve some ToString()s - Remove unused RecSrc.ClearSrc() - Rename to HasRecordInfoLock - Move ICPRead HandleImmediateRetryStatus outside the lock scope - Consoldiate EphemeralSUnlock(AfterPendingIO) * Streamline locking and FindInMemory calls in InternalXxx * - Change names to pendingContext.Initial*Address and improve setting of these in InternalXxx and handling of these in CompletePending*() and TryFindRecordInMemory. - Also consistentize related param names for readcache and log search to minAddress. * Clean up pending RMW call to CreateNewRecordRMW, per prior changes that make the inputSrc unnecessary. * - Fix stale readcache assignment to recSrc.Log - make searches after pendingIO completion non-inclusive of minAddress - Some ToString() and naming changes for consistency - Remove RecordInfo.IsValidUpdateOrLockSource (superseded by direct call to .IsClosed) * Allow length specification on KeyCode array operations * - Fix check for lock having escaped to eviction zone following BlockAllocate - Add some comments for SafeHeadAddress et al. * - Make sure the readcache bit is set when needed on addresses put into stackCtx.newLogicalAddress. - Rename to HandleNewRecordOnException for clarity * Update remote project * - Make sure FindAndUnlockTransferredRecord can go to SafeHeadAddress - Add non-ref overload of GetLockCode * Tweaks for benchmark with Mixed locking * Add ILockableKey.CompareLockCodes * Change LockCode to just be hashcode, since we may grow the hash table. * - Make CPR consistency check work without conflict with the key latches in the HashBuckets. - Change some names for clarity. - Pending read completion should return values from any in-memory record, as they are the latest * Remove duplicate opCtx param and removed sessionCtx (aka currentCtx, aka ctx) from calls where FasterSession was also passed (in favor of (new) FasterSession.SessionCtx), where the called method has a type constraint of "where FasterSession : IFasterSession<Key, Value, Input, Output, Context>". Not yet done: converting "whereFasterSession : IFasterSession" constraints to generic to remove the duplicate ctx parameter. * Fix DoLockOp to compare bucket indexes, not KeyCodes * Finish removal of duplicate sessionCtx param from calls where FasterSession was also passed (in favor of (new) FasterSession.SessionCtx), where the called method has a type constraint of "where FasterSession : IFasterSession" (non-generic). This cannot be done in Synchronization (the state machines) due to their use of NullFasterSession. * Fix key duplication in readcache and log: - VerifyInMemoryAddresses should not refresh hei if no splice point is present - FindRecordInMemory checks pendingContext.InitialHash - Move CompleteCopyToTail in ITCTT into the non-readcache section - TryFindRecordInMemory needs to check pc.InitialEntryIndex's readcache bit - Updaters need to scan down to hlog.ReadOnlyAddress to ensure the "key is not at or below LatestLogicalAddress" logic holds - ReadCacheCheckTailAfterSplice needs to check hei.*Address readcache bit * Replace use of SafeHeadAddress with SpinWaitUntilClosed in FindInReadCache * Remove LockingMode.EphemeralOnly add --hashpack arg to FASTER.benchmark * Tweaks for the Standard locking change * fix remote to use LockingMode.Standard * Add DisposeTest comments and more Asserts * Use calls on RecordSource to make it easier to verify correct matching of log and physicalAddress * Temporarily disable LocalMemoryDevice tests for investigation * test removal of DisposeTests * - Fix for CTT to address SameKeyInsertAndCTTTest failure - Add missing arg parsing for MemOnlyCache - Re-enable DeviceType.LocalMemory in tests * WIP on ConditionalInsert * [C#] MemOnlyCache sample: improved size tracking, including read cache (#800) * Improved cache size tracking, including read cache * Rename MemOnlyCache to ResizableCacheStore. * update doc * fixes * Updates * ClearBitsForDiskImages should unseal record as well (Q: why was it sealed to begin with?) * Correct clearing of index bits during recovery * Remove RecordInfo sealing * WIP Ephemeral locking at IFunctions-level only, part 1 * Remove unused SessionType enumeration; consolidate duplicate IFasterSession implementations * - Add EphemeralLocking readcache detach/reattach logic - Remove unused ReadFlags.ResetModifiedBit * Rename a couple files * re-add RecordInfo.Seal for Ephemeral locking; remove unused (RMW|Upsert)Action.NeedMoreSpace (this is the default 'false' behavior) * Remove single-key overloads of Lock() and Unlock() * - Update a too-aggressive assert. - CreateLogDevice errors on Windows if path > MAX_PATH minus room for segment#. * Improve previous MAX_PATH fix * Chnge Read of an expired to just return NOTFOUND | Expired rather than tombstoning * - Replace ReadFlags with ReadCopyOptions - More WIP on ConditionalInsert * RETRY_LATER rather than trying to re-find splice point directly in VerifyInMemoryAddresses * More WIP on ConditionalInsert * WIP on ConditionalCopyToTail * change filename * - Fix Compact/ConditionalCopyToTail - Make TryCopyToReadCache bool - Tighten up DetachAndReattachReadCacheChain - Other minor tweaks * fix merge ---------
2023-03-28 04:23:17 +03:00
readOptions.CopyOptions.CopyTo = ReadCopyTo.MainLog;
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, [Values] ConcurrencyControlMode concurrencyControlMode)
{
DoDisposePendingReadInsertTest2Threads(copyDest, initialReadCacheInsert: false);
}
[Test]
[Category("FasterKV")]
[Category("Smoke")]
public void DisposeCopyToTailWithInitialReadCache2Threads([Values(ReadCopyDestination.ReadCache)] ReadCopyDestination copyDest, [Values] ConcurrencyControlMode concurrencyControlMode)
{
// 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 };
[C#] Change locking to use FasterBase hash buckets (#799) * Locking fixes - CompletePending* must also check to lock non-auxiliary records - Ephemeral locking must look for lock evictions as well - InternalLock must check for SpinWaitUntilRecordIsClosed - Replace oneMiss handling in InternalLock - EphemeralSUnlock must follow unlock failures - LockTable should have its own bufferPool - Ensure OnPagesClosed does eviction scans in address order * More locking fixes: - Fix missing unlock of a Tombstoned record in InternalContinuePendingRead - Add more Asserts where ManualLocking requires a locked record - Update and remove obsolete comments * - Remove key-present optimization for SpinWaitUntilRecordIsClosed - Better checking on following records transferred from LockTable in InternalLock(unlock) - Add some additional comments * Fix hash bucket overflow pointer during recovery Fix debug assert logic * WIP on locktable implemented via mainhash overflow buckets * unstaged files missed in previous push * Updates to EphemeralOnly locking for transfer-from-RO/RC * Change LockTableTests to OverflowBucketlockTableTests * Remove RecordInfo.Tentative, .IsIntermediate* * More locking WIP: session.NeedKeyLockCode, test cleanup * WIP locking: Tests build * WIP on mainhash locking: - Add KeyCode creation and sorting and methods public and internal - Remove unnecessary IsLocked (it does not make work with EphemeralOnly and SessionControlled may map to multiple keys) - More tests run now * Most UTs run * More UTs succeed * Still some UT failures * - use XLocks as Tentative indicator for insertions/splices at log tail and readcache insertions - improve readcache consistency checking - clear HasInMemoryLock when HeadAddress goes above srcRecord address following BlockAllocate - rename LockingMode.SessionControlled -> Mixed and other renaming for clarity - remove some unused methods - fix locking sequences in InternalContinuePendingR(ead|MW) * More fixes - Missing 'ref' on recordInfo var in FindAndUnlockTransferredRecord - Improve record allocation checking for below-HA in-memory source and RecordInfo lock clearing if so - Add LockCode to HashEntryInfo in DEBUG * Remove SpinWaitUntilRecordIsClosed; it was only used in ReadCache and in the relevant case we just need to wait for ReadCacheEvict to complete. * - MixedModeTentativeOrClosed is not needed - Add/Improve some ToString()s - Remove unused RecSrc.ClearSrc() - Rename to HasRecordInfoLock - Move ICPRead HandleImmediateRetryStatus outside the lock scope - Consoldiate EphemeralSUnlock(AfterPendingIO) * Streamline locking and FindInMemory calls in InternalXxx * - Change names to pendingContext.Initial*Address and improve setting of these in InternalXxx and handling of these in CompletePending*() and TryFindRecordInMemory. - Also consistentize related param names for readcache and log search to minAddress. * Clean up pending RMW call to CreateNewRecordRMW, per prior changes that make the inputSrc unnecessary. * - Fix stale readcache assignment to recSrc.Log - make searches after pendingIO completion non-inclusive of minAddress - Some ToString() and naming changes for consistency - Remove RecordInfo.IsValidUpdateOrLockSource (superseded by direct call to .IsClosed) * Allow length specification on KeyCode array operations * - Fix check for lock having escaped to eviction zone following BlockAllocate - Add some comments for SafeHeadAddress et al. * - Make sure the readcache bit is set when needed on addresses put into stackCtx.newLogicalAddress. - Rename to HandleNewRecordOnException for clarity * Update remote project * - Make sure FindAndUnlockTransferredRecord can go to SafeHeadAddress - Add non-ref overload of GetLockCode * Tweaks for benchmark with Mixed locking * Add ILockableKey.CompareLockCodes * Change LockCode to just be hashcode, since we may grow the hash table. * - Make CPR consistency check work without conflict with the key latches in the HashBuckets. - Change some names for clarity. - Pending read completion should return values from any in-memory record, as they are the latest * Remove duplicate opCtx param and removed sessionCtx (aka currentCtx, aka ctx) from calls where FasterSession was also passed (in favor of (new) FasterSession.SessionCtx), where the called method has a type constraint of "where FasterSession : IFasterSession<Key, Value, Input, Output, Context>". Not yet done: converting "whereFasterSession : IFasterSession" constraints to generic to remove the duplicate ctx parameter. * Fix DoLockOp to compare bucket indexes, not KeyCodes * Finish removal of duplicate sessionCtx param from calls where FasterSession was also passed (in favor of (new) FasterSession.SessionCtx), where the called method has a type constraint of "where FasterSession : IFasterSession" (non-generic). This cannot be done in Synchronization (the state machines) due to their use of NullFasterSession. * Fix key duplication in readcache and log: - VerifyInMemoryAddresses should not refresh hei if no splice point is present - FindRecordInMemory checks pendingContext.InitialHash - Move CompleteCopyToTail in ITCTT into the non-readcache section - TryFindRecordInMemory needs to check pc.InitialEntryIndex's readcache bit - Updaters need to scan down to hlog.ReadOnlyAddress to ensure the "key is not at or below LatestLogicalAddress" logic holds - ReadCacheCheckTailAfterSplice needs to check hei.*Address readcache bit * Replace use of SafeHeadAddress with SpinWaitUntilClosed in FindInReadCache * Remove LockingMode.EphemeralOnly add --hashpack arg to FASTER.benchmark * Tweaks for the Standard locking change * fix remote to use LockingMode.Standard * Add DisposeTest comments and more Asserts * Use calls on RecordSource to make it easier to verify correct matching of log and physicalAddress * Temporarily disable LocalMemoryDevice tests for investigation * test removal of DisposeTests * - Fix for CTT to address SameKeyInsertAndCTTTest failure - Add missing arg parsing for MemOnlyCache - Re-enable DeviceType.LocalMemory in tests * [C#] MemOnlyCache sample: improved size tracking, including read cache (#800) * Improved cache size tracking, including read cache * Rename MemOnlyCache to ResizableCacheStore. * update doc * fixes * Updates * ClearBitsForDiskImages should unseal record as well (Q: why was it sealed to begin with?) * Correct clearing of index bits during recovery * Remove RecordInfo sealing * WIP Ephemeral locking at IFunctions-level only, part 1 * Remove unused SessionType enumeration; consolidate duplicate IFasterSession implementations * - Add EphemeralLocking readcache detach/reattach logic - Remove unused ReadFlags.ResetModifiedBit * Rename a couple files * re-add RecordInfo.Seal for Ephemeral locking; remove unused (RMW|Upsert)Action.NeedMoreSpace (this is the default 'false' behavior) * Remove single-key overloads of Lock() and Unlock() * - Update a too-aggressive assert. - CreateLogDevice errors on Windows if path > MAX_PATH minus room for segment#. * Improve previous MAX_PATH fix * Chnge Read of an expired to just return NOTFOUND | Expired rather than tombstoning * RETRY_LATER rather than trying to re-find splice point directly in VerifyInMemoryAddresses --------- Co-authored-by: Badrish Chandramouli <badrishc@microsoft.com>
2023-03-23 21:49:12 +03:00
MyKey collidingKey = new() { key = TestCollidingKey };
MyValue collidingValue = new() { value = TestCollidingValue };
[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
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);
[C#] Change locking to use FasterBase hash buckets (#799) * Locking fixes - CompletePending* must also check to lock non-auxiliary records - Ephemeral locking must look for lock evictions as well - InternalLock must check for SpinWaitUntilRecordIsClosed - Replace oneMiss handling in InternalLock - EphemeralSUnlock must follow unlock failures - LockTable should have its own bufferPool - Ensure OnPagesClosed does eviction scans in address order * More locking fixes: - Fix missing unlock of a Tombstoned record in InternalContinuePendingRead - Add more Asserts where ManualLocking requires a locked record - Update and remove obsolete comments * - Remove key-present optimization for SpinWaitUntilRecordIsClosed - Better checking on following records transferred from LockTable in InternalLock(unlock) - Add some additional comments * Fix hash bucket overflow pointer during recovery Fix debug assert logic * WIP on locktable implemented via mainhash overflow buckets * unstaged files missed in previous push * Updates to EphemeralOnly locking for transfer-from-RO/RC * Change LockTableTests to OverflowBucketlockTableTests * Remove RecordInfo.Tentative, .IsIntermediate* * More locking WIP: session.NeedKeyLockCode, test cleanup * WIP locking: Tests build * WIP on mainhash locking: - Add KeyCode creation and sorting and methods public and internal - Remove unnecessary IsLocked (it does not make work with EphemeralOnly and SessionControlled may map to multiple keys) - More tests run now * Most UTs run * More UTs succeed * Still some UT failures * - use XLocks as Tentative indicator for insertions/splices at log tail and readcache insertions - improve readcache consistency checking - clear HasInMemoryLock when HeadAddress goes above srcRecord address following BlockAllocate - rename LockingMode.SessionControlled -> Mixed and other renaming for clarity - remove some unused methods - fix locking sequences in InternalContinuePendingR(ead|MW) * More fixes - Missing 'ref' on recordInfo var in FindAndUnlockTransferredRecord - Improve record allocation checking for below-HA in-memory source and RecordInfo lock clearing if so - Add LockCode to HashEntryInfo in DEBUG * Remove SpinWaitUntilRecordIsClosed; it was only used in ReadCache and in the relevant case we just need to wait for ReadCacheEvict to complete. * - MixedModeTentativeOrClosed is not needed - Add/Improve some ToString()s - Remove unused RecSrc.ClearSrc() - Rename to HasRecordInfoLock - Move ICPRead HandleImmediateRetryStatus outside the lock scope - Consoldiate EphemeralSUnlock(AfterPendingIO) * Streamline locking and FindInMemory calls in InternalXxx * - Change names to pendingContext.Initial*Address and improve setting of these in InternalXxx and handling of these in CompletePending*() and TryFindRecordInMemory. - Also consistentize related param names for readcache and log search to minAddress. * Clean up pending RMW call to CreateNewRecordRMW, per prior changes that make the inputSrc unnecessary. * - Fix stale readcache assignment to recSrc.Log - make searches after pendingIO completion non-inclusive of minAddress - Some ToString() and naming changes for consistency - Remove RecordInfo.IsValidUpdateOrLockSource (superseded by direct call to .IsClosed) * Allow length specification on KeyCode array operations * - Fix check for lock having escaped to eviction zone following BlockAllocate - Add some comments for SafeHeadAddress et al. * - Make sure the readcache bit is set when needed on addresses put into stackCtx.newLogicalAddress. - Rename to HandleNewRecordOnException for clarity * Update remote project * - Make sure FindAndUnlockTransferredRecord can go to SafeHeadAddress - Add non-ref overload of GetLockCode * Tweaks for benchmark with Mixed locking * Add ILockableKey.CompareLockCodes * Change LockCode to just be hashcode, since we may grow the hash table. * - Make CPR consistency check work without conflict with the key latches in the HashBuckets. - Change some names for clarity. - Pending read completion should return values from any in-memory record, as they are the latest * Remove duplicate opCtx param and removed sessionCtx (aka currentCtx, aka ctx) from calls where FasterSession was also passed (in favor of (new) FasterSession.SessionCtx), where the called method has a type constraint of "where FasterSession : IFasterSession<Key, Value, Input, Output, Context>". Not yet done: converting "whereFasterSession : IFasterSession" constraints to generic to remove the duplicate ctx parameter. * Fix DoLockOp to compare bucket indexes, not KeyCodes * Finish removal of duplicate sessionCtx param from calls where FasterSession was also passed (in favor of (new) FasterSession.SessionCtx), where the called method has a type constraint of "where FasterSession : IFasterSession" (non-generic). This cannot be done in Synchronization (the state machines) due to their use of NullFasterSession. * Fix key duplication in readcache and log: - VerifyInMemoryAddresses should not refresh hei if no splice point is present - FindRecordInMemory checks pendingContext.InitialHash - Move CompleteCopyToTail in ITCTT into the non-readcache section - TryFindRecordInMemory needs to check pc.InitialEntryIndex's readcache bit - Updaters need to scan down to hlog.ReadOnlyAddress to ensure the "key is not at or below LatestLogicalAddress" logic holds - ReadCacheCheckTailAfterSplice needs to check hei.*Address readcache bit * Replace use of SafeHeadAddress with SpinWaitUntilClosed in FindInReadCache * Remove LockingMode.EphemeralOnly add --hashpack arg to FASTER.benchmark * Tweaks for the Standard locking change * fix remote to use LockingMode.Standard * Add DisposeTest comments and more Asserts * Use calls on RecordSource to make it easier to verify correct matching of log and physicalAddress * Temporarily disable LocalMemoryDevice tests for investigation * test removal of DisposeTests * - Fix for CTT to address SameKeyInsertAndCTTTest failure - Add missing arg parsing for MemOnlyCache - Re-enable DeviceType.LocalMemory in tests * [C#] MemOnlyCache sample: improved size tracking, including read cache (#800) * Improved cache size tracking, including read cache * Rename MemOnlyCache to ResizableCacheStore. * update doc * fixes * Updates * ClearBitsForDiskImages should unseal record as well (Q: why was it sealed to begin with?) * Correct clearing of index bits during recovery * Remove RecordInfo sealing * WIP Ephemeral locking at IFunctions-level only, part 1 * Remove unused SessionType enumeration; consolidate duplicate IFasterSession implementations * - Add EphemeralLocking readcache detach/reattach logic - Remove unused ReadFlags.ResetModifiedBit * Rename a couple files * re-add RecordInfo.Seal for Ephemeral locking; remove unused (RMW|Upsert)Action.NeedMoreSpace (this is the default 'false' behavior) * Remove single-key overloads of Lock() and Unlock() * - Update a too-aggressive assert. - CreateLogDevice errors on Windows if path > MAX_PATH minus room for segment#. * Improve previous MAX_PATH fix * Chnge Read of an expired to just return NOTFOUND | Expired rather than tombstoning * RETRY_LATER rather than trying to re-find splice point directly in VerifyInMemoryAddresses --------- Co-authored-by: Badrish Chandramouli <badrishc@microsoft.com>
2023-03-23 21:49:12 +03:00
session.Upsert(ref collidingKey, ref collidingValue);
[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 (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);
[C#] Change locking to use FasterBase hash buckets (#799) * Locking fixes - CompletePending* must also check to lock non-auxiliary records - Ephemeral locking must look for lock evictions as well - InternalLock must check for SpinWaitUntilRecordIsClosed - Replace oneMiss handling in InternalLock - EphemeralSUnlock must follow unlock failures - LockTable should have its own bufferPool - Ensure OnPagesClosed does eviction scans in address order * More locking fixes: - Fix missing unlock of a Tombstoned record in InternalContinuePendingRead - Add more Asserts where ManualLocking requires a locked record - Update and remove obsolete comments * - Remove key-present optimization for SpinWaitUntilRecordIsClosed - Better checking on following records transferred from LockTable in InternalLock(unlock) - Add some additional comments * Fix hash bucket overflow pointer during recovery Fix debug assert logic * WIP on locktable implemented via mainhash overflow buckets * unstaged files missed in previous push * Updates to EphemeralOnly locking for transfer-from-RO/RC * Change LockTableTests to OverflowBucketlockTableTests * Remove RecordInfo.Tentative, .IsIntermediate* * More locking WIP: session.NeedKeyLockCode, test cleanup * WIP locking: Tests build * WIP on mainhash locking: - Add KeyCode creation and sorting and methods public and internal - Remove unnecessary IsLocked (it does not make work with EphemeralOnly and SessionControlled may map to multiple keys) - More tests run now * Most UTs run * More UTs succeed * Still some UT failures * - use XLocks as Tentative indicator for insertions/splices at log tail and readcache insertions - improve readcache consistency checking - clear HasInMemoryLock when HeadAddress goes above srcRecord address following BlockAllocate - rename LockingMode.SessionControlled -> Mixed and other renaming for clarity - remove some unused methods - fix locking sequences in InternalContinuePendingR(ead|MW) * More fixes - Missing 'ref' on recordInfo var in FindAndUnlockTransferredRecord - Improve record allocation checking for below-HA in-memory source and RecordInfo lock clearing if so - Add LockCode to HashEntryInfo in DEBUG * Remove SpinWaitUntilRecordIsClosed; it was only used in ReadCache and in the relevant case we just need to wait for ReadCacheEvict to complete. * - MixedModeTentativeOrClosed is not needed - Add/Improve some ToString()s - Remove unused RecSrc.ClearSrc() - Rename to HasRecordInfoLock - Move ICPRead HandleImmediateRetryStatus outside the lock scope - Consoldiate EphemeralSUnlock(AfterPendingIO) * Streamline locking and FindInMemory calls in InternalXxx * - Change names to pendingContext.Initial*Address and improve setting of these in InternalXxx and handling of these in CompletePending*() and TryFindRecordInMemory. - Also consistentize related param names for readcache and log search to minAddress. * Clean up pending RMW call to CreateNewRecordRMW, per prior changes that make the inputSrc unnecessary. * - Fix stale readcache assignment to recSrc.Log - make searches after pendingIO completion non-inclusive of minAddress - Some ToString() and naming changes for consistency - Remove RecordInfo.IsValidUpdateOrLockSource (superseded by direct call to .IsClosed) * Allow length specification on KeyCode array operations * - Fix check for lock having escaped to eviction zone following BlockAllocate - Add some comments for SafeHeadAddress et al. * - Make sure the readcache bit is set when needed on addresses put into stackCtx.newLogicalAddress. - Rename to HandleNewRecordOnException for clarity * Update remote project * - Make sure FindAndUnlockTransferredRecord can go to SafeHeadAddress - Add non-ref overload of GetLockCode * Tweaks for benchmark with Mixed locking * Add ILockableKey.CompareLockCodes * Change LockCode to just be hashcode, since we may grow the hash table. * - Make CPR consistency check work without conflict with the key latches in the HashBuckets. - Change some names for clarity. - Pending read completion should return values from any in-memory record, as they are the latest * Remove duplicate opCtx param and removed sessionCtx (aka currentCtx, aka ctx) from calls where FasterSession was also passed (in favor of (new) FasterSession.SessionCtx), where the called method has a type constraint of "where FasterSession : IFasterSession<Key, Value, Input, Output, Context>". Not yet done: converting "whereFasterSession : IFasterSession" constraints to generic to remove the duplicate ctx parameter. * Fix DoLockOp to compare bucket indexes, not KeyCodes * Finish removal of duplicate sessionCtx param from calls where FasterSession was also passed (in favor of (new) FasterSession.SessionCtx), where the called method has a type constraint of "where FasterSession : IFasterSession" (non-generic). This cannot be done in Synchronization (the state machines) due to their use of NullFasterSession. * Fix key duplication in readcache and log: - VerifyInMemoryAddresses should not refresh hei if no splice point is present - FindRecordInMemory checks pendingContext.InitialHash - Move CompleteCopyToTail in ITCTT into the non-readcache section - TryFindRecordInMemory needs to check pc.InitialEntryIndex's readcache bit - Updaters need to scan down to hlog.ReadOnlyAddress to ensure the "key is not at or below LatestLogicalAddress" logic holds - ReadCacheCheckTailAfterSplice needs to check hei.*Address readcache bit * Replace use of SafeHeadAddress with SpinWaitUntilClosed in FindInReadCache * Remove LockingMode.EphemeralOnly add --hashpack arg to FASTER.benchmark * Tweaks for the Standard locking change * fix remote to use LockingMode.Standard * Add DisposeTest comments and more Asserts * Use calls on RecordSource to make it easier to verify correct matching of log and physicalAddress * Temporarily disable LocalMemoryDevice tests for investigation * test removal of DisposeTests * - Fix for CTT to address SameKeyInsertAndCTTTest failure - Add missing arg parsing for MemOnlyCache - Re-enable DeviceType.LocalMemory in tests * [C#] MemOnlyCache sample: improved size tracking, including read cache (#800) * Improved cache size tracking, including read cache * Rename MemOnlyCache to ResizableCacheStore. * update doc * fixes * Updates * ClearBitsForDiskImages should unseal record as well (Q: why was it sealed to begin with?) * Correct clearing of index bits during recovery * Remove RecordInfo sealing * WIP Ephemeral locking at IFunctions-level only, part 1 * Remove unused SessionType enumeration; consolidate duplicate IFasterSession implementations * - Add EphemeralLocking readcache detach/reattach logic - Remove unused ReadFlags.ResetModifiedBit * Rename a couple files * re-add RecordInfo.Seal for Ephemeral locking; remove unused (RMW|Upsert)Action.NeedMoreSpace (this is the default 'false' behavior) * Remove single-key overloads of Lock() and Unlock() * - Update a too-aggressive assert. - CreateLogDevice errors on Windows if path > MAX_PATH minus room for segment#. * Improve previous MAX_PATH fix * Chnge Read of an expired to just return NOTFOUND | Expired rather than tombstoning * RETRY_LATER rather than trying to re-find splice point directly in VerifyInMemoryAddresses --------- Co-authored-by: Badrish Chandramouli <badrishc@microsoft.com>
2023-03-23 21:49:12 +03:00
Assert.IsTrue(status.IsPending, status.ToString());
[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
session.CompletePending(wait: true);
}
[C#] Change locking to use FasterBase hash buckets (#799) * Locking fixes - CompletePending* must also check to lock non-auxiliary records - Ephemeral locking must look for lock evictions as well - InternalLock must check for SpinWaitUntilRecordIsClosed - Replace oneMiss handling in InternalLock - EphemeralSUnlock must follow unlock failures - LockTable should have its own bufferPool - Ensure OnPagesClosed does eviction scans in address order * More locking fixes: - Fix missing unlock of a Tombstoned record in InternalContinuePendingRead - Add more Asserts where ManualLocking requires a locked record - Update and remove obsolete comments * - Remove key-present optimization for SpinWaitUntilRecordIsClosed - Better checking on following records transferred from LockTable in InternalLock(unlock) - Add some additional comments * Fix hash bucket overflow pointer during recovery Fix debug assert logic * WIP on locktable implemented via mainhash overflow buckets * unstaged files missed in previous push * Updates to EphemeralOnly locking for transfer-from-RO/RC * Change LockTableTests to OverflowBucketlockTableTests * Remove RecordInfo.Tentative, .IsIntermediate* * More locking WIP: session.NeedKeyLockCode, test cleanup * WIP locking: Tests build * WIP on mainhash locking: - Add KeyCode creation and sorting and methods public and internal - Remove unnecessary IsLocked (it does not make work with EphemeralOnly and SessionControlled may map to multiple keys) - More tests run now * Most UTs run * More UTs succeed * Still some UT failures * - use XLocks as Tentative indicator for insertions/splices at log tail and readcache insertions - improve readcache consistency checking - clear HasInMemoryLock when HeadAddress goes above srcRecord address following BlockAllocate - rename LockingMode.SessionControlled -> Mixed and other renaming for clarity - remove some unused methods - fix locking sequences in InternalContinuePendingR(ead|MW) * More fixes - Missing 'ref' on recordInfo var in FindAndUnlockTransferredRecord - Improve record allocation checking for below-HA in-memory source and RecordInfo lock clearing if so - Add LockCode to HashEntryInfo in DEBUG * Remove SpinWaitUntilRecordIsClosed; it was only used in ReadCache and in the relevant case we just need to wait for ReadCacheEvict to complete. * - MixedModeTentativeOrClosed is not needed - Add/Improve some ToString()s - Remove unused RecSrc.ClearSrc() - Rename to HasRecordInfoLock - Move ICPRead HandleImmediateRetryStatus outside the lock scope - Consoldiate EphemeralSUnlock(AfterPendingIO) * Streamline locking and FindInMemory calls in InternalXxx * - Change names to pendingContext.Initial*Address and improve setting of these in InternalXxx and handling of these in CompletePending*() and TryFindRecordInMemory. - Also consistentize related param names for readcache and log search to minAddress. * Clean up pending RMW call to CreateNewRecordRMW, per prior changes that make the inputSrc unnecessary. * - Fix stale readcache assignment to recSrc.Log - make searches after pendingIO completion non-inclusive of minAddress - Some ToString() and naming changes for consistency - Remove RecordInfo.IsValidUpdateOrLockSource (superseded by direct call to .IsClosed) * Allow length specification on KeyCode array operations * - Fix check for lock having escaped to eviction zone following BlockAllocate - Add some comments for SafeHeadAddress et al. * - Make sure the readcache bit is set when needed on addresses put into stackCtx.newLogicalAddress. - Rename to HandleNewRecordOnException for clarity * Update remote project * - Make sure FindAndUnlockTransferredRecord can go to SafeHeadAddress - Add non-ref overload of GetLockCode * Tweaks for benchmark with Mixed locking * Add ILockableKey.CompareLockCodes * Change LockCode to just be hashcode, since we may grow the hash table. * - Make CPR consistency check work without conflict with the key latches in the HashBuckets. - Change some names for clarity. - Pending read completion should return values from any in-memory record, as they are the latest * Remove duplicate opCtx param and removed sessionCtx (aka currentCtx, aka ctx) from calls where FasterSession was also passed (in favor of (new) FasterSession.SessionCtx), where the called method has a type constraint of "where FasterSession : IFasterSession<Key, Value, Input, Output, Context>". Not yet done: converting "whereFasterSession : IFasterSession" constraints to generic to remove the duplicate ctx parameter. * Fix DoLockOp to compare bucket indexes, not KeyCodes * Finish removal of duplicate sessionCtx param from calls where FasterSession was also passed (in favor of (new) FasterSession.SessionCtx), where the called method has a type constraint of "where FasterSession : IFasterSession" (non-generic). This cannot be done in Synchronization (the state machines) due to their use of NullFasterSession. * Fix key duplication in readcache and log: - VerifyInMemoryAddresses should not refresh hei if no splice point is present - FindRecordInMemory checks pendingContext.InitialHash - Move CompleteCopyToTail in ITCTT into the non-readcache section - TryFindRecordInMemory needs to check pc.InitialEntryIndex's readcache bit - Updaters need to scan down to hlog.ReadOnlyAddress to ensure the "key is not at or below LatestLogicalAddress" logic holds - ReadCacheCheckTailAfterSplice needs to check hei.*Address readcache bit * Replace use of SafeHeadAddress with SpinWaitUntilClosed in FindInReadCache * Remove LockingMode.EphemeralOnly add --hashpack arg to FASTER.benchmark * Tweaks for the Standard locking change * fix remote to use LockingMode.Standard * Add DisposeTest comments and more Asserts * Use calls on RecordSource to make it easier to verify correct matching of log and physicalAddress * Temporarily disable LocalMemoryDevice tests for investigation * test removal of DisposeTests * - Fix for CTT to address SameKeyInsertAndCTTTest failure - Add missing arg parsing for MemOnlyCache - Re-enable DeviceType.LocalMemory in tests * [C#] MemOnlyCache sample: improved size tracking, including read cache (#800) * Improved cache size tracking, including read cache * Rename MemOnlyCache to ResizableCacheStore. * update doc * fixes * Updates * ClearBitsForDiskImages should unseal record as well (Q: why was it sealed to begin with?) * Correct clearing of index bits during recovery * Remove RecordInfo sealing * WIP Ephemeral locking at IFunctions-level only, part 1 * Remove unused SessionType enumeration; consolidate duplicate IFasterSession implementations * - Add EphemeralLocking readcache detach/reattach logic - Remove unused ReadFlags.ResetModifiedBit * Rename a couple files * re-add RecordInfo.Seal for Ephemeral locking; remove unused (RMW|Upsert)Action.NeedMoreSpace (this is the default 'false' behavior) * Remove single-key overloads of Lock() and Unlock() * - Update a too-aggressive assert. - CreateLogDevice errors on Windows if path > MAX_PATH minus room for segment#. * Improve previous MAX_PATH fix * Chnge Read of an expired to just return NOTFOUND | Expired rather than tombstoning * RETRY_LATER rather than trying to re-find splice point directly in VerifyInMemoryAddresses --------- Co-authored-by: Badrish Chandramouli <badrishc@microsoft.com>
2023-03-23 21:49:12 +03:00
// We use Read() only here (not Upsert()), so we have only read locks and thus do not self-deadlock with an XLock on the colliding bucket.
[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 DoRead(DisposeFunctions functions)
{
[C#] Change locking to use FasterBase hash buckets (#799) * Locking fixes - CompletePending* must also check to lock non-auxiliary records - Ephemeral locking must look for lock evictions as well - InternalLock must check for SpinWaitUntilRecordIsClosed - Replace oneMiss handling in InternalLock - EphemeralSUnlock must follow unlock failures - LockTable should have its own bufferPool - Ensure OnPagesClosed does eviction scans in address order * More locking fixes: - Fix missing unlock of a Tombstoned record in InternalContinuePendingRead - Add more Asserts where ManualLocking requires a locked record - Update and remove obsolete comments * - Remove key-present optimization for SpinWaitUntilRecordIsClosed - Better checking on following records transferred from LockTable in InternalLock(unlock) - Add some additional comments * Fix hash bucket overflow pointer during recovery Fix debug assert logic * WIP on locktable implemented via mainhash overflow buckets * unstaged files missed in previous push * Updates to EphemeralOnly locking for transfer-from-RO/RC * Change LockTableTests to OverflowBucketlockTableTests * Remove RecordInfo.Tentative, .IsIntermediate* * More locking WIP: session.NeedKeyLockCode, test cleanup * WIP locking: Tests build * WIP on mainhash locking: - Add KeyCode creation and sorting and methods public and internal - Remove unnecessary IsLocked (it does not make work with EphemeralOnly and SessionControlled may map to multiple keys) - More tests run now * Most UTs run * More UTs succeed * Still some UT failures * - use XLocks as Tentative indicator for insertions/splices at log tail and readcache insertions - improve readcache consistency checking - clear HasInMemoryLock when HeadAddress goes above srcRecord address following BlockAllocate - rename LockingMode.SessionControlled -> Mixed and other renaming for clarity - remove some unused methods - fix locking sequences in InternalContinuePendingR(ead|MW) * More fixes - Missing 'ref' on recordInfo var in FindAndUnlockTransferredRecord - Improve record allocation checking for below-HA in-memory source and RecordInfo lock clearing if so - Add LockCode to HashEntryInfo in DEBUG * Remove SpinWaitUntilRecordIsClosed; it was only used in ReadCache and in the relevant case we just need to wait for ReadCacheEvict to complete. * - MixedModeTentativeOrClosed is not needed - Add/Improve some ToString()s - Remove unused RecSrc.ClearSrc() - Rename to HasRecordInfoLock - Move ICPRead HandleImmediateRetryStatus outside the lock scope - Consoldiate EphemeralSUnlock(AfterPendingIO) * Streamline locking and FindInMemory calls in InternalXxx * - Change names to pendingContext.Initial*Address and improve setting of these in InternalXxx and handling of these in CompletePending*() and TryFindRecordInMemory. - Also consistentize related param names for readcache and log search to minAddress. * Clean up pending RMW call to CreateNewRecordRMW, per prior changes that make the inputSrc unnecessary. * - Fix stale readcache assignment to recSrc.Log - make searches after pendingIO completion non-inclusive of minAddress - Some ToString() and naming changes for consistency - Remove RecordInfo.IsValidUpdateOrLockSource (superseded by direct call to .IsClosed) * Allow length specification on KeyCode array operations * - Fix check for lock having escaped to eviction zone following BlockAllocate - Add some comments for SafeHeadAddress et al. * - Make sure the readcache bit is set when needed on addresses put into stackCtx.newLogicalAddress. - Rename to HandleNewRecordOnException for clarity * Update remote project * - Make sure FindAndUnlockTransferredRecord can go to SafeHeadAddress - Add non-ref overload of GetLockCode * Tweaks for benchmark with Mixed locking * Add ILockableKey.CompareLockCodes * Change LockCode to just be hashcode, since we may grow the hash table. * - Make CPR consistency check work without conflict with the key latches in the HashBuckets. - Change some names for clarity. - Pending read completion should return values from any in-memory record, as they are the latest * Remove duplicate opCtx param and removed sessionCtx (aka currentCtx, aka ctx) from calls where FasterSession was also passed (in favor of (new) FasterSession.SessionCtx), where the called method has a type constraint of "where FasterSession : IFasterSession<Key, Value, Input, Output, Context>". Not yet done: converting "whereFasterSession : IFasterSession" constraints to generic to remove the duplicate ctx parameter. * Fix DoLockOp to compare bucket indexes, not KeyCodes * Finish removal of duplicate sessionCtx param from calls where FasterSession was also passed (in favor of (new) FasterSession.SessionCtx), where the called method has a type constraint of "where FasterSession : IFasterSession" (non-generic). This cannot be done in Synchronization (the state machines) due to their use of NullFasterSession. * Fix key duplication in readcache and log: - VerifyInMemoryAddresses should not refresh hei if no splice point is present - FindRecordInMemory checks pendingContext.InitialHash - Move CompleteCopyToTail in ITCTT into the non-readcache section - TryFindRecordInMemory needs to check pc.InitialEntryIndex's readcache bit - Updaters need to scan down to hlog.ReadOnlyAddress to ensure the "key is not at or below LatestLogicalAddress" logic holds - ReadCacheCheckTailAfterSplice needs to check hei.*Address readcache bit * Replace use of SafeHeadAddress with SpinWaitUntilClosed in FindInReadCache * Remove LockingMode.EphemeralOnly add --hashpack arg to FASTER.benchmark * Tweaks for the Standard locking change * fix remote to use LockingMode.Standard * Add DisposeTest comments and more Asserts * Use calls on RecordSource to make it easier to verify correct matching of log and physicalAddress * Temporarily disable LocalMemoryDevice tests for investigation * test removal of DisposeTests * - Fix for CTT to address SameKeyInsertAndCTTTest failure - Add missing arg parsing for MemOnlyCache - Re-enable DeviceType.LocalMemory in tests * [C#] MemOnlyCache sample: improved size tracking, including read cache (#800) * Improved cache size tracking, including read cache * Rename MemOnlyCache to ResizableCacheStore. * update doc * fixes * Updates * ClearBitsForDiskImages should unseal record as well (Q: why was it sealed to begin with?) * Correct clearing of index bits during recovery * Remove RecordInfo sealing * WIP Ephemeral locking at IFunctions-level only, part 1 * Remove unused SessionType enumeration; consolidate duplicate IFasterSession implementations * - Add EphemeralLocking readcache detach/reattach logic - Remove unused ReadFlags.ResetModifiedBit * Rename a couple files * re-add RecordInfo.Seal for Ephemeral locking; remove unused (RMW|Upsert)Action.NeedMoreSpace (this is the default 'false' behavior) * Remove single-key overloads of Lock() and Unlock() * - Update a too-aggressive assert. - CreateLogDevice errors on Windows if path > MAX_PATH minus room for segment#. * Improve previous MAX_PATH fix * Chnge Read of an expired to just return NOTFOUND | Expired rather than tombstoning * RETRY_LATER rather than trying to re-find splice point directly in VerifyInMemoryAddresses --------- Co-authored-by: Badrish Chandramouli <badrishc@microsoft.com>
2023-03-23 21:49:12 +03:00
MyOutput output = new();
MyInput input = new();
[C#] Add ConditionalCopyToTail (#807) * Locking fixes - CompletePending* must also check to lock non-auxiliary records - Ephemeral locking must look for lock evictions as well - InternalLock must check for SpinWaitUntilRecordIsClosed - Replace oneMiss handling in InternalLock - EphemeralSUnlock must follow unlock failures - LockTable should have its own bufferPool - Ensure OnPagesClosed does eviction scans in address order * More locking fixes: - Fix missing unlock of a Tombstoned record in InternalContinuePendingRead - Add more Asserts where ManualLocking requires a locked record - Update and remove obsolete comments * - Remove key-present optimization for SpinWaitUntilRecordIsClosed - Better checking on following records transferred from LockTable in InternalLock(unlock) - Add some additional comments * Fix hash bucket overflow pointer during recovery Fix debug assert logic * WIP on locktable implemented via mainhash overflow buckets * unstaged files missed in previous push * Updates to EphemeralOnly locking for transfer-from-RO/RC * Change LockTableTests to OverflowBucketlockTableTests * Remove RecordInfo.Tentative, .IsIntermediate* * More locking WIP: session.NeedKeyLockCode, test cleanup * WIP locking: Tests build * WIP on mainhash locking: - Add KeyCode creation and sorting and methods public and internal - Remove unnecessary IsLocked (it does not make work with EphemeralOnly and SessionControlled may map to multiple keys) - More tests run now * Most UTs run * More UTs succeed * Still some UT failures * - use XLocks as Tentative indicator for insertions/splices at log tail and readcache insertions - improve readcache consistency checking - clear HasInMemoryLock when HeadAddress goes above srcRecord address following BlockAllocate - rename LockingMode.SessionControlled -> Mixed and other renaming for clarity - remove some unused methods - fix locking sequences in InternalContinuePendingR(ead|MW) * More fixes - Missing 'ref' on recordInfo var in FindAndUnlockTransferredRecord - Improve record allocation checking for below-HA in-memory source and RecordInfo lock clearing if so - Add LockCode to HashEntryInfo in DEBUG * Remove SpinWaitUntilRecordIsClosed; it was only used in ReadCache and in the relevant case we just need to wait for ReadCacheEvict to complete. * - MixedModeTentativeOrClosed is not needed - Add/Improve some ToString()s - Remove unused RecSrc.ClearSrc() - Rename to HasRecordInfoLock - Move ICPRead HandleImmediateRetryStatus outside the lock scope - Consoldiate EphemeralSUnlock(AfterPendingIO) * Streamline locking and FindInMemory calls in InternalXxx * - Change names to pendingContext.Initial*Address and improve setting of these in InternalXxx and handling of these in CompletePending*() and TryFindRecordInMemory. - Also consistentize related param names for readcache and log search to minAddress. * Clean up pending RMW call to CreateNewRecordRMW, per prior changes that make the inputSrc unnecessary. * - Fix stale readcache assignment to recSrc.Log - make searches after pendingIO completion non-inclusive of minAddress - Some ToString() and naming changes for consistency - Remove RecordInfo.IsValidUpdateOrLockSource (superseded by direct call to .IsClosed) * Allow length specification on KeyCode array operations * - Fix check for lock having escaped to eviction zone following BlockAllocate - Add some comments for SafeHeadAddress et al. * - Make sure the readcache bit is set when needed on addresses put into stackCtx.newLogicalAddress. - Rename to HandleNewRecordOnException for clarity * Update remote project * - Make sure FindAndUnlockTransferredRecord can go to SafeHeadAddress - Add non-ref overload of GetLockCode * Tweaks for benchmark with Mixed locking * Add ILockableKey.CompareLockCodes * Change LockCode to just be hashcode, since we may grow the hash table. * - Make CPR consistency check work without conflict with the key latches in the HashBuckets. - Change some names for clarity. - Pending read completion should return values from any in-memory record, as they are the latest * Remove duplicate opCtx param and removed sessionCtx (aka currentCtx, aka ctx) from calls where FasterSession was also passed (in favor of (new) FasterSession.SessionCtx), where the called method has a type constraint of "where FasterSession : IFasterSession<Key, Value, Input, Output, Context>". Not yet done: converting "whereFasterSession : IFasterSession" constraints to generic to remove the duplicate ctx parameter. * Fix DoLockOp to compare bucket indexes, not KeyCodes * Finish removal of duplicate sessionCtx param from calls where FasterSession was also passed (in favor of (new) FasterSession.SessionCtx), where the called method has a type constraint of "where FasterSession : IFasterSession" (non-generic). This cannot be done in Synchronization (the state machines) due to their use of NullFasterSession. * Fix key duplication in readcache and log: - VerifyInMemoryAddresses should not refresh hei if no splice point is present - FindRecordInMemory checks pendingContext.InitialHash - Move CompleteCopyToTail in ITCTT into the non-readcache section - TryFindRecordInMemory needs to check pc.InitialEntryIndex's readcache bit - Updaters need to scan down to hlog.ReadOnlyAddress to ensure the "key is not at or below LatestLogicalAddress" logic holds - ReadCacheCheckTailAfterSplice needs to check hei.*Address readcache bit * Replace use of SafeHeadAddress with SpinWaitUntilClosed in FindInReadCache * Remove LockingMode.EphemeralOnly add --hashpack arg to FASTER.benchmark * Tweaks for the Standard locking change * fix remote to use LockingMode.Standard * Add DisposeTest comments and more Asserts * Use calls on RecordSource to make it easier to verify correct matching of log and physicalAddress * Temporarily disable LocalMemoryDevice tests for investigation * test removal of DisposeTests * - Fix for CTT to address SameKeyInsertAndCTTTest failure - Add missing arg parsing for MemOnlyCache - Re-enable DeviceType.LocalMemory in tests * WIP on ConditionalInsert * [C#] MemOnlyCache sample: improved size tracking, including read cache (#800) * Improved cache size tracking, including read cache * Rename MemOnlyCache to ResizableCacheStore. * update doc * fixes * Updates * ClearBitsForDiskImages should unseal record as well (Q: why was it sealed to begin with?) * Correct clearing of index bits during recovery * Remove RecordInfo sealing * WIP Ephemeral locking at IFunctions-level only, part 1 * Remove unused SessionType enumeration; consolidate duplicate IFasterSession implementations * - Add EphemeralLocking readcache detach/reattach logic - Remove unused ReadFlags.ResetModifiedBit * Rename a couple files * re-add RecordInfo.Seal for Ephemeral locking; remove unused (RMW|Upsert)Action.NeedMoreSpace (this is the default 'false' behavior) * Remove single-key overloads of Lock() and Unlock() * - Update a too-aggressive assert. - CreateLogDevice errors on Windows if path > MAX_PATH minus room for segment#. * Improve previous MAX_PATH fix * Chnge Read of an expired to just return NOTFOUND | Expired rather than tombstoning * - Replace ReadFlags with ReadCopyOptions - More WIP on ConditionalInsert * RETRY_LATER rather than trying to re-find splice point directly in VerifyInMemoryAddresses * More WIP on ConditionalInsert * WIP on ConditionalCopyToTail * change filename * - Fix Compact/ConditionalCopyToTail - Make TryCopyToReadCache bool - Tighten up DetachAndReattachReadCacheChain - Other minor tweaks * fix merge ---------
2023-03-28 04:23:17 +03:00
ReadOptions readOptions = new() { CopyFrom = ReadCopyFrom.Device };
[C#] Change locking to use FasterBase hash buckets (#799) * Locking fixes - CompletePending* must also check to lock non-auxiliary records - Ephemeral locking must look for lock evictions as well - InternalLock must check for SpinWaitUntilRecordIsClosed - Replace oneMiss handling in InternalLock - EphemeralSUnlock must follow unlock failures - LockTable should have its own bufferPool - Ensure OnPagesClosed does eviction scans in address order * More locking fixes: - Fix missing unlock of a Tombstoned record in InternalContinuePendingRead - Add more Asserts where ManualLocking requires a locked record - Update and remove obsolete comments * - Remove key-present optimization for SpinWaitUntilRecordIsClosed - Better checking on following records transferred from LockTable in InternalLock(unlock) - Add some additional comments * Fix hash bucket overflow pointer during recovery Fix debug assert logic * WIP on locktable implemented via mainhash overflow buckets * unstaged files missed in previous push * Updates to EphemeralOnly locking for transfer-from-RO/RC * Change LockTableTests to OverflowBucketlockTableTests * Remove RecordInfo.Tentative, .IsIntermediate* * More locking WIP: session.NeedKeyLockCode, test cleanup * WIP locking: Tests build * WIP on mainhash locking: - Add KeyCode creation and sorting and methods public and internal - Remove unnecessary IsLocked (it does not make work with EphemeralOnly and SessionControlled may map to multiple keys) - More tests run now * Most UTs run * More UTs succeed * Still some UT failures * - use XLocks as Tentative indicator for insertions/splices at log tail and readcache insertions - improve readcache consistency checking - clear HasInMemoryLock when HeadAddress goes above srcRecord address following BlockAllocate - rename LockingMode.SessionControlled -> Mixed and other renaming for clarity - remove some unused methods - fix locking sequences in InternalContinuePendingR(ead|MW) * More fixes - Missing 'ref' on recordInfo var in FindAndUnlockTransferredRecord - Improve record allocation checking for below-HA in-memory source and RecordInfo lock clearing if so - Add LockCode to HashEntryInfo in DEBUG * Remove SpinWaitUntilRecordIsClosed; it was only used in ReadCache and in the relevant case we just need to wait for ReadCacheEvict to complete. * - MixedModeTentativeOrClosed is not needed - Add/Improve some ToString()s - Remove unused RecSrc.ClearSrc() - Rename to HasRecordInfoLock - Move ICPRead HandleImmediateRetryStatus outside the lock scope - Consoldiate EphemeralSUnlock(AfterPendingIO) * Streamline locking and FindInMemory calls in InternalXxx * - Change names to pendingContext.Initial*Address and improve setting of these in InternalXxx and handling of these in CompletePending*() and TryFindRecordInMemory. - Also consistentize related param names for readcache and log search to minAddress. * Clean up pending RMW call to CreateNewRecordRMW, per prior changes that make the inputSrc unnecessary. * - Fix stale readcache assignment to recSrc.Log - make searches after pendingIO completion non-inclusive of minAddress - Some ToString() and naming changes for consistency - Remove RecordInfo.IsValidUpdateOrLockSource (superseded by direct call to .IsClosed) * Allow length specification on KeyCode array operations * - Fix check for lock having escaped to eviction zone following BlockAllocate - Add some comments for SafeHeadAddress et al. * - Make sure the readcache bit is set when needed on addresses put into stackCtx.newLogicalAddress. - Rename to HandleNewRecordOnException for clarity * Update remote project * - Make sure FindAndUnlockTransferredRecord can go to SafeHeadAddress - Add non-ref overload of GetLockCode * Tweaks for benchmark with Mixed locking * Add ILockableKey.CompareLockCodes * Change LockCode to just be hashcode, since we may grow the hash table. * - Make CPR consistency check work without conflict with the key latches in the HashBuckets. - Change some names for clarity. - Pending read completion should return values from any in-memory record, as they are the latest * Remove duplicate opCtx param and removed sessionCtx (aka currentCtx, aka ctx) from calls where FasterSession was also passed (in favor of (new) FasterSession.SessionCtx), where the called method has a type constraint of "where FasterSession : IFasterSession<Key, Value, Input, Output, Context>". Not yet done: converting "whereFasterSession : IFasterSession" constraints to generic to remove the duplicate ctx parameter. * Fix DoLockOp to compare bucket indexes, not KeyCodes * Finish removal of duplicate sessionCtx param from calls where FasterSession was also passed (in favor of (new) FasterSession.SessionCtx), where the called method has a type constraint of "where FasterSession : IFasterSession" (non-generic). This cannot be done in Synchronization (the state machines) due to their use of NullFasterSession. * Fix key duplication in readcache and log: - VerifyInMemoryAddresses should not refresh hei if no splice point is present - FindRecordInMemory checks pendingContext.InitialHash - Move CompleteCopyToTail in ITCTT into the non-readcache section - TryFindRecordInMemory needs to check pc.InitialEntryIndex's readcache bit - Updaters need to scan down to hlog.ReadOnlyAddress to ensure the "key is not at or below LatestLogicalAddress" logic holds - ReadCacheCheckTailAfterSplice needs to check hei.*Address readcache bit * Replace use of SafeHeadAddress with SpinWaitUntilClosed in FindInReadCache * Remove LockingMode.EphemeralOnly add --hashpack arg to FASTER.benchmark * Tweaks for the Standard locking change * fix remote to use LockingMode.Standard * Add DisposeTest comments and more Asserts * Use calls on RecordSource to make it easier to verify correct matching of log and physicalAddress * Temporarily disable LocalMemoryDevice tests for investigation * test removal of DisposeTests * - Fix for CTT to address SameKeyInsertAndCTTTest failure - Add missing arg parsing for MemOnlyCache - Re-enable DeviceType.LocalMemory in tests * [C#] MemOnlyCache sample: improved size tracking, including read cache (#800) * Improved cache size tracking, including read cache * Rename MemOnlyCache to ResizableCacheStore. * update doc * fixes * Updates * ClearBitsForDiskImages should unseal record as well (Q: why was it sealed to begin with?) * Correct clearing of index bits during recovery * Remove RecordInfo sealing * WIP Ephemeral locking at IFunctions-level only, part 1 * Remove unused SessionType enumeration; consolidate duplicate IFasterSession implementations * - Add EphemeralLocking readcache detach/reattach logic - Remove unused ReadFlags.ResetModifiedBit * Rename a couple files * re-add RecordInfo.Seal for Ephemeral locking; remove unused (RMW|Upsert)Action.NeedMoreSpace (this is the default 'false' behavior) * Remove single-key overloads of Lock() and Unlock() * - Update a too-aggressive assert. - CreateLogDevice errors on Windows if path > MAX_PATH minus room for segment#. * Improve previous MAX_PATH fix * Chnge Read of an expired to just return NOTFOUND | Expired rather than tombstoning * RETRY_LATER rather than trying to re-find splice point directly in VerifyInMemoryAddresses --------- Co-authored-by: Badrish Chandramouli <badrishc@microsoft.com>
2023-03-23 21:49:12 +03:00
if (copyDest == ReadCopyDestination.Tail)
[C#] Add ConditionalCopyToTail (#807) * Locking fixes - CompletePending* must also check to lock non-auxiliary records - Ephemeral locking must look for lock evictions as well - InternalLock must check for SpinWaitUntilRecordIsClosed - Replace oneMiss handling in InternalLock - EphemeralSUnlock must follow unlock failures - LockTable should have its own bufferPool - Ensure OnPagesClosed does eviction scans in address order * More locking fixes: - Fix missing unlock of a Tombstoned record in InternalContinuePendingRead - Add more Asserts where ManualLocking requires a locked record - Update and remove obsolete comments * - Remove key-present optimization for SpinWaitUntilRecordIsClosed - Better checking on following records transferred from LockTable in InternalLock(unlock) - Add some additional comments * Fix hash bucket overflow pointer during recovery Fix debug assert logic * WIP on locktable implemented via mainhash overflow buckets * unstaged files missed in previous push * Updates to EphemeralOnly locking for transfer-from-RO/RC * Change LockTableTests to OverflowBucketlockTableTests * Remove RecordInfo.Tentative, .IsIntermediate* * More locking WIP: session.NeedKeyLockCode, test cleanup * WIP locking: Tests build * WIP on mainhash locking: - Add KeyCode creation and sorting and methods public and internal - Remove unnecessary IsLocked (it does not make work with EphemeralOnly and SessionControlled may map to multiple keys) - More tests run now * Most UTs run * More UTs succeed * Still some UT failures * - use XLocks as Tentative indicator for insertions/splices at log tail and readcache insertions - improve readcache consistency checking - clear HasInMemoryLock when HeadAddress goes above srcRecord address following BlockAllocate - rename LockingMode.SessionControlled -> Mixed and other renaming for clarity - remove some unused methods - fix locking sequences in InternalContinuePendingR(ead|MW) * More fixes - Missing 'ref' on recordInfo var in FindAndUnlockTransferredRecord - Improve record allocation checking for below-HA in-memory source and RecordInfo lock clearing if so - Add LockCode to HashEntryInfo in DEBUG * Remove SpinWaitUntilRecordIsClosed; it was only used in ReadCache and in the relevant case we just need to wait for ReadCacheEvict to complete. * - MixedModeTentativeOrClosed is not needed - Add/Improve some ToString()s - Remove unused RecSrc.ClearSrc() - Rename to HasRecordInfoLock - Move ICPRead HandleImmediateRetryStatus outside the lock scope - Consoldiate EphemeralSUnlock(AfterPendingIO) * Streamline locking and FindInMemory calls in InternalXxx * - Change names to pendingContext.Initial*Address and improve setting of these in InternalXxx and handling of these in CompletePending*() and TryFindRecordInMemory. - Also consistentize related param names for readcache and log search to minAddress. * Clean up pending RMW call to CreateNewRecordRMW, per prior changes that make the inputSrc unnecessary. * - Fix stale readcache assignment to recSrc.Log - make searches after pendingIO completion non-inclusive of minAddress - Some ToString() and naming changes for consistency - Remove RecordInfo.IsValidUpdateOrLockSource (superseded by direct call to .IsClosed) * Allow length specification on KeyCode array operations * - Fix check for lock having escaped to eviction zone following BlockAllocate - Add some comments for SafeHeadAddress et al. * - Make sure the readcache bit is set when needed on addresses put into stackCtx.newLogicalAddress. - Rename to HandleNewRecordOnException for clarity * Update remote project * - Make sure FindAndUnlockTransferredRecord can go to SafeHeadAddress - Add non-ref overload of GetLockCode * Tweaks for benchmark with Mixed locking * Add ILockableKey.CompareLockCodes * Change LockCode to just be hashcode, since we may grow the hash table. * - Make CPR consistency check work without conflict with the key latches in the HashBuckets. - Change some names for clarity. - Pending read completion should return values from any in-memory record, as they are the latest * Remove duplicate opCtx param and removed sessionCtx (aka currentCtx, aka ctx) from calls where FasterSession was also passed (in favor of (new) FasterSession.SessionCtx), where the called method has a type constraint of "where FasterSession : IFasterSession<Key, Value, Input, Output, Context>". Not yet done: converting "whereFasterSession : IFasterSession" constraints to generic to remove the duplicate ctx parameter. * Fix DoLockOp to compare bucket indexes, not KeyCodes * Finish removal of duplicate sessionCtx param from calls where FasterSession was also passed (in favor of (new) FasterSession.SessionCtx), where the called method has a type constraint of "where FasterSession : IFasterSession" (non-generic). This cannot be done in Synchronization (the state machines) due to their use of NullFasterSession. * Fix key duplication in readcache and log: - VerifyInMemoryAddresses should not refresh hei if no splice point is present - FindRecordInMemory checks pendingContext.InitialHash - Move CompleteCopyToTail in ITCTT into the non-readcache section - TryFindRecordInMemory needs to check pc.InitialEntryIndex's readcache bit - Updaters need to scan down to hlog.ReadOnlyAddress to ensure the "key is not at or below LatestLogicalAddress" logic holds - ReadCacheCheckTailAfterSplice needs to check hei.*Address readcache bit * Replace use of SafeHeadAddress with SpinWaitUntilClosed in FindInReadCache * Remove LockingMode.EphemeralOnly add --hashpack arg to FASTER.benchmark * Tweaks for the Standard locking change * fix remote to use LockingMode.Standard * Add DisposeTest comments and more Asserts * Use calls on RecordSource to make it easier to verify correct matching of log and physicalAddress * Temporarily disable LocalMemoryDevice tests for investigation * test removal of DisposeTests * - Fix for CTT to address SameKeyInsertAndCTTTest failure - Add missing arg parsing for MemOnlyCache - Re-enable DeviceType.LocalMemory in tests * WIP on ConditionalInsert * [C#] MemOnlyCache sample: improved size tracking, including read cache (#800) * Improved cache size tracking, including read cache * Rename MemOnlyCache to ResizableCacheStore. * update doc * fixes * Updates * ClearBitsForDiskImages should unseal record as well (Q: why was it sealed to begin with?) * Correct clearing of index bits during recovery * Remove RecordInfo sealing * WIP Ephemeral locking at IFunctions-level only, part 1 * Remove unused SessionType enumeration; consolidate duplicate IFasterSession implementations * - Add EphemeralLocking readcache detach/reattach logic - Remove unused ReadFlags.ResetModifiedBit * Rename a couple files * re-add RecordInfo.Seal for Ephemeral locking; remove unused (RMW|Upsert)Action.NeedMoreSpace (this is the default 'false' behavior) * Remove single-key overloads of Lock() and Unlock() * - Update a too-aggressive assert. - CreateLogDevice errors on Windows if path > MAX_PATH minus room for segment#. * Improve previous MAX_PATH fix * Chnge Read of an expired to just return NOTFOUND | Expired rather than tombstoning * - Replace ReadFlags with ReadCopyOptions - More WIP on ConditionalInsert * RETRY_LATER rather than trying to re-find splice point directly in VerifyInMemoryAddresses * More WIP on ConditionalInsert * WIP on ConditionalCopyToTail * change filename * - Fix Compact/ConditionalCopyToTail - Make TryCopyToReadCache bool - Tighten up DetachAndReattachReadCacheChain - Other minor tweaks * fix merge ---------
2023-03-28 04:23:17 +03:00
readOptions.CopyOptions.CopyTo = ReadCopyTo.MainLog;
[C#] Change locking to use FasterBase hash buckets (#799) * Locking fixes - CompletePending* must also check to lock non-auxiliary records - Ephemeral locking must look for lock evictions as well - InternalLock must check for SpinWaitUntilRecordIsClosed - Replace oneMiss handling in InternalLock - EphemeralSUnlock must follow unlock failures - LockTable should have its own bufferPool - Ensure OnPagesClosed does eviction scans in address order * More locking fixes: - Fix missing unlock of a Tombstoned record in InternalContinuePendingRead - Add more Asserts where ManualLocking requires a locked record - Update and remove obsolete comments * - Remove key-present optimization for SpinWaitUntilRecordIsClosed - Better checking on following records transferred from LockTable in InternalLock(unlock) - Add some additional comments * Fix hash bucket overflow pointer during recovery Fix debug assert logic * WIP on locktable implemented via mainhash overflow buckets * unstaged files missed in previous push * Updates to EphemeralOnly locking for transfer-from-RO/RC * Change LockTableTests to OverflowBucketlockTableTests * Remove RecordInfo.Tentative, .IsIntermediate* * More locking WIP: session.NeedKeyLockCode, test cleanup * WIP locking: Tests build * WIP on mainhash locking: - Add KeyCode creation and sorting and methods public and internal - Remove unnecessary IsLocked (it does not make work with EphemeralOnly and SessionControlled may map to multiple keys) - More tests run now * Most UTs run * More UTs succeed * Still some UT failures * - use XLocks as Tentative indicator for insertions/splices at log tail and readcache insertions - improve readcache consistency checking - clear HasInMemoryLock when HeadAddress goes above srcRecord address following BlockAllocate - rename LockingMode.SessionControlled -> Mixed and other renaming for clarity - remove some unused methods - fix locking sequences in InternalContinuePendingR(ead|MW) * More fixes - Missing 'ref' on recordInfo var in FindAndUnlockTransferredRecord - Improve record allocation checking for below-HA in-memory source and RecordInfo lock clearing if so - Add LockCode to HashEntryInfo in DEBUG * Remove SpinWaitUntilRecordIsClosed; it was only used in ReadCache and in the relevant case we just need to wait for ReadCacheEvict to complete. * - MixedModeTentativeOrClosed is not needed - Add/Improve some ToString()s - Remove unused RecSrc.ClearSrc() - Rename to HasRecordInfoLock - Move ICPRead HandleImmediateRetryStatus outside the lock scope - Consoldiate EphemeralSUnlock(AfterPendingIO) * Streamline locking and FindInMemory calls in InternalXxx * - Change names to pendingContext.Initial*Address and improve setting of these in InternalXxx and handling of these in CompletePending*() and TryFindRecordInMemory. - Also consistentize related param names for readcache and log search to minAddress. * Clean up pending RMW call to CreateNewRecordRMW, per prior changes that make the inputSrc unnecessary. * - Fix stale readcache assignment to recSrc.Log - make searches after pendingIO completion non-inclusive of minAddress - Some ToString() and naming changes for consistency - Remove RecordInfo.IsValidUpdateOrLockSource (superseded by direct call to .IsClosed) * Allow length specification on KeyCode array operations * - Fix check for lock having escaped to eviction zone following BlockAllocate - Add some comments for SafeHeadAddress et al. * - Make sure the readcache bit is set when needed on addresses put into stackCtx.newLogicalAddress. - Rename to HandleNewRecordOnException for clarity * Update remote project * - Make sure FindAndUnlockTransferredRecord can go to SafeHeadAddress - Add non-ref overload of GetLockCode * Tweaks for benchmark with Mixed locking * Add ILockableKey.CompareLockCodes * Change LockCode to just be hashcode, since we may grow the hash table. * - Make CPR consistency check work without conflict with the key latches in the HashBuckets. - Change some names for clarity. - Pending read completion should return values from any in-memory record, as they are the latest * Remove duplicate opCtx param and removed sessionCtx (aka currentCtx, aka ctx) from calls where FasterSession was also passed (in favor of (new) FasterSession.SessionCtx), where the called method has a type constraint of "where FasterSession : IFasterSession<Key, Value, Input, Output, Context>". Not yet done: converting "whereFasterSession : IFasterSession" constraints to generic to remove the duplicate ctx parameter. * Fix DoLockOp to compare bucket indexes, not KeyCodes * Finish removal of duplicate sessionCtx param from calls where FasterSession was also passed (in favor of (new) FasterSession.SessionCtx), where the called method has a type constraint of "where FasterSession : IFasterSession" (non-generic). This cannot be done in Synchronization (the state machines) due to their use of NullFasterSession. * Fix key duplication in readcache and log: - VerifyInMemoryAddresses should not refresh hei if no splice point is present - FindRecordInMemory checks pendingContext.InitialHash - Move CompleteCopyToTail in ITCTT into the non-readcache section - TryFindRecordInMemory needs to check pc.InitialEntryIndex's readcache bit - Updaters need to scan down to hlog.ReadOnlyAddress to ensure the "key is not at or below LatestLogicalAddress" logic holds - ReadCacheCheckTailAfterSplice needs to check hei.*Address readcache bit * Replace use of SafeHeadAddress with SpinWaitUntilClosed in FindInReadCache * Remove LockingMode.EphemeralOnly add --hashpack arg to FASTER.benchmark * Tweaks for the Standard locking change * fix remote to use LockingMode.Standard * Add DisposeTest comments and more Asserts * Use calls on RecordSource to make it easier to verify correct matching of log and physicalAddress * Temporarily disable LocalMemoryDevice tests for investigation * test removal of DisposeTests * - Fix for CTT to address SameKeyInsertAndCTTTest failure - Add missing arg parsing for MemOnlyCache - Re-enable DeviceType.LocalMemory in tests * [C#] MemOnlyCache sample: improved size tracking, including read cache (#800) * Improved cache size tracking, including read cache * Rename MemOnlyCache to ResizableCacheStore. * update doc * fixes * Updates * ClearBitsForDiskImages should unseal record as well (Q: why was it sealed to begin with?) * Correct clearing of index bits during recovery * Remove RecordInfo sealing * WIP Ephemeral locking at IFunctions-level only, part 1 * Remove unused SessionType enumeration; consolidate duplicate IFasterSession implementations * - Add EphemeralLocking readcache detach/reattach logic - Remove unused ReadFlags.ResetModifiedBit * Rename a couple files * re-add RecordInfo.Seal for Ephemeral locking; remove unused (RMW|Upsert)Action.NeedMoreSpace (this is the default 'false' behavior) * Remove single-key overloads of Lock() and Unlock() * - Update a too-aggressive assert. - CreateLogDevice errors on Windows if path > MAX_PATH minus room for segment#. * Improve previous MAX_PATH fix * Chnge Read of an expired to just return NOTFOUND | Expired rather than tombstoning * RETRY_LATER rather than trying to re-find splice point directly in VerifyInMemoryAddresses --------- Co-authored-by: Badrish Chandramouli <badrishc@microsoft.com>
2023-03-23 21:49:12 +03:00
[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 var session = fht.NewSession(functions);
if (functions.isSUT)
{
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);
[C#] Change locking to use FasterBase hash buckets (#799) * Locking fixes - CompletePending* must also check to lock non-auxiliary records - Ephemeral locking must look for lock evictions as well - InternalLock must check for SpinWaitUntilRecordIsClosed - Replace oneMiss handling in InternalLock - EphemeralSUnlock must follow unlock failures - LockTable should have its own bufferPool - Ensure OnPagesClosed does eviction scans in address order * More locking fixes: - Fix missing unlock of a Tombstoned record in InternalContinuePendingRead - Add more Asserts where ManualLocking requires a locked record - Update and remove obsolete comments * - Remove key-present optimization for SpinWaitUntilRecordIsClosed - Better checking on following records transferred from LockTable in InternalLock(unlock) - Add some additional comments * Fix hash bucket overflow pointer during recovery Fix debug assert logic * WIP on locktable implemented via mainhash overflow buckets * unstaged files missed in previous push * Updates to EphemeralOnly locking for transfer-from-RO/RC * Change LockTableTests to OverflowBucketlockTableTests * Remove RecordInfo.Tentative, .IsIntermediate* * More locking WIP: session.NeedKeyLockCode, test cleanup * WIP locking: Tests build * WIP on mainhash locking: - Add KeyCode creation and sorting and methods public and internal - Remove unnecessary IsLocked (it does not make work with EphemeralOnly and SessionControlled may map to multiple keys) - More tests run now * Most UTs run * More UTs succeed * Still some UT failures * - use XLocks as Tentative indicator for insertions/splices at log tail and readcache insertions - improve readcache consistency checking - clear HasInMemoryLock when HeadAddress goes above srcRecord address following BlockAllocate - rename LockingMode.SessionControlled -> Mixed and other renaming for clarity - remove some unused methods - fix locking sequences in InternalContinuePendingR(ead|MW) * More fixes - Missing 'ref' on recordInfo var in FindAndUnlockTransferredRecord - Improve record allocation checking for below-HA in-memory source and RecordInfo lock clearing if so - Add LockCode to HashEntryInfo in DEBUG * Remove SpinWaitUntilRecordIsClosed; it was only used in ReadCache and in the relevant case we just need to wait for ReadCacheEvict to complete. * - MixedModeTentativeOrClosed is not needed - Add/Improve some ToString()s - Remove unused RecSrc.ClearSrc() - Rename to HasRecordInfoLock - Move ICPRead HandleImmediateRetryStatus outside the lock scope - Consoldiate EphemeralSUnlock(AfterPendingIO) * Streamline locking and FindInMemory calls in InternalXxx * - Change names to pendingContext.Initial*Address and improve setting of these in InternalXxx and handling of these in CompletePending*() and TryFindRecordInMemory. - Also consistentize related param names for readcache and log search to minAddress. * Clean up pending RMW call to CreateNewRecordRMW, per prior changes that make the inputSrc unnecessary. * - Fix stale readcache assignment to recSrc.Log - make searches after pendingIO completion non-inclusive of minAddress - Some ToString() and naming changes for consistency - Remove RecordInfo.IsValidUpdateOrLockSource (superseded by direct call to .IsClosed) * Allow length specification on KeyCode array operations * - Fix check for lock having escaped to eviction zone following BlockAllocate - Add some comments for SafeHeadAddress et al. * - Make sure the readcache bit is set when needed on addresses put into stackCtx.newLogicalAddress. - Rename to HandleNewRecordOnException for clarity * Update remote project * - Make sure FindAndUnlockTransferredRecord can go to SafeHeadAddress - Add non-ref overload of GetLockCode * Tweaks for benchmark with Mixed locking * Add ILockableKey.CompareLockCodes * Change LockCode to just be hashcode, since we may grow the hash table. * - Make CPR consistency check work without conflict with the key latches in the HashBuckets. - Change some names for clarity. - Pending read completion should return values from any in-memory record, as they are the latest * Remove duplicate opCtx param and removed sessionCtx (aka currentCtx, aka ctx) from calls where FasterSession was also passed (in favor of (new) FasterSession.SessionCtx), where the called method has a type constraint of "where FasterSession : IFasterSession<Key, Value, Input, Output, Context>". Not yet done: converting "whereFasterSession : IFasterSession" constraints to generic to remove the duplicate ctx parameter. * Fix DoLockOp to compare bucket indexes, not KeyCodes * Finish removal of duplicate sessionCtx param from calls where FasterSession was also passed (in favor of (new) FasterSession.SessionCtx), where the called method has a type constraint of "where FasterSession : IFasterSession" (non-generic). This cannot be done in Synchronization (the state machines) due to their use of NullFasterSession. * Fix key duplication in readcache and log: - VerifyInMemoryAddresses should not refresh hei if no splice point is present - FindRecordInMemory checks pendingContext.InitialHash - Move CompleteCopyToTail in ITCTT into the non-readcache section - TryFindRecordInMemory needs to check pc.InitialEntryIndex's readcache bit - Updaters need to scan down to hlog.ReadOnlyAddress to ensure the "key is not at or below LatestLogicalAddress" logic holds - ReadCacheCheckTailAfterSplice needs to check hei.*Address readcache bit * Replace use of SafeHeadAddress with SpinWaitUntilClosed in FindInReadCache * Remove LockingMode.EphemeralOnly add --hashpack arg to FASTER.benchmark * Tweaks for the Standard locking change * fix remote to use LockingMode.Standard * Add DisposeTest comments and more Asserts * Use calls on RecordSource to make it easier to verify correct matching of log and physicalAddress * Temporarily disable LocalMemoryDevice tests for investigation * test removal of DisposeTests * - Fix for CTT to address SameKeyInsertAndCTTTest failure - Add missing arg parsing for MemOnlyCache - Re-enable DeviceType.LocalMemory in tests * [C#] MemOnlyCache sample: improved size tracking, including read cache (#800) * Improved cache size tracking, including read cache * Rename MemOnlyCache to ResizableCacheStore. * update doc * fixes * Updates * ClearBitsForDiskImages should unseal record as well (Q: why was it sealed to begin with?) * Correct clearing of index bits during recovery * Remove RecordInfo sealing * WIP Ephemeral locking at IFunctions-level only, part 1 * Remove unused SessionType enumeration; consolidate duplicate IFasterSession implementations * - Add EphemeralLocking readcache detach/reattach logic - Remove unused ReadFlags.ResetModifiedBit * Rename a couple files * re-add RecordInfo.Seal for Ephemeral locking; remove unused (RMW|Upsert)Action.NeedMoreSpace (this is the default 'false' behavior) * Remove single-key overloads of Lock() and Unlock() * - Update a too-aggressive assert. - CreateLogDevice errors on Windows if path > MAX_PATH minus room for segment#. * Improve previous MAX_PATH fix * Chnge Read of an expired to just return NOTFOUND | Expired rather than tombstoning * RETRY_LATER rather than trying to re-find splice point directly in VerifyInMemoryAddresses --------- Co-authored-by: Badrish Chandramouli <badrishc@microsoft.com>
2023-03-23 21:49:12 +03:00
Assert.IsTrue(status.Found, status.ToString());
[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(TestInitialValue, output.value.value);
}
else
{
otherGate.Wait();
[C#] Change locking to use FasterBase hash buckets (#799) * Locking fixes - CompletePending* must also check to lock non-auxiliary records - Ephemeral locking must look for lock evictions as well - InternalLock must check for SpinWaitUntilRecordIsClosed - Replace oneMiss handling in InternalLock - EphemeralSUnlock must follow unlock failures - LockTable should have its own bufferPool - Ensure OnPagesClosed does eviction scans in address order * More locking fixes: - Fix missing unlock of a Tombstoned record in InternalContinuePendingRead - Add more Asserts where ManualLocking requires a locked record - Update and remove obsolete comments * - Remove key-present optimization for SpinWaitUntilRecordIsClosed - Better checking on following records transferred from LockTable in InternalLock(unlock) - Add some additional comments * Fix hash bucket overflow pointer during recovery Fix debug assert logic * WIP on locktable implemented via mainhash overflow buckets * unstaged files missed in previous push * Updates to EphemeralOnly locking for transfer-from-RO/RC * Change LockTableTests to OverflowBucketlockTableTests * Remove RecordInfo.Tentative, .IsIntermediate* * More locking WIP: session.NeedKeyLockCode, test cleanup * WIP locking: Tests build * WIP on mainhash locking: - Add KeyCode creation and sorting and methods public and internal - Remove unnecessary IsLocked (it does not make work with EphemeralOnly and SessionControlled may map to multiple keys) - More tests run now * Most UTs run * More UTs succeed * Still some UT failures * - use XLocks as Tentative indicator for insertions/splices at log tail and readcache insertions - improve readcache consistency checking - clear HasInMemoryLock when HeadAddress goes above srcRecord address following BlockAllocate - rename LockingMode.SessionControlled -> Mixed and other renaming for clarity - remove some unused methods - fix locking sequences in InternalContinuePendingR(ead|MW) * More fixes - Missing 'ref' on recordInfo var in FindAndUnlockTransferredRecord - Improve record allocation checking for below-HA in-memory source and RecordInfo lock clearing if so - Add LockCode to HashEntryInfo in DEBUG * Remove SpinWaitUntilRecordIsClosed; it was only used in ReadCache and in the relevant case we just need to wait for ReadCacheEvict to complete. * - MixedModeTentativeOrClosed is not needed - Add/Improve some ToString()s - Remove unused RecSrc.ClearSrc() - Rename to HasRecordInfoLock - Move ICPRead HandleImmediateRetryStatus outside the lock scope - Consoldiate EphemeralSUnlock(AfterPendingIO) * Streamline locking and FindInMemory calls in InternalXxx * - Change names to pendingContext.Initial*Address and improve setting of these in InternalXxx and handling of these in CompletePending*() and TryFindRecordInMemory. - Also consistentize related param names for readcache and log search to minAddress. * Clean up pending RMW call to CreateNewRecordRMW, per prior changes that make the inputSrc unnecessary. * - Fix stale readcache assignment to recSrc.Log - make searches after pendingIO completion non-inclusive of minAddress - Some ToString() and naming changes for consistency - Remove RecordInfo.IsValidUpdateOrLockSource (superseded by direct call to .IsClosed) * Allow length specification on KeyCode array operations * - Fix check for lock having escaped to eviction zone following BlockAllocate - Add some comments for SafeHeadAddress et al. * - Make sure the readcache bit is set when needed on addresses put into stackCtx.newLogicalAddress. - Rename to HandleNewRecordOnException for clarity * Update remote project * - Make sure FindAndUnlockTransferredRecord can go to SafeHeadAddress - Add non-ref overload of GetLockCode * Tweaks for benchmark with Mixed locking * Add ILockableKey.CompareLockCodes * Change LockCode to just be hashcode, since we may grow the hash table. * - Make CPR consistency check work without conflict with the key latches in the HashBuckets. - Change some names for clarity. - Pending read completion should return values from any in-memory record, as they are the latest * Remove duplicate opCtx param and removed sessionCtx (aka currentCtx, aka ctx) from calls where FasterSession was also passed (in favor of (new) FasterSession.SessionCtx), where the called method has a type constraint of "where FasterSession : IFasterSession<Key, Value, Input, Output, Context>". Not yet done: converting "whereFasterSession : IFasterSession" constraints to generic to remove the duplicate ctx parameter. * Fix DoLockOp to compare bucket indexes, not KeyCodes * Finish removal of duplicate sessionCtx param from calls where FasterSession was also passed (in favor of (new) FasterSession.SessionCtx), where the called method has a type constraint of "where FasterSession : IFasterSession" (non-generic). This cannot be done in Synchronization (the state machines) due to their use of NullFasterSession. * Fix key duplication in readcache and log: - VerifyInMemoryAddresses should not refresh hei if no splice point is present - FindRecordInMemory checks pendingContext.InitialHash - Move CompleteCopyToTail in ITCTT into the non-readcache section - TryFindRecordInMemory needs to check pc.InitialEntryIndex's readcache bit - Updaters need to scan down to hlog.ReadOnlyAddress to ensure the "key is not at or below LatestLogicalAddress" logic holds - ReadCacheCheckTailAfterSplice needs to check hei.*Address readcache bit * Replace use of SafeHeadAddress with SpinWaitUntilClosed in FindInReadCache * Remove LockingMode.EphemeralOnly add --hashpack arg to FASTER.benchmark * Tweaks for the Standard locking change * fix remote to use LockingMode.Standard * Add DisposeTest comments and more Asserts * Use calls on RecordSource to make it easier to verify correct matching of log and physicalAddress * Temporarily disable LocalMemoryDevice tests for investigation * test removal of DisposeTests * - Fix for CTT to address SameKeyInsertAndCTTTest failure - Add missing arg parsing for MemOnlyCache - Re-enable DeviceType.LocalMemory in tests * [C#] MemOnlyCache sample: improved size tracking, including read cache (#800) * Improved cache size tracking, including read cache * Rename MemOnlyCache to ResizableCacheStore. * update doc * fixes * Updates * ClearBitsForDiskImages should unseal record as well (Q: why was it sealed to begin with?) * Correct clearing of index bits during recovery * Remove RecordInfo sealing * WIP Ephemeral locking at IFunctions-level only, part 1 * Remove unused SessionType enumeration; consolidate duplicate IFasterSession implementations * - Add EphemeralLocking readcache detach/reattach logic - Remove unused ReadFlags.ResetModifiedBit * Rename a couple files * re-add RecordInfo.Seal for Ephemeral locking; remove unused (RMW|Upsert)Action.NeedMoreSpace (this is the default 'false' behavior) * Remove single-key overloads of Lock() and Unlock() * - Update a too-aggressive assert. - CreateLogDevice errors on Windows if path > MAX_PATH minus room for segment#. * Improve previous MAX_PATH fix * Chnge Read of an expired to just return NOTFOUND | Expired rather than tombstoning * RETRY_LATER rather than trying to re-find splice point directly in VerifyInMemoryAddresses --------- Co-authored-by: Badrish Chandramouli <badrishc@microsoft.com>
2023-03-23 21:49:12 +03:00
var status = session.Read(ref collidingKey, 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.IsTrue(status.Found, status.ToString());
Assert.AreEqual(TestCollidingValue, output.value.value);
[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(() => DoRead(functions1)),
Task.Factory.StartNew(() => DoRead(functions2))
};
Task.WaitAll(tasks);
[C#] Change locking to use FasterBase hash buckets (#799) * Locking fixes - CompletePending* must also check to lock non-auxiliary records - Ephemeral locking must look for lock evictions as well - InternalLock must check for SpinWaitUntilRecordIsClosed - Replace oneMiss handling in InternalLock - EphemeralSUnlock must follow unlock failures - LockTable should have its own bufferPool - Ensure OnPagesClosed does eviction scans in address order * More locking fixes: - Fix missing unlock of a Tombstoned record in InternalContinuePendingRead - Add more Asserts where ManualLocking requires a locked record - Update and remove obsolete comments * - Remove key-present optimization for SpinWaitUntilRecordIsClosed - Better checking on following records transferred from LockTable in InternalLock(unlock) - Add some additional comments * Fix hash bucket overflow pointer during recovery Fix debug assert logic * WIP on locktable implemented via mainhash overflow buckets * unstaged files missed in previous push * Updates to EphemeralOnly locking for transfer-from-RO/RC * Change LockTableTests to OverflowBucketlockTableTests * Remove RecordInfo.Tentative, .IsIntermediate* * More locking WIP: session.NeedKeyLockCode, test cleanup * WIP locking: Tests build * WIP on mainhash locking: - Add KeyCode creation and sorting and methods public and internal - Remove unnecessary IsLocked (it does not make work with EphemeralOnly and SessionControlled may map to multiple keys) - More tests run now * Most UTs run * More UTs succeed * Still some UT failures * - use XLocks as Tentative indicator for insertions/splices at log tail and readcache insertions - improve readcache consistency checking - clear HasInMemoryLock when HeadAddress goes above srcRecord address following BlockAllocate - rename LockingMode.SessionControlled -> Mixed and other renaming for clarity - remove some unused methods - fix locking sequences in InternalContinuePendingR(ead|MW) * More fixes - Missing 'ref' on recordInfo var in FindAndUnlockTransferredRecord - Improve record allocation checking for below-HA in-memory source and RecordInfo lock clearing if so - Add LockCode to HashEntryInfo in DEBUG * Remove SpinWaitUntilRecordIsClosed; it was only used in ReadCache and in the relevant case we just need to wait for ReadCacheEvict to complete. * - MixedModeTentativeOrClosed is not needed - Add/Improve some ToString()s - Remove unused RecSrc.ClearSrc() - Rename to HasRecordInfoLock - Move ICPRead HandleImmediateRetryStatus outside the lock scope - Consoldiate EphemeralSUnlock(AfterPendingIO) * Streamline locking and FindInMemory calls in InternalXxx * - Change names to pendingContext.Initial*Address and improve setting of these in InternalXxx and handling of these in CompletePending*() and TryFindRecordInMemory. - Also consistentize related param names for readcache and log search to minAddress. * Clean up pending RMW call to CreateNewRecordRMW, per prior changes that make the inputSrc unnecessary. * - Fix stale readcache assignment to recSrc.Log - make searches after pendingIO completion non-inclusive of minAddress - Some ToString() and naming changes for consistency - Remove RecordInfo.IsValidUpdateOrLockSource (superseded by direct call to .IsClosed) * Allow length specification on KeyCode array operations * - Fix check for lock having escaped to eviction zone following BlockAllocate - Add some comments for SafeHeadAddress et al. * - Make sure the readcache bit is set when needed on addresses put into stackCtx.newLogicalAddress. - Rename to HandleNewRecordOnException for clarity * Update remote project * - Make sure FindAndUnlockTransferredRecord can go to SafeHeadAddress - Add non-ref overload of GetLockCode * Tweaks for benchmark with Mixed locking * Add ILockableKey.CompareLockCodes * Change LockCode to just be hashcode, since we may grow the hash table. * - Make CPR consistency check work without conflict with the key latches in the HashBuckets. - Change some names for clarity. - Pending read completion should return values from any in-memory record, as they are the latest * Remove duplicate opCtx param and removed sessionCtx (aka currentCtx, aka ctx) from calls where FasterSession was also passed (in favor of (new) FasterSession.SessionCtx), where the called method has a type constraint of "where FasterSession : IFasterSession<Key, Value, Input, Output, Context>". Not yet done: converting "whereFasterSession : IFasterSession" constraints to generic to remove the duplicate ctx parameter. * Fix DoLockOp to compare bucket indexes, not KeyCodes * Finish removal of duplicate sessionCtx param from calls where FasterSession was also passed (in favor of (new) FasterSession.SessionCtx), where the called method has a type constraint of "where FasterSession : IFasterSession" (non-generic). This cannot be done in Synchronization (the state machines) due to their use of NullFasterSession. * Fix key duplication in readcache and log: - VerifyInMemoryAddresses should not refresh hei if no splice point is present - FindRecordInMemory checks pendingContext.InitialHash - Move CompleteCopyToTail in ITCTT into the non-readcache section - TryFindRecordInMemory needs to check pc.InitialEntryIndex's readcache bit - Updaters need to scan down to hlog.ReadOnlyAddress to ensure the "key is not at or below LatestLogicalAddress" logic holds - ReadCacheCheckTailAfterSplice needs to check hei.*Address readcache bit * Replace use of SafeHeadAddress with SpinWaitUntilClosed in FindInReadCache * Remove LockingMode.EphemeralOnly add --hashpack arg to FASTER.benchmark * Tweaks for the Standard locking change * fix remote to use LockingMode.Standard * Add DisposeTest comments and more Asserts * Use calls on RecordSource to make it easier to verify correct matching of log and physicalAddress * Temporarily disable LocalMemoryDevice tests for investigation * test removal of DisposeTests * - Fix for CTT to address SameKeyInsertAndCTTTest failure - Add missing arg parsing for MemOnlyCache - Re-enable DeviceType.LocalMemory in tests * [C#] MemOnlyCache sample: improved size tracking, including read cache (#800) * Improved cache size tracking, including read cache * Rename MemOnlyCache to ResizableCacheStore. * update doc * fixes * Updates * ClearBitsForDiskImages should unseal record as well (Q: why was it sealed to begin with?) * Correct clearing of index bits during recovery * Remove RecordInfo sealing * WIP Ephemeral locking at IFunctions-level only, part 1 * Remove unused SessionType enumeration; consolidate duplicate IFasterSession implementations * - Add EphemeralLocking readcache detach/reattach logic - Remove unused ReadFlags.ResetModifiedBit * Rename a couple files * re-add RecordInfo.Seal for Ephemeral locking; remove unused (RMW|Upsert)Action.NeedMoreSpace (this is the default 'false' behavior) * Remove single-key overloads of Lock() and Unlock() * - Update a too-aggressive assert. - CreateLogDevice errors on Windows if path > MAX_PATH minus room for segment#. * Improve previous MAX_PATH fix * Chnge Read of an expired to just return NOTFOUND | Expired rather than tombstoning * RETRY_LATER rather than trying to re-find splice point directly in VerifyInMemoryAddresses --------- Co-authored-by: Badrish Chandramouli <badrishc@microsoft.com>
2023-03-23 21:49:12 +03:00
if (fht.LockTable.IsEnabled || !initialReadCacheInsert) // This allows true splice, so we generated a conflict.
Assert.AreEqual(DisposeHandler.SingleWriter, 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.IsEmpty(functions1.handlerQueue);
}
[Test]
[Category("FasterKV")]
[Category("Smoke")]
public void DisposePendingReadWithNoInsertTest([Values(ConcurrencyControlMode.RecordIsolation, ConcurrencyControlMode.None)] ConcurrencyControlMode concurrencyControlMode)
[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 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([Values(ConcurrencyControlMode.RecordIsolation, ConcurrencyControlMode.None)] ConcurrencyControlMode concurrencyControlMode)
[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 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());
}
}
}
[C#] Change locking to use FasterBase hash buckets (#799) * Locking fixes - CompletePending* must also check to lock non-auxiliary records - Ephemeral locking must look for lock evictions as well - InternalLock must check for SpinWaitUntilRecordIsClosed - Replace oneMiss handling in InternalLock - EphemeralSUnlock must follow unlock failures - LockTable should have its own bufferPool - Ensure OnPagesClosed does eviction scans in address order * More locking fixes: - Fix missing unlock of a Tombstoned record in InternalContinuePendingRead - Add more Asserts where ManualLocking requires a locked record - Update and remove obsolete comments * - Remove key-present optimization for SpinWaitUntilRecordIsClosed - Better checking on following records transferred from LockTable in InternalLock(unlock) - Add some additional comments * Fix hash bucket overflow pointer during recovery Fix debug assert logic * WIP on locktable implemented via mainhash overflow buckets * unstaged files missed in previous push * Updates to EphemeralOnly locking for transfer-from-RO/RC * Change LockTableTests to OverflowBucketlockTableTests * Remove RecordInfo.Tentative, .IsIntermediate* * More locking WIP: session.NeedKeyLockCode, test cleanup * WIP locking: Tests build * WIP on mainhash locking: - Add KeyCode creation and sorting and methods public and internal - Remove unnecessary IsLocked (it does not make work with EphemeralOnly and SessionControlled may map to multiple keys) - More tests run now * Most UTs run * More UTs succeed * Still some UT failures * - use XLocks as Tentative indicator for insertions/splices at log tail and readcache insertions - improve readcache consistency checking - clear HasInMemoryLock when HeadAddress goes above srcRecord address following BlockAllocate - rename LockingMode.SessionControlled -> Mixed and other renaming for clarity - remove some unused methods - fix locking sequences in InternalContinuePendingR(ead|MW) * More fixes - Missing 'ref' on recordInfo var in FindAndUnlockTransferredRecord - Improve record allocation checking for below-HA in-memory source and RecordInfo lock clearing if so - Add LockCode to HashEntryInfo in DEBUG * Remove SpinWaitUntilRecordIsClosed; it was only used in ReadCache and in the relevant case we just need to wait for ReadCacheEvict to complete. * - MixedModeTentativeOrClosed is not needed - Add/Improve some ToString()s - Remove unused RecSrc.ClearSrc() - Rename to HasRecordInfoLock - Move ICPRead HandleImmediateRetryStatus outside the lock scope - Consoldiate EphemeralSUnlock(AfterPendingIO) * Streamline locking and FindInMemory calls in InternalXxx * - Change names to pendingContext.Initial*Address and improve setting of these in InternalXxx and handling of these in CompletePending*() and TryFindRecordInMemory. - Also consistentize related param names for readcache and log search to minAddress. * Clean up pending RMW call to CreateNewRecordRMW, per prior changes that make the inputSrc unnecessary. * - Fix stale readcache assignment to recSrc.Log - make searches after pendingIO completion non-inclusive of minAddress - Some ToString() and naming changes for consistency - Remove RecordInfo.IsValidUpdateOrLockSource (superseded by direct call to .IsClosed) * Allow length specification on KeyCode array operations * - Fix check for lock having escaped to eviction zone following BlockAllocate - Add some comments for SafeHeadAddress et al. * - Make sure the readcache bit is set when needed on addresses put into stackCtx.newLogicalAddress. - Rename to HandleNewRecordOnException for clarity * Update remote project * - Make sure FindAndUnlockTransferredRecord can go to SafeHeadAddress - Add non-ref overload of GetLockCode * Tweaks for benchmark with Mixed locking * Add ILockableKey.CompareLockCodes * Change LockCode to just be hashcode, since we may grow the hash table. * - Make CPR consistency check work without conflict with the key latches in the HashBuckets. - Change some names for clarity. - Pending read completion should return values from any in-memory record, as they are the latest * Remove duplicate opCtx param and removed sessionCtx (aka currentCtx, aka ctx) from calls where FasterSession was also passed (in favor of (new) FasterSession.SessionCtx), where the called method has a type constraint of "where FasterSession : IFasterSession<Key, Value, Input, Output, Context>". Not yet done: converting "whereFasterSession : IFasterSession" constraints to generic to remove the duplicate ctx parameter. * Fix DoLockOp to compare bucket indexes, not KeyCodes * Finish removal of duplicate sessionCtx param from calls where FasterSession was also passed (in favor of (new) FasterSession.SessionCtx), where the called method has a type constraint of "where FasterSession : IFasterSession" (non-generic). This cannot be done in Synchronization (the state machines) due to their use of NullFasterSession. * Fix key duplication in readcache and log: - VerifyInMemoryAddresses should not refresh hei if no splice point is present - FindRecordInMemory checks pendingContext.InitialHash - Move CompleteCopyToTail in ITCTT into the non-readcache section - TryFindRecordInMemory needs to check pc.InitialEntryIndex's readcache bit - Updaters need to scan down to hlog.ReadOnlyAddress to ensure the "key is not at or below LatestLogicalAddress" logic holds - ReadCacheCheckTailAfterSplice needs to check hei.*Address readcache bit * Replace use of SafeHeadAddress with SpinWaitUntilClosed in FindInReadCache * Remove LockingMode.EphemeralOnly add --hashpack arg to FASTER.benchmark * Tweaks for the Standard locking change * fix remote to use LockingMode.Standard * Add DisposeTest comments and more Asserts * Use calls on RecordSource to make it easier to verify correct matching of log and physicalAddress * Temporarily disable LocalMemoryDevice tests for investigation * test removal of DisposeTests * - Fix for CTT to address SameKeyInsertAndCTTTest failure - Add missing arg parsing for MemOnlyCache - Re-enable DeviceType.LocalMemory in tests * [C#] MemOnlyCache sample: improved size tracking, including read cache (#800) * Improved cache size tracking, including read cache * Rename MemOnlyCache to ResizableCacheStore. * update doc * fixes * Updates * ClearBitsForDiskImages should unseal record as well (Q: why was it sealed to begin with?) * Correct clearing of index bits during recovery * Remove RecordInfo sealing * WIP Ephemeral locking at IFunctions-level only, part 1 * Remove unused SessionType enumeration; consolidate duplicate IFasterSession implementations * - Add EphemeralLocking readcache detach/reattach logic - Remove unused ReadFlags.ResetModifiedBit * Rename a couple files * re-add RecordInfo.Seal for Ephemeral locking; remove unused (RMW|Upsert)Action.NeedMoreSpace (this is the default 'false' behavior) * Remove single-key overloads of Lock() and Unlock() * - Update a too-aggressive assert. - CreateLogDevice errors on Windows if path > MAX_PATH minus room for segment#. * Improve previous MAX_PATH fix * Chnge Read of an expired to just return NOTFOUND | Expired rather than tombstoning * RETRY_LATER rather than trying to re-find splice point directly in VerifyInMemoryAddresses --------- Co-authored-by: Badrish Chandramouli <badrishc@microsoft.com>
2023-03-23 21:49:12 +03:00
#endif