瀏覽代碼

HADOOP-1723 If master asks region server to shut down, by-pass return of shutdown message

git-svn-id: https://svn.apache.org/repos/asf/lucene/hadoop/trunk@567864 13f79535-47bb-0310-9956-ffa450edef68
Jim Kellerman 18 年之前
父節點
當前提交
f98cf46f57

+ 2 - 0
src/contrib/hbase/CHANGES.txt

@@ -10,6 +10,8 @@ Trunk (unreleased changes)
   OPTIMIZATIONS
   OPTIMIZATIONS
 
 
   BUG FIXES
   BUG FIXES
+    HADOOP-1723 If master asks region server to shut down, by-pass return of
+    shutdown message
     HADOOP-1729 Recent renaming or META tables breaks hbase shell
     HADOOP-1729 Recent renaming or META tables breaks hbase shell
     HADOOP-1730 unexpected null value causes META scanner to exit (silently)
     HADOOP-1730 unexpected null value causes META scanner to exit (silently)
 
 

+ 22 - 12
src/contrib/hbase/src/java/org/apache/hadoop/hbase/HRegionServer.java

@@ -579,7 +579,8 @@ public class HRegionServer implements HConstants, HRegionInterface, Runnable {
         3 * 60 * 1000), threadWakeFrequency);
         3 * 60 * 1000), threadWakeFrequency);
     
     
     // Server
     // Server
-
+    
+    boolean masterRequestedStop = false;
     try {
     try {
       this.server.start();
       this.server.start();
       LOG.info("HRegionServer started at: " +
       LOG.info("HRegionServer started at: " +
@@ -663,6 +664,7 @@ public class HRegionServer implements HConstants, HRegionInterface, Runnable {
                 if (LOG.isDebugEnabled()) {
                 if (LOG.isDebugEnabled()) {
                   LOG.debug("Got regionserver stop message");
                   LOG.debug("Got regionserver stop message");
                 }
                 }
+                masterRequestedStop = true;
                 stopRequested = true;
                 stopRequested = true;
                 break;
                 break;
 
 
@@ -757,18 +759,20 @@ public class HRegionServer implements HConstants, HRegionInterface, Runnable {
         LOG.error("", e);
         LOG.error("", e);
       }
       }
       try {
       try {
-        HMsg[] exitMsg = new HMsg[closedRegions.size() + 1];
-        exitMsg[0] = new HMsg(HMsg.MSG_REPORT_EXITING);
-        // Tell the master what regions we are/were serving
-        int i = 1;
-        for(HRegion region: closedRegions) {
-          exitMsg[i++] = new HMsg(HMsg.MSG_REPORT_CLOSE,
-            region.getRegionInfo());
-        }
+        if (!masterRequestedStop) {
+          HMsg[] exitMsg = new HMsg[closedRegions.size() + 1];
+          exitMsg[0] = new HMsg(HMsg.MSG_REPORT_EXITING);
+          // Tell the master what regions we are/were serving
+          int i = 1;
+          for(HRegion region: closedRegions) {
+            exitMsg[i++] = new HMsg(HMsg.MSG_REPORT_CLOSE,
+                region.getRegionInfo());
+          }
 
 
-        LOG.info("telling master that region server is shutting down at: " +
-          serverInfo.getServerAddress().toString());
-        hbaseMaster.regionServerReport(serverInfo, exitMsg);
+          LOG.info("telling master that region server is shutting down at: " +
+              serverInfo.getServerAddress().toString());
+          hbaseMaster.regionServerReport(serverInfo, exitMsg);
+        }
       } catch (IOException e) {
       } catch (IOException e) {
         if (e instanceof RemoteException) {
         if (e instanceof RemoteException) {
           try {
           try {
@@ -1124,6 +1128,7 @@ public class HRegionServer implements HConstants, HRegionInterface, Runnable {
   }
   }
   
   
   /** {@inheritDoc} */
   /** {@inheritDoc} */
+  @SuppressWarnings("deprecation")
   public long startUpdate(Text regionName, long clientid, Text row) 
   public long startUpdate(Text regionName, long clientid, Text row) 
       throws IOException {
       throws IOException {
     requestCount.incrementAndGet();
     requestCount.incrementAndGet();
@@ -1135,6 +1140,7 @@ public class HRegionServer implements HConstants, HRegionInterface, Runnable {
   }
   }
 
 
   /** {@inheritDoc} */
   /** {@inheritDoc} */
+  @SuppressWarnings("deprecation")
   public void put(final Text regionName, final long clientid,
   public void put(final Text regionName, final long clientid,
       final long lockid, final Text column, final byte [] val)
       final long lockid, final Text column, final byte [] val)
   throws IOException {
   throws IOException {
@@ -1145,6 +1151,7 @@ public class HRegionServer implements HConstants, HRegionInterface, Runnable {
   }
   }
 
 
   /** {@inheritDoc} */
   /** {@inheritDoc} */
+  @SuppressWarnings("deprecation")
   public void delete(Text regionName, long clientid, long lockid, Text column) 
   public void delete(Text regionName, long clientid, long lockid, Text column) 
   throws IOException {
   throws IOException {
     requestCount.incrementAndGet();
     requestCount.incrementAndGet();
@@ -1154,6 +1161,7 @@ public class HRegionServer implements HConstants, HRegionInterface, Runnable {
   }
   }
 
 
   /** {@inheritDoc} */
   /** {@inheritDoc} */
+  @SuppressWarnings("deprecation")
   public void abort(Text regionName, long clientid, long lockid) 
   public void abort(Text regionName, long clientid, long lockid) 
   throws IOException {
   throws IOException {
     requestCount.incrementAndGet();
     requestCount.incrementAndGet();
@@ -1163,6 +1171,7 @@ public class HRegionServer implements HConstants, HRegionInterface, Runnable {
   }
   }
 
 
   /** {@inheritDoc} */
   /** {@inheritDoc} */
+  @SuppressWarnings("deprecation")
   public void commit(Text regionName, final long clientid, final long lockid,
   public void commit(Text regionName, final long clientid, final long lockid,
       final long timestamp) throws IOException {
       final long timestamp) throws IOException {
     requestCount.incrementAndGet();
     requestCount.incrementAndGet();
@@ -1172,6 +1181,7 @@ public class HRegionServer implements HConstants, HRegionInterface, Runnable {
   }
   }
 
 
   /** {@inheritDoc} */
   /** {@inheritDoc} */
+  @SuppressWarnings("deprecation")
   public void renewLease(long lockid, long clientid) throws IOException {
   public void renewLease(long lockid, long clientid) throws IOException {
     requestCount.incrementAndGet();
     requestCount.incrementAndGet();
     leases.renewLease(clientid, lockid);
     leases.renewLease(clientid, lockid);

+ 2 - 2
src/contrib/hbase/src/test/hbase-site.xml

@@ -60,7 +60,7 @@
   </property>
   </property>
   <property>
   <property>
     <name>hbase.master.lease.period</name>
     <name>hbase.master.lease.period</name>
-    <value>5000</value>
+    <value>6000</value>
     <description>Length of time the master will wait before timing out a region
     <description>Length of time the master will wait before timing out a region
     server lease. Since region servers report in every second (see above), this
     server lease. Since region servers report in every second (see above), this
     value has been reduced so that the master will notice a dead region server
     value has been reduced so that the master will notice a dead region server
@@ -69,7 +69,7 @@
   </property>
   </property>
   <property>
   <property>
     <name>hbase.master.lease.thread.wakefrequency</name>
     <name>hbase.master.lease.thread.wakefrequency</name>
-    <value>2500</value>
+    <value>3000</value>
     <description>The interval between checks for expired region server leases.
     <description>The interval between checks for expired region server leases.
     This value has been reduced due to the other reduced values above so that
     This value has been reduced due to the other reduced values above so that
     the master will notice a dead region server sooner. The default is 15 seconds.
     the master will notice a dead region server sooner. The default is 15 seconds.