You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@zookeeper.apache.org by "Anthony Urso (JIRA)" <ji...@apache.org> on 2008/07/26 01:53:31 UTC

[jira] Created: (ZOOKEEPER-104) KeptSet: a distributed data stucture backed by the children of a ZooKeeper node

KeptSet: a distributed data stucture backed by the children of a ZooKeeper node
-------------------------------------------------------------------------------

                 Key: ZOOKEEPER-104
                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-104
             Project: Zookeeper
          Issue Type: New Feature
          Components: java client
            Reporter: Anthony Urso
            Priority: Minor


Here is an implementation of a ZooKeeper backed Java Set. It should be generally useful.

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


[jira] Commented: (ZOOKEEPER-104) KeptSet: a distributed data stucture backed by the children of a ZooKeeper node

Posted by "Mahadev konar (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/ZOOKEEPER-104?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12618049#action_12618049 ] 

Mahadev konar commented on ZOOKEEPER-104:
-----------------------------------------

> in the keepset contructor i changed if (exits) zk.create() to try { zk.create() } (nodeexistsexcpetion ){}

>> Since the set can only be added to by a watcher event, these end up being semantically the same. I think checking the set first is a little more efficient, but either way is fine with me.

the problem is that if you see that the node does not exist then you will have to create it and the create might fail given that someone else might have added the node. in that case the keepset contructor would throw an exception.. thats why i did that.

the interrupted exception in truly a bizzare exception in the client library. I think we shuld get rid of it sometime. 


> KeptSet: a distributed data stucture backed by the children of a ZooKeeper node
> -------------------------------------------------------------------------------
>
>                 Key: ZOOKEEPER-104
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-104
>             Project: Zookeeper
>          Issue Type: New Feature
>          Components: java client
>            Reporter: Anthony Urso
>            Assignee: Anthony Urso
>            Priority: Minor
>         Attachments: ZOOKEEPER-104.patch, ZOOKEEPER-104.patch, ZOOKEEPER-104.patch
>
>
> Here is an implementation of a ZooKeeper backed Java Set. It should be generally useful.

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


[jira] Commented: (ZOOKEEPER-104) KeptSet: a distributed data stucture backed by the children of a ZooKeeper node

Posted by "Mahadev konar (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/ZOOKEEPER-104?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12619076#action_12619076 ] 

Mahadev konar commented on ZOOKEEPER-104:
-----------------------------------------

once ZOOKEEPER-103 is resolved then we can add the build file to build this contrib module.

> KeptSet: a distributed data stucture backed by the children of a ZooKeeper node
> -------------------------------------------------------------------------------
>
>                 Key: ZOOKEEPER-104
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-104
>             Project: Zookeeper
>          Issue Type: New Feature
>          Components: java client
>            Reporter: Anthony Urso
>            Assignee: Anthony Urso
>            Priority: Minor
>         Attachments: ZOOKEEPER-104.patch, ZOOKEEPER-104.patch, ZOOKEEPER-104.patch, ZOOKEEPER-104.patch
>
>
> Here is an implementation of a ZooKeeper backed Java Set. It should be generally useful.

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


[jira] Updated: (ZOOKEEPER-104) KeptSet: a distributed data stucture backed by the children of a ZooKeeper node

Posted by "Mahadev konar (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/ZOOKEEPER-104?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Mahadev konar updated ZOOKEEPER-104:
------------------------------------

    Attachment: ZOOKEEPER-104.patch

this is the latest patch which throws Runtimeexcpetions with interrupted exceptions and gets rid of the while true loops.


> KeptSet: a distributed data stucture backed by the children of a ZooKeeper node
> -------------------------------------------------------------------------------
>
>                 Key: ZOOKEEPER-104
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-104
>             Project: Zookeeper
>          Issue Type: New Feature
>          Components: java client
>            Reporter: Anthony Urso
>            Assignee: Anthony Urso
>            Priority: Minor
>         Attachments: ZOOKEEPER-104.patch, ZOOKEEPER-104.patch, ZOOKEEPER-104.patch, ZOOKEEPER-104.patch
>
>
> Here is an implementation of a ZooKeeper backed Java Set. It should be generally useful.

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


[jira] Commented: (ZOOKEEPER-104) KeptSet: a distributed data stucture backed by the children of a ZooKeeper node

Posted by "Benjamin Reed (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/ZOOKEEPER-104?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12619061#action_12619061 ] 

Benjamin Reed commented on ZOOKEEPER-104:
-----------------------------------------

I think we should convert to a runtime exception. (It really seems like InterruptedException should be runtime in the first place...) It looks like this is how other APIs that implement persistent sets work.

There is another possiblity: keep the whole set in memory and use watches as cache invalidations. Then you could have commit() and refresh() operations that would throw the exceptions. Depending on the size of the sets it does seem wise to keep it all cached in the client so that read operations can be executed quickly. Even the commit() allows you to batch up changes and do them faster as well.


> KeptSet: a distributed data stucture backed by the children of a ZooKeeper node
> -------------------------------------------------------------------------------
>
>                 Key: ZOOKEEPER-104
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-104
>             Project: Zookeeper
>          Issue Type: New Feature
>          Components: java client
>            Reporter: Anthony Urso
>            Assignee: Anthony Urso
>            Priority: Minor
>         Attachments: ZOOKEEPER-104.patch, ZOOKEEPER-104.patch, ZOOKEEPER-104.patch
>
>
> Here is an implementation of a ZooKeeper backed Java Set. It should be generally useful.

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


[jira] Updated: (ZOOKEEPER-104) KeptSet: a distributed data stucture backed by the children of a ZooKeeper node

Posted by "Anthony Urso (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/ZOOKEEPER-104?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Anthony Urso updated ZOOKEEPER-104:
-----------------------------------

    Attachment: ZOOKEEPER-104.patch

> KeptSet: a distributed data stucture backed by the children of a ZooKeeper node
> -------------------------------------------------------------------------------
>
>                 Key: ZOOKEEPER-104
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-104
>             Project: Zookeeper
>          Issue Type: New Feature
>          Components: java client
>            Reporter: Anthony Urso
>            Priority: Minor
>         Attachments: ZOOKEEPER-104.patch
>
>
> Here is an implementation of a ZooKeeper backed Java Set. It should be generally useful.

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


[jira] Commented: (ZOOKEEPER-104) KeptSet: a distributed data stucture backed by the children of a ZooKeeper node

Posted by "Patrick Hunt (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/ZOOKEEPER-104?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12618000#action_12618000 ] 

Patrick Hunt commented on ZOOKEEPER-104:
----------------------------------------

See ZOOKEEPER-103. Source structure, incl contrib & recipes, is currently under active discussion.

> KeptSet: a distributed data stucture backed by the children of a ZooKeeper node
> -------------------------------------------------------------------------------
>
>                 Key: ZOOKEEPER-104
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-104
>             Project: Zookeeper
>          Issue Type: New Feature
>          Components: java client
>            Reporter: Anthony Urso
>            Assignee: Anthony Urso
>            Priority: Minor
>         Attachments: ZOOKEEPER-104.patch, ZOOKEEPER-104.patch, ZOOKEEPER-104.patch
>
>
> Here is an implementation of a ZooKeeper backed Java Set. It should be generally useful.

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


[jira] Commented: (ZOOKEEPER-104) KeptSet: a distributed data stucture backed by the children of a ZooKeeper node

Posted by "Flavio Paiva Junqueira (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/ZOOKEEPER-104?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12617180#action_12617180 ] 

Flavio Paiva Junqueira commented on ZOOKEEPER-104:
--------------------------------------------------

I agree, nice idea. I took a look at the patch, and I have a comment. 

You might consider throwing KeeperException on KeptSet.add to avoid problems, for example, with addAll. On addAll, if you try to add a number of elements, the first succeeds, but some other succeeding element fails, then addAll will end up returning true, although not all elements have been written. You can change the logic so that it returns false, but in general I think it is a good idea to expose to the application that there was a problem with ZooKeeper.  

Just to make sure that I have understood correctly your abstraction, the idea is to let ZooKeeper store the elements of a set despite failures of the client that created these elements, and that's why you create regular nodes and not ephemeral nodes. 

Finally, I don't see a contrib folder in the svn, so I suspect that we don't have one yet. I'm mentioning this because your patch should add KeptSet to contrib. Pat can either agree or correct me on this part. 

> KeptSet: a distributed data stucture backed by the children of a ZooKeeper node
> -------------------------------------------------------------------------------
>
>                 Key: ZOOKEEPER-104
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-104
>             Project: Zookeeper
>          Issue Type: New Feature
>          Components: java client
>            Reporter: Anthony Urso
>            Priority: Minor
>         Attachments: ZOOKEEPER-104.patch
>
>
> Here is an implementation of a ZooKeeper backed Java Set. It should be generally useful.

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


[jira] Commented: (ZOOKEEPER-104) KeptSet: a distributed data stucture backed by the children of a ZooKeeper node

Posted by "Benjamin Reed (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/ZOOKEEPER-104?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12618399#action_12618399 ] 

Benjamin Reed commented on ZOOKEEPER-104:
-----------------------------------------

InterruptedException is something we have to deal with from Java. We can't just catch them and retry. It is generally unsafe to eat this exception since it usually means someone wants the thread to go away. There seem to be a couple of ways to deal with InterruptedException but the safest seems to be to let it go through.

> KeptSet: a distributed data stucture backed by the children of a ZooKeeper node
> -------------------------------------------------------------------------------
>
>                 Key: ZOOKEEPER-104
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-104
>             Project: Zookeeper
>          Issue Type: New Feature
>          Components: java client
>            Reporter: Anthony Urso
>            Assignee: Anthony Urso
>            Priority: Minor
>         Attachments: ZOOKEEPER-104.patch, ZOOKEEPER-104.patch, ZOOKEEPER-104.patch
>
>
> Here is an implementation of a ZooKeeper backed Java Set. It should be generally useful.

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


[jira] Commented: (ZOOKEEPER-104) KeptSet: a distributed data stucture backed by the children of a ZooKeeper node

Posted by "Anthony Urso (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/ZOOKEEPER-104?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12618903#action_12618903 ] 

Anthony Urso commented on ZOOKEEPER-104:
----------------------------------------

The Set interface does not allow InterruptedException to be passed.  I am OK with wrapping the InterruptedException in a RuntimeException and rethrowing it, but I think it violates the semantics of the InterruptedException.  It's starting to look like this is not a suitable abstraction for ZooKeeper.

> KeptSet: a distributed data stucture backed by the children of a ZooKeeper node
> -------------------------------------------------------------------------------
>
>                 Key: ZOOKEEPER-104
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-104
>             Project: Zookeeper
>          Issue Type: New Feature
>          Components: java client
>            Reporter: Anthony Urso
>            Assignee: Anthony Urso
>            Priority: Minor
>         Attachments: ZOOKEEPER-104.patch, ZOOKEEPER-104.patch, ZOOKEEPER-104.patch
>
>
> Here is an implementation of a ZooKeeper backed Java Set. It should be generally useful.

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


[jira] Commented: (ZOOKEEPER-104) KeptSet: a distributed data stucture backed by the children of a ZooKeeper node

Posted by "Anthony Urso (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/ZOOKEEPER-104?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12618017#action_12618017 ] 

Anthony Urso commented on ZOOKEEPER-104:
----------------------------------------

>> I took the liberty of making some small updates to Anthony's patch file, Anthony please let me know if you see any issues with this. 

Those changes are all good.

>> in the keepset contructor i changed if (exits) zk.create() to try { zk.create() } (nodeexistsexcpetion ){}

Since the set can only be added to by a watcher event, these end up being semantically the same. I think checking the set first is a little more efficient, but either way is fine with me.

>> also i added braces around for and if with single lines (its less confusion for readign code  ).

OK.

>> i dont understand the while loops of while(true) in all the zookeeper calls? why do you need that anthony?

I do that to handle an InterruptedException by retrying the same command. Hopefully that is the right behavior. :)
The purpose of the InterruptedException has always been a mystery to me when coding non-interactive programs.


> KeptSet: a distributed data stucture backed by the children of a ZooKeeper node
> -------------------------------------------------------------------------------
>
>                 Key: ZOOKEEPER-104
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-104
>             Project: Zookeeper
>          Issue Type: New Feature
>          Components: java client
>            Reporter: Anthony Urso
>            Assignee: Anthony Urso
>            Priority: Minor
>         Attachments: ZOOKEEPER-104.patch, ZOOKEEPER-104.patch, ZOOKEEPER-104.patch
>
>
> Here is an implementation of a ZooKeeper backed Java Set. It should be generally useful.

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


[jira] Updated: (ZOOKEEPER-104) KeptSet: a distributed data stucture backed by the children of a ZooKeeper node

Posted by "Mahadev konar (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/ZOOKEEPER-104?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Mahadev konar updated ZOOKEEPER-104:
------------------------------------

    Status: Open  (was: Patch Available)

cancelling for now... i have another patch. will upload by the end of the day or tomm ... 

> KeptSet: a distributed data stucture backed by the children of a ZooKeeper node
> -------------------------------------------------------------------------------
>
>                 Key: ZOOKEEPER-104
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-104
>             Project: Zookeeper
>          Issue Type: New Feature
>          Components: java client
>            Reporter: Anthony Urso
>            Assignee: Anthony Urso
>            Priority: Minor
>         Attachments: ZOOKEEPER-104.patch, ZOOKEEPER-104.patch, ZOOKEEPER-104.patch
>
>
> Here is an implementation of a ZooKeeper backed Java Set. It should be generally useful.

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


[jira] Commented: (ZOOKEEPER-104) KeptSet: a distributed data stucture backed by the children of a ZooKeeper node

Posted by "Mahadev konar (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/ZOOKEEPER-104?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12618568#action_12618568 ] 

Mahadev konar commented on ZOOKEEPER-104:
-----------------------------------------

ben is right.... the interrupted exception is a tricky bit.... we should let it flow out... i think your client library should also let it flow to the keepset api level. does that make sense anthony?

> KeptSet: a distributed data stucture backed by the children of a ZooKeeper node
> -------------------------------------------------------------------------------
>
>                 Key: ZOOKEEPER-104
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-104
>             Project: Zookeeper
>          Issue Type: New Feature
>          Components: java client
>            Reporter: Anthony Urso
>            Assignee: Anthony Urso
>            Priority: Minor
>         Attachments: ZOOKEEPER-104.patch, ZOOKEEPER-104.patch, ZOOKEEPER-104.patch
>
>
> Here is an implementation of a ZooKeeper backed Java Set. It should be generally useful.

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


[jira] Commented: (ZOOKEEPER-104) KeptSet: a distributed data stucture backed by the children of a ZooKeeper node

Posted by "Mahadev konar (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/ZOOKEEPER-104?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12617109#action_12617109 ] 

Mahadev konar commented on ZOOKEEPER-104:
-----------------------------------------

nice idea.... :)

> KeptSet: a distributed data stucture backed by the children of a ZooKeeper node
> -------------------------------------------------------------------------------
>
>                 Key: ZOOKEEPER-104
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-104
>             Project: Zookeeper
>          Issue Type: New Feature
>          Components: java client
>            Reporter: Anthony Urso
>            Priority: Minor
>         Attachments: ZOOKEEPER-104.patch
>
>
> Here is an implementation of a ZooKeeper backed Java Set. It should be generally useful.

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


[jira] Updated: (ZOOKEEPER-104) KeptSet: a distributed data stucture backed by the children of a ZooKeeper node

Posted by "Anthony Urso (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/ZOOKEEPER-104?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Anthony Urso updated ZOOKEEPER-104:
-----------------------------------

    Status: Patch Available  (was: Open)

Patch attached.

> KeptSet: a distributed data stucture backed by the children of a ZooKeeper node
> -------------------------------------------------------------------------------
>
>                 Key: ZOOKEEPER-104
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-104
>             Project: Zookeeper
>          Issue Type: New Feature
>          Components: java client
>            Reporter: Anthony Urso
>            Priority: Minor
>         Attachments: ZOOKEEPER-104.patch
>
>
> Here is an implementation of a ZooKeeper backed Java Set. It should be generally useful.

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


[jira] Updated: (ZOOKEEPER-104) KeptSet: a distributed data stucture backed by the children of a ZooKeeper node

Posted by "Mahadev konar (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/ZOOKEEPER-104?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Mahadev konar updated ZOOKEEPER-104:
------------------------------------

    Attachment: ZOOKEEPER-104.patch

i took the liberty of changing pat's patch :). . 

1) in the keepset contructor i changed
if (exits)
zk.create()

to 
try {
zk.create()
} (nodeexistsexcpetion ){}

2) also i added braces around for and if with single lines (its less confusion for readign code :) ).
3) i dont understand the while loops of while(true)  in all the zookeeper calls? why do you need that anthony?



> KeptSet: a distributed data stucture backed by the children of a ZooKeeper node
> -------------------------------------------------------------------------------
>
>                 Key: ZOOKEEPER-104
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-104
>             Project: Zookeeper
>          Issue Type: New Feature
>          Components: java client
>            Reporter: Anthony Urso
>            Assignee: Anthony Urso
>            Priority: Minor
>         Attachments: ZOOKEEPER-104.patch, ZOOKEEPER-104.patch, ZOOKEEPER-104.patch
>
>
> Here is an implementation of a ZooKeeper backed Java Set. It should be generally useful.

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


[jira] Commented: (ZOOKEEPER-104) KeptSet: a distributed data stucture backed by the children of a ZooKeeper node

Posted by "Mahadev konar (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/ZOOKEEPER-104?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12618906#action_12618906 ] 

Mahadev konar commented on ZOOKEEPER-104:
-----------------------------------------

the second thing is what i did in my patch... 

so the interruptexception is thrown by zookeeper only when some other thread interrupts zookeeper and tells zookeeper client to go away. the zookeeper client does blocking calls and thus throws the interrupted exception... the Set api is not supposed to do any blocking calls (looks like)... the only alternative left if throw out a runtime exception.... dont know if this use case fits zookeeper....  

> KeptSet: a distributed data stucture backed by the children of a ZooKeeper node
> -------------------------------------------------------------------------------
>
>                 Key: ZOOKEEPER-104
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-104
>             Project: Zookeeper
>          Issue Type: New Feature
>          Components: java client
>            Reporter: Anthony Urso
>            Assignee: Anthony Urso
>            Priority: Minor
>         Attachments: ZOOKEEPER-104.patch, ZOOKEEPER-104.patch, ZOOKEEPER-104.patch
>
>
> Here is an implementation of a ZooKeeper backed Java Set. It should be generally useful.

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


[jira] Assigned: (ZOOKEEPER-104) KeptSet: a distributed data stucture backed by the children of a ZooKeeper node

Posted by "Flavio Paiva Junqueira (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/ZOOKEEPER-104?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Flavio Paiva Junqueira reassigned ZOOKEEPER-104:
------------------------------------------------

    Assignee: Anthony Urso

> KeptSet: a distributed data stucture backed by the children of a ZooKeeper node
> -------------------------------------------------------------------------------
>
>                 Key: ZOOKEEPER-104
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-104
>             Project: Zookeeper
>          Issue Type: New Feature
>          Components: java client
>            Reporter: Anthony Urso
>            Assignee: Anthony Urso
>            Priority: Minor
>         Attachments: ZOOKEEPER-104.patch
>
>
> Here is an implementation of a ZooKeeper backed Java Set. It should be generally useful.

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


[jira] Commented: (ZOOKEEPER-104) KeptSet: a distributed data stucture backed by the children of a ZooKeeper node

Posted by "Mahadev konar (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/ZOOKEEPER-104?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12617995#action_12617995 ] 

Mahadev konar commented on ZOOKEEPER-104:
-----------------------------------------

also we would need some build files for building these recipes ... since we have non right now. 

> KeptSet: a distributed data stucture backed by the children of a ZooKeeper node
> -------------------------------------------------------------------------------
>
>                 Key: ZOOKEEPER-104
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-104
>             Project: Zookeeper
>          Issue Type: New Feature
>          Components: java client
>            Reporter: Anthony Urso
>            Assignee: Anthony Urso
>            Priority: Minor
>         Attachments: ZOOKEEPER-104.patch, ZOOKEEPER-104.patch, ZOOKEEPER-104.patch
>
>
> Here is an implementation of a ZooKeeper backed Java Set. It should be generally useful.

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


[jira] Commented: (ZOOKEEPER-104) KeptSet: a distributed data stucture backed by the children of a ZooKeeper node

Posted by "Anthony Urso (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/ZOOKEEPER-104?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12617551#action_12617551 ] 

Anthony Urso commented on ZOOKEEPER-104:
----------------------------------------

>> You might consider throwing KeeperException on KeptSet.add to avoid problems, for example, with addAll.

KeptSet.add does throw a wrapped KeeperException whenever one is caught. I have to wrap it in an unchecked exception because of the Set interface.

>> the idea is to let ZooKeeper store the elements of a set despite failures of the client that created these elements

For my needs, I would like the set to contain the nodes even if the creating client dies.  But I've made it configurable at instantiation in the new patch.

>> Again on KeptSet.add, it seems to me that you can shrink your synchronized block.

Good idea.  I think catching NodeExistsException eliminates the need for it entirely.

>> the set is not resync'd with the server after disconnect

I think that's fixed now, by synchronizing upon getting any event with a connected state.

>> rather than add returning false, which would happen if the client added a string that was already present

Good catch, fixed.

>> Also note that the set is updated via a watch (even for changes made by this client), so you could add a string and an immediate check for existence may fail.

Documented.



> KeptSet: a distributed data stucture backed by the children of a ZooKeeper node
> -------------------------------------------------------------------------------
>
>                 Key: ZOOKEEPER-104
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-104
>             Project: Zookeeper
>          Issue Type: New Feature
>          Components: java client
>            Reporter: Anthony Urso
>            Assignee: Anthony Urso
>            Priority: Minor
>         Attachments: ZOOKEEPER-104.patch
>
>
> Here is an implementation of a ZooKeeper backed Java Set. It should be generally useful.

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


[jira] Commented: (ZOOKEEPER-104) KeptSet: a distributed data stucture backed by the children of a ZooKeeper node

Posted by "Flavio Paiva Junqueira (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/ZOOKEEPER-104?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12617186#action_12617186 ] 

Flavio Paiva Junqueira commented on ZOOKEEPER-104:
--------------------------------------------------

Again on KeptSet.add, it seems to me that you can shrink your synchronized block. The only access to "this.set" is on the predicate of the if statement, and the call to create doesn't realy need to be synchronized, right? 

> KeptSet: a distributed data stucture backed by the children of a ZooKeeper node
> -------------------------------------------------------------------------------
>
>                 Key: ZOOKEEPER-104
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-104
>             Project: Zookeeper
>          Issue Type: New Feature
>          Components: java client
>            Reporter: Anthony Urso
>            Priority: Minor
>         Attachments: ZOOKEEPER-104.patch
>
>
> Here is an implementation of a ZooKeeper backed Java Set. It should be generally useful.

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


[jira] Commented: (ZOOKEEPER-104) KeptSet: a distributed data stucture backed by the children of a ZooKeeper node

Posted by "Patrick Hunt (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/ZOOKEEPER-104?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12617243#action_12617243 ] 

Patrick Hunt commented on ZOOKEEPER-104:
----------------------------------------

Great idea, +1

I agree with flavio, this should go into contrib, unfort we don't have one yet. Makes sense to me that this should be part of the recipes
src/contrib/recipes/src/java/org/apache/zookeeper/recipes/util/KeptSet.java
package org.apache.zookeeper.recipes.util.KeptSet
how's that sound?

Anthony, I think there's an issue in the watcher - it doesn't handle the case where the client is re-connected (disconnected then reconnected) - ie the set is not resync'd with the server after disconnect.

(the following doc hasn't been moved to apache yet)
http://zookeeper.wiki.sourceforge.net/ZooKeeperWatches
specifically:
"when a client gets a disconnect event, it must consider that an implicit trigger of all watches. When a client reconnects to a new server, the client should re-set any watches that it is still interested in"

Also, this is a leaky abstraction (not that that's necessarily bad). Notice that if two clients add the same, new, string to the same set (relative to the znode path on the zk server) one of the clients will succeed and the other will get a runtime exception (wrapping keeperexception) (rather than add returning false, which would happen if the client added a string that was already present). Also note that the set is updated via a watch (even for changes made by this client), so you could add a string and an immediate check for existence may fail. Might be confusing for ppl expecting Set semantics, would be a good idea to document.


> KeptSet: a distributed data stucture backed by the children of a ZooKeeper node
> -------------------------------------------------------------------------------
>
>                 Key: ZOOKEEPER-104
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-104
>             Project: Zookeeper
>          Issue Type: New Feature
>          Components: java client
>            Reporter: Anthony Urso
>            Assignee: Anthony Urso
>            Priority: Minor
>         Attachments: ZOOKEEPER-104.patch
>
>
> Here is an implementation of a ZooKeeper backed Java Set. It should be generally useful.

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


[jira] Commented: (ZOOKEEPER-104) KeptSet: a distributed data stucture backed by the children of a ZooKeeper node

Posted by "Patrick Hunt (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/ZOOKEEPER-104?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12618884#action_12618884 ] 

Patrick Hunt commented on ZOOKEEPER-104:
----------------------------------------

Committers/reviewers - be sure to give a strong indication when dispositioning a jira/patch. This will help both committers & contributors and keep the process flowing smoothly:

1) indicate your vote (+/-1 or 0) and provide comment on general issues
2) if there are issues with a patch that need to be addressed before committing be sure to cancel the patch. Comments should indicate to the contributor what's expected to pass review.



> KeptSet: a distributed data stucture backed by the children of a ZooKeeper node
> -------------------------------------------------------------------------------
>
>                 Key: ZOOKEEPER-104
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-104
>             Project: Zookeeper
>          Issue Type: New Feature
>          Components: java client
>            Reporter: Anthony Urso
>            Assignee: Anthony Urso
>            Priority: Minor
>         Attachments: ZOOKEEPER-104.patch, ZOOKEEPER-104.patch, ZOOKEEPER-104.patch
>
>
> Here is an implementation of a ZooKeeper backed Java Set. It should be generally useful.

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


[jira] Updated: (ZOOKEEPER-104) KeptSet: a distributed data stucture backed by the children of a ZooKeeper node

Posted by "Anthony Urso (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/ZOOKEEPER-104?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Anthony Urso updated ZOOKEEPER-104:
-----------------------------------

    Attachment: ZOOKEEPER-104.patch

Revised patch attached,

> KeptSet: a distributed data stucture backed by the children of a ZooKeeper node
> -------------------------------------------------------------------------------
>
>                 Key: ZOOKEEPER-104
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-104
>             Project: Zookeeper
>          Issue Type: New Feature
>          Components: java client
>            Reporter: Anthony Urso
>            Assignee: Anthony Urso
>            Priority: Minor
>         Attachments: ZOOKEEPER-104.patch
>
>
> Here is an implementation of a ZooKeeper backed Java Set. It should be generally useful.

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


[jira] Updated: (ZOOKEEPER-104) KeptSet: a distributed data stucture backed by the children of a ZooKeeper node

Posted by "Patrick Hunt (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/ZOOKEEPER-104?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Patrick Hunt updated ZOOKEEPER-104:
-----------------------------------

    Attachment: ZOOKEEPER-104.patch

I took the liberty of making some small updates to Anthony's patch file, Anthony please let me know if you see any issues with this.

1) fixed the tests so that they will run on my machine (starting a server for client tests is complex due to timing issues - we really need to work on making our tests easier to write)
1.5) fixed call to KeptSet constructor in test (added flags)
2) added apache licenses to the source files
3) small formatting changes
4) implementation note in the class javadoc
5) we use spaces, not tabs

> KeptSet: a distributed data stucture backed by the children of a ZooKeeper node
> -------------------------------------------------------------------------------
>
>                 Key: ZOOKEEPER-104
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-104
>             Project: Zookeeper
>          Issue Type: New Feature
>          Components: java client
>            Reporter: Anthony Urso
>            Assignee: Anthony Urso
>            Priority: Minor
>         Attachments: ZOOKEEPER-104.patch, ZOOKEEPER-104.patch
>
>
> Here is an implementation of a ZooKeeper backed Java Set. It should be generally useful.

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


[jira] Updated: (ZOOKEEPER-104) KeptSet: a distributed data stucture backed by the children of a ZooKeeper node

Posted by "Anthony Urso (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/ZOOKEEPER-104?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Anthony Urso updated ZOOKEEPER-104:
-----------------------------------

    Attachment:     (was: ZOOKEEPER-104.patch)

> KeptSet: a distributed data stucture backed by the children of a ZooKeeper node
> -------------------------------------------------------------------------------
>
>                 Key: ZOOKEEPER-104
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-104
>             Project: Zookeeper
>          Issue Type: New Feature
>          Components: java client
>            Reporter: Anthony Urso
>            Assignee: Anthony Urso
>            Priority: Minor
>         Attachments: ZOOKEEPER-104.patch
>
>
> Here is an implementation of a ZooKeeper backed Java Set. It should be generally useful.

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