hadoop-zookeeper-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Chris Darroch (JIRA)" <j...@apache.org>
Subject [jira] Commented: (ZOOKEEPER-78) added a high level protocol/feature - for easy Leader Election or exclusive Write Lock creation
Date Wed, 01 Apr 2009 22:26:12 GMT

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

Chris Darroch commented on ZOOKEEPER-78:
----------------------------------------

Just took a quick peek to see what would be either rework these in a ZooKeeper::Lock Perl
module to go along with Net::ZooKeeper, or to expose the C version through Net::ZooKeeper.
 I may well be missing something after such a brief review, but in zoo_mutex_operation() I
would be inclined to add some return value checks.

For example, if zoo_create() here returns a failure code, I believe it's possible for the
retbuf to contain whatever random data it had before the call.  In that case, getName() might
"succeed" if the data contains a '/' and return a string --- possibly one that doesn't happen
to be null-terminated within the retbuf buffer.

{noformat}
           char retbuf[len+20];
           snprintf(buf, len, "%s/%s", path, prefix);
           ret = zoo_create(zh, buf, NULL, 0,  mutex->acl, 
                            ZOO_EPHEMERAL|ZOO_SEQUENCE, retbuf, (len+20));
           mutex->id = getName(retbuf);
{noformat}

There are some calls to zoo_get_children(), etc., which I think might be usefully checked
for failure return codes as well.  Sorry not to provide a patch yet.

> added a high level protocol/feature - for easy Leader Election or exclusive Write Lock
creation
> -----------------------------------------------------------------------------------------------
>
>                 Key: ZOOKEEPER-78
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-78
>             Project: Zookeeper
>          Issue Type: New Feature
>          Components: java client
>    Affects Versions: 3.0.0
>            Reporter: james strachan
>            Assignee: james strachan
>             Fix For: 3.2.0
>
>         Attachments: patch_with_including_Benjamin's_fix.patch, using_zookeeper_facade.patch,
ZOOKEEPER-78.patch, ZOOKEEPER-78.patch, ZOOKEEPER-78.patch, ZOOKEEPER-78.patch
>
>
> Here's a patch which adds a little WriteLock helper class for performing leader elections
or creating exclusive locks in some directory znode. Note its an early cut; am sure we can
improve it over time. The aim is to avoid folks having to use the low level ZK stuff but provide
a simpler high level abstraction.

-- 
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