From 1b01d163a25d6abdb7b83c1948ca5f67aae49702 Mon Sep 17 00:00:00 2001 From: Haohui Mai Date: Thu, 27 Aug 2015 13:03:16 -0700 Subject: [PATCH] HDFS-8969. Clean up findbugs warnings for HDFS-8823 and HDFS-8932. Contributed by Anu Engineer. --- hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt | 3 +++ .../org/apache/hadoop/hdfs/server/namenode/FSEditLog.java | 2 +- .../org/apache/hadoop/hdfs/server/namenode/NamenodeFsck.java | 4 +--- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt index e91b9564239..a6c0e74211a 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt +++ b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt @@ -896,6 +896,9 @@ Release 2.8.0 - UNRELEASED HDFS-8961. Investigate lock issue in o.a.h.hdfs.shortcircuit. DfsClientShmManager.EndpointShmManager. (Mingliang Liu via wheat9) + HDFS-8969. Clean up findbugs warnings for HDFS-8823 and HDFS-8932. + (Anu Engineer via wheat9) + Release 2.7.2 - UNRELEASED INCOMPATIBLE CHANGES diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSEditLog.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSEditLog.java index d7294d19a29..61c7df9f591 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSEditLog.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSEditLog.java @@ -1651,7 +1651,7 @@ public class FSEditLog implements LogsPurgeable { * Return total number of syncs happened on this edit log. * @return long - count */ - public long getTotalSyncCount() { + public synchronized long getTotalSyncCount() { if (editLogStream != null) { return editLogStream.getNumSync(); } else { diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/NamenodeFsck.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/NamenodeFsck.java index a3e74d36f47..ddb9a3adca8 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/NamenodeFsck.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/NamenodeFsck.java @@ -252,9 +252,7 @@ public class NamenodeFsck implements DataEncryptionKeyFactory { NumberReplicas numberReplicas= bm.countNodes(blockInfo); out.println("Block Id: " + blockId); out.println("Block belongs to: "+iNode.getFullPathName()); - if (blockInfo != null) { - out.println("No. of Expected Replica: " + blockInfo.getReplication()); - } + out.println("No. of Expected Replica: " + blockInfo.getReplication()); out.println("No. of live Replica: " + numberReplicas.liveReplicas()); out.println("No. of excess Replica: " + numberReplicas.excessReplicas()); out.println("No. of stale Replica: " +