Package org.apache.hadoop.hbase

Examples of org.apache.hadoop.hbase.HServerInfo


   * Used when a region has been closed but should be reassigned.
   * @param regionInfo
   */
  public void setOffline(HRegionInfo regionInfo) {
    synchronized (this.regions) {
      HServerInfo serverInfo = this.regions.remove(regionInfo);
      if (serverInfo == null) return;
      Set<HRegionInfo> serverRegions = this.servers.get(serverInfo);
      if (!serverRegions.remove(regionInfo)) {
        LOG.warn("No " + regionInfo + " on " + serverInfo);
      }
View Full Code Here


          "already in transition (" + state.getState() + ")");
        return;
      }
    }
    // Send CLOSE RPC
    HServerInfo server = null;
    synchronized (this.regions) {
      server = regions.get(region);
    }
    try {
      if (serverManager.sendRegionClose(server, state.getRegion())) {
View Full Code Here

    // Iterate regions in META
    for (Result result : results) {
      Pair<HRegionInfo,HServerInfo> region =
        MetaReader.metaRowToRegionPairWithInfo(result);
      if (region == null) continue;
      HServerInfo regionLocation = region.getSecond();
      HRegionInfo regionInfo = region.getFirst();
      String disablingTableName = regionInfo.getTableDesc().getNameAsString();
      if (regionLocation == null) {
        // Region not being served, add to region map with no assignment
        // If this needs to be assigned out, it will also be in ZK as RIT
        // add if the table is not in disabled state
        if (false == checkIfRegionBelongsToDisabled(regionInfo)) {
          this.regions.put(regionInfo, null);
        }
        if (checkIfRegionBelongsToDisabling(regionInfo)) {
          disablingTables.add(disablingTableName);
        }
      } else if (!serverManager.isServerOnline(regionLocation.getServerName())) {
        // Region is located on a server that isn't online
        List<Pair<HRegionInfo,Result>> offlineRegions =
          offlineServers.get(regionLocation.getServerName());
        if (offlineRegions == null) {
          offlineRegions = new ArrayList<Pair<HRegionInfo,Result>>(1);
          offlineServers.put(regionLocation.getServerName(), offlineRegions);
        }
        offlineRegions.add(new Pair<HRegionInfo,Result>(regionInfo, result));
      } else {
        // Region is being served and on an active server
        // add only if region not in disabled table
View Full Code Here

    // Clean out any existing assignment plans for this server
    synchronized (this.regionPlans) {
      for (Iterator <Map.Entry<String, RegionPlan>> i =
          this.regionPlans.entrySet().iterator(); i.hasNext();) {
        Map.Entry<String, RegionPlan> e = i.next();
        HServerInfo otherHsi = e.getValue().getDestination();
        // The HSI will be null if the region is planned for a random assign.
        if (otherHsi != null && otherHsi.equals(hsi)) {
          // Use iterator's remove else we'll get CME
          i.remove();
        }
      }
    }
View Full Code Here

    } catch (KeeperException e) {
      LOG.warn("Exception while validating RIT during split report", e);
    }
    synchronized (this.regions) {        
      //one daughter is already online, do nothing
      HServerInfo hsia = this.regions.get(a);
      if (hsia != null){
        LOG.warn("Trying to process the split of " +a.getEncodedName()+ ", " +
          "but it was already done and one daughter is on region server " + hsia);
        return;
      }
View Full Code Here

    Map<HServerInfo, List<HRegionInfo>> result = null;
    synchronized (this.regions) {
      result = new HashMap<HServerInfo, List<HRegionInfo>>(this.servers.size());
      for (Map.Entry<HServerInfo, Set<HRegionInfo>> e: this.servers.entrySet()) {
        List<HRegionInfo> shallowCopy = new ArrayList<HRegionInfo>(e.getValue());
        HServerInfo clone = new HServerInfo(e.getKey());
        // Set into server load the number of regions this server is carrying
        // The load balancer calculation needs it at least and its handy.
        clone.getLoad().setNumberOfRegions(e.getValue().size());
        result.put(clone, shallowCopy);
      }
    }
    return result;
  }
View Full Code Here

    // not yet run, or from a server whose fail we are currently processing.
    // Test its host+port combo is present in serverAddresstoServerInfo.  If it
    // is, reject the server and trigger its expiration. The next time it comes
    // in, it should have been removed from serverAddressToServerInfo and queued
    // for processing by ProcessServerShutdown.
    HServerInfo info = new HServerInfo(serverInfo);
    checkIsDead(info.getServerName(), "STARTUP");
    checkAlreadySameHostPort(info);
    checkClockSkew(info, serverCurrentTime);
    recordNewServer(info, false, null);
  }
View Full Code Here

   * @throws PleaseHoldException
   */
  void checkAlreadySameHostPort(final HServerInfo serverInfo)
  throws PleaseHoldException {
    String hostAndPort = serverInfo.getServerAddress().toString();
    HServerInfo existingServer =
      haveServerWithSameHostAndPortAlready(serverInfo.getHostnamePort());
    if (existingServer != null) {
      String message = "Server start rejected; we already have " + hostAndPort +
        " registered; existingServer=" + existingServer + ", newServer=" + serverInfo;
      LOG.info(message);
      if (existingServer.getStartCode() < serverInfo.getStartCode()) {
        LOG.info("Triggering server recovery; existingServer " +
          existingServer.getServerName() + " looks stale");
        expireServer(existingServer);
      }
      throw new PleaseHoldException(message);
    }
  }
View Full Code Here

   */
  HMsg [] regionServerReport(final HServerInfo serverInfo,
    final HMsg [] msgs, final HRegionInfo[] mostLoadedRegions)
  throws IOException {
    // Be careful. This method does returns in the middle.
    HServerInfo info = new HServerInfo(serverInfo);

    // Check if dead.  If it is, it'll get a 'You Are Dead!' exception.
    checkIsDead(info.getServerName(), "REPORT");

    // If we don't know this server, tell it shutdown.
    HServerInfo storedInfo = this.onlineServers.get(info.getServerName());
    if (storedInfo == null) {
      // Maybe we already have this host+port combo and its just different
      // start code?
      checkAlreadySameHostPort(info);
      // Just let the server in. Presume master joining a running cluster.
View Full Code Here

  /**
   * @param serverName
   * @return True if we removed server from the list.
   */
  private boolean removeServerInfo(final String serverName) {
    HServerInfo info = this.onlineServers.remove(serverName);
    if (info != null) {
      return true;
    }
    return false;
  }
View Full Code Here

TOP

Related Classes of org.apache.hadoop.hbase.HServerInfo

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.