Examples of RegionPlan


Examples of org.apache.hadoop.hbase.master.RegionPlan

            destination = serverNameWithoutCodeToServerName.get(favoredNodes.get(2));
          }
        }
       
        if (destination != null) {
          RegionPlan plan = new RegionPlan(region, currentServer, destination);
          plans.add(plan);
        }
      }
    }
    return plans;
View Full Code Here

Examples of org.apache.hadoop.hbase.master.RegionPlan

    Mockito.when(master.getAssignmentManager()).thenReturn(am);
    Mockito.when(master.getZooKeeperWatcher()).thenReturn(zkWatcher);
    Mockito.when(master.getZooKeeper()).thenReturn(zkWatcher);
   
    am.addPlan(REGIONINFO.getEncodedName(), new RegionPlan(REGIONINFO, null, SERVERNAME_A));

    zkWatcher.registerListenerFirst(am);

    addServerToDrainedList(SERVERNAME_A, onlineServers, serverManager);
View Full Code Here

Examples of org.apache.hadoop.hbase.master.RegionPlan

      if (this.skipTableStateCheck) {
        // Region may be available in enablingTableRegions during master startup only.
        if (enablingTableRegions != null && enablingTableRegions.contains(hri)) {
          regions.add(hri);
          if (sn != null && serverManager.isServerOnline(sn)) {
            this.assignmentManager.addPlan(hri.getEncodedName(), new RegionPlan(hri, null, sn));
          }
        }
      } else if (onlineRegions.contains(hri)) {
        continue;
      } else {
        regions.add(hri);
        if (sn != null && serverManager.isServerOnline(sn)) {
          this.assignmentManager.addPlan(hri.getEncodedName(), new RegionPlan(hri, null, sn));
        }
      }
    }
    return regions;
  }
View Full Code Here

Examples of org.apache.hadoop.hbase.master.RegionPlan

      if (this.retainAssignment) {
        // Region may be available in enablingTableRegions during master startup only.
        if (enablingTableRegions != null && enablingTableRegions.contains(hri)) {
          regions.add(hri);
          if (sn != null && serverManager.isServerOnline(sn)) {
            this.assignmentManager.addPlan(hri.getEncodedName(), new RegionPlan(hri, null, sn));
          }
        }
      } else if (onlineRegions.contains(hri)) {
        continue;
      } else {
View Full Code Here

Examples of org.apache.hadoop.hbase.master.RegionPlan

    for (Pair<HRegionInfo, ServerName> regionLocation : regionsInMeta) {
      HRegionInfo hri = regionLocation.getFirst();
      ServerName sn = regionLocation.getSecond();
      if (regionStates.isRegionOffline(hri)) {
        if (sn != null && serverManager.isServerOnline(sn)) {
          this.assignmentManager.addPlan(hri.getEncodedName(), new RegionPlan(hri, null, sn));
        }
        regions.add(hri);
      } else {
        if (LOG.isDebugEnabled()) {
          LOG.debug("Skipping assign for the region " + hri + " during enable table "
View Full Code Here

Examples of org.apache.hadoop.hbase.master.RegionPlan

    for (Map.Entry<ServerName, List<HRegionInfo>> e : rsToRegions
        .entrySet()) {
      final List<HRegionInfo> hris = e.getValue();
      // add a plan for each of the regions that needs to be reopened
      for (HRegionInfo hri : hris) {
        RegionPlan reOpenPlan = new RegionPlan(hri, null,
            assignmentManager.getRegionServerOfRegion(hri));
        assignmentManager.addPlan(hri.getEncodedName(), reOpenPlan);
      }
      pool.execute(new Runnable() {
        public void run() {
View Full Code Here

Examples of org.apache.hadoop.hbase.master.RegionPlan

        if (LOG.isTraceEnabled()) {
          LOG.trace("Moving Region " + region.getEncodedName() + " from server "
              + initialServer.getHostname() + " to " + newServer.getHostname());
        }
        RegionPlan rp = new RegionPlan(region, initialServer, newServer);
        plans.add(rp);
      }
    }
    return plans;
  }
View Full Code Here

Examples of org.apache.hadoop.hbase.master.RegionPlan

     
      if (this.master.isStopped()) {
        LOG.debug("Server stopped; skipping assign of " + state);
        return;
      }
      RegionPlan plan = getRegionPlan(state, forceNewPlan);
      if (plan == null) {
        LOG.debug("Unable to determine a plan to assign " + state);
        return; // Should get reassigned later when RIT times out.
      }
      try {
        LOG.debug("Assigning region " + state.getRegion().getRegionNameAsString() +
          " to " + plan.getDestination().toString());
        // Transition RegionState to PENDING_OPEN
        state.update(RegionState.State.PENDING_OPEN, System.currentTimeMillis(),
            plan.getDestination());
        // Send OPEN RPC. This can fail if the server on other end is is not up.
        // Pass the version that was obtained while setting the node to OFFLINE.
        RegionOpeningState regionOpenState = serverManager.sendRegionOpen(plan
            .getDestination(), state.getRegion(), versionOfOfflineNode);
        if (regionOpenState == RegionOpeningState.ALREADY_OPENED) {
          // Remove region from in-memory transition and unassigned node from ZK
          // While trying to enable the table the regions of the table were
          // already enabled.
          LOG.debug("ALREADY_OPENED region " + state.getRegion().getRegionNameAsString() +
              " to " + plan.getDestination().toString());
          String encodedRegionName = state.getRegion()
              .getEncodedName();
          try {
            ZKAssign.deleteOfflineNode(master.getZooKeeper(), encodedRegionName);
          } catch (KeeperException.NoNodeException e) {
            if(LOG.isDebugEnabled()){
              LOG.debug("The unassigned node "+encodedRegionName+" doesnot exist.");
            }
          } catch (KeeperException e) {
            master.abort(
                "Error deleting OFFLINED node in ZK for transition ZK node ("
                    + encodedRegionName + ")", e);
          }
          synchronized (this.regionsInTransition) {
            this.regionsInTransition.remove(plan.getRegionInfo()
                .getEncodedName());
          }
          synchronized (this.regions) {
            this.regions.put(plan.getRegionInfo(), plan.getDestination());
          }
        }
        break;
      } catch (Throwable t) {
        if (t instanceof RemoteException) {
          t = ((RemoteException) t).unwrapRemoteException();
          if (t instanceof RegionAlreadyInTransitionException) {
            String errorMsg = "Failed assignment in: " + plan.getDestination()
                + " due to " + t.getMessage();
            LOG.error(errorMsg, t);
            return;
          }
        }
        LOG.warn("Failed assignment of " +
          state.getRegion().getRegionNameAsString() + " to " +
          plan.getDestination() + ", trying to assign elsewhere instead; " +
          "retry=" + i, t);
        // Clean out plan we failed execute and one that doesn't look like it'll
        // succeed anyways; we need a new plan!
        // Transition back to OFFLINE
        state.update(RegionState.State.OFFLINE);
        // Force a new plan and reassign.  Will return null if no servers.
        if (getRegionPlan(state, plan.getDestination(), true) == null) {
          this.timeoutMonitor.setAllRegionServersOffline(true);
          LOG.warn("Unable to find a viable location to assign region " +
            state.getRegion().getRegionNameAsString());
          return;
        }
View Full Code Here

Examples of org.apache.hadoop.hbase.master.RegionPlan

      }
    }

    if (servers.isEmpty()) return null;

    RegionPlan randomPlan = new RegionPlan(state.getRegion(), null,
      balancer.randomAssignment(servers));
    boolean newPlan = false;
    RegionPlan existingPlan = null;

    synchronized (this.regionPlans) {
      existingPlan = this.regionPlans.get(encodedName);

      if (existingPlan != null && existingPlan.getDestination() != null) {
        LOG.debug("Found an existing plan for " +
            state.getRegion().getRegionNameAsString() +
       " destination server is + " + existingPlan.getDestination().toString());
      }

      if (forceNewPlan
          || existingPlan == null
          || existingPlan.getDestination() == null
          || drainingServers.contains(existingPlan.getDestination())) {
        newPlan = true;
        this.regionPlans.put(encodedName, randomPlan);
      }
    }
View Full Code Here

Examples of org.apache.hadoop.hbase.master.RegionPlan

    for (Pair<HRegionInfo, ServerName> regionLocation : regionsInMeta) {
      HRegionInfo hri = regionLocation.getFirst();
      ServerName sn = regionLocation.getSecond();
      if (!regionStates.isRegionInTransition(hri) && !regionStates.isRegionAssigned(hri)) {
        if (this.retainAssignment && sn != null && serverManager.isServerOnline(sn)) {
          this.assignmentManager.addPlan(hri.getEncodedName(), new RegionPlan(hri, null, sn));
        }
        regions.add(hri);
      } else {
        if (LOG.isDebugEnabled()) {
          LOG.debug("Skipping assign for the region " + hri + " during enable table "
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.