当前位置: 首页>>代码示例>>Java>>正文


Java ZkCoordinatedStateManager.getOpenRegionCoordination方法代码示例

本文整理汇总了Java中org.apache.hadoop.hbase.coordination.ZkCoordinatedStateManager.getOpenRegionCoordination方法的典型用法代码示例。如果您正苦于以下问题:Java ZkCoordinatedStateManager.getOpenRegionCoordination方法的具体用法?Java ZkCoordinatedStateManager.getOpenRegionCoordination怎么用?Java ZkCoordinatedStateManager.getOpenRegionCoordination使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.hadoop.hbase.coordination.ZkCoordinatedStateManager的用法示例。


在下文中一共展示了ZkCoordinatedStateManager.getOpenRegionCoordination方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testFailedOpenRegion

import org.apache.hadoop.hbase.coordination.ZkCoordinatedStateManager; //导入方法依赖的package包/类
@Test
public void testFailedOpenRegion() throws Exception {
  Server server = new MockServer(HTU);
  RegionServerServices rsServices = HTU.createMockRegionServerService();

  // Create it OFFLINE, which is what it expects
  ZKAssign.createNodeOffline(server.getZooKeeper(), TEST_HRI, server.getServerName());

  ZkCoordinatedStateManager csm = new ZkCoordinatedStateManager();
  csm.initialize(server);
  csm.start();

  ZkOpenRegionCoordination.ZkOpenRegionDetails zkCrd =
    new ZkOpenRegionCoordination.ZkOpenRegionDetails();
  zkCrd.setServerName(server.getServerName());

  // Create the handler
  OpenRegionHandler handler =
    new OpenRegionHandler(server, rsServices, TEST_HRI, TEST_HTD, -1,
      csm.getOpenRegionCoordination(), zkCrd) {
      @Override
      HRegion openRegion() {
        // Fake failure of opening a region due to an IOE, which is caught
        return null;
      }
  };
  rsServices.getRegionsInTransitionInRS().put(
    TEST_HRI.getEncodedNameAsBytes(), Boolean.TRUE);
  handler.process();

  // Handler should have transitioned it to FAILED_OPEN
  RegionTransition rt = RegionTransition.parseFrom(
    ZKAssign.getData(server.getZooKeeper(), TEST_HRI.getEncodedName()));
  assertEquals(EventType.RS_ZK_REGION_FAILED_OPEN, rt.getEventType());
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:36,代码来源:TestOpenRegionHandler.java

示例2: testFailedUpdateMeta

import org.apache.hadoop.hbase.coordination.ZkCoordinatedStateManager; //导入方法依赖的package包/类
@Test
public void testFailedUpdateMeta() throws Exception {
  Server server = new MockServer(HTU);
  RegionServerServices rsServices = HTU.createMockRegionServerService();

  // Create it OFFLINE, which is what it expects
  ZKAssign.createNodeOffline(server.getZooKeeper(), TEST_HRI, server.getServerName());

  // Create the handler
  ZkCoordinatedStateManager csm = new ZkCoordinatedStateManager();
  csm.initialize(server);
  csm.start();

  ZkOpenRegionCoordination.ZkOpenRegionDetails zkCrd =
    new ZkOpenRegionCoordination.ZkOpenRegionDetails();
  zkCrd.setServerName(server.getServerName());

  OpenRegionHandler handler = new OpenRegionHandler(server, rsServices, TEST_HRI, TEST_HTD,
    -1, csm.getOpenRegionCoordination(), zkCrd) {
      @Override
      boolean updateMeta(final HRegion r, long masterSystemTime) {
        // Fake failure of updating META
        return false;
      }
  };
  rsServices.getRegionsInTransitionInRS().put(
    TEST_HRI.getEncodedNameAsBytes(), Boolean.TRUE);
  handler.process();

  // Handler should have transitioned it to FAILED_OPEN
  RegionTransition rt = RegionTransition.parseFrom(
    ZKAssign.getData(server.getZooKeeper(), TEST_HRI.getEncodedName()));
  assertEquals(EventType.RS_ZK_REGION_FAILED_OPEN, rt.getEventType());
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:35,代码来源:TestOpenRegionHandler.java

示例3: testTransitionToFailedOpenEvenIfCleanupFails

import org.apache.hadoop.hbase.coordination.ZkCoordinatedStateManager; //导入方法依赖的package包/类
@Test
public void testTransitionToFailedOpenEvenIfCleanupFails() throws Exception {
  Server server = new MockServer(HTU);
  RegionServerServices rsServices = HTU.createMockRegionServerService();
  // Create it OFFLINE, which is what it expects
  ZKAssign.createNodeOffline(server.getZooKeeper(), TEST_HRI, server.getServerName());
  // Create the handler
  ZkCoordinatedStateManager csm = new ZkCoordinatedStateManager();
  csm.initialize(server);
  csm.start();

  ZkOpenRegionCoordination.ZkOpenRegionDetails zkCrd =
    new ZkOpenRegionCoordination.ZkOpenRegionDetails();
  zkCrd.setServerName(server.getServerName());

  OpenRegionHandler handler = new OpenRegionHandler(server, rsServices, TEST_HRI, TEST_HTD,
    -1, csm.getOpenRegionCoordination(), zkCrd) {
    @Override
    boolean updateMeta(HRegion r, long masterSystemTime) {
      return false;
    };

    @Override
    void cleanupFailedOpen(HRegion region) throws IOException {
      throw new IOException("FileSystem got closed.");
    }
  };
  rsServices.getRegionsInTransitionInRS().put(TEST_HRI.getEncodedNameAsBytes(), Boolean.TRUE);
  try {
    handler.process();
  } catch (Exception e) {
    // Ignore the IOException that we have thrown from cleanupFailedOpen
  }
  RegionTransition rt = RegionTransition.parseFrom(ZKAssign.getData(server.getZooKeeper(),
      TEST_HRI.getEncodedName()));
  assertEquals(EventType.RS_ZK_REGION_FAILED_OPEN, rt.getEventType());
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:38,代码来源:TestOpenRegionHandler.java

示例4: testFailedOpenRegion

import org.apache.hadoop.hbase.coordination.ZkCoordinatedStateManager; //导入方法依赖的package包/类
@Test
public void testFailedOpenRegion() throws Exception {
  Server server = new MockServer(HTU);
  RegionServerServices rsServices = HTU.createMockRegionServerService();

  // Create it OFFLINE, which is what it expects
  ZKAssign.createNodeOffline(server.getZooKeeper(), TEST_HRI, server.getServerName());

  ZkCoordinatedStateManager csm = new ZkCoordinatedStateManager();
  csm.initialize(server);
  csm.start();

  ZkOpenRegionCoordination.ZkOpenRegionDetails zkCrd =
    new ZkOpenRegionCoordination.ZkOpenRegionDetails();
  zkCrd.setServerName(server.getServerName());

  // Create the handler
  OpenRegionHandler handler =
    new OpenRegionHandler(server, rsServices, TEST_HRI, TEST_HTD,
      csm.getOpenRegionCoordination(), zkCrd) {
      @Override
      HRegion openRegion() {
        // Fake failure of opening a region due to an IOE, which is caught
        return null;
      }
  };
  rsServices.getRegionsInTransitionInRS().put(
    TEST_HRI.getEncodedNameAsBytes(), Boolean.TRUE);
  handler.process();

  // Handler should have transitioned it to FAILED_OPEN
  RegionTransition rt = RegionTransition.parseFrom(
    ZKAssign.getData(server.getZooKeeper(), TEST_HRI.getEncodedName()));
  assertEquals(EventType.RS_ZK_REGION_FAILED_OPEN, rt.getEventType());
}
 
开发者ID:grokcoder,项目名称:pbase,代码行数:36,代码来源:TestOpenRegionHandler.java

示例5: testFailedUpdateMeta

import org.apache.hadoop.hbase.coordination.ZkCoordinatedStateManager; //导入方法依赖的package包/类
@Test
public void testFailedUpdateMeta() throws Exception {
  Server server = new MockServer(HTU);
  RegionServerServices rsServices = HTU.createMockRegionServerService();

  // Create it OFFLINE, which is what it expects
  ZKAssign.createNodeOffline(server.getZooKeeper(), TEST_HRI, server.getServerName());

  // Create the handler
  ZkCoordinatedStateManager csm = new ZkCoordinatedStateManager();
  csm.initialize(server);
  csm.start();

  ZkOpenRegionCoordination.ZkOpenRegionDetails zkCrd =
    new ZkOpenRegionCoordination.ZkOpenRegionDetails();
  zkCrd.setServerName(server.getServerName());

  OpenRegionHandler handler = new OpenRegionHandler(server, rsServices, TEST_HRI, TEST_HTD,
    csm.getOpenRegionCoordination(), zkCrd) {
      @Override
      boolean updateMeta(final HRegion r) {
        // Fake failure of updating META
        return false;
      }
  };
  rsServices.getRegionsInTransitionInRS().put(
    TEST_HRI.getEncodedNameAsBytes(), Boolean.TRUE);
  handler.process();

  // Handler should have transitioned it to FAILED_OPEN
  RegionTransition rt = RegionTransition.parseFrom(
    ZKAssign.getData(server.getZooKeeper(), TEST_HRI.getEncodedName()));
  assertEquals(EventType.RS_ZK_REGION_FAILED_OPEN, rt.getEventType());
}
 
开发者ID:grokcoder,项目名称:pbase,代码行数:35,代码来源:TestOpenRegionHandler.java

示例6: testTransitionToFailedOpenEvenIfCleanupFails

import org.apache.hadoop.hbase.coordination.ZkCoordinatedStateManager; //导入方法依赖的package包/类
@Test
public void testTransitionToFailedOpenEvenIfCleanupFails() throws Exception {
  Server server = new MockServer(HTU);
  RegionServerServices rsServices = HTU.createMockRegionServerService();
  // Create it OFFLINE, which is what it expects
  ZKAssign.createNodeOffline(server.getZooKeeper(), TEST_HRI, server.getServerName());
  // Create the handler
  ZkCoordinatedStateManager csm = new ZkCoordinatedStateManager();
  csm.initialize(server);
  csm.start();

  ZkOpenRegionCoordination.ZkOpenRegionDetails zkCrd =
    new ZkOpenRegionCoordination.ZkOpenRegionDetails();
  zkCrd.setServerName(server.getServerName());

  OpenRegionHandler handler = new OpenRegionHandler(server, rsServices, TEST_HRI, TEST_HTD,
    csm.getOpenRegionCoordination(), zkCrd) {
    @Override
    boolean updateMeta(HRegion r) {
      return false;
    };

    @Override
    void cleanupFailedOpen(HRegion region) throws IOException {
      throw new IOException("FileSystem got closed.");
    }
  };
  rsServices.getRegionsInTransitionInRS().put(TEST_HRI.getEncodedNameAsBytes(), Boolean.TRUE);
  try {
    handler.process();
  } catch (Exception e) {
    // Ignore the IOException that we have thrown from cleanupFailedOpen
  }
  RegionTransition rt = RegionTransition.parseFrom(ZKAssign.getData(server.getZooKeeper(),
      TEST_HRI.getEncodedName()));
  assertEquals(EventType.RS_ZK_REGION_FAILED_OPEN, rt.getEventType());
}
 
开发者ID:grokcoder,项目名称:pbase,代码行数:38,代码来源:TestOpenRegionHandler.java


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