HADOOP-11659. o.a.h.FileSystem.Cache#remove should use a single hash map lookup. Contributed by Brahma Reddy Battula.
This commit is contained in:
parent
5b322c6a82
commit
34117325b2
|
@ -449,6 +449,9 @@ Release 2.8.0 - UNRELEASED
|
||||||
HADOOP-11692. Improve authentication failure WARN message to avoid user
|
HADOOP-11692. Improve authentication failure WARN message to avoid user
|
||||||
confusion. (Yongjun Zhang)
|
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
|
OPTIMIZATIONS
|
||||||
|
|
||||||
BUG FIXES
|
BUG FIXES
|
||||||
|
|
|
@ -2700,9 +2700,11 @@ public abstract class FileSystem extends Configured implements Closeable {
|
||||||
}
|
}
|
||||||
|
|
||||||
synchronized void remove(Key key, FileSystem fs) {
|
synchronized void remove(Key key, FileSystem fs) {
|
||||||
if (map.containsKey(key) && fs == map.get(key)) {
|
FileSystem cachedFs = map.remove(key);
|
||||||
map.remove(key);
|
if (fs == cachedFs) {
|
||||||
toAutoClose.remove(key);
|
toAutoClose.remove(key);
|
||||||
|
} else if (cachedFs != null) {
|
||||||
|
map.put(key, cachedFs);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2730,7 +2732,8 @@ public abstract class FileSystem extends Configured implements Closeable {
|
||||||
}
|
}
|
||||||
|
|
||||||
//remove from cache
|
//remove from cache
|
||||||
remove(key, fs);
|
map.remove(key);
|
||||||
|
toAutoClose.remove(key);
|
||||||
|
|
||||||
if (fs != null) {
|
if (fs != null) {
|
||||||
try {
|
try {
|
||||||
|
|
Loading…
Reference in New Issue