On Tue, May 8, 2012 at 11:06 PM, Christoph Hellwig <[email protected]> wrote:
> On Tue, May 08, 2012 at 11:01:53PM +0800, Yunkai Zhang wrote:
>> It works well now, I don't know what you worry about?
>
> It works most of the time, but not always.  Even worse the reace is
> small enough that you won't find it during most testing, and only run
> into it on some heavily loaded production system once in a while.

Producer: watcher thread
Consumer: main thread

1) watcher thread:
When sheep leave, /sheepdog/member/<nodeid_to_str> was deleted by
zookeeper server, watcher() will forge an LEAVE event, and:
atomic_add_and_return(&nr_zk_levents, 1)

2) main thread:
Check if atomic_read(&nr_zk_levents) > 0; if so, call
atomic_sub_and_return(&nr_zk_levents, 1), and processes this LEAVE
event.

What is the problem you worry about? Can you give me an example?

-- 
Yunkai Zhang
Work at Taobao
-- 
sheepdog mailing list
[email protected]
http://lists.wpkg.org/mailman/listinfo/sheepdog

Reply via email to