Re: zookeeper utils

2010-03-02 Thread Henry Robinson
Just to illustrate one of the primitives you're looking for: an
AtomicInteger equivalent would be fairly easy to construct, with nearly
identical semantics to the Java version.

Let's say a given znode has four bytes of data that represent an integer
value. Get operations or set operations are easy, as ZK will make sure that
all operations are atomic, so they happen in a linearizable order. A
get-and-set operation can be performed by reading the znode via getData, and
performing a conditional update using the version number of the znode that
was returned as part of the getData operation. ZooKeeper's setData operation
takes an optional version number (set it to -1 to ignore it) which tells the
operation to succeed only if the znode's version hasn't changed since. Other
operations can use this procedure as a base.

This is exactly how Java's getAndSet is implemented - neither implementation
is wait-free, but they are still lock-free: some process will always make
progress.

Hope this helps - let me know if you'd like more detail on exactly how to
build this.

Henry

-- 
Henry Robinson
Software Engineer
Cloudera
415-994-6679

On 2 March 2010 20:18, David Rosenstrauch  wrote:

> On 03/02/2010 05:52 PM, Ted Dunning wrote:
>
>> What other examples are you looking for?
>>
>> On Tue, Mar 2, 2010 at 1:04 PM, David Rosenstrauch> >wrote:
>>
>>  Is there a library of higher-level zookeeper utilities that people have
>>> contributed, beyond the barrier and queue examples provided in the docs?
>>>
>>
> Well, first off, I'm trying to get familiar with Zookeeper's capabilities,
> and I figured that'd be a good place to start.
>
> Aside from that, though, we're going to need something like AtomicInteger
> for an app I'm about to start working on, so I was looking to see if there
> was already some code out there that got me all or part of the way there.
>
> DR
>


Re: zookeeper utils

2010-03-02 Thread David Rosenstrauch

On 03/02/2010 05:52 PM, Ted Dunning wrote:

What other examples are you looking for?

On Tue, Mar 2, 2010 at 1:04 PM, David Rosenstrauchwrote:


Is there a library of higher-level zookeeper utilities that people have
contributed, beyond the barrier and queue examples provided in the docs?


Well, first off, I'm trying to get familiar with Zookeeper's 
capabilities, and I figured that'd be a good place to start.


Aside from that, though, we're going to need something like 
AtomicInteger for an app I'm about to start working on, so I was looking 
to see if there was already some code out there that got me all or part 
of the way there.


DR


Re: zookeeper utils

2010-03-02 Thread David Rosenstrauch

Thanks, I'll take a look.

DR

On 03/02/2010 05:37 PM, Mahadev Konar wrote:

Hi David,
   There is an implementation for locks and queues in src/recipes. The
documentation residres in src/recipes/{lock/queue}/README.txt.

Thanks
mahadev


On 3/2/10 1:04 PM, "David Rosenstrauch"  wrote:


Was reading through the zookeeper docs on the web - specifically the
"recipes and solutions" page (as well as comments elsewhere inviting
additional such contributions from the community) and was wondering:

Is there a library of higher-level zookeeper utilities that people have
contributed, beyond the barrier and queue examples provided in the docs?

Thanks,

DR






Re: zookeeper utils

2010-03-02 Thread Ted Dunning
What other examples are you looking for?

On Tue, Mar 2, 2010 at 1:04 PM, David Rosenstrauch wrote:

> Is there a library of higher-level zookeeper utilities that people have
> contributed, beyond the barrier and queue examples provided in the docs?




-- 
Ted Dunning, CTO
DeepDyve


Re: zookeeper utils

2010-03-02 Thread Mahadev Konar
Hi David,
  There is an implementation for locks and queues in src/recipes. The
documentation residres in src/recipes/{lock/queue}/README.txt.

Thanks
mahadev


On 3/2/10 1:04 PM, "David Rosenstrauch"  wrote:

> Was reading through the zookeeper docs on the web - specifically the
> "recipes and solutions" page (as well as comments elsewhere inviting
> additional such contributions from the community) and was wondering:
> 
> Is there a library of higher-level zookeeper utilities that people have
> contributed, beyond the barrier and queue examples provided in the docs?
> 
> Thanks,
> 
> DR



zookeeper utils

2010-03-02 Thread David Rosenstrauch
Was reading through the zookeeper docs on the web - specifically the 
"recipes and solutions" page (as well as comments elsewhere inviting 
additional such contributions from the community) and was wondering:


Is there a library of higher-level zookeeper utilities that people have 
contributed, beyond the barrier and queue examples provided in the docs?


Thanks,

DR