You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by jm...@apache.org on 2012/04/15 10:59:13 UTC

svn commit: r1326281 - /hbase/branches/0.94/src/main/java/org/apache/hadoop/hbase/util/HBaseFsckRepair.java

Author: jmhsieh
Date: Sun Apr 15 08:59:12 2012
New Revision: 1326281

URL: http://svn.apache.org/viewvc?rev=1326281&view=rev
Log:
HBASE-5781 Zookeeper session got closed while trying to assign the region to RS using hbck -fix

Modified:
    hbase/branches/0.94/src/main/java/org/apache/hadoop/hbase/util/HBaseFsckRepair.java

Modified: hbase/branches/0.94/src/main/java/org/apache/hadoop/hbase/util/HBaseFsckRepair.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.94/src/main/java/org/apache/hadoop/hbase/util/HBaseFsckRepair.java?rev=1326281&r1=1326280&r2=1326281&view=diff
==============================================================================
--- hbase/branches/0.94/src/main/java/org/apache/hadoop/hbase/util/HBaseFsckRepair.java (original)
+++ hbase/branches/0.94/src/main/java/org/apache/hadoop/hbase/util/HBaseFsckRepair.java Sun Apr 15 08:59:12 2012
@@ -114,38 +114,28 @@ public class HBaseFsckRepair {
    */
   public static void waitUntilAssigned(HBaseAdmin admin,
       HRegionInfo region) throws IOException, InterruptedException {
-    HConnection connection = admin.getConnection();
-
-    try {
-      long timeout = admin.getConfiguration().getLong("hbase.hbck.assign.timeout", 120000);
-      long expiration = timeout + System.currentTimeMillis();
-      while (System.currentTimeMillis() < expiration) {
-        try {
-          Map<String, RegionState> rits=
+    long timeout = admin.getConfiguration().getLong("hbase.hbck.assign.timeout", 120000);
+    long expiration = timeout + System.currentTimeMillis();
+    while (System.currentTimeMillis() < expiration) {
+      try {
+        Map<String, RegionState> rits=
             admin.getClusterStatus().getRegionsInTransition();
 
-          if (rits.keySet() != null && !rits.keySet().contains(region.getEncodedName())) {
-            // yay! no longer RIT
-            return;
-          }
-          // still in rit
-          LOG.info("Region still in transition, waiting for "
-              + "it to become assigned: " + region);
-        } catch (IOException e) {
-          LOG.warn("Exception when waiting for region to become assigned,"
-              + " retrying", e);
+        if (rits.keySet() != null && !rits.keySet().contains(region.getEncodedName())) {
+          // yay! no longer RIT
+          return;
         }
-        Thread.sleep(1000);
-      }
-      throw new IOException("Region " + region + " failed to move out of " +
-          "transition within timeout " + timeout + "ms");
-    } finally {
-      try {
-        connection.close();
-      } catch (IOException ioe) {
-        throw ioe;
+        // still in rit
+        LOG.info("Region still in transition, waiting for "
+            + "it to become assigned: " + region);
+      } catch (IOException e) {
+        LOG.warn("Exception when waiting for region to become assigned,"
+            + " retrying", e);
       }
+      Thread.sleep(1000);
     }
+    throw new IOException("Region " + region + " failed to move out of " +
+        "transition within timeout " + timeout + "ms");
   }
 
   /**