-
Notifications
You must be signed in to change notification settings - Fork 3.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
HBASE-25682 Add a new command to update the configuration of all RSs …
…in a RSGroup for branch-2 (#3106) * HBASE-25682 Add a new command to update the configuration of all RSs in a RSGroup Signed-off-by: Pankaj Kumar<[email protected]>
- Loading branch information
Showing
11 changed files
with
356 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
122 changes: 122 additions & 0 deletions
122
...rsgroup/src/test/java/org/apache/hadoop/hbase/rsgroup/TestUpdateRSGroupConfiguration.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,122 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one | ||
* or more contributor license agreements. See the NOTICE file | ||
* distributed with this work for additional information | ||
* regarding copyright ownership. The ASF licenses this file | ||
* to you under the Apache License, Version 2.0 (the | ||
* "License"); you may not use this file except in compliance | ||
* with the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package org.apache.hadoop.hbase.rsgroup; | ||
|
||
import static org.junit.Assert.assertEquals; | ||
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.testclassification.MediumTests; | ||
import org.apache.hadoop.hbase.util.JVMClusterUtil; | ||
import org.junit.After; | ||
import org.junit.AfterClass; | ||
import org.junit.Before; | ||
import org.junit.BeforeClass; | ||
import org.junit.ClassRule; | ||
import org.junit.Test; | ||
import org.junit.experimental.categories.Category; | ||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
|
||
@Category(MediumTests.class) | ||
public class TestUpdateRSGroupConfiguration extends TestRSGroupsBase { | ||
protected static final Logger LOG = LoggerFactory.getLogger(TestUpdateRSGroupConfiguration.class); | ||
|
||
@ClassRule | ||
public static final HBaseClassTestRule CLASS_RULE = | ||
HBaseClassTestRule.forClass(TestUpdateRSGroupConfiguration.class); | ||
private static final String TEST_GROUP = "test"; | ||
private static final String TEST2_GROUP = "test2"; | ||
|
||
@BeforeClass | ||
public static void setUp() throws Exception { | ||
setUpConfigurationFiles(TEST_UTIL); | ||
setUpTestBeforeClass(); | ||
addResourceToRegionServerConfiguration(TEST_UTIL); | ||
} | ||
|
||
@AfterClass | ||
public static void tearDown() throws Exception { | ||
tearDownAfterClass(); | ||
} | ||
|
||
@Before | ||
public void beforeMethod() throws Exception { | ||
setUpBeforeMethod(); | ||
} | ||
|
||
@After | ||
public void afterMethod() throws Exception { | ||
tearDownAfterMethod(); | ||
} | ||
|
||
@Test | ||
public void testOnlineConfigChangeInRSGroup() throws Exception { | ||
addGroup(TEST_GROUP, 1); | ||
rsGroupAdmin.updateConfiguration(TEST_GROUP); | ||
} | ||
|
||
@Test | ||
public void testNonexistentRSGroup() throws Exception { | ||
try { | ||
rsGroupAdmin.updateConfiguration(TEST2_GROUP); | ||
fail("Group does not exist: test2"); | ||
} catch (IllegalArgumentException iae) { | ||
// expected | ||
} | ||
} | ||
|
||
@Test | ||
public void testCustomOnlineConfigChangeInRSGroup() throws Exception { | ||
// 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().first()))) | ||
.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().first()))) | ||
.collect(Collectors.toList()).get(0).getConfiguration(); | ||
custom = regionServerConfiguration.getInt("hbase.custom.config", 0); | ||
assertEquals(0, custom); | ||
|
||
restoreHBaseSiteXML(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
146 changes: 146 additions & 0 deletions
146
hbase-rsgroup/src/test/resources/override-hbase-site.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,146 @@ | ||
<?xml version="1.0"?> | ||
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?> | ||
<!-- | ||
/** | ||
* | ||
* Licensed to the Apache Software Foundation (ASF) under one | ||
* or more contributor license agreements. See the NOTICE file | ||
* distributed with this work for additional information | ||
* regarding copyright ownership. The ASF licenses this file | ||
* to you under the Apache License, Version 2.0 (the | ||
* "License"); you may not use this file except in compliance | ||
* with the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
--> | ||
<configuration> | ||
<property> | ||
<name>hbase.custom.config</name> | ||
<value>1000</value> | ||
</property> | ||
<property> | ||
<name>hbase.regionserver.msginterval</name> | ||
<value>1000</value> | ||
<description>Interval between messages from the RegionServer to HMaster | ||
in milliseconds. Default is 15. Set this value low if you want unit | ||
tests to be responsive. | ||
</description> | ||
</property> | ||
<property> | ||
<name>hbase.defaults.for.version.skip</name> | ||
<value>true</value> | ||
</property> | ||
<property> | ||
<name>hbase.server.thread.wakefrequency</name> | ||
<value>1000</value> | ||
<description>Time to sleep in between searches for work (in milliseconds). | ||
Used as sleep interval by service threads such as hbase:meta scanner and log roller. | ||
</description> | ||
</property> | ||
<property> | ||
<name>hbase.master.event.waiting.time</name> | ||
<value>50</value> | ||
<description>Time to sleep between checks to see if a table event took place. | ||
</description> | ||
</property> | ||
<property> | ||
<name>hbase.regionserver.handler.count</name> | ||
<value>5</value> | ||
</property> | ||
<property> | ||
<name>hbase.master.info.port</name> | ||
<value>-1</value> | ||
<description>The port for the hbase master web UI | ||
Set to -1 if you do not want the info server to run. | ||
</description> | ||
</property> | ||
<property> | ||
<name>hbase.master.port</name> | ||
<value>0</value> | ||
<description>Always have masters and regionservers come up on port '0' so we don't clash over | ||
default ports. | ||
</description> | ||
</property> | ||
<property> | ||
<name>hbase.regionserver.port</name> | ||
<value>0</value> | ||
<description>Always have masters and regionservers come up on port '0' so we don't clash over | ||
default ports. | ||
</description> | ||
</property> | ||
<property> | ||
<name>hbase.ipc.client.fallback-to-simple-auth-allowed</name> | ||
<value>true</value> | ||
</property> | ||
|
||
<property> | ||
<name>hbase.regionserver.info.port</name> | ||
<value>-1</value> | ||
<description>The port for the hbase regionserver web UI | ||
Set to -1 if you do not want the info server to run. | ||
</description> | ||
</property> | ||
<property> | ||
<name>hbase.regionserver.info.port.auto</name> | ||
<value>true</value> | ||
<description>Info server auto port bind. Enables automatic port | ||
search if hbase.regionserver.info.port is already in use. | ||
Enabled for testing to run multiple tests on one machine. | ||
</description> | ||
</property> | ||
<property> | ||
<name>hbase.regionserver.safemode</name> | ||
<value>false</value> | ||
<description> | ||
Turn on/off safe mode in region server. Always on for production, always off | ||
for tests. | ||
</description> | ||
</property> | ||
<property> | ||
<name>hbase.hregion.max.filesize</name> | ||
<value>67108864</value> | ||
<description> | ||
Maximum desired file size for an HRegion. If filesize exceeds | ||
value + (value / 2), the HRegion is split in two. Default: 256M. | ||
|
||
Keep the maximum filesize small so we split more often in tests. | ||
</description> | ||
</property> | ||
<property> | ||
<name>hadoop.log.dir</name> | ||
<value>${user.dir}/../logs</value> | ||
</property> | ||
<property> | ||
<name>hbase.zookeeper.property.clientPort</name> | ||
<value>21818</value> | ||
<description>Property from ZooKeeper's config zoo.cfg. | ||
The port at which the clients will connect. | ||
</description> | ||
</property> | ||
<property> | ||
<name>hbase.defaults.for.version.skip</name> | ||
<value>true</value> | ||
<description> | ||
Set to true to skip the 'hbase.defaults.for.version'. | ||
Setting this to true can be useful in contexts other than | ||
the other side of a maven generation; i.e. running in an | ||
ide. You'll want to set this boolean to true to avoid | ||
seeing the RuntimeException complaint: "hbase-default.xml file | ||
seems to be for and old version of HBase (@@@VERSION@@@), this | ||
version is X.X.X-SNAPSHOT" | ||
</description> | ||
</property> | ||
<property> | ||
<name>hbase.table.sanity.checks</name> | ||
<value>false</value> | ||
<description>Skip sanity checks in tests | ||
</description> | ||
</property> | ||
</configuration> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.