hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From st...@apache.org
Subject svn commit: r634791 - in /hadoop/hbase: branches/0.1/ branches/0.1/src/java/org/apache/hadoop/hbase/ trunk/ trunk/src/java/org/apache/hadoop/hbase/master/
Date Fri, 07 Mar 2008 19:55:27 GMT
Author: stack
Date: Fri Mar  7 11:55:26 2008
New Revision: 634791

URL: http://svn.apache.org/viewvc?rev=634791&view=rev
Log:
HBASE-495 No server address listed in .META.

Modified:
    hadoop/hbase/branches/0.1/CHANGES.txt
    hadoop/hbase/branches/0.1/src/java/org/apache/hadoop/hbase/HMaster.java
    hadoop/hbase/trunk/CHANGES.txt
    hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/master/ProcessServerShutdown.java
    hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/master/ServerManager.java

Modified: hadoop/hbase/branches/0.1/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/hbase/branches/0.1/CHANGES.txt?rev=634791&r1=634790&r2=634791&view=diff
==============================================================================
--- hadoop/hbase/branches/0.1/CHANGES.txt (original)
+++ hadoop/hbase/branches/0.1/CHANGES.txt Fri Mar  7 11:55:26 2008
@@ -35,6 +35,7 @@
    HBASE-472   Passing on edits, we dump all to log
    HBASE-79    When HBase needs to be migrated, it should display a message on
                stdout, not just in the logs
+   HBASE-495   No server address listed in .META.
 
   IMPROVEMENTS
    HADOOP-2555 Refactor the HTable#get and HTable#getRow methods to avoid

Modified: hadoop/hbase/branches/0.1/src/java/org/apache/hadoop/hbase/HMaster.java
URL: http://svn.apache.org/viewvc/hadoop/hbase/branches/0.1/src/java/org/apache/hadoop/hbase/HMaster.java?rev=634791&r1=634790&r2=634791&view=diff
==============================================================================
--- hadoop/hbase/branches/0.1/src/java/org/apache/hadoop/hbase/HMaster.java (original)
+++ hadoop/hbase/branches/0.1/src/java/org/apache/hadoop/hbase/HMaster.java Fri Mar  7 11:55:26
2008
@@ -1263,55 +1263,72 @@
    * HMasterRegionInterface
    */
 
-  /** {@inheritDoc} */
   @SuppressWarnings("unused")
   public HbaseMapWritable regionServerStartup(HServerInfo serverInfo)
-    throws IOException {
+  throws IOException {
 
     String s = serverInfo.getServerAddress().toString().trim();
     LOG.info("received start message from: " + s);
-
-    HServerLoad load = serversToLoad.remove(s);
+    // Do the lease check up here. There might already be one out on this
+    // server expecially if it just shutdown and came back up near-immediately
+    // after.
+    long serverLabel = -1;
+    if (!closed.get()) {
+      serverLabel = getServerLabel(s);
+      this.serverLeases.createLease(serverLabel, serverLabel,
+        new ServerExpirer(s));
+    }
+    // Now, in below, if an exception, clear the lease we just setup.
+    try {
+      registerRegionServer(s, serverInfo);
+      return createConfigurationSubset();
+    } finally {
+      if (serverLabel != -1) {
+        this.serverLeases.cancelLease(serverLabel, serverLabel);
+      }
+    }
+  }
+  
+  /* Register the newly reporting regionserver with out local data structures
+   * that keep up load, server address to server info, etc.
+   * @param serverAddress
+   * @param serverInfo
+   */
+  private void registerRegionServer(final String serverAddress,
+      final HServerInfo serverInfo) {
+    HServerLoad load = serversToLoad.remove(serverAddress);
     if (load != null) {
       // The startup message was from a known server.
       // Remove stale information about the server's load.
       Set<String> servers = loadToServers.get(load);
       if (servers != null) {
-        servers.remove(s);
+        servers.remove(serverAddress);
         loadToServers.put(load, servers);
       }
     }
 
-    HServerInfo storedInfo = serversToServerInfo.remove(s);
+    HServerInfo storedInfo = serversToServerInfo.remove(serverAddress);
     if (storedInfo != null && !closed.get()) {
       // The startup message was from a known server with the same name.
       // Timeout the old one right away.
-      HServerAddress root = rootRegionLocation.get();
+      HServerAddress root = this.rootRegionLocation.get();
       if (root != null && root.equals(storedInfo.getServerAddress())) {
         unassignRootRegion();
       }
-      delayedToDoQueue.put(new ProcessServerShutdown(storedInfo));
+      this.delayedToDoQueue.put(new ProcessServerShutdown(storedInfo));
     }
 
-    // record new server
-
+    // Record new server
     load = new HServerLoad();
     serverInfo.setLoad(load);
-    serversToServerInfo.put(s, serverInfo);
-    serversToLoad.put(s, load);
+    this.serversToServerInfo.put(serverAddress, serverInfo);
+    this.serversToLoad.put(serverAddress, load);
     Set<String> servers = loadToServers.get(load);
     if (servers == null) {
       servers = new HashSet<String>();
     }
-    servers.add(s);
-    loadToServers.put(load, servers);
-
-    if (!closed.get()) {
-      long serverLabel = getServerLabel(s);
-      serverLeases.createLease(serverLabel, serverLabel, new ServerExpirer(s));
-    }
-    
-    return createConfigurationSubset();
+    servers.add(serverAddress);
+    this.loadToServers.put(load, servers);
   }
   
   /**
@@ -1989,13 +2006,13 @@
       return "ProcessServerShutdown of " + this.deadServer.toString();
     }
 
-    /** Finds regions that the dead region server was serving */
+    /* Finds regions that the dead region server was serving
+     */
     private void scanMetaRegion(HRegionInterface server, long scannerId,
-        Text regionName) throws IOException {
-
+        Text regionName)
+    throws IOException {
       ArrayList<ToDoEntry> toDoList = new ArrayList<ToDoEntry>();
       HashSet<HRegionInfo> regions = new HashSet<HRegionInfo>();
-
       try {
         while (true) {
           HbaseMapWritable values = null;
@@ -2013,9 +2030,6 @@
           RowMap rm = toRowMap(values);
           Text row = rm.getRow();
           SortedMap<Text, byte[]> map = rm.getMap();
-          if (LOG.isDebugEnabled() && row != null) {
-            LOG.debug("shutdown scanner looking at " + row.toString());
-          }
 
           // Check server name.  If null, be conservative and treat as though
           // region had been on shutdown server (could be null because we
@@ -2029,11 +2043,6 @@
           }
           if (serverName.length() > 0 &&
               deadServerName.compareTo(serverName) != 0) {
-            // This isn't the server you're looking for - move along
-            if (LOG.isDebugEnabled()) {
-              LOG.debug("Server name " + serverName + " is not same as " +
-                  deadServerName + ": Passing");
-            }
             continue;
           }
 
@@ -2043,9 +2052,8 @@
             continue;
           }
           LOG.info(info.getRegionName() + " was on shutdown server <" +
-              serverName + "> (or server is null). Marking unassigned in " +
-          "meta and clearing pendingRegions");
-
+            serverName + "> (or server is null -- " + server.toString() +
+            " --). Marking unassigned in meta and clearing pendingRegions");
           if (info.isMetaTable()) {
             if (LOG.isDebugEnabled()) {
               LOG.debug("removing meta region " + info.getRegionName() +

Modified: hadoop/hbase/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/hbase/trunk/CHANGES.txt?rev=634791&r1=634790&r2=634791&view=diff
==============================================================================
--- hadoop/hbase/trunk/CHANGES.txt (original)
+++ hadoop/hbase/trunk/CHANGES.txt Fri Mar  7 11:55:26 2008
@@ -32,6 +32,7 @@
    HBASE-492   hbase TRUNK does not build against hadoop TRUNK
    HBASE-496   impossible state for createLease writes 400k lines in about 15mins
    HBASE-472   Passing on edits, we dump all to log
+   HBASE-495   No server address listed in .META.
    
   IMPROVEMENTS
    HBASE-415   Rewrite leases to use DelayedBlockingQueue instead of polling

Modified: hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/master/ProcessServerShutdown.java
URL: http://svn.apache.org/viewvc/hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/master/ProcessServerShutdown.java?rev=634791&r1=634790&r2=634791&view=diff
==============================================================================
--- hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/master/ProcessServerShutdown.java
(original)
+++ hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/master/ProcessServerShutdown.java
Fri Mar  7 11:55:26 2008
@@ -20,25 +20,23 @@
 package org.apache.hadoop.hbase.master;
 
 import java.io.IOException;
+import java.io.UnsupportedEncodingException;
 import java.util.ArrayList;
 import java.util.HashSet;
-import java.util.HashMap;
-import java.util.SortedMap;
-import java.io.UnsupportedEncodingException;
 import java.util.List;
+import java.util.SortedMap;
 
-import org.apache.hadoop.hbase.HServerAddress;
 import org.apache.hadoop.fs.Path;
-import org.apache.hadoop.hbase.HServerInfo;
 import org.apache.hadoop.hbase.HRegionInfo;
-import org.apache.hadoop.io.Text;
-import org.apache.hadoop.hbase.io.HbaseMapWritable;
+import org.apache.hadoop.hbase.HServerAddress;
+import org.apache.hadoop.hbase.HServerInfo;
 import org.apache.hadoop.hbase.RemoteExceptionHandler;
-import org.apache.hadoop.hbase.util.Writables;
-
+import org.apache.hadoop.hbase.io.HbaseMapWritable;
 import org.apache.hadoop.hbase.ipc.HRegionInterface;
-import org.apache.hadoop.hbase.regionserver.HRegion;
 import org.apache.hadoop.hbase.regionserver.HLog;
+import org.apache.hadoop.hbase.regionserver.HRegion;
+import org.apache.hadoop.hbase.util.Writables;
+import org.apache.hadoop.io.Text;
 
 /** 
  * Instantiated when a server's lease has expired, meaning it has crashed.
@@ -131,10 +129,6 @@
         if (serverName.length() > 0 &&
             deadServerName.compareTo(serverName) != 0) {
           // This isn't the server you're looking for - move along
-          if (LOG.isDebugEnabled()) {
-            LOG.debug("Server name " + serverName + " is not same as " +
-                deadServerName + ": Passing");
-          }
           continue;
         }
 
@@ -143,9 +137,6 @@
         if (info == null) {
           continue;
         }
-        LOG.info(info.getRegionName() + " was on shutdown server <" +
-            serverName + "> (or server is null). Marking unassigned in " +
-        "meta and clearing pendingRegions");
 
         if (info.isMetaTable()) {
           if (LOG.isDebugEnabled()) {

Modified: hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/master/ServerManager.java
URL: http://svn.apache.org/viewvc/hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/master/ServerManager.java?rev=634791&r1=634790&r2=634791&view=diff
==============================================================================
--- hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/master/ServerManager.java (original)
+++ hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/master/ServerManager.java Fri Mar
 7 11:55:26 2008
@@ -80,7 +80,12 @@
   public void regionServerStartup(HServerInfo serverInfo) {
     String s = serverInfo.getServerAddress().toString().trim();
     LOG.info("received start message from: " + s);
-
+    // Do the lease check up here. There might already be one out on this
+    // server expecially if it just shutdown and came back up near-immediately
+    // after.
+    if (!master.closed.get()) {
+      serverLeases.createLease(s, new ServerExpirer(s));
+    }
     HServerLoad load = serversToLoad.remove(s);
     if (load != null) {
       // The startup message was from a known server.
@@ -114,10 +119,6 @@
     }
     servers.add(s);
     loadToServers.put(load, servers);
-
-    if (!master.closed.get()) {
-      serverLeases.createLease(s, new ServerExpirer(s));
-    }
   }
   
   /** {@inheritDoc} */
@@ -672,4 +673,4 @@
   public boolean isDead(String serverName) {
     return deadServers.contains(serverName);
   }
-}
\ No newline at end of file
+}



Mime
View raw message