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 0D4319E79 for ; Mon, 25 Jun 2012 18:07:56 +0000 (UTC) Received: (qmail 95684 invoked by uid 500); 25 Jun 2012 18:07:55 -0000 Delivered-To: apmail-hbase-commits-archive@hbase.apache.org Received: (qmail 95600 invoked by uid 500); 25 Jun 2012 18:07:55 -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 95592 invoked by uid 99); 25 Jun 2012 18:07:55 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 25 Jun 2012 18:07:55 +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; Mon, 25 Jun 2012 18:07:54 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 7547723888CD for ; Mon, 25 Jun 2012 18:07:34 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1353688 - /hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/master/HMaster.java Date: Mon, 25 Jun 2012 18:07:33 -0000 To: commits@hbase.apache.org From: ramkrishna@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20120625180734.7547723888CD@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: ramkrishna Date: Mon Jun 25 18:07:32 2012 New Revision: 1353688 URL: http://svn.apache.org/viewvc?rev=1353688&view=rev Log: HBASE-5875 Process RIT and Master restart may remove an online server considering it as a dead server (Rajesh) Submitted by:Rajesh Reviewed by:Ram Ted, Stack Modified: hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/master/HMaster.java Modified: hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/master/HMaster.java URL: http://svn.apache.org/viewvc/hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/master/HMaster.java?rev=1353688&r1=1353687&r2=1353688&view=diff ============================================================================== --- hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/master/HMaster.java (original) +++ hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/master/HMaster.java Mon Jun 25 18:07:32 2012 @@ -748,7 +748,8 @@ Server { boolean rit = this.assignmentManager. processRegionInTransitionAndBlockUntilAssigned(HRegionInfo.ROOT_REGIONINFO); ServerName currentRootServer = null; - if (!catalogTracker.verifyRootRegionLocation(timeout)) { + boolean rootRegionLocation = catalogTracker.verifyRootRegionLocation(timeout); + if (!rit && !rootRegionLocation) { currentRootServer = this.catalogTracker.getRootLocation(); splitLogAndExpireIfOnline(currentRootServer); this.assignmentManager.assignRoot(); @@ -757,7 +758,13 @@ Server { // This guarantees that the transition assigning -ROOT- has completed this.assignmentManager.waitForAssignment(HRegionInfo.ROOT_REGIONINFO); assigned++; - } else { + } else if (rit && !rootRegionLocation) { + // Make sure a -ROOT- location is set. + if (!isRootLocation()) return false; + // This guarantees that the transition assigning -ROOT- has completed + this.assignmentManager.waitForAssignment(HRegionInfo.ROOT_REGIONINFO); + assigned++; + } else if (rootRegionLocation) { // Region already assigned. We didn't assign it. Add to in-memory state. this.assignmentManager.regionOnline(HRegionInfo.ROOT_REGIONINFO, this.catalogTracker.getRootLocation()); @@ -774,7 +781,8 @@ Server { status.setStatus("Assigning META region"); rit = this.assignmentManager. processRegionInTransitionAndBlockUntilAssigned(HRegionInfo.FIRST_META_REGIONINFO); - if (!this.catalogTracker.verifyMetaRegionLocation(timeout)) { + boolean metaRegionLocation = this.catalogTracker.verifyMetaRegionLocation(timeout); + if (!rit && !metaRegionLocation) { ServerName currentMetaServer = this.catalogTracker.getMetaLocationOrReadLocationFromRoot(); if (currentMetaServer != null @@ -782,11 +790,11 @@ Server { splitLogAndExpireIfOnline(currentMetaServer); } assignmentManager.assignMeta(); - enableServerShutdownHandler(); - this.catalogTracker.waitForMeta(); - // Above check waits for general meta availability but this does not - // guarantee that the transition has completed - this.assignmentManager.waitForAssignment(HRegionInfo.FIRST_META_REGIONINFO); + enableSSHandWaitForMeta(); + assigned++; + } else if (rit && !metaRegionLocation) { + // Wait until META region added to region server onlineRegions. See HBASE-5875. + enableSSHandWaitForMeta(); assigned++; } else { // Region already assigned. We didnt' assign it. Add to in-memory state. @@ -800,6 +808,14 @@ Server { return true; } + private void enableSSHandWaitForMeta() throws IOException, InterruptedException { + enableServerShutdownHandler(); + this.catalogTracker.waitForMeta(); + // Above check waits for general meta availability but this does not + // guarantee that the transition has completed + this.assignmentManager.waitForAssignment(HRegionInfo.FIRST_META_REGIONINFO); + } + /** * @return True if there a root available * @throws InterruptedException