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 @@ + + + + + + + hbase.deprecated.conf + 1000 + + + + hbase.deprecated.conf2 + 1000 + + diff --git a/hbase-mapreduce/src/main/java/org/apache/hadoop/hbase/mapreduce/WALPlayer.java b/hbase-mapreduce/src/main/java/org/apache/hadoop/hbase/mapreduce/WALPlayer.java index 91e7a11472db..1d38f3daee59 100644 --- a/hbase-mapreduce/src/main/java/org/apache/hadoop/hbase/mapreduce/WALPlayer.java +++ b/hbase-mapreduce/src/main/java/org/apache/hadoop/hbase/mapreduce/WALPlayer.java @@ -77,14 +77,6 @@ public class WALPlayer extends Configured implements Tool { public final static String IGNORE_MISSING_FILES = "wal.input.ignore.missing.files"; - // This relies on Hadoop Configuration to handle warning about deprecated configs and - // to set the correct non-deprecated configs when an old one shows up. - static { - Configuration.addDeprecation("hlog.bulk.output", BULK_OUTPUT_CONF_KEY); - Configuration.addDeprecation("hlog.input.tables", TABLES_KEY); - Configuration.addDeprecation("hlog.input.tablesmap", TABLE_MAP_KEY); - } - private final static String JOB_NAME_CONF_KEY = "mapreduce.job.name"; public WALPlayer(){ diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/BlockCacheFactory.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/BlockCacheFactory.java index 234c92104a55..90dd833c1130 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/BlockCacheFactory.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/BlockCacheFactory.java @@ -92,24 +92,10 @@ public final class BlockCacheFactory { @Deprecated static final String DEPRECATED_BLOCKCACHE_BLOCKSIZE_KEY = "hbase.offheapcache.minblocksize"; - /** - * The config point hbase.offheapcache.minblocksize is completely wrong, which is replaced by - * {@link BlockCacheFactory#BLOCKCACHE_BLOCKSIZE_KEY}. Keep the old config key here for backward - * compatibility. - */ - static { - Configuration.addDeprecation(DEPRECATED_BLOCKCACHE_BLOCKSIZE_KEY, BLOCKCACHE_BLOCKSIZE_KEY); - } - private BlockCacheFactory() { } public static BlockCache createBlockCache(Configuration conf) { - if (conf.get(DEPRECATED_BLOCKCACHE_BLOCKSIZE_KEY) != null) { - LOG.warn("The config key {} is deprecated now, instead please use {}. In future release " - + "we will remove the deprecated config.", DEPRECATED_BLOCKCACHE_BLOCKSIZE_KEY, - BLOCKCACHE_BLOCKSIZE_KEY); - } FirstLevelBlockCache l1Cache = createFirstLevelCache(conf); if (l1Cache == null) { return null; diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java index 128fda9c5e05..1df79e190dd3 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java @@ -492,15 +492,6 @@ public class HRegionServer extends Thread implements final static String UNSAFE_RS_HOSTNAME_DISABLE_MASTER_REVERSEDNS_KEY = "hbase.unsafe.regionserver.hostname.disable.master.reversedns"; - /** - * 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. - */ - static { - Configuration.addDeprecation(RS_HOSTNAME_DISABLE_MASTER_REVERSEDNS_KEY, UNSAFE_RS_HOSTNAME_DISABLE_MASTER_REVERSEDNS_KEY); - } - /** * This servers startcode. */ diff --git a/src/main/asciidoc/_chapters/offheap_read_write.adoc b/src/main/asciidoc/_chapters/offheap_read_write.adoc index 45a2b1c6089d..bea47c454418 100644 --- a/src/main/asciidoc/_chapters/offheap_read_write.adoc +++ b/src/main/asciidoc/_chapters/offheap_read_write.adoc @@ -165,12 +165,6 @@ because of link:https://issues.apache.org/jira/browse/HBASE-22532[HBASE-22532]. The three config keys -- `hbase.ipc.server.reservoir.enabled`, `hbase.ipc.server.reservoir.initial.buffer.size` and `hbase.ipc.server.reservoir.initial.max` -- introduced in hbase-2.x have been renamed and deprecated in hbase-3.x/hbase-2.3.x. Please use the new config keys instead: `hbase.server.allocator.pool.enabled`, `hbase.server.allocator.buffer.size` and `hbase.server.allocator.max.buffer.count`. -If you still use the deprecated three config keys in hbase-3.x, you will get a WARN log message like: - -[source] ----- -The config keys hbase.ipc.server.reservoir.initial.buffer.size and hbase.ipc.server.reservoir.initial.max are deprecated now, instead please use hbase.server.allocator.buffer.size and hbase.server.allocator.max.buffer.count. In future release we will remove the two deprecated configs. ----- Next, we have some suggestions regards performance.