Search in sources :

Example 1 with MasterRpcServices

use of org.apache.hadoop.hbase.master.MasterRpcServices in project hbase by apache.

the class TestMasterFifoRpcScheduler method testMasterRpcScheduler.

@Test
public void testMasterRpcScheduler() {
    HMaster master = TEST_UTIL.getHBaseCluster().getMaster();
    MasterRpcServices masterRpcServices = master.getMasterRpcServices();
    RpcScheduler masterRpcScheduler = masterRpcServices.getRpcScheduler();
    Assert.assertTrue(masterRpcScheduler instanceof MasterFifoRpcScheduler);
}
Also used : MasterRpcServices(org.apache.hadoop.hbase.master.MasterRpcServices) HMaster(org.apache.hadoop.hbase.master.HMaster) Test(org.junit.Test)

Example 2 with MasterRpcServices

use of org.apache.hadoop.hbase.master.MasterRpcServices in project hbase by apache.

the class TestSimpleRegionNormalizer method setupMocksForNormalizer.

protected void setupMocksForNormalizer(Map<byte[], Integer> regionSizes, List<HRegionInfo> hris) {
    masterServices = Mockito.mock(MasterServices.class, RETURNS_DEEP_STUBS);
    masterRpcServices = Mockito.mock(MasterRpcServices.class, RETURNS_DEEP_STUBS);
    // for simplicity all regions are assumed to be on one server; doesn't matter to us
    ServerName sn = ServerName.valueOf("localhost", 0, 1L);
    when(masterServices.getAssignmentManager().getRegionStates().getRegionsOfTable(any(TableName.class))).thenReturn(hris);
    when(masterServices.getAssignmentManager().getRegionStates().getRegionServerOfRegion(any(HRegionInfo.class))).thenReturn(sn);
    for (Map.Entry<byte[], Integer> region : regionSizes.entrySet()) {
        RegionLoad regionLoad = Mockito.mock(RegionLoad.class);
        when(regionLoad.getName()).thenReturn(region.getKey());
        when(regionLoad.getStorefileSizeMB()).thenReturn(region.getValue());
        when(masterServices.getServerManager().getLoad(sn).getRegionsLoad().get(region.getKey())).thenReturn(regionLoad);
    }
    try {
        when(masterRpcServices.isSplitOrMergeEnabled(any(RpcController.class), any(IsSplitOrMergeEnabledRequest.class))).thenReturn(IsSplitOrMergeEnabledResponse.newBuilder().setEnabled(true).build());
    } catch (ServiceException se) {
        LOG.debug("error setting isSplitOrMergeEnabled switch", se);
    }
    normalizer.setMasterServices(masterServices);
    normalizer.setMasterRpcServices(masterRpcServices);
}
Also used : HRegionInfo(org.apache.hadoop.hbase.HRegionInfo) RpcController(org.apache.hadoop.hbase.shaded.com.google.protobuf.RpcController) TableName(org.apache.hadoop.hbase.TableName) MasterRpcServices(org.apache.hadoop.hbase.master.MasterRpcServices) RegionLoad(org.apache.hadoop.hbase.RegionLoad) IsSplitOrMergeEnabledRequest(org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProtos.IsSplitOrMergeEnabledRequest) ServiceException(org.apache.hadoop.hbase.shaded.com.google.protobuf.ServiceException) ServerName(org.apache.hadoop.hbase.ServerName) MasterServices(org.apache.hadoop.hbase.master.MasterServices) HashMap(java.util.HashMap) Map(java.util.Map)

Aggregations

MasterRpcServices (org.apache.hadoop.hbase.master.MasterRpcServices)2 HashMap (java.util.HashMap)1 Map (java.util.Map)1 HRegionInfo (org.apache.hadoop.hbase.HRegionInfo)1 RegionLoad (org.apache.hadoop.hbase.RegionLoad)1 ServerName (org.apache.hadoop.hbase.ServerName)1 TableName (org.apache.hadoop.hbase.TableName)1 HMaster (org.apache.hadoop.hbase.master.HMaster)1 MasterServices (org.apache.hadoop.hbase.master.MasterServices)1 RpcController (org.apache.hadoop.hbase.shaded.com.google.protobuf.RpcController)1 ServiceException (org.apache.hadoop.hbase.shaded.com.google.protobuf.ServiceException)1 IsSplitOrMergeEnabledRequest (org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProtos.IsSplitOrMergeEnabledRequest)1 Test (org.junit.Test)1