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


Java ZKAssign.createNodeClosing方法代码示例

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


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

示例1: testOpenCloseByMasterWithZNode

import org.apache.hadoop.hbase.zookeeper.ZKAssign; //导入方法依赖的package包/类
@Test(timeout = 60000)
public void testOpenCloseByMasterWithZNode() throws Exception {

  ZKAssign.createNodeClosing(HTU.getZooKeeperWatcher(), hri, getRS().getServerName());

  AdminProtos.CloseRegionRequest crr = RequestConverter.buildCloseRegionRequest(
    getRS().getServerName(), regionName, true);
  AdminProtos.CloseRegionResponse responseClose = getRS().rpcServices.closeRegion(null, crr);
  Assert.assertTrue(responseClose.getClosed());

  checkRegionIsClosed(HTU, getRS(), hri);

  ZKAssign.deleteClosedNode(HTU.getZooKeeperWatcher(), hri.getEncodedName(),
    getRS().getServerName());

  openRegion(HTU, getRS(), hri);
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:18,代码来源:TestRegionServerNoMaster.java

示例2: testClosingFailureDuringRecovery

import org.apache.hadoop.hbase.zookeeper.ZKAssign; //导入方法依赖的package包/类
/**
 * Scenario:<ul>
 *  <li> master starts a close, and creates a znode</li>
 *  <li> it fails just at this moment, before contacting the RS</li>
 *  <li> while the second master is coming up, the targeted RS dies. But it's before ZK timeout so
 *    we don't know, and we have an exception.</li>
 *  <li> the master must handle this nicely and reassign.
 *  </ul>
 */
@Test (timeout=180000)
public void testClosingFailureDuringRecovery() throws Exception {

  AssignmentManagerWithExtrasForTesting am =
      setUpMockedAssignmentManager(this.server, this.serverManager);
  ZKAssign.createNodeClosing(this.watcher, REGIONINFO, SERVERNAME_A);
  try {
    am.getRegionStates().createRegionState(REGIONINFO);

    assertFalse( am.getRegionStates().isRegionsInTransition() );

    am.processRegionInTransition(REGIONINFO.getEncodedName(), REGIONINFO);

    assertTrue( am.getRegionStates().isRegionsInTransition() );
  } finally {
    am.shutdown();
  }
}
 
开发者ID:grokcoder,项目名称:pbase,代码行数:28,代码来源:TestAssignmentManager.java

示例3: testOpenCloseByMasterWithZNode

import org.apache.hadoop.hbase.zookeeper.ZKAssign; //导入方法依赖的package包/类
@Test(timeout = 60000)
public void testOpenCloseByMasterWithZNode() throws Exception {

  ZKAssign.createNodeClosing(HTU.getZooKeeperWatcher(), hri, getRS().getServerName());

  AdminProtos.CloseRegionRequest crr = RequestConverter.buildCloseRegionRequest(
    getRS().getServerName(), regionName, true);
  AdminProtos.CloseRegionResponse responseClose = getRS().rpcServices.closeRegion(null, crr);
  Assert.assertTrue(responseClose.getClosed());

  checkRegionIsClosed();

  ZKAssign.deleteClosedNode(HTU.getZooKeeperWatcher(), hri.getEncodedName(),
    getRS().getServerName());

  reopenRegion();
}
 
开发者ID:grokcoder,项目名称:pbase,代码行数:18,代码来源:TestRegionServerNoMaster.java

示例4: testOpenCloseByMasterWithZNode

import org.apache.hadoop.hbase.zookeeper.ZKAssign; //导入方法依赖的package包/类
@Test(timeout = 60000)
public void testOpenCloseByMasterWithZNode() throws Exception {

  ZKAssign.createNodeClosing(HTU.getZooKeeperWatcher(), hri, getRS().getServerName());

  AdminProtos.CloseRegionRequest crr = RequestConverter.buildCloseRegionRequest(
    getRS().getServerName(), regionName, true);
  AdminProtos.CloseRegionResponse responseClose = getRS().closeRegion(null, crr);
  Assert.assertTrue(responseClose.getClosed());

  checkRegionIsClosed();

  ZKAssign.deleteClosedNode(HTU.getZooKeeperWatcher(), hri.getEncodedName(),
    getRS().getServerName());

  reopenRegion();
}
 
开发者ID:tenggyut,项目名称:HIndex,代码行数:18,代码来源:TestRegionServerNoMaster.java

示例5: closeRegion

import org.apache.hadoop.hbase.zookeeper.ZKAssign; //导入方法依赖的package包/类
private void closeRegion(HRegionInfo hri) throws Exception {
  ZKAssign.createNodeClosing(HTU.getZooKeeperWatcher(), hri, getRS().getServerName());

  AdminProtos.CloseRegionRequest crr = RequestConverter.buildCloseRegionRequest(
    getRS().getServerName(), hri.getEncodedName(), true);
  AdminProtos.CloseRegionResponse responseClose = getRS()
      .getRSRpcServices().closeRegion(null, crr);
  Assert.assertTrue(responseClose.getClosed());

  checkRegionIsClosed(hri.getEncodedName());

  ZKAssign.deleteClosedNode(HTU.getZooKeeperWatcher(), hri.getEncodedName(), null);
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:14,代码来源:TestReplicasClient.java

示例6: closeRegion

import org.apache.hadoop.hbase.zookeeper.ZKAssign; //导入方法依赖的package包/类
public static void closeRegion(HBaseTestingUtility HTU, HRegionServer rs, HRegionInfo hri)
    throws Exception {
  ZKAssign.createNodeClosing(HTU.getZooKeeperWatcher(), hri, rs.getServerName());
  AdminProtos.CloseRegionRequest crr = RequestConverter.buildCloseRegionRequest(
    rs.getServerName(), hri.getEncodedName(), true);
  AdminProtos.CloseRegionResponse responseClose = rs.rpcServices.closeRegion(null, crr);
  Assert.assertTrue(responseClose.getClosed());
  checkRegionIsClosed(HTU, rs, hri);
  ZKAssign.deleteClosedNode(HTU.getZooKeeperWatcher(), hri.getEncodedName(), null);
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:11,代码来源:TestRegionServerNoMaster.java

示例7: testMultipleCloseFromMaster

import org.apache.hadoop.hbase.zookeeper.ZKAssign; //导入方法依赖的package包/类
@Test(timeout = 60000)
public void testMultipleCloseFromMaster() throws Exception {

  // As opening, we must support multiple requests on the same region
  ZKAssign.createNodeClosing(HTU.getZooKeeperWatcher(), hri, getRS().getServerName());
  for (int i = 0; i < 10; i++) {
    AdminProtos.CloseRegionRequest crr =
        RequestConverter.buildCloseRegionRequest(getRS().getServerName(), regionName, 0, null, true);
    try {
      AdminProtos.CloseRegionResponse responseClose = getRS().rpcServices.closeRegion(null, crr);
      Assert.assertEquals("The first request should succeeds", 0, i);
      Assert.assertTrue("request " + i + " failed",
          responseClose.getClosed() || responseClose.hasClosed());
    } catch (ServiceException se) {
      Assert.assertTrue("The next queries should throw an exception.", i > 0);
    }
  }

  checkRegionIsClosed(HTU, getRS(), hri);

  Assert.assertTrue(
    ZKAssign.deleteClosedNode(HTU.getZooKeeperWatcher(), hri.getEncodedName(),
      getRS().getServerName())
  );

  openRegion(HTU, getRS(), hri);
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:28,代码来源:TestRegionServerNoMaster.java

示例8: testZKClosingNodeVersionMismatch

import org.apache.hadoop.hbase.zookeeper.ZKAssign; //导入方法依赖的package包/类
/**
 * Test if close region can handle ZK closing node version mismatch
 * @throws IOException
 * @throws NodeExistsException
 * @throws KeeperException
* @throws DeserializationException
 */
@Test public void testZKClosingNodeVersionMismatch()
throws IOException, NodeExistsException, KeeperException, DeserializationException {
  final Server server = new MockServer(HTU);
  final RegionServerServices rss = HTU.createMockRegionServerService();

  HTableDescriptor htd = TEST_HTD;
  final HRegionInfo hri = TEST_HRI;

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

  // open a region first so that it can be closed later
  OpenRegion(server, rss, htd, hri, coordinationProvider.getOpenRegionCoordination());

  // close the region
  // Create it CLOSING, which is what Master set before sending CLOSE RPC
  int versionOfClosingNode = ZKAssign.createNodeClosing(server.getZooKeeper(),
    hri, server.getServerName());

  // The CloseRegionHandler will validate the expected version
  // Given it is set to invalid versionOfClosingNode+1,
  // CloseRegionHandler should be M_ZK_REGION_CLOSING

  ZkCloseRegionCoordination.ZkCloseRegionDetails zkCrd =
    new ZkCloseRegionCoordination.ZkCloseRegionDetails();
  zkCrd.setPublishStatusInZk(true);
  zkCrd.setExpectedVersion(versionOfClosingNode+1);

  CloseRegionHandler handler = new CloseRegionHandler(server, rss, hri, false,
    coordinationProvider.getCloseRegionCoordination(), zkCrd);
  handler.process();

  // Handler should remain in M_ZK_REGION_CLOSING
  RegionTransition rt =
    RegionTransition.parseFrom(ZKAssign.getData(server.getZooKeeper(), hri.getEncodedName()));
  assertTrue(rt.getEventType().equals(EventType.M_ZK_REGION_CLOSING ));
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:46,代码来源:TestCloseRegionHandler.java

示例9: testCloseRegion

import org.apache.hadoop.hbase.zookeeper.ZKAssign; //导入方法依赖的package包/类
/**
 * Test if the region can be closed properly
 * @throws IOException
 * @throws NodeExistsException
 * @throws KeeperException
* @throws org.apache.hadoop.hbase.exceptions.DeserializationException
 */
@Test public void testCloseRegion()
throws IOException, NodeExistsException, KeeperException, DeserializationException {
  final Server server = new MockServer(HTU);
  final RegionServerServices rss = HTU.createMockRegionServerService();

  HTableDescriptor htd = TEST_HTD;
  HRegionInfo hri = TEST_HRI;

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

  // open a region first so that it can be closed later
  OpenRegion(server, rss, htd, hri, coordinationProvider.getOpenRegionCoordination());

  // close the region
  // Create it CLOSING, which is what Master set before sending CLOSE RPC
  int versionOfClosingNode = ZKAssign.createNodeClosing(server.getZooKeeper(),
    hri, server.getServerName());

  // The CloseRegionHandler will validate the expected version
  // Given it is set to correct versionOfClosingNode,
  // CloseRegionHandlerit should be RS_ZK_REGION_CLOSED

  ZkCloseRegionCoordination.ZkCloseRegionDetails zkCrd =
    new ZkCloseRegionCoordination.ZkCloseRegionDetails();
  zkCrd.setPublishStatusInZk(true);
  zkCrd.setExpectedVersion(versionOfClosingNode);

  CloseRegionHandler handler = new CloseRegionHandler(server, rss, hri, false,
    coordinationProvider.getCloseRegionCoordination(), zkCrd);
  handler.process();
  // Handler should have transitioned it to RS_ZK_REGION_CLOSED
  RegionTransition rt = RegionTransition.parseFrom(
    ZKAssign.getData(server.getZooKeeper(), hri.getEncodedName()));
  assertTrue(rt.getEventType().equals(EventType.RS_ZK_REGION_CLOSED));
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:45,代码来源:TestCloseRegionHandler.java

示例10: testZKClosingNodeVersionMismatch

import org.apache.hadoop.hbase.zookeeper.ZKAssign; //导入方法依赖的package包/类
/**
 * Test if close region can handle ZK closing node version mismatch
 * @throws IOException
 * @throws NodeExistsException
 * @throws KeeperException
 */
@Test public void testZKClosingNodeVersionMismatch()
throws IOException, NodeExistsException, KeeperException {
  final Server server = new MockServer(HTU);
  final MockRegionServerServices rss = new MockRegionServerServices();
  rss.setFileSystem(HTU.getTestFileSystem());
   
  HTableDescriptor htd = TEST_HTD;
  final HRegionInfo hri = TEST_HRI;
   
  // open a region first so that it can be closed later
  OpenRegion(server, rss, htd, hri);
   
  // close the region
  // Create it CLOSING, which is what Master set before sending CLOSE RPC
  int versionOfClosingNode = ZKAssign.createNodeClosing(server.getZooKeeper(),
    hri, server.getServerName());
   
  // The CloseRegionHandler will validate the expected version
  // Given it is set to invalid versionOfClosingNode+1,
  // CloseRegionHandler should be M_ZK_REGION_CLOSING
  CloseRegionHandler handler =
    new CloseRegionHandler(server, rss, hri, false, true,
    versionOfClosingNode+1);
  handler.process();
   
  // Handler should remain in M_ZK_REGION_CLOSING
  RegionTransitionData data =
    ZKAssign.getData(server.getZooKeeper(), hri.getEncodedName());
  assertTrue(EventType.M_ZK_REGION_CLOSING == data.getEventType());
}
 
开发者ID:fengchen8086,项目名称:LCIndex-HBase-0.94.16,代码行数:37,代码来源:TestCloseRegionHandler.java

示例11: testCloseRegion

import org.apache.hadoop.hbase.zookeeper.ZKAssign; //导入方法依赖的package包/类
/**
 * Test if the region can be closed properly
 * @throws IOException
 * @throws NodeExistsException
 * @throws KeeperException
 */
@Test public void testCloseRegion()
throws IOException, NodeExistsException, KeeperException {
  final Server server = new MockServer(HTU);
  final MockRegionServerServices rss = new MockRegionServerServices();
  rss.setFileSystem(HTU.getTestFileSystem());
   
  HTableDescriptor htd = TEST_HTD;
  HRegionInfo hri = TEST_HRI;
   
  // open a region first so that it can be closed later
  OpenRegion(server, rss, htd, hri);
   
  // close the region
  // Create it CLOSING, which is what Master set before sending CLOSE RPC
  int versionOfClosingNode = ZKAssign.createNodeClosing(server.getZooKeeper(),
    hri, server.getServerName());
   
  // The CloseRegionHandler will validate the expected version
  // Given it is set to correct versionOfClosingNode,
  // CloseRegionHandlerit should be RS_ZK_REGION_CLOSED
  CloseRegionHandler handler =
    new CloseRegionHandler(server, rss, hri, false, true,
    versionOfClosingNode);
  handler.process();
  // Handler should have transitioned it to RS_ZK_REGION_CLOSED
  RegionTransitionData data =
    ZKAssign.getData(server.getZooKeeper(), hri.getEncodedName());
  assertTrue(EventType.RS_ZK_REGION_CLOSED == data.getEventType());
}
 
开发者ID:fengchen8086,项目名称:LCIndex-HBase-0.94.16,代码行数:36,代码来源:TestCloseRegionHandler.java

示例12: testMultipleCloseFromMaster

import org.apache.hadoop.hbase.zookeeper.ZKAssign; //导入方法依赖的package包/类
@Test(timeout = 60000)
public void testMultipleCloseFromMaster() throws Exception {

  // As opening, we must support multiple requests on the same region
  ZKAssign.createNodeClosing(HTU.getZooKeeperWatcher(), hri, getRS().getServerName());
  for (int i = 0; i < 10; i++) {
    AdminProtos.CloseRegionRequest crr =
        RequestConverter.buildCloseRegionRequest(getRS().getServerName(), regionName, 0, null, true);
    try {
      AdminProtos.CloseRegionResponse responseClose = getRS().rpcServices.closeRegion(null, crr);
      Assert.assertEquals("The first request should succeeds", 0, i);
      Assert.assertTrue("request " + i + " failed",
          responseClose.getClosed() || responseClose.hasClosed());
    } catch (ServiceException se) {
      Assert.assertTrue("The next queries should throw an exception.", i > 0);
    }
  }

  checkRegionIsClosed();

  Assert.assertTrue(
    ZKAssign.deleteClosedNode(HTU.getZooKeeperWatcher(), hri.getEncodedName(),
      getRS().getServerName())
  );

  reopenRegion();
}
 
开发者ID:grokcoder,项目名称:pbase,代码行数:28,代码来源:TestRegionServerNoMaster.java

示例13: closeRegion

import org.apache.hadoop.hbase.zookeeper.ZKAssign; //导入方法依赖的package包/类
private void closeRegion(HRegionInfo hri) throws Exception {
  ZKAssign.createNodeClosing(HTU.getZooKeeperWatcher(), hri, getRS().getServerName());

  AdminProtos.CloseRegionRequest crr = RequestConverter.buildCloseRegionRequest(getRS().getServerName(),
      hri.getEncodedName(), true);
  AdminProtos.CloseRegionResponse responseClose = getRS().getRSRpcServices().closeRegion(null, crr);
  Assert.assertTrue(responseClose.getClosed());

  checkRegionIsClosed(hri.getEncodedName());

  ZKAssign.deleteClosedNode(HTU.getZooKeeperWatcher(), hri.getEncodedName(), getRS().getServerName());
}
 
开发者ID:grokcoder,项目名称:pbase,代码行数:13,代码来源:TestRegionReplicas.java

示例14: testClosingFailureDuringRecovery

import org.apache.hadoop.hbase.zookeeper.ZKAssign; //导入方法依赖的package包/类
/**
 * Scenario:<ul>
 *  <li> master starts a close, and creates a znode</li>
 *  <li> it fails just at this moment, before contacting the RS</li>
 *  <li> while the second master is coming up, the targeted RS dies. But it's before ZK timeout so
 *    we don't know, and we have an exception.</li>
 *  <li> the master must handle this nicely and reassign.
 *  </ul>
 */
@Test
public void testClosingFailureDuringRecovery() throws Exception {

  AssignmentManagerWithExtrasForTesting am =
      setUpMockedAssignmentManager(this.server, this.serverManager);
  ZKAssign.createNodeClosing(this.watcher, REGIONINFO, SERVERNAME_A);
  am.getRegionStates().createRegionState(REGIONINFO);

  assertFalse( am.getRegionStates().isRegionsInTransition() );

  am.processRegionInTransition(REGIONINFO.getEncodedName(), REGIONINFO);

  assertTrue( am.getRegionStates().isRegionsInTransition() );
}
 
开发者ID:tenggyut,项目名称:HIndex,代码行数:24,代码来源:TestAssignmentManager.java

示例15: testMultipleCloseFromMaster

import org.apache.hadoop.hbase.zookeeper.ZKAssign; //导入方法依赖的package包/类
@Test(timeout = 60000)
public void testMultipleCloseFromMaster() throws Exception {

  // As opening, we must support multiple requests on the same region
  ZKAssign.createNodeClosing(HTU.getZooKeeperWatcher(), hri, getRS().getServerName());
  for (int i = 0; i < 10; i++) {
    AdminProtos.CloseRegionRequest crr =
        RequestConverter.buildCloseRegionRequest(getRS().getServerName(), regionName, 0, null, true);
    try {
      AdminProtos.CloseRegionResponse responseClose = getRS().closeRegion(null, crr);
      Assert.assertEquals("The first request should succeeds", 0, i);
      Assert.assertTrue("request " + i + " failed",
          responseClose.getClosed() || responseClose.hasClosed());
    } catch (ServiceException se) {
      Assert.assertTrue("The next queries should throw an exception.", i > 0);
    }
  }

  checkRegionIsClosed();

  Assert.assertTrue(
    ZKAssign.deleteClosedNode(HTU.getZooKeeperWatcher(), hri.getEncodedName(),
      getRS().getServerName())
  );

  reopenRegion();
}
 
开发者ID:tenggyut,项目名称:HIndex,代码行数:28,代码来源:TestRegionServerNoMaster.java


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