hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From te...@apache.org
Subject svn commit: r1457934 - in /hbase/branches/0.95/hbase-server/src/main/java/org/apache/hadoop/hbase/master: DeadServer.java ServerManager.java handler/MetaServerShutdownHandler.java
Date Mon, 18 Mar 2013 19:38:19 GMT
Author: tedyu
Date: Mon Mar 18 19:38:18 2013
New Revision: 1457934

URL: http://svn.apache.org/r1457934
Log:
HBASE-8097 MetaServerShutdownHandler may potentially keep bumping up DeadServer.numProcessing
(Jeffrey Zhong)


Modified:
    hbase/branches/0.95/hbase-server/src/main/java/org/apache/hadoop/hbase/master/DeadServer.java
    hbase/branches/0.95/hbase-server/src/main/java/org/apache/hadoop/hbase/master/ServerManager.java
    hbase/branches/0.95/hbase-server/src/main/java/org/apache/hadoop/hbase/master/handler/MetaServerShutdownHandler.java

Modified: hbase/branches/0.95/hbase-server/src/main/java/org/apache/hadoop/hbase/master/DeadServer.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.95/hbase-server/src/main/java/org/apache/hadoop/hbase/master/DeadServer.java?rev=1457934&r1=1457933&r2=1457934&view=diff
==============================================================================
--- hbase/branches/0.95/hbase-server/src/main/java/org/apache/hadoop/hbase/master/DeadServer.java
(original)
+++ hbase/branches/0.95/hbase-server/src/main/java/org/apache/hadoop/hbase/master/DeadServer.java
Mon Mar 18 19:38:18 2013
@@ -98,9 +98,15 @@ public class DeadServer {
     return clone;
   }
 
-  public synchronized boolean add(ServerName e) {
+  /**
+   * Adds the server to the dead server list if it's not there already.
+   * @param sn the server name
+   */
+  public synchronized void add(ServerName sn) {
     this.numProcessing++;
-    return deadServers.put(e, EnvironmentEdgeManager.currentTimeMillis()) != null;
+    if (!deadServers.containsKey(sn)){
+      deadServers.put(sn, EnvironmentEdgeManager.currentTimeMillis());
+    }
   }
 
   @SuppressWarnings("UnusedParameters")

Modified: hbase/branches/0.95/hbase-server/src/main/java/org/apache/hadoop/hbase/master/ServerManager.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.95/hbase-server/src/main/java/org/apache/hadoop/hbase/master/ServerManager.java?rev=1457934&r1=1457933&r2=1457934&view=diff
==============================================================================
--- hbase/branches/0.95/hbase-server/src/main/java/org/apache/hadoop/hbase/master/ServerManager.java
(original)
+++ hbase/branches/0.95/hbase-server/src/main/java/org/apache/hadoop/hbase/master/ServerManager.java
Mon Mar 18 19:38:18 2013
@@ -487,7 +487,7 @@ public class ServerManager {
     boolean carryingMeta = services.getAssignmentManager().isCarryingMeta(serverName);
     if (carryingMeta) {
       this.services.getExecutorService().submit(new MetaServerShutdownHandler(this.master,
-        this.services, this.deadservers, serverName, carryingMeta));
+        this.services, this.deadservers, serverName));
     } else {
       this.services.getExecutorService().submit(new ServerShutdownHandler(this.master,
         this.services, this.deadservers, serverName, true));

Modified: hbase/branches/0.95/hbase-server/src/main/java/org/apache/hadoop/hbase/master/handler/MetaServerShutdownHandler.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.95/hbase-server/src/main/java/org/apache/hadoop/hbase/master/handler/MetaServerShutdownHandler.java?rev=1457934&r1=1457933&r2=1457934&view=diff
==============================================================================
--- hbase/branches/0.95/hbase-server/src/main/java/org/apache/hadoop/hbase/master/handler/MetaServerShutdownHandler.java
(original)
+++ hbase/branches/0.95/hbase-server/src/main/java/org/apache/hadoop/hbase/master/handler/MetaServerShutdownHandler.java
Mon Mar 18 19:38:18 2013
@@ -32,49 +32,51 @@ import org.apache.hadoop.hbase.master.Ma
 import org.apache.zookeeper.KeeperException;
 
 /**
- * Shutdown handler for the server hosting <code>-ROOT-</code>,
- * <code>.META.</code>, or both.
+ * Shutdown handler for the server hosting <code>.META.</code>
  */
 @InterfaceAudience.Private
 public class MetaServerShutdownHandler extends ServerShutdownHandler {
-  private final boolean carryingMeta;
   private static final Log LOG = LogFactory.getLog(MetaServerShutdownHandler.class);
   public MetaServerShutdownHandler(final Server server,
       final MasterServices services,
-      final DeadServer deadServers, final ServerName serverName,
-      final boolean carryingMeta) {
+      final DeadServer deadServers, final ServerName serverName) {
     super(server, services, deadServers, serverName,
       EventType.M_META_SERVER_SHUTDOWN, true);
-    this.carryingMeta = carryingMeta;
   }
 
   @Override
   public void process() throws IOException {
-    try {
-      LOG.info("Splitting META logs for " + serverName);
-      if (this.shouldSplitHlog) {
-        this.services.getMasterFileSystem().splitMetaLog(serverName);
+    boolean gotException = true; 
+    try{
+      try {
+        LOG.info("Splitting META logs for " + serverName);
+        if (this.shouldSplitHlog) {
+          this.services.getMasterFileSystem().splitMetaLog(serverName);
+        }
+      } catch (IOException ioe) {
+        this.services.getExecutorService().submit(this);
+        this.deadServers.add(serverName);
+        throw new IOException("failed log splitting for " +
+            serverName + ", will retry", ioe);
       }
-    } catch (IOException ioe) {
-      this.services.getExecutorService().submit(this);
-      this.deadServers.add(serverName);
-      throw new IOException("failed log splitting for " +
-          serverName + ", will retry", ioe);
-    }
-
-    // Assign root and meta if we were carrying them.
-    if (isCarryingMeta()) { // .META.
+  
+      // Assign meta if we were carrying it.
       // Check again: region may be assigned to other where because of RIT
       // timeout
       if (this.services.getAssignmentManager().isCarryingMeta(serverName)) {
-        LOG.info("Server " + serverName
-            + " was carrying META. Trying to assign.");
-        this.services.getAssignmentManager().regionOffline(
-            HRegionInfo.FIRST_META_REGIONINFO);
+        LOG.info("Server " + serverName + " was carrying META. Trying to assign.");
+        this.services.getAssignmentManager().regionOffline(HRegionInfo.FIRST_META_REGIONINFO);
         verifyAndAssignMetaWithRetries();
       } else {
         LOG.info("META has been assigned to otherwhere, skip assigning.");
       }
+      
+      gotException = false;
+    } finally {
+      if (gotException){
+        // If we had an exception, this.deadServers.finish will be skipped in super.process()
+        this.deadServers.finish(serverName);
+      }     
     }
     super.process();
   }
@@ -97,10 +99,10 @@ public class MetaServerShutdownHandler e
     if (!this.server.getCatalogTracker().verifyMetaRegionLocation(timeout)) {
       this.services.getAssignmentManager().assignMeta();
     } else if (serverName.equals(server.getCatalogTracker().getMetaLocation())) {
-      throw new IOException("-ROOT- is onlined on the dead server "
+      throw new IOException(".META. is onlined on the dead server "
           + serverName);
     } else {
-      LOG.info("Skip assigning -ROOT-, because it is online on the "
+      LOG.info("Skip assigning .META., because it is online on the "
           + server.getCatalogTracker().getMetaLocation());
     }
   }
@@ -142,10 +144,6 @@ public class MetaServerShutdownHandler e
     }
   }
 
-  boolean isCarryingMeta() {
-    return this.carryingMeta;
-  }
-  
   @Override
   public String toString() {
     String name = "UnknownServerName";



Mime
View raw message