• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java GetRegionInfoRequest类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.apache.hadoop.hbase.protobuf.generated.AdminProtos.GetRegionInfoRequest的典型用法代码示例。如果您正苦于以下问题:Java GetRegionInfoRequest类的具体用法?Java GetRegionInfoRequest怎么用?Java GetRegionInfoRequest使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



GetRegionInfoRequest类属于org.apache.hadoop.hbase.protobuf.generated.AdminProtos包,在下文中一共展示了GetRegionInfoRequest类的17个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: getRegionInfo

import org.apache.hadoop.hbase.protobuf.generated.AdminProtos.GetRegionInfoRequest; //导入依赖的package包/类
@Override
@QosPriority(priority=HConstants.ADMIN_QOS)
public GetRegionInfoResponse getRegionInfo(final RpcController controller,
    final GetRegionInfoRequest request) throws ServiceException {
  try {
    checkOpen();
    requestCount.increment();
    Region region = getRegion(request.getRegion());
    HRegionInfo info = region.getRegionInfo();
    GetRegionInfoResponse.Builder builder = GetRegionInfoResponse.newBuilder();
    builder.setRegionInfo(HRegionInfo.convert(info));
    if (request.hasCompactionState() && request.getCompactionState()) {
      builder.setCompactionState(region.getCompactionState());
    }
    builder.setIsRecovering(region.isRecovering());
    return builder.build();
  } catch (IOException ie) {
    throw new ServiceException(ie);
  }
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:21,代码来源:RSRpcServices.java


示例2: testVerifyMetaRegionLocationFails

import org.apache.hadoop.hbase.protobuf.generated.AdminProtos.GetRegionInfoRequest; //导入依赖的package包/类
/**
 * Test get of meta region fails properly if nothing to connect to.
 * @throws IOException
 * @throws InterruptedException
 * @throws KeeperException
 * @throws ServiceException
 */
@Test
public void testVerifyMetaRegionLocationFails()
throws IOException, InterruptedException, KeeperException, ServiceException {
  ClusterConnection connection = Mockito.mock(ClusterConnection.class);
  ServiceException connectException =
    new ServiceException(new ConnectException("Connection refused"));
  final AdminProtos.AdminService.BlockingInterface implementation =
    Mockito.mock(AdminProtos.AdminService.BlockingInterface.class);
  Mockito.when(implementation.getRegionInfo((RpcController)Mockito.any(),
    (GetRegionInfoRequest)Mockito.any())).thenThrow(connectException);
  Mockito.when(connection.getAdmin(Mockito.any(ServerName.class))).
    thenReturn(implementation);
      RpcControllerFactory controllerFactory = Mockito.mock(RpcControllerFactory.class);
      Mockito.when(controllerFactory.newController()).thenReturn(
        Mockito.mock(PayloadCarryingRpcController.class));
      Mockito.when(connection.getRpcControllerFactory()).thenReturn(controllerFactory);

  ServerName sn = ServerName.valueOf("example.com", 1234, System.currentTimeMillis());
  MetaTableLocator.setMetaLocation(this.watcher,
          sn,
          RegionState.State.OPENING);
  assertFalse(new MetaTableLocator().verifyMetaRegionLocation(connection, watcher, 100));
  MetaTableLocator.setMetaLocation(this.watcher, sn, RegionState.State.OPEN);
  assertFalse(new MetaTableLocator().verifyMetaRegionLocation(connection, watcher, 100));
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:33,代码来源:TestMetaTableLocator.java


示例3: getCompactionStateForRegion

import org.apache.hadoop.hbase.protobuf.generated.AdminProtos.GetRegionInfoRequest; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
public CompactionState getCompactionStateForRegion(final byte[] regionName)
throws IOException {
  try {
    Pair<HRegionInfo, ServerName> regionServerPair = getRegion(regionName);
    if (regionServerPair == null) {
      throw new IllegalArgumentException("Invalid region: " + Bytes.toStringBinary(regionName));
    }
    if (regionServerPair.getSecond() == null) {
      throw new NoServerForRegionException(Bytes.toStringBinary(regionName));
    }
    ServerName sn = regionServerPair.getSecond();
    AdminService.BlockingInterface admin = this.connection.getAdmin(sn);
    GetRegionInfoRequest request = RequestConverter.buildGetRegionInfoRequest(
      regionServerPair.getFirst().getRegionName(), true);
    PayloadCarryingRpcController controller = rpcControllerFactory.newController();
    // TODO: this does not do retries, it should. Set priority and timeout in controller
    GetRegionInfoResponse response = admin.getRegionInfo(controller, request);
    return response.getCompactionState();
  } catch (ServiceException se) {
    throw ProtobufUtil.getRemoteException(se);
  }
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:27,代码来源:HBaseAdmin.java


示例4: getRegionInfo

import org.apache.hadoop.hbase.protobuf.generated.AdminProtos.GetRegionInfoRequest; //导入依赖的package包/类
@Override
@QosPriority(priority = HConstants.ADMIN_QOS)
public GetRegionInfoResponse getRegionInfo(final RpcController controller,
                                           final GetRegionInfoRequest request) throws ServiceException {
    try {
        checkOpen();
        requestCount.increment();
        HRegion region = getRegion(request.getRegion());
        HRegionInfo info = region.getRegionInfo();
        GetRegionInfoResponse.Builder builder = GetRegionInfoResponse.newBuilder();
        builder.setRegionInfo(HRegionInfo.convert(info));
        if (request.hasCompactionState() && request.getCompactionState()) {
            builder.setCompactionState(region.getCompactionState());
        }
        builder.setIsRecovering(region.isRecovering());
        return builder.build();
    } catch (IOException ie) {
        throw new ServiceException(ie);
    }
}
 
开发者ID:grokcoder,项目名称:pbase,代码行数:21,代码来源:RSRpcServices.java


示例5: testVerifyMetaRegionLocationFails

import org.apache.hadoop.hbase.protobuf.generated.AdminProtos.GetRegionInfoRequest; //导入依赖的package包/类
/**
 * Test get of meta region fails properly if nothing to connect to.
 * @throws IOException
 * @throws InterruptedException
 * @throws KeeperException
 * @throws ServiceException
 */
@Test
public void testVerifyMetaRegionLocationFails()
throws IOException, InterruptedException, KeeperException, ServiceException {
  ClusterConnection connection = Mockito.mock(ClusterConnection.class);
  ServiceException connectException =
    new ServiceException(new ConnectException("Connection refused"));
  final AdminProtos.AdminService.BlockingInterface implementation =
    Mockito.mock(AdminProtos.AdminService.BlockingInterface.class);
  Mockito.when(implementation.getRegionInfo((RpcController)Mockito.any(),
    (GetRegionInfoRequest)Mockito.any())).thenThrow(connectException);
  Mockito.when(connection.getAdmin(Mockito.any(ServerName.class))).
    thenReturn(implementation);

  ServerName sn = ServerName.valueOf("example.com", 1234, System.currentTimeMillis());
  MetaTableLocator.setMetaLocation(this.watcher,
          sn,
          RegionState.State.OPENING);
  assertFalse(new MetaTableLocator().verifyMetaRegionLocation(connection, watcher, 100));
  MetaTableLocator.setMetaLocation(this.watcher, sn, RegionState.State.OPEN);
  assertFalse(new MetaTableLocator().verifyMetaRegionLocation(connection, watcher, 100));
}
 
开发者ID:grokcoder,项目名称:pbase,代码行数:29,代码来源:TestMetaTableLocator.java


示例6: getCompactionStateForRegion

import org.apache.hadoop.hbase.protobuf.generated.AdminProtos.GetRegionInfoRequest; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
public CompactionState getCompactionStateForRegion(final byte[] regionName)
throws IOException {
  try {
    Pair<HRegionInfo, ServerName> regionServerPair = getRegion(regionName);
    if (regionServerPair == null) {
      throw new IllegalArgumentException("Invalid region: " + Bytes.toStringBinary(regionName));
    }
    if (regionServerPair.getSecond() == null) {
      throw new NoServerForRegionException(Bytes.toStringBinary(regionName));
    }
    ServerName sn = regionServerPair.getSecond();
    AdminService.BlockingInterface admin = this.connection.getAdmin(sn);
    GetRegionInfoRequest request = RequestConverter.buildGetRegionInfoRequest(
      regionServerPair.getFirst().getRegionName(), true);
    GetRegionInfoResponse response = admin.getRegionInfo(null, request);
    return response.getCompactionState();
  } catch (ServiceException se) {
    throw ProtobufUtil.getRemoteException(se);
  }
}
 
开发者ID:grokcoder,项目名称:pbase,代码行数:25,代码来源:HBaseAdmin.java


示例7: getRegionInfo

import org.apache.hadoop.hbase.protobuf.generated.AdminProtos.GetRegionInfoRequest; //导入依赖的package包/类
@Override
@QosPriority(priority=HConstants.HIGH_QOS)
public GetRegionInfoResponse getRegionInfo(final RpcController controller,
    final GetRegionInfoRequest request) throws ServiceException {
  try {
    checkOpen();
    requestCount.increment();
    HRegion region = getRegion(request.getRegion());
    HRegionInfo info = region.getRegionInfo();
    GetRegionInfoResponse.Builder builder = GetRegionInfoResponse.newBuilder();
    builder.setRegionInfo(HRegionInfo.convert(info));
    if (request.hasCompactionState() && request.getCompactionState()) {
      builder.setCompactionState(region.getCompactionState());
    }
    builder.setIsRecovering(region.isRecovering());
    return builder.build();
  } catch (IOException ie) {
    throw new ServiceException(ie);
  }
}
 
开发者ID:tenggyut,项目名称:HIndex,代码行数:21,代码来源:HRegionServer.java


示例8: testVerifyMetaRegionLocationFails

import org.apache.hadoop.hbase.protobuf.generated.AdminProtos.GetRegionInfoRequest; //导入依赖的package包/类
/**
 * Test get of meta region fails properly if nothing to connect to.
 * @throws IOException
 * @throws InterruptedException
 * @throws KeeperException
 * @throws ServiceException
 */
@Test
public void testVerifyMetaRegionLocationFails()
throws IOException, InterruptedException, KeeperException, ServiceException {
  HConnection connection = Mockito.mock(HConnection.class);
  ServiceException connectException =
    new ServiceException(new ConnectException("Connection refused"));
  final AdminProtos.AdminService.BlockingInterface implementation =
    Mockito.mock(AdminProtos.AdminService.BlockingInterface.class);
  Mockito.when(implementation.getRegionInfo((RpcController)Mockito.any(),
    (GetRegionInfoRequest)Mockito.any())).thenThrow(connectException);
  Mockito.when(connection.getAdmin(Mockito.any(ServerName.class), Mockito.anyBoolean())).
    thenReturn(implementation);
  final CatalogTracker ct = constructAndStartCatalogTracker(connection);

  MetaRegionTracker.setMetaLocation(this.watcher,
      ServerName.valueOf("example.com", 1234, System.currentTimeMillis()));
  Assert.assertFalse(ct.verifyMetaRegionLocation(100));
}
 
开发者ID:tenggyut,项目名称:HIndex,代码行数:26,代码来源:TestCatalogTracker.java


示例9: getRegionInfo

import org.apache.hadoop.hbase.protobuf.generated.AdminProtos.GetRegionInfoRequest; //导入依赖的package包/类
@Override
@QosPriority(priority=HConstants.HIGH_QOS)
public GetRegionInfoResponse getRegionInfo(final RpcController controller,
    final GetRegionInfoRequest request) throws ServiceException {
  try {
    checkOpen();
    requestCount.increment();
    HRegion region = getRegion(request.getRegion());
    HRegionInfo info = region.getRegionInfo();
    GetRegionInfoResponse.Builder builder = GetRegionInfoResponse.newBuilder();
    builder.setRegionInfo(HRegionInfo.convert(info));
    if (request.hasCompactionState() && request.getCompactionState()) {
      builder.setCompactionState(
        CompactionRequest.getCompactionState(info.getRegionId()));
    }
    return builder.build();
  } catch (IOException ie) {
    throw new ServiceException(ie);
  }
}
 
开发者ID:daidong,项目名称:DominoHBase,代码行数:21,代码来源:HRegionServer.java


示例10: testVerifyRootRegionLocationFails

import org.apache.hadoop.hbase.protobuf.generated.AdminProtos.GetRegionInfoRequest; //导入依赖的package包/类
/**
 * Test get of root region fails properly if nothing to connect to.
 * @throws IOException
 * @throws InterruptedException
 * @throws KeeperException
 * @throws ServiceException
 */
@Test
public void testVerifyRootRegionLocationFails()
throws IOException, InterruptedException, KeeperException, ServiceException {
  HConnection connection = Mockito.mock(HConnection.class);
  ServiceException connectException =
    new ServiceException(new ConnectException("Connection refused"));
  final AdminProtocol implementation =
    Mockito.mock(AdminProtocol.class);
  Mockito.when(implementation.getRegionInfo((RpcController)Mockito.any(),
    (GetRegionInfoRequest)Mockito.any())).thenThrow(connectException);
  Mockito.when(connection.getAdmin(Mockito.anyString(),
    Mockito.anyInt(), Mockito.anyBoolean())).
    thenReturn(implementation);
  final CatalogTracker ct = constructAndStartCatalogTracker(connection);
  try {
    RootRegionTracker.setRootLocation(this.watcher,
      new ServerName("example.com", 1234, System.currentTimeMillis()));
    Assert.assertFalse(ct.verifyRootRegionLocation(100));
  } finally {
    // Clean out root location or later tests will be confused... they presume
    // start fresh in zk.
    RootRegionTracker.deleteRootLocation(this.watcher);
  }
}
 
开发者ID:daidong,项目名称:DominoHBase,代码行数:32,代码来源:TestCatalogTracker.java


示例11: getRegionInfo

import org.apache.hadoop.hbase.protobuf.generated.AdminProtos.GetRegionInfoRequest; //导入依赖的package包/类
@Override
public GetRegionInfoResponse getRegionInfo(RpcController controller,
    GetRegionInfoRequest request) throws ServiceException {
  GetRegionInfoResponse.Builder builder = GetRegionInfoResponse.newBuilder();
  builder.setRegionInfo(HRegionInfo.convert(HRegionInfo.FIRST_META_REGIONINFO));
  return builder.build();
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:8,代码来源:MockRegionServer.java


示例12: buildGetRegionInfoRequest

import org.apache.hadoop.hbase.protobuf.generated.AdminProtos.GetRegionInfoRequest; //导入依赖的package包/类
/**
 * Create a protocol buffer GetRegionInfoRequest for a given region name
 *
 * @param regionName the name of the region to get info
 * @param includeCompactionState indicate if the compaction state is requested
 * @return a protocol buffer GetRegionInfoRequest
 */
public static GetRegionInfoRequest
    buildGetRegionInfoRequest(final byte[] regionName,
      final boolean includeCompactionState) {
  GetRegionInfoRequest.Builder builder = GetRegionInfoRequest.newBuilder();
  RegionSpecifier region = buildRegionSpecifier(
    RegionSpecifierType.REGION_NAME, regionName);
  builder.setRegion(region);
  if (includeCompactionState) {
    builder.setCompactionState(includeCompactionState);
  }
  return builder.build();
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:20,代码来源:RequestConverter.java


示例13: getRegionInfo

import org.apache.hadoop.hbase.protobuf.generated.AdminProtos.GetRegionInfoRequest; //导入依赖的package包/类
/**
 * A helper to retrieve region info given a region name
 * using admin protocol.
 *
 * @param admin
 * @param regionName
 * @return the retrieved region info
 * @throws IOException
 */
public static HRegionInfo getRegionInfo(final RpcController controller,
    final AdminService.BlockingInterface admin, final byte[] regionName) throws IOException {
  try {
    GetRegionInfoRequest request =
      RequestConverter.buildGetRegionInfoRequest(regionName);
    GetRegionInfoResponse response =
      admin.getRegionInfo(controller, request);
    return HRegionInfo.convert(response.getRegionInfo());
  } catch (ServiceException se) {
    throw getRemoteException(se);
  }
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:22,代码来源:ProtobufUtil.java


示例14: getRegionInfo

import org.apache.hadoop.hbase.protobuf.generated.AdminProtos.GetRegionInfoRequest; //导入依赖的package包/类
/**
 * A helper to retrieve region info given a region name
 * using admin protocol.
 *
 * @param admin
 * @param regionName
 * @return the retrieved region info
 * @throws IOException
 */
public static HRegionInfo getRegionInfo(final AdminService.BlockingInterface admin,
    final byte[] regionName) throws IOException {
  try {
    GetRegionInfoRequest request =
      RequestConverter.buildGetRegionInfoRequest(regionName);
    GetRegionInfoResponse response =
      admin.getRegionInfo(null, request);
    return HRegionInfo.convert(response.getRegionInfo());
  } catch (ServiceException se) {
    throw getRemoteException(se);
  }
}
 
开发者ID:grokcoder,项目名称:pbase,代码行数:22,代码来源:ProtobufUtil.java


示例15: getRegionInfo

import org.apache.hadoop.hbase.protobuf.generated.AdminProtos.GetRegionInfoRequest; //导入依赖的package包/类
/**
 * A helper to retrieve region info given a region name
 * using admin protocol.
 *
 * @param admin
 * @param regionName
 * @return the retrieved region info
 * @throws IOException
 */
public static HRegionInfo getRegionInfo(final AdminProtocol admin,
    final byte[] regionName) throws IOException {
  try {
    GetRegionInfoRequest request =
      RequestConverter.buildGetRegionInfoRequest(regionName);
    GetRegionInfoResponse response =
      admin.getRegionInfo(null, request);
    return HRegionInfo.convert(response.getRegionInfo());
  } catch (ServiceException se) {
    throw getRemoteException(se);
  }
}
 
开发者ID:daidong,项目名称:DominoHBase,代码行数:22,代码来源:ProtobufUtil.java


示例16: getRegionInfo

import org.apache.hadoop.hbase.protobuf.generated.AdminProtos.GetRegionInfoRequest; //导入依赖的package包/类
@Override
public GetRegionInfoResponse getRegionInfo(RpcController controller,
    GetRegionInfoRequest request) throws ServiceException {
  GetRegionInfoResponse.Builder builder = GetRegionInfoResponse.newBuilder();
  builder.setRegionInfo(HRegionInfo.convert(HRegionInfo.ROOT_REGIONINFO));
  return builder.build();
}
 
开发者ID:daidong,项目名称:DominoHBase,代码行数:8,代码来源:MockRegionServer.java


示例17: testNoTimeoutWaitForMeta

import org.apache.hadoop.hbase.protobuf.generated.AdminProtos.GetRegionInfoRequest; //导入依赖的package包/类
/**
 * Test waiting on meta w/ no timeout specified.
 * @throws Exception
 */
@Ignore // Can't make it work reliably on all platforms; mockito gets confused
// Throwing: org.mockito.exceptions.misusing.WrongTypeOfReturnValue:
// Result cannot be returned by locateRegion()
// If you plug locateRegion, it then throws for incCounter, and if you plug
// that ... and so one.
@Test public void testNoTimeoutWaitForMeta()
throws Exception {
  // Mock an HConnection and a AdminProtocol implementation.  Have the
  // HConnection return the HRI.  Have the HRI return a few mocked up responses
  // to make our test work.
  // Mock an AdminProtocol.
  final AdminProtocol implementation = Mockito.mock(AdminProtocol.class);
  HConnection connection = mockConnection(implementation, null);
  try {
    // Now the ct is up... set into the mocks some answers that make it look
    // like things have been getting assigned. Make it so we'll return a
    // location (no matter what the Get is). Same for getHRegionInfo -- always
    // just return the meta region.
    final Result result = getMetaTableRowResult();

    // TODO: Refactor.  This method has been moved out of HConnection.
    // It works for now but has been deprecated.
    Mockito.when(connection.getRegionServerWithRetries((ServerCallable<Result>)Mockito.any())).
      thenReturn(result);
    GetRegionInfoResponse.Builder builder = GetRegionInfoResponse.newBuilder();
    builder.setRegionInfo(HRegionInfo.convert(HRegionInfo.FIRST_META_REGIONINFO));
    Mockito.when(implementation.getRegionInfo((RpcController)Mockito.any(),
      (GetRegionInfoRequest)Mockito.any())).thenReturn(builder.build());
    final CatalogTracker ct = constructAndStartCatalogTracker(connection);
    ServerName hsa = ct.getMetaLocation();
    Assert.assertNull(hsa);

    // Now test waiting on meta location getting set.
    Thread t = new WaitOnMetaThread(ct) {
      @Override
      void doWaiting() throws InterruptedException {
        this.ct.waitForMeta();
      }
    };
    startWaitAliveThenWaitItLives(t, 1000);

    // This should trigger wake up of meta wait (Its the removal of the meta
    // region unassigned node that triggers catalogtrackers that a meta has
    // been assigned).
    String node = ct.getMetaNodeTracker().getNode();
    ZKUtil.createAndFailSilent(this.watcher, node);
    MetaEditor.updateMetaLocation(ct, HRegionInfo.FIRST_META_REGIONINFO, SN);
    ZKUtil.deleteNode(this.watcher, node);
    // Go get the new meta location. waitForMeta gets and verifies meta.
    Assert.assertTrue(ct.waitForMeta(10000).equals(SN));
    // Join the thread... should exit shortly.
    t.join();
    // Now meta is available.
    Assert.assertTrue(ct.waitForMeta(10000).equals(SN));
  } finally {
    HConnectionManager.deleteConnection(UTIL.getConfiguration(), true);
  }
}
 
开发者ID:daidong,项目名称:DominoHBase,代码行数:63,代码来源:TestCatalogTracker.java



注:本文中的org.apache.hadoop.hbase.protobuf.generated.AdminProtos.GetRegionInfoRequest类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java ChangeList类代码示例发布时间:2022-05-23
下一篇:
Java WeiboException类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap