Return-Path: Delivered-To: apmail-hadoop-hbase-user-archive@minotaur.apache.org Received: (qmail 13842 invoked from network); 18 May 2009 14:30:02 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 18 May 2009 14:30:02 -0000 Received: (qmail 20446 invoked by uid 500); 18 May 2009 14:30:01 -0000 Delivered-To: apmail-hadoop-hbase-user-archive@hadoop.apache.org Received: (qmail 20404 invoked by uid 500); 18 May 2009 14:30:01 -0000 Mailing-List: contact hbase-user-help@hadoop.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: hbase-user@hadoop.apache.org Delivered-To: mailing list hbase-user@hadoop.apache.org Received: (qmail 20394 invoked by uid 99); 18 May 2009 14:30:01 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 18 May 2009 14:30:01 +0000 X-ASF-Spam-Status: No, hits=2.4 required=10.0 tests=HTML_MESSAGE,SPF_PASS,URIBL_GREY X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of germoglio@gmail.com designates 209.85.217.167 as permitted sender) Received: from [209.85.217.167] (HELO mail-gx0-f167.google.com) (209.85.217.167) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 18 May 2009 14:29:49 +0000 Received: by gxk11 with SMTP id 11so6512924gxk.5 for ; Mon, 18 May 2009 07:29:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :from:date:message-id:subject:to:content-type; bh=8xbKwMkqoCMtqQsLQnmhjWZnc1+UTpwCY2uwP73pCOs=; b=TpmV8jSwkB37YoYkM+fvDHdk1eyqTYe3sEW0+C6UEmOJrLc1Z7cxlBOs23+ytZVVrg QDVz9SGeM9bCvhKAOzrUS7fxFAdTCw3mnf86yRPP18weSQePoe79MCPRIOuYXktroAsI GIOTouoX14RgNyxjZf32LqsnWopfuYt7a2QYc= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type; b=vqrmQQCW/nehcR7S1Rz6RFY7idQBEKi6JQ6cHHBWMI/ceP9FlosmMx86ncxEz7LDWb Xspbm99jE75LOfRSX1HiJrogLwFjcQdslgfw7ypW3xMI/vYIPtWKVOd+CJsGgBhhv8Ni bav3IuslYSpDnhQ3J8WQRh4IRZAFT5J9Qejmw= MIME-Version: 1.0 Received: by 10.150.202.11 with SMTP id z11mr12749347ybf.0.1242656657162; Mon, 18 May 2009 07:24:17 -0700 (PDT) In-Reply-To: <82b0992a0905142240s61c94797hca99b7405d96b832@mail.gmail.com> References: <29bed2720905081629r6d50a895g87304b05f5a0a4fa@mail.gmail.com> <29bed2720905131944j84685d1s99101b4929016422@mail.gmail.com> <92eebe280905132300y52b3f04cq3f65911eda5acbbb@mail.gmail.com> <7c962aed0905140716m2f47cb86n662d664b5a3a5aa@mail.gmail.com> <29bed2720905140944r41f89bbcwffa591af87d6db86@mail.gmail.com> <7c962aed0905141140k3fc0f7adse624c518c0f37dd2@mail.gmail.com> <29bed2720905141731q56f1df49v84e5fc5082fe8f5d@mail.gmail.com> <78568af10905141905j1707a889u3501438252144e6b@mail.gmail.com> <78568af10905141905x12102633yab1636415a921833@mail.gmail.com> <82b0992a0905142240s61c94797hca99b7405d96b832@mail.gmail.com> From: Guilherme Germoglio Date: Mon, 18 May 2009 11:23:57 -0300 Message-ID: <29bed2720905180723v308bc790k922ac7cc3302dd96@mail.gmail.com> Subject: Re: Problems when executing many (?) HTable.lockRow() To: hbase-user@hadoop.apache.org Content-Type: multipart/alternative; boundary=000e0cd4d35ca0c100046a308cfd X-Virus-Checked: Checked by ClamAV on apache.org --000e0cd4d35ca0c100046a308cfd Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit hello, what is the current state of zk in hbase? and what will it be on version 0.20? I mean "are/will we able to run hbase without zk?" Because I think that making rowlocks perform well is essential for users and also maybe this approach will make the code simpler, but I don't know what are the drawbacks of creating such a dependency on zk. thanks, On Fri, May 15, 2009 at 2:40 AM, Nitay wrote: > I like this a lot Guilherme. Perhaps we should open a JIRA with them so we > can track these great ideas. > > On Thu, May 14, 2009 at 7:05 PM, Ryan Rawson wrote: > > > Given the non core nature, I think the api should potentially facilitate > > this but the code should be contrib. > > > > On May 14, 2009 5:32 PM, "Guilherme Germoglio" > > wrote: > > > > On Thu, May 14, 2009 at 3:40 PM, stack wrote: > No > > consideration has been made f... > > I think so. > > > > If nothing is to be changed on RowLock class, we could use the following > > approach: > > > > Considering the line as is today: > > > > *RowLock lock = htable.lockRow(row);* > > > > *htable.lockRow(row)*, instead of contacting the regionserver and > > requesting > > a lock for the given row, it would contact zk for a lock, just as the > lock > > recipe< > > > > > http://hadoop.apache.org/zookeeper/docs/current/recipes.html#sc_recipes_Locks > > >[1]. > > Notice that it will be waiting for the lock just as it does today, the > > only difference is that regionserver resources (e.g., RPC thread) aren't > > used. After it receives the lock, htable would: (1) randomly generate a > > lockid, (2) put an entry in a Map, (3) create a > > RowLock using the lockid and (4) return the method. > > > > From this point, any operation could be performed even without passing > > rowlock as parameter, zookeeper + the implementation of the lock recipe > in > > htable are now ensuring that no other client would be performing any > > operation concurrently on the given row. [2] > > > > Finally, *htable.unlockRow(lock)* must be invoked, which would make > Htable > > delete the matching zk node (remember the Map). > > > > One good thing of this approach is that we don't have to worry about lock > > leases: if the client dies, zk will notice at some point in the future > and > > release the lock. And if the client forgets to unlock the row, its code > is > > wrong. (: > > > > However, if we are to redesign the API, I would propose write and read > > locks. Then htable would have two methods: HTable.lockRowForRead(row), > > HTable.lockRowForWrite(row) [3] and the lock recipe to be implemented > would > > be the Shared Locks > > recipe< > > > http://hadoop.apache.org/zookeeper/docs/current/recipes.html#Shared+Locks > > >. > > > > > > [1] We may design carefully how the locknode would be created according > to > > zk constraints on how many nodes it can manage in a single directory. > Maybe > > we should do something like: > > /hbase/locks/table-name/hash-function(row)/row/{read-, write-} > > > > [2] I agree that we are not protecting ourselves from a malicious client > > using HTable, who could simply "forget" to request the lock for the given > > row and then mess everything. But this is how it's everywhere, isn't it? > > > > [3] Suggest better method names, please! > > > > > St.Ack > > > On Thu, May 14, 2009 at 9:44 AM, Guilherme Germoglio < > > germoglio@gmail.com > >wrote:... > > -- > > > > Guilherme msn: guigermoglio@hotmail.com homepage: > > http://germoglio.googlepages.com > > > -- Guilherme msn: guigermoglio@hotmail.com homepage: http://germoglio.googlepages.com --000e0cd4d35ca0c100046a308cfd--