hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From st...@apache.org
Subject svn commit: r648321 - in /hadoop/hbase/branches/0.1: CHANGES.txt src/java/org/apache/hadoop/hbase/HRegionServer.java src/java/org/apache/hadoop/hbase/Leases.java
Date Tue, 15 Apr 2008 16:38:20 GMT
Author: stack
Date: Tue Apr 15 09:38:17 2008
New Revision: 648321

URL: http://svn.apache.org/viewvc?rev=648321&view=rev
Log:
HBASE-12 when hbase regionserver restarts, it says "impossible state for createLease()"

Modified:
    hadoop/hbase/branches/0.1/CHANGES.txt
    hadoop/hbase/branches/0.1/src/java/org/apache/hadoop/hbase/HRegionServer.java
    hadoop/hbase/branches/0.1/src/java/org/apache/hadoop/hbase/Leases.java

Modified: hadoop/hbase/branches/0.1/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/hbase/branches/0.1/CHANGES.txt?rev=648321&r1=648320&r2=648321&view=diff
==============================================================================
--- hadoop/hbase/branches/0.1/CHANGES.txt (original)
+++ hadoop/hbase/branches/0.1/CHANGES.txt Tue Apr 15 09:38:17 2008
@@ -8,6 +8,8 @@
                least a subset of HADOOP-1700
    HBASE-573   HBase does not read hadoop-*.xml for dfs configuration after
                moving out hadoop/contrib
+   HBASE-12    when hbase regionserver restarts, it says "impossible state for
+               createLease()"
 
 Release 0.1.1 - 04/11/2008
 

Modified: hadoop/hbase/branches/0.1/src/java/org/apache/hadoop/hbase/HRegionServer.java
URL: http://svn.apache.org/viewvc/hadoop/hbase/branches/0.1/src/java/org/apache/hadoop/hbase/HRegionServer.java?rev=648321&r1=648320&r2=648321&view=diff
==============================================================================
--- hadoop/hbase/branches/0.1/src/java/org/apache/hadoop/hbase/HRegionServer.java (original)
+++ hadoop/hbase/branches/0.1/src/java/org/apache/hadoop/hbase/HRegionServer.java Tue Apr
15 09:38:17 2008
@@ -22,6 +22,7 @@
 import java.io.IOException;
 import java.lang.Thread.UncaughtExceptionHandler;
 import java.lang.reflect.Constructor;
+import java.lang.reflect.Member;
 import java.net.InetSocketAddress;
 import java.net.UnknownHostException;
 import java.util.ArrayList;
@@ -49,6 +50,7 @@
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.dfs.AlreadyBeingCreatedException;
 import org.apache.hadoop.fs.FileSystem;
 import org.apache.hadoop.fs.Path;
 import org.apache.hadoop.hbase.filter.RowFilterInterface;
@@ -1039,11 +1041,17 @@
           LOG.debug("Done telling master we are up");
         }
         break;
-      } catch(IOException e) {
+      } catch (Leases.LeaseStillHeldException e) {
+        LOG.info("Lease " + e.getName() + " already held on master. Check " +
+          "DNS configuration so that all region servers are" +
+          "reporting their true IPs and not 127.0.0.1. Otherwise, this" +
+          "problem should resolve itself after the lease period of " +
+          this.conf.get("hbase.master.lease.period")
+          + " seconds expires over on the master");
+      } catch (IOException e) {
         LOG.warn("error telling master we are up", e);
-        sleeper.sleep(lastMsg);
-        continue;
       }
+      sleeper.sleep(lastMsg);
     }
     return result;
   }

Modified: hadoop/hbase/branches/0.1/src/java/org/apache/hadoop/hbase/Leases.java
URL: http://svn.apache.org/viewvc/hadoop/hbase/branches/0.1/src/java/org/apache/hadoop/hbase/Leases.java?rev=648321&r1=648320&r2=648321&view=diff
==============================================================================
--- hadoop/hbase/branches/0.1/src/java/org/apache/hadoop/hbase/Leases.java (original)
+++ hadoop/hbase/branches/0.1/src/java/org/apache/hadoop/hbase/Leases.java Tue Apr 15 09:38:17
2008
@@ -133,17 +133,18 @@
    * @param holderId id of lease holder
    * @param resourceId id of resource being leased
    * @param listener listener that will process lease expirations
+   * @throws LeaseStillHeldException 
    */
   public void createLease(final long holderId, final long resourceId,
-      final LeaseListener listener) {
+      final LeaseListener listener)
+  throws LeaseStillHeldException {
     LeaseName name = null;
     synchronized(leases) {
       synchronized(sortedLeases) {
         Lease lease = new Lease(holderId, resourceId, listener);
         name = lease.getLeaseName();
         if(leases.get(name) != null) {
-          throw new AssertionError("Impossible state for createLease(): " +
-            "Lease " + name + " is still held.");
+          throw new LeaseStillHeldException(name.toString());
         }
         leases.put(name, lease);
         sortedLeases.add(lease);
@@ -298,6 +299,22 @@
       }
       // Objects are equal
       return 0;
+    }
+  }
+
+  /**
+   * Thrown if we are asked create a lease but lease on passed name already
+   * exists.
+   */
+  public static class LeaseStillHeldException extends IOException {
+    private final String leaseName;
+    
+    public LeaseStillHeldException(final String name) {
+      this.leaseName = name;
+    }
+    
+    public String getName() {
+      return this.leaseName;
     }
   }
   



Mime
View raw message