Skip to content

Commit 99e4e3e

Browse files
authored
HBASE-27082 Change the return value of RSGroupInfo.getServers from SortedSet to Set to keep compatibility (#4480)
Signed-off-by: Andrew Purtell <[email protected]>
1 parent 540fe8b commit 99e4e3e

File tree

3 files changed

+7
-6
lines changed

3 files changed

+7
-6
lines changed

hbase-common/src/main/java/org/apache/hadoop/hbase/rsgroup/RSGroupInfo.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
import java.util.HashMap;
2323
import java.util.Map;
2424
import java.util.Objects;
25+
import java.util.Set;
2526
import java.util.SortedSet;
2627
import java.util.TreeSet;
2728
import org.apache.hadoop.hbase.TableName;
@@ -55,7 +56,7 @@ public RSGroupInfo(String name) {
5556
this(name, new TreeSet<Address>(), new TreeSet<TableName>());
5657
}
5758

58-
RSGroupInfo(String name, SortedSet<Address> servers) {
59+
RSGroupInfo(String name, Set<Address> servers) {
5960
this.name = name;
6061
this.servers = servers == null ? new TreeSet<>() : new TreeSet<>(servers);
6162
this.tables = new TreeSet<>();
@@ -67,7 +68,7 @@ public RSGroupInfo(String name) {
6768
* stored in the configuration of a table so this will be removed.
6869
*/
6970
@Deprecated
70-
RSGroupInfo(String name, SortedSet<Address> servers, SortedSet<TableName> tables) {
71+
RSGroupInfo(String name, Set<Address> servers, Set<TableName> tables) {
7172
this.name = name;
7273
this.servers = (servers == null) ? new TreeSet<>() : new TreeSet<>(servers);
7374
this.tables = (tables == null) ? new TreeSet<>() : new TreeSet<>(tables);
@@ -110,7 +111,7 @@ public boolean containsServer(Address hostPort) {
110111
/**
111112
* Get list of servers.
112113
*/
113-
public SortedSet<Address> getServers() {
114+
public Set<Address> getServers() {
114115
return servers;
115116
}
116117

hbase-server/src/test/java/org/apache/hadoop/hbase/rsgroup/TestRSGroupsAdmin2.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -718,7 +718,7 @@ public boolean evaluate() throws Exception {
718718
ADMIN.addRSGroup(rsGroup2);
719719

720720
long startTime = EnvironmentEdgeManager.currentTime();
721-
ADMIN.moveServersToRSGroup(Sets.newHashSet(newGroup.getServers().first()), rsGroup2);
721+
ADMIN.moveServersToRSGroup(Sets.newHashSet(newGroup.getServers().iterator().next()), rsGroup2);
722722
long timeTaken = EnvironmentEdgeManager.currentTime() - startTime;
723723
String msg =
724724
"Should not take mote than 15000 ms to move a table with 100 regions. Time taken ="

hbase-server/src/test/java/org/apache/hadoop/hbase/rsgroup/TestUpdateRSGroupConfiguration.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ public void testCustomOnlineConfigChangeInRSGroup() throws Exception {
100100
Configuration regionServerConfiguration = TEST_UTIL.getMiniHBaseCluster()
101101
.getLiveRegionServerThreads().stream().map(JVMClusterUtil.RegionServerThread::getRegionServer)
102102
.filter(regionServer -> (regionServer.getServerName().getAddress()
103-
.equals(testRSGroup.getServers().first())))
103+
.equals(testRSGroup.getServers().iterator().next())))
104104
.collect(Collectors.toList()).get(0).getConfiguration();
105105
int custom = regionServerConfiguration.getInt("hbase.custom.config", 0);
106106
assertEquals(1000, custom);
@@ -109,7 +109,7 @@ public void testCustomOnlineConfigChangeInRSGroup() throws Exception {
109109
regionServerConfiguration = TEST_UTIL.getMiniHBaseCluster().getLiveRegionServerThreads()
110110
.stream().map(JVMClusterUtil.RegionServerThread::getRegionServer)
111111
.filter(regionServer -> (regionServer.getServerName().getAddress()
112-
.equals(test2RSGroup.getServers().first())))
112+
.equals(test2RSGroup.getServers().iterator().next())))
113113
.collect(Collectors.toList()).get(0).getConfiguration();
114114
custom = regionServerConfiguration.getInt("hbase.custom.config", 0);
115115
assertEquals(0, custom);

0 commit comments

Comments
 (0)