/** * Calls {@link #createDestinationServersList} without server to exclude. */ public List<ServerName> createDestinationServersList(){ return createDestinationServersList(null); }
@Override public List<ServerName> createDestinationServersList() { return super.createDestinationServersList(EXCLUDE_SERVERS); } }
@Override public List<ServerName> createDestinationServersList() { return super.createDestinationServersList(EXCLUDE_SERVERS); } }
List<ServerName> servers = master.getServerManager().createDestinationServersList(); for (int i = 0; servers.size() < 1; ++i) { servers = master.getServerManager().createDestinationServersList();
/** * 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); }
boolean rsgroupHasServersOnline(TableDescriptor desc) throws IOException { String groupName; try { groupName = master.getClusterSchema().getNamespace(desc.getTableName().getNamespaceAsString()) .getConfigurationValue(RSGroupInfo.NAMESPACE_DESC_PROP_GROUP); if (groupName == null) { groupName = RSGroupInfo.DEFAULT_GROUP; } } catch (MasterNotRunningException | PleaseHoldException e) { LOG.info("Master has not initialized yet; temporarily using default RSGroup '" + RSGroupInfo.DEFAULT_GROUP + "' for deploy of system table"); groupName = RSGroupInfo.DEFAULT_GROUP; } RSGroupInfo rsGroupInfo = groupAdminServer.getRSGroupInfo(groupName); if (rsGroupInfo == null) { throw new ConstraintException( "Default RSGroup (" + groupName + ") for this table's " + "namespace does not exist."); } for (ServerName onlineServer : master.getServerManager().createDestinationServersList()) { if (rsGroupInfo.getServers().contains(onlineServer.getAddress())) { return true; } } return false; }
"choosing a server at random"); exclude.add(regionState.getServerName()); final List<ServerName> destServers = this.serverManager.createDestinationServersList(exclude); dest = balancer.randomAssignment(hri, destServers); if (dest == null) {
final List<ServerName> destServers = this.serverManager.createDestinationServersList(); for (ServerName server : serversAdded) { final List<RegionInfo> regionsOnServer = this.assignmentManager.getRegionsOnServer(server);
/** * Calls {@link #createDestinationServersList} without server to exclude. */ public List<ServerName> createDestinationServersList(){ return createDestinationServersList(null); }
@Override public Boolean evaluate() throws IOException { List<ServerName> servers = sm.createDestinationServersList(); return servers != null && !servers.isEmpty(); } });
/** * Assigns specified regions retaining assignments, if any. * <p> * This is a synchronous call and will return once every region has been * assigned. If anything fails, an exception is thrown * @throws InterruptedException * @throws IOException */ public void assign(Map<HRegionInfo, ServerName> regions) throws IOException, InterruptedException { if (regions == null || regions.isEmpty()) { return; } List<ServerName> servers = serverManager.createDestinationServersList(); if (servers == null || servers.isEmpty()) { throw new IOException("Found no destination server to assign region(s)"); } // Reuse existing assignment info Map<ServerName, List<HRegionInfo>> bulkPlan = balancer.retainAssignment(regions, servers); if (bulkPlan == null) { throw new IOException("Unable to determine a plan to assign region(s)"); } assign(regions.size(), servers.size(), "retainAssignment=true", bulkPlan); }
/** * Assigns specified regions round robin, if any. * <p> * This is a synchronous call and will return once every region has been * assigned. If anything fails, an exception is thrown * @throws InterruptedException * @throws IOException */ public void assign(List<HRegionInfo> regions) throws IOException, InterruptedException { if (regions == null || regions.isEmpty()) { return; } List<ServerName> servers = serverManager.createDestinationServersList(); if (servers == null || servers.isEmpty()) { throw new IOException("Found no destination server to assign region(s)"); } // Generate a round-robin bulk assignment plan Map<ServerName, List<HRegionInfo>> bulkPlan = balancer.roundRobinAssignment(regions, servers); if (bulkPlan == null) { throw new IOException("Unable to determine a plan to assign region(s)"); } processFavoredNodes(regions); assign(regions.size(), servers.size(), "round-robin=true", bulkPlan); }
boolean rsgroupHasServersOnline(TableDescriptor desc) throws IOException { String groupName; try { groupName = master.getClusterSchema().getNamespace(desc.getTableName().getNamespaceAsString()) .getConfigurationValue(RSGroupInfo.NAMESPACE_DESC_PROP_GROUP); if (groupName == null) { groupName = RSGroupInfo.DEFAULT_GROUP; } } catch (MasterNotRunningException | PleaseHoldException e) { LOG.info("Master has not initialized yet; temporarily using default RSGroup '" + RSGroupInfo.DEFAULT_GROUP + "' for deploy of system table"); groupName = RSGroupInfo.DEFAULT_GROUP; } RSGroupInfo rsGroupInfo = groupAdminServer.getRSGroupInfo(groupName); if (rsGroupInfo == null) { throw new ConstraintException( "Default RSGroup (" + groupName + ") for this table's " + "namespace does not exist."); } for (ServerName onlineServer : master.getServerManager().createDestinationServersList()) { if (rsGroupInfo.getServers().contains(onlineServer.getAddress())) { return true; } } return false; }
boolean rsgroupHasServersOnline(TableDescriptor desc) throws IOException { String groupName = master.getClusterSchema().getNamespace(desc.getTableName().getNamespaceAsString()) .getConfigurationValue(RSGroupInfo.NAMESPACE_DESC_PROP_GROUP); if (groupName == null) { groupName = RSGroupInfo.DEFAULT_GROUP; } RSGroupInfo rsGroupInfo = groupAdminServer.getRSGroupInfo(groupName); if (rsGroupInfo == null) { throw new ConstraintException( "Default RSGroup (" + groupName + ") for this table's " + "namespace does not exist."); } for (ServerName onlineServer : master.getServerManager().createDestinationServersList()) { if (rsGroupInfo.getServers().contains(onlineServer.getAddress())) { return true; } } return false; }
serverManager.createDestinationServersList(serverToExclude);
List<ServerName> onlineServers = serverManager.createDestinationServersList(); Map<ServerName, List<HRegionInfo>> bulkPlan = env.getMasterServices().getAssignmentManager().getBalancer()
List<ServerName> onlineServers = serverManager.createDestinationServersList(); Map<ServerName, List<HRegionInfo>> bulkPlan = this.assignmentManager.getBalancer().retainAssignment(regionsToAssign, onlineServers);
LOG.info("Passed destination servername is null/empty so " + "choosing a server at random"); final List<ServerName> destServers = this.serverManager.createDestinationServersList( regionState.getServerName()); dest = balancer.randomAssignment(hri, destServers);