hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jiten...@apache.org
Subject [26/34] git commit: HDFS-7144. Fix findbugs warnings in RamDiskReplicaTracker. (Contributed by Tsz Wo Nicholas Sze)
Date Fri, 17 Oct 2014 23:31:13 GMT
HDFS-7144. Fix findbugs warnings in RamDiskReplicaTracker. (Contributed by Tsz Wo Nicholas
Sze)

Conflicts:
	hadoop-hdfs-project/hadoop-hdfs/CHANGES-HDFS-6581.txt


Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/ba31a950
Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/ba31a950
Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/ba31a950

Branch: refs/heads/branch-2.6
Commit: ba31a9503c51369a63ddaaf7af0b90c6acca7be8
Parents: 3481f5d
Author: arp <arp@apache.org>
Authored: Thu Sep 25 11:14:24 2014 -0700
Committer: Jitendra Pandey <Jitendra@Jitendra-Pandeys-MacBook-Pro-4.local>
Committed: Fri Oct 17 16:00:52 2014 -0700

----------------------------------------------------------------------
 .../impl/RamDiskReplicaLruTracker.java          | 10 +++++++++
 .../fsdataset/impl/RamDiskReplicaTracker.java   | 22 ++++++++++++--------
 2 files changed, 23 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hadoop/blob/ba31a950/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/fsdataset/impl/RamDiskReplicaLruTracker.java
----------------------------------------------------------------------
diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/fsdataset/impl/RamDiskReplicaLruTracker.java
b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/fsdataset/impl/RamDiskReplicaLruTracker.java
index 0899e70..7808003 100644
--- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/fsdataset/impl/RamDiskReplicaLruTracker.java
+++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/fsdataset/impl/RamDiskReplicaLruTracker.java
@@ -40,6 +40,16 @@ public class RamDiskReplicaLruTracker extends RamDiskReplicaTracker {
     private RamDiskReplicaLru(String bpid, long blockId, FsVolumeImpl ramDiskVolume) {
       super(bpid, blockId, ramDiskVolume);
     }
+
+    @Override
+    public int hashCode() {
+      return super.hashCode();
+    }
+
+    @Override
+    public boolean equals(Object other) {
+      return super.equals(other);
+    }
   }
 
   /**

http://git-wip-us.apache.org/repos/asf/hadoop/blob/ba31a950/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/fsdataset/impl/RamDiskReplicaTracker.java
----------------------------------------------------------------------
diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/fsdataset/impl/RamDiskReplicaTracker.java
b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/fsdataset/impl/RamDiskReplicaTracker.java
index 03fc068..2401424 100644
--- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/fsdataset/impl/RamDiskReplicaTracker.java
+++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/fsdataset/impl/RamDiskReplicaTracker.java
@@ -19,6 +19,9 @@
 package org.apache.hadoop.hdfs.server.datanode.fsdataset.impl;
 
 import com.google.common.base.Preconditions;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
 import org.apache.hadoop.classification.InterfaceAudience;
 import org.apache.hadoop.classification.InterfaceStability;
 import org.apache.hadoop.conf.Configuration;
@@ -31,6 +34,7 @@ import java.io.File;
 @InterfaceAudience.Private
 @InterfaceStability.Unstable
 public abstract class RamDiskReplicaTracker {
+  static final Log LOG = LogFactory.getLog(RamDiskReplicaTracker.class);
 
   FsDatasetImpl fsDataset;
 
@@ -117,18 +121,18 @@ public abstract class RamDiskReplicaTracker {
     // Delete the saved meta and block files. Failure to delete can be
     // ignored, the directory scanner will retry the deletion later.
     void deleteSavedFiles() {
-      try {
-        if (savedBlockFile != null) {
-          savedBlockFile.delete();
-          savedBlockFile = null;
+      if (savedBlockFile != null) {
+        if (!savedBlockFile.delete()) {
+          LOG.warn("Failed to delete block file " + savedBlockFile);
         }
+        savedBlockFile = null;
+      }
 
-        if (savedMetaFile != null) {
-          savedMetaFile.delete();
-          savedMetaFile = null;
+      if (savedMetaFile != null) {
+        if (!savedMetaFile.delete()) {
+          LOG.warn("Failed to delete meta file " + savedMetaFile);
         }
-      } catch (Throwable t) {
-        // Ignore any exceptions.
+        savedMetaFile = null;
       }
     }
 


Mime
View raw message