Return-Path: X-Original-To: apmail-hbase-commits-archive@www.apache.org Delivered-To: apmail-hbase-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id EF41169C9 for ; Tue, 24 May 2011 17:25:13 +0000 (UTC) Received: (qmail 47886 invoked by uid 500); 24 May 2011 17:25:13 -0000 Delivered-To: apmail-hbase-commits-archive@hbase.apache.org Received: (qmail 47838 invoked by uid 500); 24 May 2011 17:25:13 -0000 Mailing-List: contact commits-help@hbase.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@hbase.apache.org Delivered-To: mailing list commits@hbase.apache.org Received: (qmail 47831 invoked by uid 99); 24 May 2011 17:25:13 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 24 May 2011 17:25:13 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 24 May 2011 17:25:10 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id D6DC8238896F; Tue, 24 May 2011 17:24:48 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1127157 - in /hbase/branches/0.90: CHANGES.txt src/main/java/org/apache/hadoop/hbase/master/handler/ServerShutdownHandler.java Date: Tue, 24 May 2011 17:24:48 -0000 To: commits@hbase.apache.org From: stack@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20110524172448.D6DC8238896F@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: stack Date: Tue May 24 17:24:48 2011 New Revision: 1127157 URL: http://svn.apache.org/viewvc?rev=1127157&view=rev Log: HBASE-3914 ROOT region appeared in two regionserver's onlineRegions at the same time Modified: hbase/branches/0.90/CHANGES.txt hbase/branches/0.90/src/main/java/org/apache/hadoop/hbase/master/handler/ServerShutdownHandler.java Modified: hbase/branches/0.90/CHANGES.txt URL: http://svn.apache.org/viewvc/hbase/branches/0.90/CHANGES.txt?rev=1127157&r1=1127156&r2=1127157&view=diff ============================================================================== --- hbase/branches/0.90/CHANGES.txt (original) +++ hbase/branches/0.90/CHANGES.txt Tue May 24 17:24:48 2011 @@ -18,6 +18,8 @@ Release 0.90.4 - Unreleased HBASE-3908 TableSplit not implementing "hashCode" problem (Daniel Iancu) HBASE-3195 Binary row keys in hbck and other miscellaneous binary key display issues + HBASE-3914 ROOT region appeared in two regionserver's onlineRegions at + the same time (Jieshan Bean) IMPROVEMENT HBASE-3882 hbase-config.sh needs to be updated so it can auto-detects the Modified: hbase/branches/0.90/src/main/java/org/apache/hadoop/hbase/master/handler/ServerShutdownHandler.java URL: http://svn.apache.org/viewvc/hbase/branches/0.90/src/main/java/org/apache/hadoop/hbase/master/handler/ServerShutdownHandler.java?rev=1127157&r1=1127156&r2=1127157&view=diff ============================================================================== --- hbase/branches/0.90/src/main/java/org/apache/hadoop/hbase/master/handler/ServerShutdownHandler.java (original) +++ hbase/branches/0.90/src/main/java/org/apache/hadoop/hbase/master/handler/ServerShutdownHandler.java Tue May 24 17:24:48 2011 @@ -74,6 +74,26 @@ public class ServerShutdownHandler exten } /** + * Before assign the ROOT region, ensure it haven't + * been assigned by other place + *

+ * Under some scenarios, the ROOT region can be opened twice, so it seemed online + * in two regionserver at the same time. + * If the ROOT region has been assigned, so the operation can be canceled. + * @throws InterruptedException + * @throws IOException + * @throws KeeperException + */ + private void verifyAndAssignRoot() + throws InterruptedException, IOException, KeeperException { + long timeout = this.server.getConfiguration(). + getLong("hbase.catalog.verification.timeout", 1000); + if (!this.server.getCatalogTracker().verifyRootRegionLocation(timeout)) { + this.services.getAssignmentManager().assignRoot(); + } + } + + /** * @return True if the server we are processing was carrying -ROOT- */ boolean isCarryingRoot() { @@ -104,10 +124,14 @@ public class ServerShutdownHandler exten // Assign root and meta if we were carrying them. if (isCarryingRoot()) { // -ROOT- try { - this.services.getAssignmentManager().assignRoot(); + verifyAndAssignRoot(); } catch (KeeperException e) { this.server.abort("In server shutdown processing, assigning root", e); throw new IOException("Aborting", e); + } catch (InterruptedException e1) { + LOG.warn("Interrupted while verifying root region's location", e1); + Thread.currentThread().interrupt(); + throw new IOException(e1); } } @@ -300,4 +324,4 @@ public class ServerShutdownHandler exten return false; } } -} \ No newline at end of file +}