Skip to content

Commit a8980a4

Browse files
authored
Revert "HBASE-25861 Correct the usage of Configuration#addDeprecation (#3249)"
This reverts commit aab6e1d.
1 parent d19e058 commit a8980a4

File tree

10 files changed

+60
-87
lines changed

10 files changed

+60
-87
lines changed

hbase-common/src/main/java/org/apache/hadoop/hbase/HBaseConfiguration.java

Lines changed: 0 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,6 @@
3636
public class HBaseConfiguration extends Configuration {
3737
private static final Logger LOG = LoggerFactory.getLogger(HBaseConfiguration.class);
3838

39-
static {
40-
addDeprecatedKeys();
41-
}
42-
4339
/**
4440
* Instantiating HBaseConfiguration() is deprecated. Please use
4541
* HBaseConfiguration#create() to construct a plain Configuration
@@ -81,37 +77,6 @@ private static void checkDefaultsVersion(Configuration conf) {
8177
}
8278
}
8379

84-
/**
85-
* The hbase.ipc.server.reservoir.initial.max and hbase.ipc.server.reservoir.initial.buffer.size
86-
* were introduced in HBase2.0.0, while in HBase3.0.0 the two config keys will be replaced by
87-
* hbase.server.allocator.max.buffer.count and hbase.server.allocator.buffer.size.
88-
* Also the hbase.ipc.server.reservoir.enabled will be replaced by
89-
* hbase.server.allocator.pool.enabled. Keep the three old config keys here for HBase2.x
90-
* compatibility.
91-
* <br>
92-
* HBASE-24667: This config hbase.regionserver.hostname.disable.master.reversedns will be
93-
* replaced by hbase.unsafe.regionserver.hostname.disable.master.reversedns. Keep the old config
94-
* keys here for backward compatibility.
95-
*/
96-
private static void addDeprecatedKeys() {
97-
Configuration.addDeprecations(new DeprecationDelta[]{
98-
new DeprecationDelta("hbase.regionserver.hostname", "hbase.unsafe.regionserver.hostname"),
99-
new DeprecationDelta("hbase.regionserver.hostname.disable.master.reversedns",
100-
"hbase.unsafe.regionserver.hostname.disable.master.reversedns"),
101-
new DeprecationDelta("hbase.offheapcache.minblocksize",
102-
"hbase.blockcache.minblocksize"),
103-
new DeprecationDelta("hbase.ipc.server.reservoir.enabled",
104-
"hbase.server.allocator.pool.enabled"),
105-
new DeprecationDelta("hbase.ipc.server.reservoir.initial.max",
106-
"hbase.server.allocator.max.buffer.count"),
107-
new DeprecationDelta("hbase.ipc.server.reservoir.initial.buffer.size",
108-
"hbase.server.allocator.buffer.size"),
109-
new DeprecationDelta("hlog.bulk.output", "wal.bulk.output"),
110-
new DeprecationDelta("hlog.input.tables", "wal.input.tables"),
111-
new DeprecationDelta("hlog.input.tablesmap", "wal.input.tablesmap")
112-
});
113-
}
114-
11580
public static Configuration addHbaseResources(Configuration conf) {
11681
conf.addResource("hbase-default.xml");
11782
conf.addResource("hbase-site.xml");

hbase-common/src/main/java/org/apache/hadoop/hbase/io/ByteBuffAllocator.java

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,20 @@ public class ByteBuffAllocator {
9696
@Deprecated
9797
static final String DEPRECATED_BUFFER_SIZE_KEY = "hbase.ipc.server.reservoir.initial.buffer.size";
9898

99+
/**
100+
* The hbase.ipc.server.reservoir.initial.max and hbase.ipc.server.reservoir.initial.buffer.size
101+
* were introduced in HBase2.0.0, while in HBase3.0.0 the two config keys will be replaced by
102+
* {@link ByteBuffAllocator#MAX_BUFFER_COUNT_KEY} and {@link ByteBuffAllocator#BUFFER_SIZE_KEY}.
103+
* Also the hbase.ipc.server.reservoir.enabled will be replaced by
104+
* hbase.server.allocator.pool.enabled. Keep the three old config keys here for HBase2.x
105+
* compatibility.
106+
*/
107+
static {
108+
Configuration.addDeprecation(DEPRECATED_ALLOCATOR_POOL_ENABLED_KEY, ALLOCATOR_POOL_ENABLED_KEY);
109+
Configuration.addDeprecation(DEPRECATED_MAX_BUFFER_COUNT_KEY, MAX_BUFFER_COUNT_KEY);
110+
Configuration.addDeprecation(DEPRECATED_BUFFER_SIZE_KEY, BUFFER_SIZE_KEY);
111+
}
112+
99113
/**
100114
* There're some reasons why better to choose 65KB(rather than 64KB) as the default buffer size:
101115
* <p>
@@ -153,6 +167,13 @@ public interface Recycler {
153167
* @return ByteBuffAllocator to manage the byte buffers.
154168
*/
155169
public static ByteBuffAllocator create(Configuration conf, boolean reservoirEnabled) {
170+
if (conf.get(DEPRECATED_BUFFER_SIZE_KEY) != null
171+
|| conf.get(DEPRECATED_MAX_BUFFER_COUNT_KEY) != null) {
172+
LOG.warn("The config keys {} and {} are deprecated now, instead please use {} and {}. In "
173+
+ "future release we will remove the two deprecated configs.",
174+
DEPRECATED_BUFFER_SIZE_KEY, DEPRECATED_MAX_BUFFER_COUNT_KEY, BUFFER_SIZE_KEY,
175+
MAX_BUFFER_COUNT_KEY);
176+
}
156177
int poolBufSize = conf.getInt(BUFFER_SIZE_KEY, DEFAULT_BUFFER_SIZE);
157178
if (reservoirEnabled) {
158179
// The max number of buffers to be pooled in the ByteBufferPool. The default value been

hbase-common/src/main/java/org/apache/hadoop/hbase/util/DNS.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ public final class DNS {
5959
} catch (Exception e) {
6060
HAS_NEW_DNS_GET_DEFAULT_HOST_API = false; // FindBugs: Causes REC_CATCH_EXCEPTION. Suppressed
6161
}
62+
Configuration.addDeprecation(RS_HOSTNAME_KEY, UNSAFE_RS_HOSTNAME_KEY);
6263
}
6364

6465
public enum ServerType {

hbase-common/src/test/java/org/apache/hadoop/hbase/TestHBaseConfiguration.java

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -133,23 +133,6 @@ public void testGetConfigOfShortcircuitRead() throws Exception {
133133
assertEquals("/var/lib/hadoop-hdfs/dn_socket", conf.get("dfs.domain.socket.path"));
134134
}
135135

136-
@Test
137-
public void testDeprecatedConfigurations() {
138-
// Configuration.addDeprecations before create Configuration object
139-
Configuration.addDeprecations(new Configuration.DeprecationDelta[]{
140-
new Configuration.DeprecationDelta("hbase.deprecated.conf", "hbase.new.conf")
141-
});
142-
Configuration conf = HBaseConfiguration.create();
143-
conf.addResource("hbase-deprecated-conf.xml");
144-
assertEquals("1000", conf.get("hbase.new.conf"));
145-
146-
// Configuration.addDeprecations after create Configuration object
147-
Configuration.addDeprecations(new Configuration.DeprecationDelta[]{
148-
new Configuration.DeprecationDelta("hbase.deprecated.conf2", "hbase.new.conf2")
149-
});
150-
assertNull(conf.get("hbase.new.conf2"));
151-
}
152-
153136
private static class ReflectiveCredentialProviderClient {
154137
public static final String HADOOP_CRED_PROVIDER_FACTORY_CLASS_NAME =
155138
"org.apache.hadoop.security.alias.JavaKeyStoreProvider$Factory";

hbase-common/src/test/java/org/apache/hadoop/hbase/io/TestByteBuffAllocator.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@
2929

3030
import org.apache.hadoop.conf.Configuration;
3131
import org.apache.hadoop.hbase.HBaseClassTestRule;
32-
import org.apache.hadoop.hbase.HBaseConfiguration;
3332
import org.apache.hadoop.hbase.nio.ByteBuff;
3433
import org.apache.hadoop.hbase.nio.MultiByteBuff;
3534
import org.apache.hadoop.hbase.nio.SingleByteBuff;
@@ -346,7 +345,7 @@ private void assertException(Runnable r) {
346345

347346
@Test
348347
public void testDeprecatedConfigs() {
349-
Configuration conf = HBaseConfiguration.create();
348+
Configuration conf = new Configuration();
350349
conf.setInt(ByteBuffAllocator.DEPRECATED_MAX_BUFFER_COUNT_KEY, 10);
351350
conf.setInt(ByteBuffAllocator.DEPRECATED_BUFFER_SIZE_KEY, 1024);
352351
ByteBuffAllocator allocator = ByteBuffAllocator.create(conf, true);

hbase-common/src/test/resources/hbase-deprecated-conf.xml

Lines changed: 0 additions & 33 deletions
This file was deleted.

hbase-mapreduce/src/main/java/org/apache/hadoop/hbase/mapreduce/WALPlayer.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,14 @@ public class WALPlayer extends Configured implements Tool {
7777
public final static String IGNORE_MISSING_FILES = "wal.input.ignore.missing.files";
7878

7979

80+
// This relies on Hadoop Configuration to handle warning about deprecated configs and
81+
// to set the correct non-deprecated configs when an old one shows up.
82+
static {
83+
Configuration.addDeprecation("hlog.bulk.output", BULK_OUTPUT_CONF_KEY);
84+
Configuration.addDeprecation("hlog.input.tables", TABLES_KEY);
85+
Configuration.addDeprecation("hlog.input.tablesmap", TABLE_MAP_KEY);
86+
}
87+
8088
private final static String JOB_NAME_CONF_KEY = "mapreduce.job.name";
8189

8290
public WALPlayer(){

hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/BlockCacheFactory.java

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,10 +92,24 @@ public final class BlockCacheFactory {
9292
@Deprecated
9393
static final String DEPRECATED_BLOCKCACHE_BLOCKSIZE_KEY = "hbase.offheapcache.minblocksize";
9494

95+
/**
96+
* The config point hbase.offheapcache.minblocksize is completely wrong, which is replaced by
97+
* {@link BlockCacheFactory#BLOCKCACHE_BLOCKSIZE_KEY}. Keep the old config key here for backward
98+
* compatibility.
99+
*/
100+
static {
101+
Configuration.addDeprecation(DEPRECATED_BLOCKCACHE_BLOCKSIZE_KEY, BLOCKCACHE_BLOCKSIZE_KEY);
102+
}
103+
95104
private BlockCacheFactory() {
96105
}
97106

98107
public static BlockCache createBlockCache(Configuration conf) {
108+
if (conf.get(DEPRECATED_BLOCKCACHE_BLOCKSIZE_KEY) != null) {
109+
LOG.warn("The config key {} is deprecated now, instead please use {}. In future release "
110+
+ "we will remove the deprecated config.", DEPRECATED_BLOCKCACHE_BLOCKSIZE_KEY,
111+
BLOCKCACHE_BLOCKSIZE_KEY);
112+
}
99113
FirstLevelBlockCache l1Cache = createFirstLevelCache(conf);
100114
if (l1Cache == null) {
101115
return null;

hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -492,6 +492,15 @@ public class HRegionServer extends Thread implements
492492
final static String UNSAFE_RS_HOSTNAME_DISABLE_MASTER_REVERSEDNS_KEY =
493493
"hbase.unsafe.regionserver.hostname.disable.master.reversedns";
494494

495+
/**
496+
* HBASE-24667: This config hbase.regionserver.hostname.disable.master.reversedns will be replaced by
497+
* hbase.unsafe.regionserver.hostname.disable.master.reversedns. Keep the old config keys here for backward
498+
* compatibility.
499+
*/
500+
static {
501+
Configuration.addDeprecation(RS_HOSTNAME_DISABLE_MASTER_REVERSEDNS_KEY, UNSAFE_RS_HOSTNAME_DISABLE_MASTER_REVERSEDNS_KEY);
502+
}
503+
495504
/**
496505
* This servers startcode.
497506
*/

src/main/asciidoc/_chapters/offheap_read_write.adoc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,12 @@ because of link:https://issues.apache.org/jira/browse/HBASE-22532[HBASE-22532].
165165
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
166166
have been renamed and deprecated in hbase-3.x/hbase-2.3.x. Please use the new config keys instead:
167167
`hbase.server.allocator.pool.enabled`, `hbase.server.allocator.buffer.size` and `hbase.server.allocator.max.buffer.count`.
168+
If you still use the deprecated three config keys in hbase-3.x, you will get a WARN log message like:
169+
170+
[source]
171+
----
172+
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.
173+
----
168174
169175
Next, we have some suggestions regards performance.
170176

0 commit comments

Comments
 (0)