-
Notifications
You must be signed in to change notification settings - Fork 650
Ensure CompletedSemaphore is Always Released #1666
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from 10 commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
ec0c534
wip; adding tracking
vazois e911785
fix hanging ClusterReplicationCheckpointCleanupTest
vazois 1ee8603
fix Tsavorite formatting
vazois bf3e55b
fix Garnet formatting
vazois 40b1494
fix breaking build
vazois 7b2c3ac
improve log message
vazois c9170a4
throw the caught AsyncFlushSnapshotPage exception
vazois 3928dec
Merge remote-tracking branch 'origin/dev' into vazois/dev-ct-fix
vazois a812f12
remove verbose logging
vazois 5f848ee
ensure release AsyncFlushDeltaToDevice semaphore
vazois f4179eb
revert to non-lambda use
vazois f3613f2
revert TrackVersion change
vazois c1a7fdd
release Semaphore from AsyncFlushDeltaToDevice if exception triggers
vazois 75f52fe
Merge remote-tracking branch 'origin/dev' into vazois/dev-ct-fix
vazois 72961b8
Merge branch 'dev' into vazois/dev-ct-fix
vazois 9f083c9
Merge branch 'dev' into vazois/dev-ct-fix
vazois 3b1745e
fix AttachAndWaitForSync helper method
vazois File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
62 changes: 62 additions & 0 deletions
62
libs/storage/Tsavorite/cs/src/core/Index/Checkpointing/SemaphoreWaiterMonitor.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,62 @@ | ||
| // Copyright (c) Microsoft Corporation. | ||
| // Licensed under the MIT license. | ||
|
|
||
| using System.Threading; | ||
|
|
||
| namespace Tsavorite.core | ||
| { | ||
| /// <summary> | ||
| /// Identifies the type of semaphore added to the state machine driver waiting list, | ||
| /// including the originating state machine task. | ||
| /// </summary> | ||
| public enum StateMachineSemaphoreType | ||
| { | ||
| /// <summary> | ||
| /// Waiting for all transactions in the last version to complete. | ||
| /// </summary> | ||
| LastVersionTransactionsDone, | ||
|
|
||
| /// <summary> | ||
| /// Waiting for the main index checkpoint to complete (IndexCheckpointSMTask). | ||
| /// </summary> | ||
| IndexCheckpointSMTaskMainIndexCheckpoint, | ||
|
|
||
| /// <summary> | ||
| /// Waiting for the overflow buckets checkpoint to complete (IndexCheckpointSMTask). | ||
| /// </summary> | ||
| IndexCheckpointSMTaskOverflowBucketsCheckpoint, | ||
|
|
||
| /// <summary> | ||
| /// Waiting for the hybrid log flush to complete (FoldOverSMTask). | ||
| /// </summary> | ||
| FoldOverSMTaskHybridLogFlushed, | ||
|
|
||
| /// <summary> | ||
| /// Waiting for the hybrid log flush to complete (IncrementalSnapshotCheckpointSMTask). | ||
| /// </summary> | ||
| IncrementalSnapshotCheckpointSMTaskHybridLogFlushed, | ||
|
|
||
| /// <summary> | ||
| /// Waiting for the hybrid log flush to complete (SnapshotCheckpointSMTask). | ||
| /// </summary> | ||
| SnapshotCheckpointSMTaskHybridLogFlushed, | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// Pairs a <see cref="SemaphoreSlim"/> with a <see cref="StateMachineSemaphoreType"/> | ||
| /// so the state machine driver can identify which operation a semaphore belongs to. | ||
| /// </summary> | ||
| internal readonly struct SemaphoreWaiterMonitor | ||
| { | ||
| public SemaphoreSlim Semaphore { get; } | ||
| public StateMachineSemaphoreType Type { get; } | ||
|
|
||
| public SemaphoreWaiterMonitor(SemaphoreSlim semaphore, StateMachineSemaphoreType type) | ||
| { | ||
| Semaphore = semaphore; | ||
| Type = type; | ||
| } | ||
|
|
||
| public override string ToString() => Type.ToString(); | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.