@Override public void moveServersAndTables(Set<Address> servers, Set<TableName> tables, String targetGroup) throws IOException { if (servers == null || servers.isEmpty()) { throw new ConstraintException("The list of servers to move cannot be null or empty."); } if (tables == null || tables.isEmpty()) { throw new ConstraintException("The list of tables to move cannot be null or empty."); } //check target group getAndCheckRSGroupInfo(targetGroup); // Hold a lock on the manager instance while moving servers and tables to prevent // another writer changing our state while we are working. synchronized (rsGroupInfoManager) { //check servers and tables status checkServersAndTables(servers, tables, targetGroup); //Move servers and tables to a new group. String srcGroup = getRSGroupOfServer(servers.iterator().next()).getName(); rsGroupInfoManager.moveServersAndTables(servers, tables, srcGroup, targetGroup); //move regions which should not belong to these tables moveRegionsFromServers(servers, tables, targetGroup); //move regions which should belong to these servers moveRegionsToServers(servers, tables, targetGroup); } LOG.info("Move servers and tables done. Severs :" + servers + " , Tables : " + tables + " => " + targetGroup); }
RSGroupInfo targetGrp = getAndCheckRSGroupInfo(targetGroupName);
@Override public void moveServersAndTables(Set<Address> servers, Set<TableName> tables, String targetGroup) throws IOException { if (servers == null || servers.isEmpty()) { throw new ConstraintException("The list of servers to move cannot be null or empty."); } if (tables == null || tables.isEmpty()) { throw new ConstraintException("The list of tables to move cannot be null or empty."); } //check target group getAndCheckRSGroupInfo(targetGroup); // Hold a lock on the manager instance while moving servers and tables to prevent // another writer changing our state while we are working. synchronized (rsGroupInfoManager) { //check servers and tables status checkServersAndTables(servers, tables, targetGroup); //Move servers and tables to a new group. String srcGroup = getRSGroupOfServer(servers.iterator().next()).getName(); rsGroupInfoManager.moveServersAndTables(servers, tables, srcGroup, targetGroup); //move regions which should not belong to these tables moveRegionsFromServers(servers, tables, targetGroup); //move regions which should belong to these servers moveRegionsToServers(servers, tables, targetGroup); } LOG.info("Move servers and tables done. Severs :" + servers + " , Tables : " + tables + " => " + targetGroup); }
RSGroupInfo targetGrp = getAndCheckRSGroupInfo(targetGroupName);
RSGroupInfo targetGrp = getAndCheckRSGroupInfo(targetGroupName);