From efc73d7896e65a8a03d226ac21309257a7dc126c Mon Sep 17 00:00:00 2001 From: Haohui Mai Date: Thu, 5 Nov 2015 10:00:01 -0800 Subject: [PATCH] HDFS-9372. Remove dead code in DataStorage.recoverTransitionRead. Contributed by Duo Zhang. --- hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt | 3 +++ .../hadoop/hdfs/server/datanode/DataStorage.java | 12 ------------ 2 files changed, 3 insertions(+), 12 deletions(-) diff --git a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt index f5c6f0f5fe..7246a57dd5 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt +++ b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt @@ -1671,6 +1671,9 @@ Release 2.8.0 - UNRELEASED HDFS-9308. Add truncateMeta() and deleteMeta() to MiniDFSCluster. (Tony Wu via lei) + HDFS-9372. Remove dead code in DataStorage.recoverTransitionRead. + (Duo Zhang via wheat9) + BUG FIXES HDFS-7501. TransactionsSinceLastCheckpoint can be negative on SBNs. diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/DataStorage.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/DataStorage.java index 8b8c6c52b0..707f1a58d9 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/DataStorage.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/DataStorage.java @@ -44,7 +44,6 @@ import org.apache.hadoop.hdfs.server.common.StorageInfo; import org.apache.hadoop.hdfs.server.protocol.DatanodeStorage; import org.apache.hadoop.hdfs.server.protocol.NamespaceInfo; -import org.apache.hadoop.io.nativeio.NativeIO; import org.apache.hadoop.util.Daemon; import org.apache.hadoop.util.DiskChecker; @@ -106,9 +105,6 @@ public class DataStorage extends Storage { * versions of Datanodes we cannot make this field a UUID. */ private String datanodeUuid = null; - - // Flag to ensure we only initialize storage once - private boolean initialized = false; // Maps block pool IDs to block pool storage private final Map bpStorageMap @@ -462,14 +458,6 @@ synchronized void removeVolumes(final Set dirsToRemove) */ void recoverTransitionRead(DataNode datanode, NamespaceInfo nsInfo, Collection dataDirs, StartupOption startOpt) throws IOException { - if (this.initialized) { - LOG.info("DataNode version: " + HdfsServerConstants.DATANODE_LAYOUT_VERSION - + " and NameNode layout version: " + nsInfo.getLayoutVersion()); - this.storageDirs = new ArrayList(dataDirs.size()); - // mark DN storage is initialized - this.initialized = true; - } - if (addStorageLocations(datanode, nsInfo, dataDirs, startOpt).isEmpty()) { throw new IOException("All specified directories are failed to load."); }