hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jxi...@apache.org
Subject svn commit: r1574740 - in /hbase/branches/0.98/hbase-server/src: main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java test/java/org/apache/hadoop/hbase/master/TestMasterMetrics.java
Date Thu, 06 Mar 2014 01:29:57 GMT
Author: jxiang
Date: Thu Mar  6 01:29:57 2014
New Revision: 1574740

URL: http://svn.apache.org/r1574740
Log:
HBASE-10649 TestMasterMetrics fails occasionally

Modified:
    hbase/branches/0.98/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java
    hbase/branches/0.98/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestMasterMetrics.java

Modified: hbase/branches/0.98/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.98/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java?rev=1574740&r1=1574739&r2=1574740&view=diff
==============================================================================
--- hbase/branches/0.98/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java
(original)
+++ hbase/branches/0.98/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java
Thu Mar  6 01:29:57 2014
@@ -50,6 +50,7 @@ import java.util.concurrent.locks.Reentr
 
 import javax.management.ObjectName;
 
+import com.google.common.annotations.VisibleForTesting;
 import com.google.protobuf.HBaseZeroCopyByteString;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
@@ -1043,7 +1044,8 @@ public class HRegionServer implements Cl
     return writeCount;
   }
 
-  void tryRegionServerReport(long reportStartTime, long reportEndTime)
+  @VisibleForTesting
+  protected void tryRegionServerReport(long reportStartTime, long reportEndTime)
   throws IOException {
     if (this.rssStub == null) {
       // the current server is stopping.

Modified: hbase/branches/0.98/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestMasterMetrics.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.98/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestMasterMetrics.java?rev=1574740&r1=1574739&r2=1574740&view=diff
==============================================================================
--- hbase/branches/0.98/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestMasterMetrics.java
(original)
+++ hbase/branches/0.98/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestMasterMetrics.java
Thu Mar  6 01:29:57 2014
@@ -17,6 +17,8 @@
  */
 package org.apache.hadoop.hbase.master;
 
+import java.io.IOException;
+
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.hadoop.conf.Configuration;
@@ -25,6 +27,7 @@ import org.apache.hadoop.hbase.HBaseTest
 import org.apache.hadoop.hbase.MediumTests;
 import org.apache.hadoop.hbase.MiniHBaseCluster;
 import org.apache.hadoop.hbase.ServerName;
+import org.apache.hadoop.hbase.MiniHBaseCluster.MiniHBaseClusterRegionServer;
 import org.apache.hadoop.hbase.protobuf.ProtobufUtil;
 import org.apache.hadoop.hbase.protobuf.generated.ClusterStatusProtos;
 import org.apache.hadoop.hbase.protobuf.generated.RegionServerStatusProtos;
@@ -45,15 +48,24 @@ public class TestMasterMetrics {
   private static HMaster master;
   private static HBaseTestingUtility TEST_UTIL;
 
+  private static class MyRegionServer extends MiniHBaseClusterRegionServer {
+    public MyRegionServer(Configuration conf) throws IOException,
+        InterruptedException {
+      super(conf);
+     }
+
+    @Override
+    protected void tryRegionServerReport(
+        long reportStartTime, long reportEndTime) {
+      // do nothing
+    }
+  }
 
   @BeforeClass
   public static void startCluster() throws Exception {
     LOG.info("Starting cluster");
     TEST_UTIL = new HBaseTestingUtility();
-    Configuration conf = TEST_UTIL.getConfiguration();
-    // Prevent region server report any load during the test
-    conf.setInt("hbase.regionserver.msginterval", 3000000);
-    TEST_UTIL.startMiniCluster(1, 1);
+    TEST_UTIL.startMiniCluster(1, 1, 1, null, HMaster.class, MyRegionServer.class);
     cluster = TEST_UTIL.getHBaseCluster();
     LOG.info("Waiting for active/ready master");
     cluster.waitForActiveAndReadyMaster();



Mime
View raw message