Package org.apache.hadoop.hbase

Examples of org.apache.hadoop.hbase.HServerInfo


    /** {@inheritDoc} */
    public void leaseExpired() {
      LOG.info(server + " lease expired");
      // Remove the server from the known servers list and update load info
      HServerInfo info = serversToServerInfo.remove(server);
      if (info != null) {
        HServerAddress root = master.getRootRegionLocation();
        if (root != null && root.equals(info.getServerAddress())) {
          master.regionManager.unassignRootRegion();
        }
        String serverName = info.getServerAddress().toString();
        HServerLoad load = serversToLoad.remove(serverName);
        if (load != null) {
          synchronized (loadToServers) {
            Set<String> servers = loadToServers.get(load);
            if (servers != null) {
View Full Code Here


      regionManager.noLongerUnassigned(info);
      regionManager.noLongerPending(info.getRegionName());
      return;
    }
    HServerInfo storedInfo = null;
    boolean deadServer = false;
    if (serverName.length() != 0) {
     
      if (regionManager.isMarkedToClose(serverName, info.getRegionName())) {
        // Skip if region is on kill list
        if(LOG.isDebugEnabled()) {
          LOG.debug("not assigning region (on kill list): " +
            info.getRegionNameAsString());
        }
        return;
      }
     
      storedInfo = master.serverManager.getServerInfo(serverName);
      deadServer = master.serverManager.isDead(serverName);
    }

    /*
     * If the server is a dead server or its startcode is off -- either null
     * or doesn't match the start code for the address -- then add it to the
     * list of unassigned regions IF not already there (or pending open).
     */
    if (!deadServer && !regionManager.isUnassigned(info) &&
          !regionManager.isPending(info.getRegionName())
        && (storedInfo == null || storedInfo.getStartCode() != startCode)) {
      // The current assignment is invalid
      if (LOG.isDebugEnabled()) {
        LOG.debug("Current assignment of " +
          info.getRegionNameAsString() +
          " is not valid: serverInfo: " + storedInfo + ", passed startCode: " +
          startCode + ", storedInfo.startCode: " +
          ((storedInfo != null)? storedInfo.getStartCode(): -1) +
          ", unassignedRegions: " +
          regionManager.isUnassigned(info) +
          ", pendingRegions: " +
          regionManager.isPending(info.getRegionName()));
      }
View Full Code Here

      address.getPort(), conf.getInt("hbase.regionserver.handler.count", 10),
      false, conf);
    this.server.setErrorHandler(this);
    // Address is giving a default IP for the moment. Will be changed after
    // calling the master.
    this.serverInfo = new HServerInfo(new HServerAddress(
      new InetSocketAddress(address.getBindAddress(),
      this.server.getListenerAddress().getPort())), System.currentTimeMillis(),
      this.conf.getInt("hbase.regionserver.info.port", 60030), machineName);
    if (this.serverInfo.getServerAddress() == null) {
      throw new NullPointerException("Server address cannot be null; " +
View Full Code Here

   */
  @Override
  @QosPriority(priority=HConstants.HIGH_QOS)
  public HServerInfo getHServerInfo() throws IOException {
    checkOpen();
    return new HServerInfo(new HServerAddress(this.isa),
      this.startcode, this.rsInfo.getInfoPort());
  }
View Full Code Here

   */
  @Override
  @QosPriority(priority=HConstants.HIGH_QOS)
  public HServerInfo getHServerInfo() throws IOException {
    checkOpen();
    return new HServerInfo(new HServerAddress(this.isa),
      this.startcode, this.rsInfo.getInfoPort());
  }
View Full Code Here

   */
  @Override
  @QosPriority(priority=HConstants.HIGH_QOS)
  public HServerInfo getHServerInfo() throws IOException {
    checkOpen();
    return new HServerInfo(new HServerAddress(this.isa),
      this.startcode, this.rsInfo.getInfoPort());
  }
View Full Code Here

   */
  @Override
  @QosPriority(priority=HConstants.HIGH_QOS)
  public HServerInfo getHServerInfo() throws IOException {
    checkOpen();
    return new HServerInfo(new HServerAddress(this.isa),
      this.startcode, this.webuiport);
  }
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);
    String hostAndPort = info.getServerAddress().toString();
    HServerInfo existingServer = haveServerWithSameHostAndPortAlready(info.getHostnamePort());
    if (existingServer != null) {
      String message = "Server start rejected; we already have " + hostAndPort +
        " registered; existingServer=" + existingServer + ", newServer=" + info;
      LOG.info(message);
      if (existingServer.getStartCode() < info.getStartCode()) {
        LOG.info("Triggering server recovery; existingServer looks stale");
        expireServer(existingServer);
      }
      throw new PleaseHoldException(message);
    }
View Full Code Here

    HServerLoad load = useInfoLoad ? info.getLoad() : new HServerLoad();
    String serverName = info.getServerName();
    info.setLoad(load);
    // We must set this watcher here because it can be set on a fresh start
    // or on a failover
    Watcher watcher = new ServerExpirer(new HServerInfo(info));
    this.master.getZooKeeperWrapper().updateRSLocationGetWatch(info, watcher);
    this.serversToServerInfo.put(serverName, info);
    this.serversToLoad.put(serverName, load);
    synchronized (this.loadToServers) {
      Set<String> servers = this.loadToServers.get(load);
View Full Code Here

   * @throws IOException
   */
  HMsg [] regionServerReport(final HServerInfo serverInfo,
    final HMsg msgs[], final HRegionInfo[] mostLoadedRegions)
  throws IOException {
    HServerInfo info = new HServerInfo(serverInfo);
    checkIsDead(info.getServerName(), "REPORT");
    if (msgs.length > 0) {
      if (msgs[0].isType(HMsg.Type.MSG_REPORT_EXITING)) {
        processRegionServerExit(info, msgs);
        return HMsg.EMPTY_HMSG_ARRAY;
      } else if (msgs[0].isType(HMsg.Type.MSG_REPORT_QUIESCED)) {
        LOG.info("Region server " + info.getServerName() + " quiesced");
        this.quiescedServers.incrementAndGet();
      }
    }
    if (this.master.getShutdownRequested().get()) {
      if (quiescedServers.get() >= serversToServerInfo.size()) {
        // If the only servers we know about are meta servers, then we can
        // proceed with shutdown
        LOG.info("All user tables quiesced. Proceeding with shutdown");
        this.master.startShutdown();
      }
      if (!this.master.isClosed()) {
        if (msgs.length > 0 &&
            msgs[0].isType(HMsg.Type.MSG_REPORT_QUIESCED)) {
          // Server is already quiesced, but we aren't ready to shut down
          // return empty response
          return HMsg.EMPTY_HMSG_ARRAY;
        }
        // Tell the server to stop serving any user regions
        return new HMsg [] {HMsg.REGIONSERVER_QUIESCE};
      }
    }
    if (this.master.isClosed()) {
      // Tell server to shut down if we are shutting down.  This should
      // happen after check of MSG_REPORT_EXITING above, since region server
      // will send us one of these messages after it gets MSG_REGIONSERVER_STOP
      return new HMsg [] {HMsg.REGIONSERVER_STOP};
    }

    HServerInfo storedInfo = this.serversToServerInfo.get(info.getServerName());
    if (storedInfo == null) {
      LOG.warn("Received report from unknown server -- telling it " +
        "to " + HMsg.REGIONSERVER_STOP + ": " + info.getServerName());
      // The HBaseMaster may have been restarted.
      // Tell the RegionServer to abort!
      return new HMsg[] {HMsg.REGIONSERVER_STOP};
    } else if (storedInfo.getStartCode() != info.getStartCode()) {
      // This state is reachable if:
      //
      // 1) RegionServer A started
      // 2) RegionServer B started on the same machine, then
      //    clobbered A in regionServerStartup.
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.