HBASE-27082 Change the return value of RSGroupInfo.getServers from SortedSet to Set to keep compatibility (#4480)

Signed-off-by: Andrew Purtell <apurtell@apache.org>
This commit is contained in:
Duo Zhang 2022-06-01 23:30:52 +08:00 committed by GitHub
parent 540fe8bbfa
commit 99e4e3ea3e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 6 deletions

View File

@ -22,6 +22,7 @@ import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
import java.util.Set;
import java.util.SortedSet;
import java.util.TreeSet;
import org.apache.hadoop.hbase.TableName;
@ -55,7 +56,7 @@ public class RSGroupInfo {
this(name, new TreeSet<Address>(), new TreeSet<TableName>());
}
RSGroupInfo(String name, SortedSet<Address> servers) {
RSGroupInfo(String name, Set<Address> servers) {
this.name = name;
this.servers = servers == null ? new TreeSet<>() : new TreeSet<>(servers);
this.tables = new TreeSet<>();
@ -67,7 +68,7 @@ public class RSGroupInfo {
* stored in the configuration of a table so this will be removed.
*/
@Deprecated
RSGroupInfo(String name, SortedSet<Address> servers, SortedSet<TableName> tables) {
RSGroupInfo(String name, Set<Address> servers, Set<TableName> tables) {
this.name = name;
this.servers = (servers == null) ? new TreeSet<>() : new TreeSet<>(servers);
this.tables = (tables == null) ? new TreeSet<>() : new TreeSet<>(tables);
@ -110,7 +111,7 @@ public class RSGroupInfo {
/**
* Get list of servers.
*/
public SortedSet<Address> getServers() {
public Set<Address> getServers() {
return servers;
}

View File

@ -718,7 +718,7 @@ public class TestRSGroupsAdmin2 extends TestRSGroupsBase {
ADMIN.addRSGroup(rsGroup2);
long startTime = EnvironmentEdgeManager.currentTime();
ADMIN.moveServersToRSGroup(Sets.newHashSet(newGroup.getServers().first()), rsGroup2);
ADMIN.moveServersToRSGroup(Sets.newHashSet(newGroup.getServers().iterator().next()), rsGroup2);
long timeTaken = EnvironmentEdgeManager.currentTime() - startTime;
String msg =
"Should not take mote than 15000 ms to move a table with 100 regions. Time taken ="

View File

@ -100,7 +100,7 @@ public class TestUpdateRSGroupConfiguration extends TestRSGroupsBase {
Configuration regionServerConfiguration = TEST_UTIL.getMiniHBaseCluster()
.getLiveRegionServerThreads().stream().map(JVMClusterUtil.RegionServerThread::getRegionServer)
.filter(regionServer -> (regionServer.getServerName().getAddress()
.equals(testRSGroup.getServers().first())))
.equals(testRSGroup.getServers().iterator().next())))
.collect(Collectors.toList()).get(0).getConfiguration();
int custom = regionServerConfiguration.getInt("hbase.custom.config", 0);
assertEquals(1000, custom);
@ -109,7 +109,7 @@ public class TestUpdateRSGroupConfiguration extends TestRSGroupsBase {
regionServerConfiguration = TEST_UTIL.getMiniHBaseCluster().getLiveRegionServerThreads()
.stream().map(JVMClusterUtil.RegionServerThread::getRegionServer)
.filter(regionServer -> (regionServer.getServerName().getAddress()
.equals(test2RSGroup.getServers().first())))
.equals(test2RSGroup.getServers().iterator().next())))
.collect(Collectors.toList()).get(0).getConfiguration();
custom = regionServerConfiguration.getInt("hbase.custom.config", 0);
assertEquals(0, custom);