Package org.apache.hadoop.hbase.executor

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


          HRegionInfo regionInfo = region.getFirst();
          Result result = region.getSecond();
          // If region was in transition (was in zk) force it offline for
          // reassign
          try {
            RegionTransitionData data = ZKAssign.getData(watcher,
                regionInfo.getEncodedName());

            // If zk node of this region has been updated by a live server,
            // we consider that this region is being handled.
            // So we should skip it and process it in
            // processRegionsInTransition.
            if (data != null && data.getOrigin() != null &&
                serverManager.isServerOnline(data.getOrigin())) {
              LOG.info("The region " + regionInfo.getEncodedName()
                  + "is being handled on " + data.getOrigin());
              continue;
            }
            // Process with existing RS shutdown code
            boolean assign = ServerShutdownHandler.processDeadRegion(
                regionInfo, result, this, this.catalogTracker);
View Full Code Here


        + regionInfo.getRegionNameAsString());
    // Should have a ZK node in OPENING state
    try {
      String node = ZKAssign.getNodeName(watcher, regionInfo.getEncodedName());
      Stat stat = new Stat();
      RegionTransitionData dataInZNode = ZKAssign.getDataNoWatch(watcher, node,
          stat);
      if (dataInZNode == null) {
        LOG.warn("Data is null, node " + node + " no longer exists");
        return;
      }
      if (dataInZNode.getEventType() == EventType.RS_ZK_REGION_OPENED) {
        LOG.debug("Region has transitioned to OPENED, allowing "
            + "watched event handlers to process");
        return;
      } else if (dataInZNode.getEventType() != EventType.RS_ZK_REGION_OPENING &&
          dataInZNode.getEventType() != EventType.RS_ZK_REGION_FAILED_OPEN ) {
        LOG.warn("While timing out a region in state OPENING, "
            + "found ZK node in unexpected state: "
            + dataInZNode.getEventType());
        return;
      }
      invokeAssign(regionInfo);
    } catch (KeeperException ke) {
      LOG.error("Unexpected ZK exception timing out CLOSING region", ke);
View Full Code Here

   * 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

        }
    };
    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

        }
    };
    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

    try {
      handler.process();
    } catch (Exception e) {
      // Ignore the IOException that we have thrown from cleanupFailedOpen
    }
    RegionTransitionData data =
        ZKAssign.getData(server.getZooKeeper(), TEST_HRI.getEncodedName());
    assertEquals(EventType.RS_ZK_REGION_FAILED_OPEN, data.getEventType());
  }
View Full Code Here

   */
  void createNodeSplitting(final ZooKeeperWatcher zkw, final HRegionInfo region,
      final ServerName serverName) throws KeeperException, IOException {
    LOG.debug(zkw.prefix("Creating ephemeral node for " +
      region.getEncodedName() + " in SPLITTING state"));
    RegionTransitionData data =
      new RegionTransitionData(EventType.RS_ZK_REGION_SPLITTING,
        region.getRegionName(), serverName);

    String node = ZKAssign.getNodeName(zkw, region.getEncodedName());
    if (!ZKUtil.createEphemeralNodeAndWatch(zkw, node, data.getBytes())) {
      throw new IOException("Failed create of ephemeral " + node);
    }
  }
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

        }
    };
    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

    try {
      handler.process();
    } catch (Exception e) {
      // Ignore the IOException that we have thrown from cleanupFailedOpen
    }
    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.