Fix Metadata locking and Reading for decomposedfs and align defaults with OpenCloud#722
Open
rhafer wants to merge 10 commits into
Open
Fix Metadata locking and Reading for decomposedfs and align defaults with OpenCloud#722rhafer wants to merge 10 commits into
rhafer wants to merge 10 commits into
Conversation
This switches the default metadata backend for decomposedfs to "messagepack" to align with the hardcoded default in OpenCloud, which is force to "messagepack" for all decomposedfs setups.
…lockfiles This reworks the metadata interfaces to prevent misuse of the `LockAndRead` and `AllWithLockedSource` methods. The `LockAndRead` method is removed completely. It returned an io.Reader object that seemed to be useful for reading the Nodes Attributes from it. That was however misleading. For most of the current backed the Reader is pointing to the metadata lockfile instead of the metadata source itself. The `AllWithLockedSource` is replaced with the new method `AllWhileLocked` it does require the reader parameter. But requires the caller to take care that the Metadata was locked with `Lock()` before calling. All of the callers where adjusted to no longer pass the reader around. And the unused ParentWithReader method. Fixes: opencloud-eu/opencloud#3059
Each node now knows whether it has already been locked or not, allowing for conditional locking and simplifying of the code because of less special handling of locked/unlocked cases.
This prevents leaking lock-state into goroutines.
This is used to hold node locks only in the scope of a goroutine. If a locked node was to leak into another goroutine the goroutinelock Lock would return false and thus make the other goroutine lock the node for themselves.
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 reworks the metadata interfaces to prevent misuse of the
LockAndReadandAllWithLockedSourcemethods.The
LockAndReadmethod is removed completely. It returned an io.Reader object that seemed to be useful for reading the Nodes Attributes from it. That was however misleading. For most of the current backed theReader is pointing to the metadata lockfile instead of the metadata source itself.
The
AllWithLockedSourceis replaced with the new methodAllWhileLockedit does require the reader parameter. But requires the caller to take care that the Metadata was locked withLock()before calling.All of the callers where adjusted to no longer pass the reader around. And the unused ParentWithReader method.
This switches the default metadata backend for decomposedfs to "messagepack" to align with the hardcoded default in OpenCloud, which is force to "messagepack" for all decomposedfs setups.