hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From zjs...@apache.org
Subject [33/50] [abbrv] hadoop git commit: HDFS-7753. Fix Multithreaded correctness Warnings in BackupImage. Contributed by Rakesh R and Konstantin Shvachko.
Date Wed, 11 Feb 2015 19:48:51 GMT
HDFS-7753. Fix Multithreaded correctness Warnings in BackupImage. Contributed by Rakesh R and
Konstantin Shvachko.

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

Branch: refs/heads/YARN-2928
Commit: a4ceea60f57a32d531549e492aa5894dd34e0d0f
Parents: 7c6b654
Author: Konstantin V Shvachko <shv@apache.org>
Authored: Wed Feb 11 00:45:18 2015 -0800
Committer: Konstantin V Shvachko <shv@apache.org>
Committed: Wed Feb 11 00:45:18 2015 -0800

----------------------------------------------------------------------
 hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt     |  3 +++
 .../hdfs/server/namenode/BackupImage.java       | 21 +++++++++++++-------
 2 files changed, 17 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hadoop/blob/a4ceea60/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt
----------------------------------------------------------------------
diff --git a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt
index 2e90478..1d2a76a 100644
--- a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt
+++ b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt
@@ -904,6 +904,9 @@ Release 2.7.0 - UNRELEASED
     HDFS-7769. TestHDFSCLI should not create files in hdfs project root dir.
     (szetszwo)
 
+    HDFS-7753. Fix Multithreaded correctness Warnings in BackupImage.
+    (Rakesh R and shv)
+
 Release 2.6.1 - UNRELEASED
 
   INCOMPATIBLE CHANGES

http://git-wip-us.apache.org/repos/asf/hadoop/blob/a4ceea60/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/BackupImage.java
----------------------------------------------------------------------
diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/BackupImage.java
b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/BackupImage.java
index 1900b40..dc44959 100644
--- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/BackupImage.java
+++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/BackupImage.java
@@ -92,9 +92,16 @@ public class BackupImage extends FSImage {
     storage.setDisablePreUpgradableLayoutCheck(true);
     bnState = BNState.DROP_UNTIL_NEXT_ROLL;
   }
-  
-  void setNamesystem(FSNamesystem fsn) {
-    this.namesystem = fsn;
+
+  synchronized FSNamesystem getNamesystem() {
+    return namesystem;
+  }
+
+  synchronized void setNamesystem(FSNamesystem fsn) {
+    // Avoids overriding this.namesystem object
+    if (namesystem == null) {
+      this.namesystem = fsn;
+    }
   }
 
   /**
@@ -195,7 +202,7 @@ public class BackupImage extends FSImage {
       }
 
       FSEditLogLoader logLoader =
-          new FSEditLogLoader(namesystem, lastAppliedTxId);
+          new FSEditLogLoader(getNamesystem(), lastAppliedTxId);
       int logVersion = storage.getLayoutVersion();
       backupInputStream.setBytes(data, logVersion);
 
@@ -209,7 +216,7 @@ public class BackupImage extends FSImage {
       }
       lastAppliedTxId = logLoader.getLastAppliedTxId();
 
-      FSImage.updateCountForQuota(namesystem.dir.rootDir); // inefficient!
+      FSImage.updateCountForQuota(getNamesystem().dir.getRoot()); // inefficient!
     } finally {
       backupInputStream.clear();
     }
@@ -258,7 +265,7 @@ public class BackupImage extends FSImage {
           editStreams.add(s);
         }
       }
-      loadEdits(editStreams, namesystem);
+      loadEdits(editStreams, getNamesystem());
     }
     
     // now, need to load the in-progress file
@@ -293,7 +300,7 @@ public class BackupImage extends FSImage {
             + " txns from in-progress stream " + stream);
         
         FSEditLogLoader loader =
-            new FSEditLogLoader(namesystem, lastAppliedTxId);
+            new FSEditLogLoader(getNamesystem(), lastAppliedTxId);
         loader.loadFSEdits(stream, lastAppliedTxId + 1);
         lastAppliedTxId = loader.getLastAppliedTxId();
         assert lastAppliedTxId == getEditLog().getLastWrittenTxId();


Mime
View raw message