Repository navigation
Rewrite of the locking interface - #536
Merged
Merged
Conversation
RubenVerborgh
approved these changes
Jan 21, 2021
RubenVerborgh
left a comment
Member
There was a problem hiding this comment.
Only a whole bunch of style nits; I added them because I think they will help understanding what is very crucial and sensitive code.
By making use of withReadLock and withWriteLock instead of acquiring the locks themselves it's easier to keep control of what happens.
Due to the new interface, it is now possible to throw an error if there is a timeout which should make it easier to find locking issues.
Due to not having re-entrant locks this would cause deadlocks with the LockingResourceStore or require more advanced configurations. If this is needed in the future we can potentially add a LockingPatchHandler.
This has as added bonus that, in the case of getRepresentation, the stream will be destroyed with an error in case of a timeout.
jvherweg
force-pushed
the
feat/lock-readwrite
branch
from
January 22, 2021 10:28
239d26c to
576ef9d
Compare
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This PR combines several locking-related changes:
ResourceLockernow works with twogetReadLock/getWriteLockfunctions. This is both in preparation of read/write locks and multi-threaded locks since there no longer is a reference to the lock object. The main reason for doing this change now is because it also allows more control over what happens within a locked run, which was needed to detect locking conflicts. Adds the interface of Distinguish between read and write locks #32 but does not actually provide a read/write locking algorithm.WrappedExpiringResourceLockerconsequently also needed a change. Its locking functions will now error when a timeout occurs, allowing for easier problem detection.LockingResourceStoreto the store stack.LockingResourceStorewas also updated with the new interface. It now returns an error in case the operation was not able to succeed within the timeout.LockingResourceStorehas been added to the default config, so perhaps in the future some locking related issues are going to pop up since this is the first time we actually added full locking for all requests. Closes Integrate LockingResourceStore in the configs #355.Every bullet corresponds to a single commit.
Getting all the promise to interact nicely with eachother was an interesting experience.