Package org.apache.hadoop.hbase.executor

Examples of org.apache.hadoop.hbase.executor.RegionTransitionData


   * The AM's info could be old when OpenedRegionHandler
   * processing hasn't finished yet when server shutdown occurs.
   * @return whether the serverName currently hosts the region
   */
  public boolean isCarryingRegion(ServerName serverName, HRegionInfo hri) {
    RegionTransitionData data = null;
    try {
      data = ZKAssign.getData(master.getZooKeeper(), hri.getEncodedName());
    } catch (KeeperException e) {
      master.abort("Unexpected ZK exception reading unassigned node for region="
        + hri.getEncodedName(), e);
    }

    ServerName addressFromZK = (data != null && data.getOrigin() != null) ?
      data.getOrigin() : null;
    if (addressFromZK != null) {
      // if we get something from ZK, we will use the data
      boolean matchZK = (addressFromZK != null &&
        addressFromZK.equals(serverName));
      LOG.debug("based on ZK, current region=" + hri.getRegionNameAsString() +
View Full Code Here


      ZKAssign.createNodeOffline(zkw, region, serverName);
      hrs.openRegion(region);

      int iTimes = 0;
      while (true) {
        RegionTransitionData rtd = ZKAssign.getData(zkw,
            region.getEncodedName());
        if (rtd != null && rtd.getEventType() == EventType.RS_ZK_REGION_OPENED) {
          break;
        }
        Thread.sleep(100);
        iTimes++;
        if (iTimes >= REGION_ONLINE_TIMEOUT) {
View Full Code Here

      String path = ZKAssign.getNodeName(t.getConnection().getZooKeeperWatcher(),
        hri.getEncodedName());
      Stat stats =
        t.getConnection().getZooKeeperWatcher().getRecoverableZooKeeper().exists(path, false);
      LOG.info("EPHEMERAL NODE BEFORE SERVER ABORT, path=" + path + ", stats=" + stats);
      RegionTransitionData rtd =
        ZKAssign.getData(t.getConnection().getZooKeeperWatcher(),
          hri.getEncodedName());
      // State could be SPLIT or SPLITTING.
      assertTrue(rtd.getEventType().equals(EventType.RS_ZK_REGION_SPLIT) ||
        rtd.getEventType().equals(EventType.RS_ZK_REGION_SPLITTING));
      // Now crash the server
      cluster.abortRegionServer(tableRegionIndex);
      waitUntilRegionServerDead();
      awaitDaughters(tableName, daughters.size());
View Full Code Here

          .getZooKeeperWatcher(), hri.getEncodedName());
      Stat stats = t.getConnection().getZooKeeperWatcher()
          .getRecoverableZooKeeper().exists(path, false);
      LOG.info("EPHEMERAL NODE BEFORE SERVER ABORT, path=" + path + ", stats="
          + stats);
      RegionTransitionData rtd = ZKAssign.getData(t.getConnection()
          .getZooKeeperWatcher(), hri.getEncodedName());
      // State could be SPLIT or SPLITTING.
      assertTrue(rtd.getEventType().equals(EventType.RS_ZK_REGION_SPLIT)
          || rtd.getEventType().equals(EventType.RS_ZK_REGION_SPLITTING));


      // abort and wait for new master.
      MockMasterWithoutCatalogJanitor master = abortAndWaitForMaster();
View Full Code Here

    region = enabledRegions.remove(0);
    regionsThatShouldBeOnline.add(region);
    ZKAssign.createNodeOffline(zkw, region, serverName);
    hrs.openRegion(region);
    while (true) {
      RegionTransitionData rtd = ZKAssign.getData(zkw, region.getEncodedName());
      if (rtd != null && rtd.getEventType() == EventType.RS_ZK_REGION_OPENED) {
        break;
      }
      Thread.sleep(100);
    }

    // Region of disable table was opened on RS
    region = disabledRegions.remove(0);
    regionsThatShouldBeOffline.add(region);
    ZKAssign.createNodeOffline(zkw, region, serverName);
    hrs.openRegion(region);
    while (true) {
      RegionTransitionData rtd = ZKAssign.getData(zkw, region.getEncodedName());
      if (rtd != null && rtd.getEventType() == EventType.RS_ZK_REGION_OPENED) {
        break;
      }
      Thread.sleep(100);
    }
View Full Code Here

    region = enabledRegions.remove(0);
    regionsThatShouldBeOnline.add(region);
    ZKAssign.createNodeOffline(zkw, region, deadServerName);
    hrsDead.openRegion(region);
    while (true) {
      RegionTransitionData rtd = ZKAssign.getData(zkw, region.getEncodedName());
      if (rtd != null && rtd.getEventType() == EventType.RS_ZK_REGION_OPENED) {
        break;
      }
      Thread.sleep(100);
    }
    LOG.debug("\n\nRegion of enabled table was OPENED on dead RS\n" +
        region + "\n\n");

    // Region of disabled table was opened on dead RS
    region = disabledRegions.remove(0);
    regionsThatShouldBeOffline.add(region);
    ZKAssign.createNodeOffline(zkw, region, deadServerName);
    hrsDead.openRegion(region);
    while (true) {
      RegionTransitionData rtd = ZKAssign.getData(zkw, region.getEncodedName());
      if (rtd != null && rtd.getEventType() == EventType.RS_ZK_REGION_OPENED) {
        break;
      }
      Thread.sleep(100);
    }
    LOG.debug("\n\nRegion of disabled table was OPENED on dead RS\n" +
        region + "\n\n");

    /*
     * ZK = NONE
     */

    // Region of enabled table was open at steady-state on dead RS
    region = enabledRegions.remove(0);
    regionsThatShouldBeOnline.add(region);
    ZKAssign.createNodeOffline(zkw, region, deadServerName);
    hrsDead.openRegion(region);
    while (true) {
      RegionTransitionData rtd = ZKAssign.getData(zkw, region.getEncodedName());
      if (rtd != null && rtd.getEventType() == EventType.RS_ZK_REGION_OPENED) {
        ZKAssign.deleteOpenedNode(zkw, region.getEncodedName());
        break;
      }
      Thread.sleep(100);
    }
    LOG.debug("\n\nRegion of enabled table was open at steady-state on dead RS"
        + "\n" + region + "\n\n");

    // Region of disabled table was open at steady-state on dead RS
    region = disabledRegions.remove(0);
    regionsThatShouldBeOffline.add(region);
    ZKAssign.createNodeOffline(zkw, region, deadServerName);
    hrsDead.openRegion(region);
    while (true) {
      RegionTransitionData rtd = ZKAssign.getData(zkw, region.getEncodedName());
      if (rtd != null && rtd.getEventType() == EventType.RS_ZK_REGION_OPENED) {
        ZKAssign.deleteOpenedNode(zkw, region.getEncodedName());
        break;
      }
      Thread.sleep(100);
    }
View Full Code Here

         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());
     }
View Full Code Here

       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());
     }
View Full Code Here

       ZKAssign.createNodeOffline(server.getZooKeeper(), hri, server.getServerName());
       int version = ZKAssign.transitionNodeOpening(server.getZooKeeper(), hri, server.getServerName());
       OpenRegionHandler openHandler = new OpenRegionHandler(server, rss, hri, htd, version);
       openHandler.process();
       RegionTransitionData data = ZKAssign.getData(server.getZooKeeper(), hri.getEncodedName());

       // delete the node, which is what Master do after the region is opened
       ZKAssign.deleteNode(server.getZooKeeper(), hri.getEncodedName(),
         EventType.RS_ZK_REGION_OPENED);
     }
View Full Code Here

        }
    };
    handler.process();

    // Handler should have transitioned it to FAILED_OPEN
    RegionTransitionData data =
      ZKAssign.getData(server.getZooKeeper(), TEST_HRI.getEncodedName());
    assertEquals(EventType.RS_ZK_REGION_FAILED_OPEN, data.getEventType());
  }
View Full Code Here

TOP

Related Classes of org.apache.hadoop.hbase.executor.RegionTransitionData

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.