Return-Path: Delivered-To: apmail-hadoop-zookeeper-user-archive@minotaur.apache.org Received: (qmail 80150 invoked from network); 24 Feb 2010 05:12:11 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 24 Feb 2010 05:12:11 -0000 Received: (qmail 71229 invoked by uid 500); 24 Feb 2010 05:12:11 -0000 Delivered-To: apmail-hadoop-zookeeper-user-archive@hadoop.apache.org Received: (qmail 71193 invoked by uid 500); 24 Feb 2010 05:12:11 -0000 Mailing-List: contact zookeeper-user-help@hadoop.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: zookeeper-user@hadoop.apache.org Delivered-To: mailing list zookeeper-user@hadoop.apache.org Received: (qmail 71183 invoked by uid 99); 24 Feb 2010 05:12:10 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 24 Feb 2010 05:12:10 +0000 X-ASF-Spam-Status: No, hits=2.2 required=10.0 tests=HTML_MESSAGE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of waite.134@googlemail.com designates 209.85.220.213 as permitted sender) Received: from [209.85.220.213] (HELO mail-fx0-f213.google.com) (209.85.220.213) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 24 Feb 2010 05:12:02 +0000 Received: by fxm5 with SMTP id 5so4812636fxm.29 for ; Tue, 23 Feb 2010 21:11:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:content-type; bh=lPc8n5xVBh+XRlIez0Q7rqIDhUxeWBUpbHYMMwfdyZQ=; b=MV+6w0Wg9lQg0xSMSFPpqlZuyMQjb6DxRR77LS/pvViRLRm8Y55RPzsTStGgqIaUuD 4buSA3LvjYTKTCLguh1L3B83huXGPatnj8g66Xss6gcgkrR5dH2KRd7rYBRKTNSHGbzP ZsAw7Rkoa+JHqgih6yQPgPpzMsOx2E+O1V4J0= DomainKey-Signature: a=rsa-sha1; c=nofws; d=googlemail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; b=xiOhQP1vJdmKR9S4hWWLnA3XwNdRf2EXjcJPr62VKY2K+BigUq/ZPtBS1mWtA0SX1m Vb60Uwo3FssC30LQjYCbAk+cBHi3Uxr8ZorX14UgN+ZoHCuOj92Iz/0Ubq56NKVWevJB XXQx6LhpVVDK7imo39Feia1T+hIPDW8C/MgjU= MIME-Version: 1.0 Received: by 10.102.248.17 with SMTP id v17mr2080732muh.79.1266988300274; Tue, 23 Feb 2010 21:11:40 -0800 (PST) In-Reply-To: References: <8bc75ecf1002230405u4f28a5f4q4a25348b35af3671@mail.gmail.com> Date: Wed, 24 Feb 2010 05:11:40 +0000 Message-ID: <8bc75ecf1002232111n22538dcbj7d68519bb1bfb5e8@mail.gmail.com> Subject: Re: how to lock one-of-many ? From: Martin Waite To: zookeeper-user@hadoop.apache.org Content-Type: multipart/alternative; boundary=0016364164d7928c2d048051b3ab --0016364164d7928c2d048051b3ab Content-Type: text/plain; charset=ISO-8859-1 Thanks Ted. The randomization should work well in this case. regards, Martin On 23 February 2010 18:27, Ted Dunning wrote: > I think that the crux of Mahadev's suggestion is that you do as you say, > but > you should try the resources in randomized order. > > That will have very robust properties, especially with more than a handful > of resources and is easy to code and to analyze. > > It won't work if you really mean "lock first available from this sequence". > > On Tue, Feb 23, 2010 at 4:05 AM, Martin Waite >wrote: > > > For locking, I could loop through > > the available ids, attempting to create a lock for that in the locked > > directory. However this seems a bit clumsy and slow. Also, the locks > are > > held for a relatively short time (1 second on average), and by time I > have > > blundered through all the possible locks, ids that were locked at the > start > > might be available by time I finished. > > > > > > -- > Ted Dunning, CTO > DeepDyve > --0016364164d7928c2d048051b3ab--