HBASE-25928 TestHBaseConfiguration#testDeprecatedConfigurations is broken with Hadoop 3.3 (#3320)

Signed-off-by: Wei-Chiu Chuang <weichiu@apache.org>
Signed-off-by: stack <stack@apache.org>
This commit is contained in:
Baiqiang Zhao 2021-05-28 22:24:48 +08:00 committed by stack
parent b4e8b91414
commit a1cac20e95
2 changed files with 8 additions and 7 deletions

View File

@ -92,6 +92,11 @@ public class HBaseConfiguration extends Configuration {
* HBASE-24667: This config hbase.regionserver.hostname.disable.master.reversedns will be
* replaced by hbase.unsafe.regionserver.hostname.disable.master.reversedns. Keep the old config
* keys here for backward compatibility.
* <br>
* Note: Before Hadoop-3.3, we must call the addDeprecations method before creating the
* Configuration object to work correctly. After this bug is fixed in hadoop-3.3, there will be
* no order problem.
* @see <a href="https://issues.apache.org/jira/browse/HADOOP-15708">HADOOP-15708</a>
*/
private static void addDeprecatedKeys() {
Configuration.addDeprecations(new DeprecationDelta[]{

View File

@ -137,17 +137,13 @@ public class TestHBaseConfiguration {
public void testDeprecatedConfigurations() {
// Configuration.addDeprecations before create Configuration object
Configuration.addDeprecations(new Configuration.DeprecationDelta[]{
new Configuration.DeprecationDelta("hbase.deprecated.conf", "hbase.new.conf")
new Configuration.DeprecationDelta("hbase.deprecated.conf", "hbase.new.conf"),
new Configuration.DeprecationDelta("hbase.deprecated.conf2", "hbase.new.conf2")
});
Configuration conf = HBaseConfiguration.create();
conf.addResource("hbase-deprecated-conf.xml");
assertEquals("1000", conf.get("hbase.new.conf"));
// Configuration.addDeprecations after create Configuration object
Configuration.addDeprecations(new Configuration.DeprecationDelta[]{
new Configuration.DeprecationDelta("hbase.deprecated.conf2", "hbase.new.conf2")
});
assertNull(conf.get("hbase.new.conf2"));
assertEquals("1000", conf.get("hbase.new.conf2"));
}
private static class ReflectiveCredentialProviderClient {