Search in sources :

Example 1 with GetMetaRegionLocationsResponse

use of org.apache.hadoop.hbase.shaded.protobuf.generated.RegistryProtos.GetMetaRegionLocationsResponse in project hbase by apache.

the class TestClientMetaServiceRPCs method TestMetaLocations.

/**
 * Verifies that the meta region locations RPC returns consistent results across all masters.
 */
@Test
public void TestMetaLocations() throws Exception {
    HBaseRpcController rpcController = getRpcController();
    List<HRegionLocation> metaLocations = TEST_UTIL.getMiniHBaseCluster().getMaster().getMetaLocations();
    Collections.sort(metaLocations);
    int rpcCount = 0;
    for (JVMClusterUtil.MasterThread masterThread : TEST_UTIL.getMiniHBaseCluster().getMasterThreads()) {
        ClientMetaService.BlockingInterface stub = getMasterStub(masterThread.getMaster().getServerName());
        GetMetaRegionLocationsResponse resp = stub.getMetaRegionLocations(rpcController, GetMetaRegionLocationsRequest.getDefaultInstance());
        List<HRegionLocation> result = new ArrayList<>();
        resp.getMetaLocationsList().forEach(location -> result.add(ProtobufUtil.toRegionLocation(location)));
        Collections.sort(result);
        assertEquals(metaLocations, result);
        rpcCount++;
    }
    assertEquals(MASTER_COUNT, rpcCount);
}
Also used : HBaseRpcController(org.apache.hadoop.hbase.ipc.HBaseRpcController) HRegionLocation(org.apache.hadoop.hbase.HRegionLocation) JVMClusterUtil(org.apache.hadoop.hbase.util.JVMClusterUtil) ClientMetaService(org.apache.hadoop.hbase.shaded.protobuf.generated.RegistryProtos.ClientMetaService) ArrayList(java.util.ArrayList) GetMetaRegionLocationsResponse(org.apache.hadoop.hbase.shaded.protobuf.generated.RegistryProtos.GetMetaRegionLocationsResponse) Test(org.junit.Test)

Aggregations

ArrayList (java.util.ArrayList)1 HRegionLocation (org.apache.hadoop.hbase.HRegionLocation)1 HBaseRpcController (org.apache.hadoop.hbase.ipc.HBaseRpcController)1 ClientMetaService (org.apache.hadoop.hbase.shaded.protobuf.generated.RegistryProtos.ClientMetaService)1 GetMetaRegionLocationsResponse (org.apache.hadoop.hbase.shaded.protobuf.generated.RegistryProtos.GetMetaRegionLocationsResponse)1 JVMClusterUtil (org.apache.hadoop.hbase.util.JVMClusterUtil)1 Test (org.junit.Test)1