diff --git a/hbase-common/src/main/java/org/apache/hadoop/hbase/HBaseConfiguration.java b/hbase-common/src/main/java/org/apache/hadoop/hbase/HBaseConfiguration.java
index c5fa14dda3a1..d55cd5bf618c 100644
--- a/hbase-common/src/main/java/org/apache/hadoop/hbase/HBaseConfiguration.java
+++ b/hbase-common/src/main/java/org/apache/hadoop/hbase/HBaseConfiguration.java
@@ -36,6 +36,10 @@
public class HBaseConfiguration extends Configuration {
private static final Logger LOG = LoggerFactory.getLogger(HBaseConfiguration.class);
+ static {
+ addDeprecatedKeys();
+ }
+
/**
* Instantiating HBaseConfiguration() is deprecated. Please use
* HBaseConfiguration#create() to construct a plain Configuration
@@ -77,6 +81,37 @@ private static void checkDefaultsVersion(Configuration conf) {
}
}
+ /**
+ * The hbase.ipc.server.reservoir.initial.max and hbase.ipc.server.reservoir.initial.buffer.size
+ * were introduced in HBase2.0.0, while in HBase3.0.0 the two config keys will be replaced by
+ * hbase.server.allocator.max.buffer.count and hbase.server.allocator.buffer.size.
+ * Also the hbase.ipc.server.reservoir.enabled will be replaced by
+ * hbase.server.allocator.pool.enabled. Keep the three old config keys here for HBase2.x
+ * compatibility.
+ *
+ * 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.
+ */
+ private static void addDeprecatedKeys() {
+ Configuration.addDeprecations(new DeprecationDelta[]{
+ new DeprecationDelta("hbase.regionserver.hostname", "hbase.unsafe.regionserver.hostname"),
+ new DeprecationDelta("hbase.regionserver.hostname.disable.master.reversedns",
+ "hbase.unsafe.regionserver.hostname.disable.master.reversedns"),
+ new DeprecationDelta("hbase.offheapcache.minblocksize",
+ "hbase.blockcache.minblocksize"),
+ new DeprecationDelta("hbase.ipc.server.reservoir.enabled",
+ "hbase.server.allocator.pool.enabled"),
+ new DeprecationDelta("hbase.ipc.server.reservoir.initial.max",
+ "hbase.server.allocator.max.buffer.count"),
+ new DeprecationDelta("hbase.ipc.server.reservoir.initial.buffer.size",
+ "hbase.server.allocator.buffer.size"),
+ new DeprecationDelta("hlog.bulk.output", "wal.bulk.output"),
+ new DeprecationDelta("hlog.input.tables", "wal.input.tables"),
+ new DeprecationDelta("hlog.input.tablesmap", "wal.input.tablesmap")
+ });
+ }
+
public static Configuration addHbaseResources(Configuration conf) {
conf.addResource("hbase-default.xml");
conf.addResource("hbase-site.xml");
diff --git a/hbase-common/src/main/java/org/apache/hadoop/hbase/io/ByteBuffAllocator.java b/hbase-common/src/main/java/org/apache/hadoop/hbase/io/ByteBuffAllocator.java
index 03e1f9b30345..9e835407ef1f 100644
--- a/hbase-common/src/main/java/org/apache/hadoop/hbase/io/ByteBuffAllocator.java
+++ b/hbase-common/src/main/java/org/apache/hadoop/hbase/io/ByteBuffAllocator.java
@@ -96,20 +96,6 @@ public class ByteBuffAllocator {
@Deprecated
static final String DEPRECATED_BUFFER_SIZE_KEY = "hbase.ipc.server.reservoir.initial.buffer.size";
- /**
- * The hbase.ipc.server.reservoir.initial.max and hbase.ipc.server.reservoir.initial.buffer.size
- * were introduced in HBase2.0.0, while in HBase3.0.0 the two config keys will be replaced by
- * {@link ByteBuffAllocator#MAX_BUFFER_COUNT_KEY} and {@link ByteBuffAllocator#BUFFER_SIZE_KEY}.
- * Also the hbase.ipc.server.reservoir.enabled will be replaced by
- * hbase.server.allocator.pool.enabled. Keep the three old config keys here for HBase2.x
- * compatibility.
- */
- static {
- Configuration.addDeprecation(DEPRECATED_ALLOCATOR_POOL_ENABLED_KEY, ALLOCATOR_POOL_ENABLED_KEY);
- Configuration.addDeprecation(DEPRECATED_MAX_BUFFER_COUNT_KEY, MAX_BUFFER_COUNT_KEY);
- Configuration.addDeprecation(DEPRECATED_BUFFER_SIZE_KEY, BUFFER_SIZE_KEY);
- }
-
/**
* There're some reasons why better to choose 65KB(rather than 64KB) as the default buffer size:
*
@@ -167,13 +153,6 @@ public interface Recycler {
* @return ByteBuffAllocator to manage the byte buffers.
*/
public static ByteBuffAllocator create(Configuration conf, boolean reservoirEnabled) {
- if (conf.get(DEPRECATED_BUFFER_SIZE_KEY) != null
- || conf.get(DEPRECATED_MAX_BUFFER_COUNT_KEY) != null) {
- LOG.warn("The config keys {} and {} are deprecated now, instead please use {} and {}. In "
- + "future release we will remove the two deprecated configs.",
- DEPRECATED_BUFFER_SIZE_KEY, DEPRECATED_MAX_BUFFER_COUNT_KEY, BUFFER_SIZE_KEY,
- MAX_BUFFER_COUNT_KEY);
- }
int poolBufSize = conf.getInt(BUFFER_SIZE_KEY, DEFAULT_BUFFER_SIZE);
if (reservoirEnabled) {
// The max number of buffers to be pooled in the ByteBufferPool. The default value been
diff --git a/hbase-common/src/main/java/org/apache/hadoop/hbase/util/DNS.java b/hbase-common/src/main/java/org/apache/hadoop/hbase/util/DNS.java
index 5c23ddcedb5a..098884c6e332 100644
--- a/hbase-common/src/main/java/org/apache/hadoop/hbase/util/DNS.java
+++ b/hbase-common/src/main/java/org/apache/hadoop/hbase/util/DNS.java
@@ -59,7 +59,6 @@ public final class DNS {
} catch (Exception e) {
HAS_NEW_DNS_GET_DEFAULT_HOST_API = false; // FindBugs: Causes REC_CATCH_EXCEPTION. Suppressed
}
- Configuration.addDeprecation(RS_HOSTNAME_KEY, UNSAFE_RS_HOSTNAME_KEY);
}
public enum ServerType {
diff --git a/hbase-common/src/test/java/org/apache/hadoop/hbase/TestHBaseConfiguration.java b/hbase-common/src/test/java/org/apache/hadoop/hbase/TestHBaseConfiguration.java
index ffa94ba2d59f..3b98c50a4f13 100644
--- a/hbase-common/src/test/java/org/apache/hadoop/hbase/TestHBaseConfiguration.java
+++ b/hbase-common/src/test/java/org/apache/hadoop/hbase/TestHBaseConfiguration.java
@@ -133,6 +133,23 @@ public void testGetConfigOfShortcircuitRead() throws Exception {
assertEquals("/var/lib/hadoop-hdfs/dn_socket", conf.get("dfs.domain.socket.path"));
}
+ @Test
+ public void testDeprecatedConfigurations() {
+ // Configuration.addDeprecations before create Configuration object
+ Configuration.addDeprecations(new Configuration.DeprecationDelta[]{
+ new Configuration.DeprecationDelta("hbase.deprecated.conf", "hbase.new.conf")
+ });
+ 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"));
+ }
+
private static class ReflectiveCredentialProviderClient {
public static final String HADOOP_CRED_PROVIDER_FACTORY_CLASS_NAME =
"org.apache.hadoop.security.alias.JavaKeyStoreProvider$Factory";
diff --git a/hbase-common/src/test/java/org/apache/hadoop/hbase/io/TestByteBuffAllocator.java b/hbase-common/src/test/java/org/apache/hadoop/hbase/io/TestByteBuffAllocator.java
index 7df6bf79b27a..1c870eed69e1 100644
--- a/hbase-common/src/test/java/org/apache/hadoop/hbase/io/TestByteBuffAllocator.java
+++ b/hbase-common/src/test/java/org/apache/hadoop/hbase/io/TestByteBuffAllocator.java
@@ -29,6 +29,7 @@
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.hbase.HBaseClassTestRule;
+import org.apache.hadoop.hbase.HBaseConfiguration;
import org.apache.hadoop.hbase.nio.ByteBuff;
import org.apache.hadoop.hbase.nio.MultiByteBuff;
import org.apache.hadoop.hbase.nio.SingleByteBuff;
@@ -345,7 +346,7 @@ private void assertException(Runnable r) {
@Test
public void testDeprecatedConfigs() {
- Configuration conf = new Configuration();
+ Configuration conf = HBaseConfiguration.create();
conf.setInt(ByteBuffAllocator.DEPRECATED_MAX_BUFFER_COUNT_KEY, 10);
conf.setInt(ByteBuffAllocator.DEPRECATED_BUFFER_SIZE_KEY, 1024);
ByteBuffAllocator allocator = ByteBuffAllocator.create(conf, true);
diff --git a/hbase-common/src/test/resources/hbase-deprecated-conf.xml b/hbase-common/src/test/resources/hbase-deprecated-conf.xml
new file mode 100644
index 000000000000..c446501f7814
--- /dev/null
+++ b/hbase-common/src/test/resources/hbase-deprecated-conf.xml
@@ -0,0 +1,33 @@
+
+
+
+
+