Package org.apache.hadoop.hbase

Examples of org.apache.hadoop.hbase.HServerLoad


      throw new Leases.LeaseStillHeldException(serverName);
    }
   
    LOG.info("Received start message from: " + serverName);
    // Go on to process the regionserver registration.
    HServerLoad load = serversToLoad.remove(serverName);
    if (load != null) {
      // The startup message was from a known server.
      // Remove stale information about the server's load.
      synchronized (loadToServers) {
        Set<String> servers = loadToServers.get(load);
View Full Code Here


   * @param info The region server informations
   * @param useInfoLoad True if the load from the info should be used
   *                    like under a master failover
   */
  public void recordNewServer(HServerInfo info, boolean useInfoLoad) {
    HServerLoad load = useInfoLoad ? info.getLoad() : new HServerLoad();
    String serverName = HServerInfo.getServerName(info);
    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(serverName, info.getServerAddress());
View Full Code Here

      final HRegionInfo[] mostLoadedRegions, HMsg[] msgs)
  throws IOException {
    // Refresh the info object and the load information
    serverAddressToServerInfo.put(serverInfo.getServerAddress(), serverInfo);
    serversToServerInfo.put(serverInfo.getServerName(), serverInfo);
    HServerLoad load = serversToLoad.get(serverInfo.getServerName());
    if (load != null) {
      this.master.getMetrics().incrementRequests(load.getNumberOfRequests());
      if (!load.equals(serverInfo.getLoad())) {
        // We have previous information about the load on this server
        // and the load on this server has changed
        synchronized (loadToServers) {
          Set<String> servers = loadToServers.get(load);
          // Note that servers should never be null because loadToServers
View Full Code Here

      master.regionManager.offlineMetaServer(info.getServerAddress());

      infoUpdated = true;

      // update load information
      HServerLoad load = serversToLoad.remove(serverName);
      if (load != null) {
        synchronized (loadToServers) {
          Set<String> servers = loadToServers.get(load);
          if (servers != null) {
            servers.remove(serverName);
View Full Code Here

        // Remove the server from the known servers list and update load info
        serverAddressToServerInfo.remove(serverAddress);
        HServerInfo info = serversToServerInfo.remove(server);
        if (info != null) {
          String serverName = HServerInfo.getServerName(info);
          HServerLoad load = serversToLoad.remove(serverName);
          if (load != null) {
            synchronized (loadToServers) {
              Set<String> servers = loadToServers.get(load);
              if (servers != null) {
                servers.remove(serverName);
View Full Code Here

      StorageClusterStatusModel model = new StorageClusterStatusModel();
      model.setRegions(status.getRegionsCount());
      model.setRequests(status.getRequestsCount());
      model.setAverageLoad(status.getAverageLoad());
      for (HServerInfo info: status.getServerInfo()) {
        HServerLoad load = info.getLoad();
        StorageClusterStatusModel.Node node =
          model.addLiveNode(
            info.getServerAddress().getHostname() + ":" +
            Integer.toString(info.getServerAddress().getPort()),
            info.getStartCode(), load.getUsedHeapMB(),
            load.getMaxHeapMB());
        node.setRequests(load.getNumberOfRequests());
        for (HServerLoad.RegionLoad region: load.getRegionsLoad()) {
          node.addRegion(region.getName(), region.getStores(),
            region.getStorefiles(), region.getStorefileSizeMB(),
            region.getMemStoreSizeMB(), region.getStorefileIndexSizeMB());
        }
      }
View Full Code Here

   * @param mostLoadedRegions
   * @param returnMsgs
   */
  void assignRegions(HServerInfo info, HRegionInfo[] mostLoadedRegions,
      ArrayList<HMsg> returnMsgs) {
    HServerLoad thisServersLoad = info.getLoad();
    boolean isSingleServer = master.serverManager.numServers() == 1;

    // figure out what regions need to be assigned and aren't currently being
    // worked on elsewhere.
    Set<RegionState> regionsToAssign = regionsAwaitingAssignment(info.getServerAddress(),
View Full Code Here

    nRegionsToAssign -= nregions;
    if (nRegionsToAssign > 0 || isMetaAssign) {
      // We still have more regions to assign. See how many we can assign
      // before this server becomes more heavily loaded than the next
      // most heavily loaded server.
      HServerLoad heavierLoad = new HServerLoad();
      int nservers = computeNextHeaviestLoad(thisServersLoad, heavierLoad);

      nregions = 0;
     
      // Advance past any less-loaded servers
      for (HServerLoad load = new HServerLoad(thisServersLoad);
        load.compareTo(heavierLoad) <= 0 && nregions < nRegionsToAssign;
        load.setNumberOfRegions(load.getNumberOfRegions() + 1), nregions++) {
        // continue;
      }

      LOG.debug("Doing for " + info + " nregions: " + nregions +
      " and nRegionsToAssign: " + nRegionsToAssign);
View Full Code Here

          }
          try {
            doMetrics();
            MemoryUsage memory =
                ManagementFactory.getMemoryMXBean().getHeapMemoryUsage();
            HServerLoad hsl = new HServerLoad(requestCount.get(),
              (int)(memory.getUsed()/1024/1024),
              (int)(memory.getMax()/1024/1024));
            for (HRegion r: onlineRegions.values()) {
              hsl.addRegionInfo(createRegionLoad(r));
            }
            this.serverInfo.setLoad(hsl);
            this.requestCount.set(0);
            HMsg msgs[] = hbaseMaster.regionServerReport(
              serverInfo, outboundArray, getMostLoadedRegions());
View Full Code Here

    // Pretend that we will assign regions to these more lightly loaded servers
    // until they reach load equal with ours. Then, see how many regions are left
    // unassigned. That is how many regions we should assign to this server.
    int nRegions = 0;
    for (Map.Entry<HServerLoad, Set<String>> e : lightServers.entrySet()) {
      HServerLoad lightLoad = new HServerLoad(e.getKey());
      do {
        lightLoad.setNumberOfRegions(lightLoad.getNumberOfRegions() + 1);
        nRegions += 1;
      } while (lightLoad.compareTo(thisServersLoad) <= 0
          && nRegions < numUnassignedRegions);

      nRegions *= e.getValue().size();
      if (nRegions >= numUnassignedRegions) {
        break;
View Full Code Here

TOP

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

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.