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> Conflicts: hbase-common/src/main/java/org/apache/hadoop/hbase/rsgroup/RSGroupInfo.java hbase-rsgroup/src/test/java/org/apache/hadoop/hbase/rsgroup/TestRSGroupsAdmin2.java hbase-rsgroup/src/test/java/org/apache/hadoop/hbase/rsgroup/TestUpdateRSGroupConfiguration.java
This commit is contained in:
parent
b7158a87ea
commit
267e9fa48a
|
@ -47,10 +47,22 @@ public class RSGroupInfo {
|
||||||
private final Map<String, String> configuration;
|
private final Map<String, String> configuration;
|
||||||
|
|
||||||
public RSGroupInfo(String name) {
|
public RSGroupInfo(String name) {
|
||||||
this(name, new TreeSet<>(), new TreeSet<>());
|
this(name, new TreeSet<Address>(), new TreeSet<TableName>());
|
||||||
}
|
}
|
||||||
|
|
||||||
RSGroupInfo(String name, SortedSet<Address> servers, SortedSet<TableName> tables) {
|
RSGroupInfo(String name, Set<Address> servers) {
|
||||||
|
this.name = name;
|
||||||
|
this.servers = servers == null ? new TreeSet<>() : new TreeSet<>(servers);
|
||||||
|
this.tables = new TreeSet<>();
|
||||||
|
configuration = new HashMap<>();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @deprecated Since 3.0.0, will be removed in 4.0.0. The rsgroup information for a table will be
|
||||||
|
* stored in the configuration of a table so this will be removed.
|
||||||
|
*/
|
||||||
|
@Deprecated
|
||||||
|
RSGroupInfo(String name, Set<Address> servers, Set<TableName> tables) {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
this.servers = (servers == null) ? new TreeSet<>() : new TreeSet<>(servers);
|
this.servers = (servers == null) ? new TreeSet<>() : new TreeSet<>(servers);
|
||||||
this.tables = (tables == null) ? new TreeSet<>() : new TreeSet<>(tables);
|
this.tables = (tables == null) ? new TreeSet<>() : new TreeSet<>(tables);
|
||||||
|
|
|
@ -664,7 +664,7 @@ public class TestRSGroupsAdmin2 extends TestRSGroupsBase {
|
||||||
return getTableRegionMap().get(tableName).size() >= tableRegionCount;
|
return getTableRegionMap().get(tableName).size() >= tableRegionCount;
|
||||||
});
|
});
|
||||||
long startTime = EnvironmentEdgeManager.currentTime();
|
long startTime = EnvironmentEdgeManager.currentTime();
|
||||||
rsGroupAdmin.moveTables(Sets.newHashSet(tableName), newGroup.getName());
|
rsGroupAdmin.moveServers(Sets.newHashSet(newGroup.getServers().iterator().next()), newGroup.getName());
|
||||||
long timeTaken = EnvironmentEdgeManager.currentTime() - startTime;
|
long timeTaken = EnvironmentEdgeManager.currentTime() - startTime;
|
||||||
String msg =
|
String msg =
|
||||||
"Should not take mote than 15000 ms to move a table with 100 regions. Time taken ="
|
"Should not take mote than 15000 ms to move a table with 100 regions. Time taken ="
|
||||||
|
|
|
@ -17,10 +17,14 @@
|
||||||
*/
|
*/
|
||||||
package org.apache.hadoop.hbase.rsgroup;
|
package org.apache.hadoop.hbase.rsgroup;
|
||||||
|
|
||||||
|
import static org.junit.Assert.assertEquals;
|
||||||
import static org.junit.Assert.fail;
|
import static org.junit.Assert.fail;
|
||||||
|
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
import org.apache.hadoop.conf.Configuration;
|
||||||
import org.apache.hadoop.hbase.HBaseClassTestRule;
|
import org.apache.hadoop.hbase.HBaseClassTestRule;
|
||||||
import org.apache.hadoop.hbase.testclassification.MediumTests;
|
import org.apache.hadoop.hbase.testclassification.MediumTests;
|
||||||
|
import org.apache.hadoop.hbase.util.JVMClusterUtil;
|
||||||
import org.junit.After;
|
import org.junit.After;
|
||||||
import org.junit.AfterClass;
|
import org.junit.AfterClass;
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
|
@ -85,7 +89,36 @@ public class TestUpdateRSGroupConfiguration extends TestRSGroupsBase {
|
||||||
@Test
|
@Test
|
||||||
@Ignore
|
@Ignore
|
||||||
public void testCustomOnlineConfigChangeInRSGroup() throws Exception {
|
public void testCustomOnlineConfigChangeInRSGroup() throws Exception {
|
||||||
// Test contents removed on branch-2.5 and branch-2.
|
// Check the default configuration of the RegionServers
|
||||||
|
TEST_UTIL.getMiniHBaseCluster().getRegionServerThreads().forEach(thread -> {
|
||||||
|
Configuration conf = thread.getRegionServer().getConfiguration();
|
||||||
|
assertEquals(0, conf.getInt("hbase.custom.config", 0));
|
||||||
|
});
|
||||||
|
|
||||||
|
replaceHBaseSiteXML();
|
||||||
|
RSGroupInfo testRSGroup = addGroup(TEST_GROUP, 1);
|
||||||
|
RSGroupInfo test2RSGroup = addGroup(TEST2_GROUP, 1);
|
||||||
|
rsGroupAdmin.updateConfiguration(TEST_GROUP);
|
||||||
|
|
||||||
|
// Check the configuration of the RegionServer in test rsgroup, should be update
|
||||||
|
Configuration regionServerConfiguration = TEST_UTIL.getMiniHBaseCluster()
|
||||||
|
.getLiveRegionServerThreads().stream().map(JVMClusterUtil.RegionServerThread::getRegionServer)
|
||||||
|
.filter(regionServer -> (regionServer.getServerName().getAddress()
|
||||||
|
.equals(testRSGroup.getServers().iterator().next())))
|
||||||
|
.collect(Collectors.toList()).get(0).getConfiguration();
|
||||||
|
int custom = regionServerConfiguration.getInt("hbase.custom.config", 0);
|
||||||
|
assertEquals(1000, custom);
|
||||||
|
|
||||||
|
// Check the configuration of the RegionServer in test2 rsgroup, should not be update
|
||||||
|
regionServerConfiguration = TEST_UTIL.getMiniHBaseCluster().getLiveRegionServerThreads()
|
||||||
|
.stream().map(JVMClusterUtil.RegionServerThread::getRegionServer)
|
||||||
|
.filter(regionServer -> (regionServer.getServerName().getAddress()
|
||||||
|
.equals(test2RSGroup.getServers().iterator().next())))
|
||||||
|
.collect(Collectors.toList()).get(0).getConfiguration();
|
||||||
|
custom = regionServerConfiguration.getInt("hbase.custom.config", 0);
|
||||||
|
assertEquals(0, custom);
|
||||||
|
|
||||||
|
restoreHBaseSiteXML();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue