hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From li...@apache.org
Subject svn commit: r1505599 - /hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/master/ServerManager.java
Date Mon, 22 Jul 2013 04:59:33 GMT
Author: liyin
Date: Mon Jul 22 04:59:33 2013
New Revision: 1505599

URL: http://svn.apache.org/r1505599
Log:
[0.89-fb] [master] Ensure that the master does not resend messages by default

Author: aaiyer

Summary:
To ensure that HBase can handle dropped messages,
we have introduced resends on the master side. This requires
that the region servers be able to handle duplicate messages.

Since we plan to do a rolling restart to deploy the next version,
      we should be able to disable this feature on the master side
      until all the RS are upgraded.

Adding a config option to disable/enable the message resends.

Test Plan:
mr tests.
Push to titanshadow, and initiate the schema change.

Reviewers: shaneh, rshroff, liyintang

Reviewed By: shaneh

CC: hbase-eng@

Differential Revision: https://phabricator.fb.com/D802547

Modified:
    hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/master/ServerManager.java

Modified: hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/master/ServerManager.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/master/ServerManager.java?rev=1505599&r1=1505598&r2=1505599&view=diff
==============================================================================
--- hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/master/ServerManager.java
(original)
+++ hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/master/ServerManager.java
Mon Jul 22 04:59:33 2013
@@ -133,6 +133,8 @@ public class ServerManager {
    */
   final Object deadServerStatusLock = new Object();
 
+  private final boolean resendDroppedMessages;
+
   /**
    * A set of host:port pairs representing regionservers that are blacklisted
    * from region assignment. Used for unit tests only. Please do not use this
@@ -228,6 +230,8 @@ public class ServerManager {
         DEFAULT_BLACKLIST_NODE_EXPIRATION_WINDOW);
     this.blacklistUpdateInterval = c.getLong("hbase.master.blacklist.update.interval",
         DEFAULT_BLACKLIST_UPDATE_WINDOW);
+
+    this.resendDroppedMessages = c.getBoolean("hbase.master.msgs.resend-openclose", false);
   }
 
   /**
@@ -629,32 +633,42 @@ public class ServerManager {
       // Tell the region server to close regions that we have marked for closing.
       for (HRegionInfo i:
         this.master.getRegionManager().getMarkedToClose(serverInfo.getServerName())) {
-        if (closingRegions == null || !closingRegions.contains(i.getEncodedName())) {
-          HMsg msg = new HMsg(HMsg.Type.MSG_REGION_CLOSE, i);
-          LOG.info("HMsg " + msg.toString() + " was lost earlier. Resending to " + serverInfo.getServerName());
-          returnMsgs.add(msg);
+        if (resendDroppedMessages) {
+          if (closingRegions == null || !closingRegions.contains(i.getEncodedName())) {
+            HMsg msg = new HMsg(HMsg.Type.MSG_REGION_CLOSE, i);
+            LOG.info("HMsg " + msg.toString() + " was lost earlier. Resending to " + serverInfo.getServerName());
+            returnMsgs.add(msg);
+          } else {
+            // Transition the region from toClose to closing state
+            this.master.getRegionManager().setPendingClose(i.getRegionNameAsString());
+          }
         } else {
-          // Transition the region from toClose to closing state
-          this.master.getRegionManager().setPendingClose(i.getRegionNameAsString());
+            // old code path for backward compatability during rolling restart.
+            // TODO: Amit: get rid of this after all clusters have been pushed
+            HMsg msg = new HMsg(HMsg.Type.MSG_REGION_CLOSE, i);
+            returnMsgs.add(msg);
+            this.master.getRegionManager().setPendingClose(i.getRegionNameAsString());
         }
       }
 
       // Figure out what the RegionServer ought to do, and write back.
 
-      // 1. Remind the server to open the regions that the RS has not acked for
-      // Normally, the master shouldn't need to do this. But, this may be required
-      // if there was a network Incident, in which the master's message to OPEN a
-      // region was lost.
-      for (HRegionInfo i:
-        this.master.getRegionManager().getRegionsInPendingOpenUnacked(serverInfo.getServerName()))
{
-        if (openingRegions == null || !openingRegions.contains(i.getEncodedName())) {
-          HMsg msg = new HMsg(HMsg.Type.MSG_REGION_OPEN, i);
-          LOG.info("HMsg " + msg.toString() + " was lost earlier. Resending to " + serverInfo.getServerName());
-          returnMsgs.add(msg);
-          openingCount++;
-        } else {
-          LOG.info("Region " + i.getEncodedName() + " is reported to be opening " + serverInfo.getServerName());
-          this.processRegionOpening(i.getRegionNameAsString());
+      if (resendDroppedMessages) {
+        // 1. Remind the server to open the regions that the RS has not acked for
+        // Normally, the master shouldn't need to do this. But, this may be required
+        // if there was a network Incident, in which the master's message to OPEN a
+        // region was lost.
+        for (HRegionInfo i:
+          this.master.getRegionManager().getRegionsInPendingOpenUnacked(serverInfo.getServerName()))
{
+          if (openingRegions == null || !openingRegions.contains(i.getEncodedName())) {
+            HMsg msg = new HMsg(HMsg.Type.MSG_REGION_OPEN, i);
+            LOG.info("HMsg " + msg.toString() + " was lost earlier. Resending to " + serverInfo.getServerName());
+            returnMsgs.add(msg);
+            openingCount++;
+          } else {
+            LOG.info("Region " + i.getEncodedName() + " is reported to be opening " + serverInfo.getServerName());
+            this.processRegionOpening(i.getRegionNameAsString());
+          }
         }
       }
 



Mime
View raw message