Skip to content

Commit

Permalink
Revert "[RSGroup] Forward-port HBASE-22658 to master branch and branc…
Browse files Browse the repository at this point in the history
…h-2.x (apache#1326)"

Reason: Invalid, branch-2 and master is different in RSGroup module.

This reverts commit 27c1f2f
  • Loading branch information
Reidddddd committed Mar 24, 2020
1 parent 27c1f2f commit 0bff130
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 161 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.EnumSet;
import java.util.Iterator;
Expand Down Expand Up @@ -61,8 +60,6 @@
import org.apache.hadoop.hbase.client.Scan;
import org.apache.hadoop.hbase.client.Table;
import org.apache.hadoop.hbase.filter.FirstKeyOnlyFilter;
import org.apache.hadoop.hbase.net.Address;
import org.apache.hadoop.hbase.rsgroup.RSGroupInfo;
import org.apache.yetus.audience.InterfaceAudience;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
Expand Down Expand Up @@ -419,9 +416,7 @@ public boolean unload() throws InterruptedException, ExecutionException, Timeout
try {
// Get Online RegionServers
List<ServerName> regionServers = new ArrayList<>();
RSGroupInfo rsgroup = admin.getRSGroup(Address.fromParts(hostname, port));
LOG.info("{} belongs to {}", hostname, rsgroup.getName());
regionServers.addAll(filterRSGroupServers(rsgroup, admin.getRegionServers()));
regionServers.addAll(admin.getRegionServers());
// Remove the host Region server from target Region Servers list
ServerName server = stripServer(regionServers, hostname, port);
if (server == null) {
Expand All @@ -436,8 +431,6 @@ public boolean unload() throws InterruptedException, ExecutionException, Timeout
if (regionServers.isEmpty()) {
LOG.warn("No Regions were moved - no servers available");
return false;
} else {
LOG.info("Available servers {}", regionServers);
}
unloadRegions(server, regionServers, movedRegions);
} catch (Exception e) {
Expand All @@ -453,22 +446,6 @@ public boolean unload() throws InterruptedException, ExecutionException, Timeout
return waitTaskToFinish(unloadPool, unloadTask, "unloading");
}

@VisibleForTesting
Collection<ServerName> filterRSGroupServers(RSGroupInfo rsgroup,
Collection<ServerName> onlineServers) {
if (rsgroup.getName().equals(RSGroupInfo.DEFAULT_GROUP)) {
return onlineServers;
}
List<ServerName> serverLists = new ArrayList<>(rsgroup.getServers().size());
for (ServerName server : onlineServers) {
Address address = Address.fromParts(server.getHostname(), server.getPort());
if (rsgroup.containsServer(address)) {
serverLists.add(server);
}
}
return serverLists;
}

private void unloadRegions(ServerName server, List<ServerName> regionServers,
List<RegionInfo> movedRegions) throws Exception {
while (true) {
Expand Down Expand Up @@ -813,4 +790,4 @@ public static void main(String[] args) {
mover.doStaticMain(args);
}
}
}
}

This file was deleted.

0 comments on commit 0bff130

Please sign in to comment.