hadoop-zookeeper-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Benjamin Reed (JIRA)" <j...@apache.org>
Subject [jira] Commented: (ZOOKEEPER-767) Submitting Demo/Recipe Shared / Exclusive Lock Code
Date Wed, 09 Jun 2010 16:50:24 GMT

    [ https://issues.apache.org/jira/browse/ZOOKEEPER-767?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12877131#action_12877131
] 

Benjamin Reed commented on ZOOKEEPER-767:
-----------------------------------------

1) just to make sure we are talking about the same thing. this is the code i'm referring to:

{noformat}
// Check that we don't already have a lock...
if (currentExclusiveLock != null && !isExpired(currentExclusiveLock)) {
           // We have the exclusive lock! Remove newly made lock file and just
           // return.
           zooKeeper.delete(writeLock, -1);
           return currentExclusiveLock;
}
{noformat}

2) no, i'm talking about when you go to get the shared lock, you first check to see if you
have a shared lock. shouldn't you check for both shared and exclusive?

3) the problem is that connection loss and session expiration are different. with connection
loss you will get an exception, but your session can recover and you can keep using it. for
session expired you are right the EPHEMERAL will go away. in the connection loss scenario
you have a situation where you may acquire a lock but not know it.

with regard to the question of current lock implementation in the repository. i'm trying to
understand the differences with that implementation and yours. both follow the same recipe
right? if the current lock implementation implemented shared locks, would you have used that
one? or is there something more fundamental?

> Submitting Demo/Recipe Shared / Exclusive Lock Code
> ---------------------------------------------------
>
>                 Key: ZOOKEEPER-767
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-767
>             Project: Zookeeper
>          Issue Type: Improvement
>          Components: recipes
>    Affects Versions: 3.3.0
>            Reporter: Sam Baskinger
>            Assignee: Sam Baskinger
>            Priority: Minor
>             Fix For: 3.4.0
>
>         Attachments: ZOOKEEPER-767.patch, ZOOKEEPER-767.patch
>
>
> Networked Insights would like to share-back some code for shared/exclusive locking that
we are using in our labs.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message