-
Notifications
You must be signed in to change notification settings - Fork 251
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
lockfile: add RecursiveLock() API #347
Conversation
LGTM, but definitely want some other head nods. |
I am fine with this, but we need @nalind review. |
Looks reasonable, but I'd like a test that ensures that mixing recursive and non-recursive write locks in a single process doesn't unexpectedly break. |
Great idea. I will update the PR and re-ping once the new tests are green. |
Add a RecursiveLock() API to allow for recursive acquisitions of a writer lock within the same process space. This is yet another requirement for the copy-detection mechanism in containers/image where multiple goroutines can be pulling the same blob. Having a recursive lock avoids a complex synchronization mechanism as the commit order is determinted by the corresponding index in the image. Signed-off-by: Valentin Rothberg <[email protected]>
c8c9668
to
237602b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Test added, and CI is green. @nalind PTAL.
@@ -408,6 +498,63 @@ func TestLockfileMixedConcurrent(t *testing.T) { | |||
} | |||
} | |||
|
|||
func TestLockfileMixedConcurrentRecursiveWriters(t *testing.T) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here's the new test.
@nalind Can we merge this so we can create a new version? |
LGTM |
Add a RecursiveLock() API to allow for recursive acquisitions of a
writer lock within the same process space. This is yet another
requirement for the copy-detection mechanism in containers/image where
multiple goroutines can be pulling the same blob. Having a recursive
lock avoids a complex synchronization mechanism as the commit order is
determinted by the corresponding index in the image.
Signed-off-by: Valentin Rothberg [email protected]