hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aajis...@apache.org
Subject hadoop git commit: HADOOP-11659. o.a.h.FileSystem.Cache#remove should use a single hash map lookup. Contributed by Brahma Reddy Battula.
Date Wed, 18 Mar 2015 06:45:12 GMT
Repository: hadoop
Updated Branches:
  refs/heads/trunk 5b322c6a8 -> 34117325b


HADOOP-11659. o.a.h.FileSystem.Cache#remove should use a single hash map lookup. Contributed
by Brahma Reddy Battula.


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

Branch: refs/heads/trunk
Commit: 34117325b29f0f1bdbe21343e7fd07e9ad0af907
Parents: 5b322c6
Author: Akira Ajisaka <aajisaka@apache.org>
Authored: Wed Mar 18 15:43:10 2015 +0900
Committer: Akira Ajisaka <aajisaka@apache.org>
Committed: Wed Mar 18 15:43:10 2015 +0900

----------------------------------------------------------------------
 hadoop-common-project/hadoop-common/CHANGES.txt          |  3 +++
 .../src/main/java/org/apache/hadoop/fs/FileSystem.java   | 11 +++++++----
 2 files changed, 10 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hadoop/blob/34117325/hadoop-common-project/hadoop-common/CHANGES.txt
----------------------------------------------------------------------
diff --git a/hadoop-common-project/hadoop-common/CHANGES.txt b/hadoop-common-project/hadoop-common/CHANGES.txt
index a6bd68d..37dea77 100644
--- a/hadoop-common-project/hadoop-common/CHANGES.txt
+++ b/hadoop-common-project/hadoop-common/CHANGES.txt
@@ -449,6 +449,9 @@ Release 2.8.0 - UNRELEASED
     HADOOP-11692. Improve authentication failure WARN message to avoid user
     confusion. (Yongjun Zhang)
 
+    HADOOP-11659. o.a.h.fs.FileSystem.Cache#remove should use a single hash map
+    lookup. (Brahma Reddy Battula via aajisaka)
+
   OPTIMIZATIONS
 
   BUG FIXES

http://git-wip-us.apache.org/repos/asf/hadoop/blob/34117325/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/FileSystem.java
----------------------------------------------------------------------
diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/FileSystem.java
b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/FileSystem.java
index 42434f1..2ca8813 100644
--- a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/FileSystem.java
+++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/FileSystem.java
@@ -2700,10 +2700,12 @@ public abstract class FileSystem extends Configured implements Closeable
{
     }
 
     synchronized void remove(Key key, FileSystem fs) {
-      if (map.containsKey(key) && fs == map.get(key)) {
-        map.remove(key);
+      FileSystem cachedFs = map.remove(key);
+      if (fs == cachedFs) {
         toAutoClose.remove(key);
-        }
+      } else if (cachedFs != null) {
+        map.put(key, cachedFs);
+      }
     }
 
     synchronized void closeAll() throws IOException {
@@ -2730,7 +2732,8 @@ public abstract class FileSystem extends Configured implements Closeable
{
         }
 
         //remove from cache
-        remove(key, fs);
+        map.remove(key);
+        toAutoClose.remove(key);
 
         if (fs != null) {
           try {


Mime
View raw message