protected TransitRegionStateProcedure createAssignProcedure(RegionInfo hri) { return am.createAssignProcedures(Arrays.asList(hri))[0]; }
/** * Create round-robin assigns. Use on table creation to distribute out regions across cluster. * @return AssignProcedures made out of the passed in <code>hris</code> and a call to the balancer * to populate the assigns with targets chosen using round-robin (default balancer * scheme). If at assign-time, the target chosen is no longer up, thats fine, the * AssignProcedure will ask the balancer for a new target, and so on. */ public TransitRegionStateProcedure[] createRoundRobinAssignProcedures(List<RegionInfo> hris, List<ServerName> serversToExclude) { if (hris.isEmpty()) { return new TransitRegionStateProcedure[0]; } if (serversToExclude != null && this.master.getServerManager().getOnlineServersList().size() == 1) { LOG.debug("Only one region server found and hence going ahead with the assignment"); serversToExclude = null; } try { // Ask the balancer to assign our regions. Pass the regions en masse. The balancer can do // a better job if it has all the assignments in the one lump. Map<ServerName, List<RegionInfo>> assignments = getBalancer().roundRobinAssignment(hris, this.master.getServerManager().createDestinationServersList(serversToExclude)); // Return mid-method! return createAssignProcedures(assignments); } catch (HBaseIOException hioe) { LOG.warn("Failed roundRobinAssignment", hioe); } // If an error above, fall-through to this simpler assign. Last resort. return createAssignProcedures(hris); }
LOG.info("Going to assign meta"); addChildProcedure(env.getAssignmentManager() .createAssignProcedures(Arrays.asList(RegionInfoBuilder.FIRST_META_REGIONINFO))); setNextState(InitMetaState.INIT_META_CREATE_NAMESPACES); return Flow.HAS_MORE_STATE;
addChildProcedure(env.getAssignmentManager().createAssignProcedures(regionsOfTable)); setNextState(EnableTableState.ENABLE_TABLE_SET_ENABLED_TABLE_STATE); break;