Return-Path: Delivered-To: apmail-hbase-commits-archive@www.apache.org Received: (qmail 68466 invoked from network); 23 Jul 2010 22:45:16 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 23 Jul 2010 22:45:16 -0000 Received: (qmail 13598 invoked by uid 500); 23 Jul 2010 22:45:16 -0000 Delivered-To: apmail-hbase-commits-archive@hbase.apache.org Received: (qmail 13510 invoked by uid 500); 23 Jul 2010 22:45:15 -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 12820 invoked by uid 99); 23 Jul 2010 22:45:14 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 23 Jul 2010 22:45:14 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.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; Fri, 23 Jul 2010 22:45:13 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id C27942388A3B; Fri, 23 Jul 2010 22:44:21 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r967290 - in /hbase/trunk: CHANGES.txt src/main/java/org/apache/hadoop/hbase/master/ZKUnassignedWatcher.java src/main/java/org/apache/hadoop/hbase/zookeeper/ZooKeeperWrapper.java Date: Fri, 23 Jul 2010 22:44:21 -0000 To: commits@hbase.apache.org From: jdcryans@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20100723224421.C27942388A3B@eris.apache.org> Author: jdcryans Date: Fri Jul 23 22:44:21 2010 New Revision: 967290 URL: http://svn.apache.org/viewvc?rev=967290&view=rev Log: HBASE-2866 Region permanently offlined Modified: hbase/trunk/CHANGES.txt hbase/trunk/src/main/java/org/apache/hadoop/hbase/master/ZKUnassignedWatcher.java hbase/trunk/src/main/java/org/apache/hadoop/hbase/zookeeper/ZooKeeperWrapper.java Modified: hbase/trunk/CHANGES.txt URL: http://svn.apache.org/viewvc/hbase/trunk/CHANGES.txt?rev=967290&r1=967289&r2=967290&view=diff ============================================================================== --- hbase/trunk/CHANGES.txt (original) +++ hbase/trunk/CHANGES.txt Fri Jul 23 22:44:21 2010 @@ -449,6 +449,7 @@ Release 0.21.0 - Unreleased HBASE-2859 Cleanup deprecated stuff in TestHLog (Alex Newman via Stack) HBASE-2858 TestReplication.queueFailover fails half the time HBASE-2863 HBASE-2553 removed an important edge case + HBASE-2866 Region permanently offlined IMPROVEMENTS HBASE-1760 Cleanup TODOs in HTable Modified: hbase/trunk/src/main/java/org/apache/hadoop/hbase/master/ZKUnassignedWatcher.java URL: http://svn.apache.org/viewvc/hbase/trunk/src/main/java/org/apache/hadoop/hbase/master/ZKUnassignedWatcher.java?rev=967290&r1=967289&r2=967290&view=diff ============================================================================== --- hbase/trunk/src/main/java/org/apache/hadoop/hbase/master/ZKUnassignedWatcher.java (original) +++ hbase/trunk/src/main/java/org/apache/hadoop/hbase/master/ZKUnassignedWatcher.java Fri Jul 23 22:44:21 2010 @@ -169,6 +169,7 @@ public class ZKUnassignedWatcher impleme String region = zNodePath.substring( zNodePath.indexOf(rgnInTransitNode) + rgnInTransitNode.length() + 1); HBaseEventType rsEvent = HBaseEventType.fromByte(data[0]); + LOG.debug("Got event type [ " + rsEvent + " ] for region " + region); // if the node was CLOSED then handle it if(rsEvent == HBaseEventType.RS2ZK_REGION_CLOSED) { Modified: hbase/trunk/src/main/java/org/apache/hadoop/hbase/zookeeper/ZooKeeperWrapper.java URL: http://svn.apache.org/viewvc/hbase/trunk/src/main/java/org/apache/hadoop/hbase/zookeeper/ZooKeeperWrapper.java?rev=967290&r1=967289&r2=967290&view=diff ============================================================================== --- hbase/trunk/src/main/java/org/apache/hadoop/hbase/zookeeper/ZooKeeperWrapper.java (original) +++ hbase/trunk/src/main/java/org/apache/hadoop/hbase/zookeeper/ZooKeeperWrapper.java Fri Jul 23 22:44:21 2010 @@ -1133,22 +1133,36 @@ public class ZooKeeperWrapper implements return; } - if(LOG.isDebugEnabled()) { - // Check existing state for logging purposes. - Stat stat = new Stat(); - byte[] oldData = null; - try { - oldData = readZNode(znode, stat); - } catch (IOException e) { - LOG.error("Error reading data for " + znode); - } - if(oldData == null) { - LOG.debug("While updating UNASSIGNED region " + regionName + " - node exists with no data" ); - } - else { - LOG.debug("While updating UNASSIGNED region " + regionName + " exists, state = " + (HBaseEventType.fromByte(oldData[0]))); + Stat stat = new Stat(); + byte[] oldData = null; + try { + oldData = readZNode(znode, stat); + } catch (IOException e) { + LOG.error("Error reading data for " + znode); + } + // If there is no data in the ZNode, then update it + if(oldData == null) { + LOG.debug("While updating UNASSIGNED region " + regionName + " - node exists with no data" ); + } + // If there is data in the ZNode, do not update if it is already correct + else { + HBaseEventType curState = HBaseEventType.fromByte(oldData[0]); + HBaseEventType newState = HBaseEventType.fromByte(data[0]); + // If the znode has the right state already, do not update it. Updating + // the znode again and again will bump up the zk version. This may cause + // the region server to fail. The RS expects that the znode is never + // updated by anyone else while it is opening/closing a region. + if(curState == newState) { + LOG.debug("No need to update UNASSIGNED region " + regionName + + " as it already exists in state = " + curState); + return; } + + // If the ZNode is in another state, then update it + LOG.debug("UNASSIGNED region " + regionName + " is currently in state = " + + curState + ", updating it to " + newState); } + // Update the ZNode synchronized(unassignedZNodesWatched) { unassignedZNodesWatched.add(znode); try {