Author: cmccabe
Date: Sat Nov  2 18:55:56 2013
New Revision: 1538253

URL: http://svn.apache.org/r1538253
Log:
HADOOP-9478. Fix race conditions during the initialization of Configuration 
related to deprecatedKeyMap (cmccabe)

Modified:
    
hadoop/common/branches/branch-2.2/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/HdfsConfiguration.java

Modified: 
hadoop/common/branches/branch-2.2/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/HdfsConfiguration.java
URL: 
http://svn.apache.org/viewvc/hadoop/common/branches/branch-2.2/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/HdfsConfiguration.java?rev=1538253&r1=1538252&r2=1538253&view=diff
==============================================================================
--- 
hadoop/common/branches/branch-2.2/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/HdfsConfiguration.java
 (original)
+++ 
hadoop/common/branches/branch-2.2/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/HdfsConfiguration.java
 Sat Nov  2 18:55:56 2013
@@ -19,6 +19,7 @@
 package org.apache.hadoop.hdfs;
 
 import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.conf.Configuration.DeprecationDelta;
 
 import org.apache.hadoop.classification.InterfaceAudience;
 
@@ -62,48 +63,83 @@ public class HdfsConfiguration extends C
   public static void init() {
   }
 
-  private static void deprecate(String oldKey, String newKey) {
-    Configuration.addDeprecation(oldKey, newKey);
-  }
-
   private static void addDeprecatedKeys() {
-    deprecate("dfs.backup.address", 
DFSConfigKeys.DFS_NAMENODE_BACKUP_ADDRESS_KEY);
-    deprecate("dfs.backup.http.address", 
DFSConfigKeys.DFS_NAMENODE_BACKUP_HTTP_ADDRESS_KEY);
-    deprecate("dfs.balance.bandwidthPerSec", 
DFSConfigKeys.DFS_DATANODE_BALANCE_BANDWIDTHPERSEC_KEY);
-    deprecate("dfs.data.dir", DFSConfigKeys.DFS_DATANODE_DATA_DIR_KEY);
-    deprecate("dfs.http.address", DFSConfigKeys.DFS_NAMENODE_HTTP_ADDRESS_KEY);
-    deprecate("dfs.https.address", 
DFSConfigKeys.DFS_NAMENODE_HTTPS_ADDRESS_KEY);
-    deprecate("dfs.max.objects", DFSConfigKeys.DFS_NAMENODE_MAX_OBJECTS_KEY);
-    deprecate("dfs.name.dir", DFSConfigKeys.DFS_NAMENODE_NAME_DIR_KEY);
-    deprecate("dfs.name.dir.restore", 
DFSConfigKeys.DFS_NAMENODE_NAME_DIR_RESTORE_KEY);
-    deprecate("dfs.name.edits.dir", DFSConfigKeys.DFS_NAMENODE_EDITS_DIR_KEY);
-    deprecate("dfs.read.prefetch.size", 
DFSConfigKeys.DFS_CLIENT_READ_PREFETCH_SIZE_KEY);
-    deprecate("dfs.safemode.extension", 
DFSConfigKeys.DFS_NAMENODE_SAFEMODE_EXTENSION_KEY);
-    deprecate("dfs.safemode.threshold.pct", 
DFSConfigKeys.DFS_NAMENODE_SAFEMODE_THRESHOLD_PCT_KEY);
-    deprecate("dfs.secondary.http.address", 
DFSConfigKeys.DFS_NAMENODE_SECONDARY_HTTP_ADDRESS_KEY);
-    deprecate("dfs.socket.timeout", 
DFSConfigKeys.DFS_CLIENT_SOCKET_TIMEOUT_KEY);
-    deprecate("fs.checkpoint.dir", 
DFSConfigKeys.DFS_NAMENODE_CHECKPOINT_DIR_KEY);
-    deprecate("fs.checkpoint.edits.dir", 
DFSConfigKeys.DFS_NAMENODE_CHECKPOINT_EDITS_DIR_KEY);
-    deprecate("fs.checkpoint.period", 
DFSConfigKeys.DFS_NAMENODE_CHECKPOINT_PERIOD_KEY);
-    deprecate("heartbeat.recheck.interval", 
DFSConfigKeys.DFS_NAMENODE_HEARTBEAT_RECHECK_INTERVAL_KEY);
-    deprecate("dfs.https.client.keystore.resource", 
DFSConfigKeys.DFS_CLIENT_HTTPS_KEYSTORE_RESOURCE_KEY);
-    deprecate("dfs.https.need.client.auth", 
DFSConfigKeys.DFS_CLIENT_HTTPS_NEED_AUTH_KEY);
-    deprecate("slave.host.name", DFSConfigKeys.DFS_DATANODE_HOST_NAME_KEY);
-    deprecate("session.id", DFSConfigKeys.DFS_METRICS_SESSION_ID_KEY);
-    deprecate("dfs.access.time.precision", 
DFSConfigKeys.DFS_NAMENODE_ACCESSTIME_PRECISION_KEY);
-    deprecate("dfs.replication.considerLoad", 
DFSConfigKeys.DFS_NAMENODE_REPLICATION_CONSIDERLOAD_KEY);
-    deprecate("dfs.replication.interval", 
DFSConfigKeys.DFS_NAMENODE_REPLICATION_INTERVAL_KEY);
-    deprecate("dfs.replication.min", 
DFSConfigKeys.DFS_NAMENODE_REPLICATION_MIN_KEY);
-    deprecate("dfs.replication.pending.timeout.sec", 
DFSConfigKeys.DFS_NAMENODE_REPLICATION_PENDING_TIMEOUT_SEC_KEY);
-    deprecate("dfs.max-repl-streams", 
DFSConfigKeys.DFS_NAMENODE_REPLICATION_MAX_STREAMS_KEY);
-    deprecate("dfs.permissions", DFSConfigKeys.DFS_PERMISSIONS_ENABLED_KEY);
-    deprecate("dfs.permissions.supergroup", 
DFSConfigKeys.DFS_PERMISSIONS_SUPERUSERGROUP_KEY);
-    deprecate("dfs.write.packet.size", 
DFSConfigKeys.DFS_CLIENT_WRITE_PACKET_SIZE_KEY);
-    deprecate("dfs.block.size", DFSConfigKeys.DFS_BLOCK_SIZE_KEY);
-    deprecate("dfs.datanode.max.xcievers", 
DFSConfigKeys.DFS_DATANODE_MAX_RECEIVER_THREADS_KEY);
-    deprecate("io.bytes.per.checksum", 
DFSConfigKeys.DFS_BYTES_PER_CHECKSUM_KEY);
-    deprecate("dfs.federation.nameservices", DFSConfigKeys.DFS_NAMESERVICES);
-    deprecate("dfs.federation.nameservice.id", 
DFSConfigKeys.DFS_NAMESERVICE_ID);
+    Configuration.addDeprecations(new DeprecationDelta[] {
+      new DeprecationDelta("dfs.backup.address",
+        DFSConfigKeys.DFS_NAMENODE_BACKUP_ADDRESS_KEY),
+      new DeprecationDelta("dfs.backup.http.address",
+        DFSConfigKeys.DFS_NAMENODE_BACKUP_HTTP_ADDRESS_KEY),
+      new DeprecationDelta("dfs.balance.bandwidthPerSec",
+        DFSConfigKeys.DFS_DATANODE_BALANCE_BANDWIDTHPERSEC_KEY),
+      new DeprecationDelta("dfs.data.dir",
+        DFSConfigKeys.DFS_DATANODE_DATA_DIR_KEY),
+      new DeprecationDelta("dfs.http.address",
+        DFSConfigKeys.DFS_NAMENODE_HTTP_ADDRESS_KEY),
+      new DeprecationDelta("dfs.https.address",
+        DFSConfigKeys.DFS_NAMENODE_HTTPS_ADDRESS_KEY),
+      new DeprecationDelta("dfs.max.objects",
+        DFSConfigKeys.DFS_NAMENODE_MAX_OBJECTS_KEY),
+      new DeprecationDelta("dfs.name.dir",
+        DFSConfigKeys.DFS_NAMENODE_NAME_DIR_KEY),
+      new DeprecationDelta("dfs.name.dir.restore",
+        DFSConfigKeys.DFS_NAMENODE_NAME_DIR_RESTORE_KEY),
+      new DeprecationDelta("dfs.name.edits.dir",
+        DFSConfigKeys.DFS_NAMENODE_EDITS_DIR_KEY),
+      new DeprecationDelta("dfs.read.prefetch.size",
+        DFSConfigKeys.DFS_CLIENT_READ_PREFETCH_SIZE_KEY),
+      new DeprecationDelta("dfs.safemode.extension",
+        DFSConfigKeys.DFS_NAMENODE_SAFEMODE_EXTENSION_KEY),
+      new DeprecationDelta("dfs.safemode.threshold.pct",
+        DFSConfigKeys.DFS_NAMENODE_SAFEMODE_THRESHOLD_PCT_KEY),
+      new DeprecationDelta("dfs.secondary.http.address",
+        DFSConfigKeys.DFS_NAMENODE_SECONDARY_HTTP_ADDRESS_KEY),
+      new DeprecationDelta("dfs.socket.timeout",
+        DFSConfigKeys.DFS_CLIENT_SOCKET_TIMEOUT_KEY),
+      new DeprecationDelta("fs.checkpoint.dir",
+        DFSConfigKeys.DFS_NAMENODE_CHECKPOINT_DIR_KEY),
+      new DeprecationDelta("fs.checkpoint.edits.dir",
+        DFSConfigKeys.DFS_NAMENODE_CHECKPOINT_EDITS_DIR_KEY),
+      new DeprecationDelta("fs.checkpoint.period",
+        DFSConfigKeys.DFS_NAMENODE_CHECKPOINT_PERIOD_KEY),
+      new DeprecationDelta("heartbeat.recheck.interval",
+        DFSConfigKeys.DFS_NAMENODE_HEARTBEAT_RECHECK_INTERVAL_KEY),
+      new DeprecationDelta("dfs.https.client.keystore.resource",
+        DFSConfigKeys.DFS_CLIENT_HTTPS_KEYSTORE_RESOURCE_KEY),
+      new DeprecationDelta("dfs.https.need.client.auth",
+        DFSConfigKeys.DFS_CLIENT_HTTPS_NEED_AUTH_KEY),
+      new DeprecationDelta("slave.host.name",
+        DFSConfigKeys.DFS_DATANODE_HOST_NAME_KEY),
+      new DeprecationDelta("session.id",
+        DFSConfigKeys.DFS_METRICS_SESSION_ID_KEY),
+      new DeprecationDelta("dfs.access.time.precision",
+        DFSConfigKeys.DFS_NAMENODE_ACCESSTIME_PRECISION_KEY),
+      new DeprecationDelta("dfs.replication.considerLoad",
+        DFSConfigKeys.DFS_NAMENODE_REPLICATION_CONSIDERLOAD_KEY),
+      new DeprecationDelta("dfs.replication.interval",
+        DFSConfigKeys.DFS_NAMENODE_REPLICATION_INTERVAL_KEY),
+      new DeprecationDelta("dfs.replication.min",
+        DFSConfigKeys.DFS_NAMENODE_REPLICATION_MIN_KEY),
+      new DeprecationDelta("dfs.replication.pending.timeout.sec",
+        DFSConfigKeys.DFS_NAMENODE_REPLICATION_PENDING_TIMEOUT_SEC_KEY),
+      new DeprecationDelta("dfs.max-repl-streams",
+        DFSConfigKeys.DFS_NAMENODE_REPLICATION_MAX_STREAMS_KEY),
+      new DeprecationDelta("dfs.permissions",
+        DFSConfigKeys.DFS_PERMISSIONS_ENABLED_KEY),
+      new DeprecationDelta("dfs.permissions.supergroup",
+        DFSConfigKeys.DFS_PERMISSIONS_SUPERUSERGROUP_KEY),
+      new DeprecationDelta("dfs.write.packet.size",
+        DFSConfigKeys.DFS_CLIENT_WRITE_PACKET_SIZE_KEY),
+      new DeprecationDelta("dfs.block.size",
+        DFSConfigKeys.DFS_BLOCK_SIZE_KEY),
+      new DeprecationDelta("dfs.datanode.max.xcievers",
+        DFSConfigKeys.DFS_DATANODE_MAX_RECEIVER_THREADS_KEY),
+      new DeprecationDelta("io.bytes.per.checksum",
+        DFSConfigKeys.DFS_BYTES_PER_CHECKSUM_KEY),
+      new DeprecationDelta("dfs.federation.nameservices",
+        DFSConfigKeys.DFS_NAMESERVICES),
+      new DeprecationDelta("dfs.federation.nameservice.id",
+        DFSConfigKeys.DFS_NAMESERVICE_ID)
+    });
   }
 
   public static void main(String[] args) {


Reply via email to