HBASE-10649 TestMasterMetrics fails occasionally
git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1574738 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
bd18c274ba
commit
78b7dad2c8
|
@ -50,6 +50,7 @@ import java.util.concurrent.locks.ReentrantReadWriteLock;
|
|||
|
||||
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;
|
||||
|
@ -1046,7 +1047,8 @@ public class HRegionServer implements ClientProtos.ClientService.BlockingInterfa
|
|||
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.
|
||||
|
|
|
@ -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.HBaseTestingUtility;
|
|||
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();
|
||||
|
|
Loading…
Reference in New Issue