You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-commits@hadoop.apache.org by ay...@apache.org on 2020/02/12 15:13:39 UTC
[hadoop] branch branch-3.1 updated: HDFS-15161. When
evictableMmapped or evictable size is zero,
do not throw NoSuchElementException in ShortCircuitCache#close().
Contributed by Lisheng Sun
This is an automated email from the ASF dual-hosted git repository.
ayushsaxena pushed a commit to branch branch-3.1
in repository https://gitbox.apache.org/repos/asf/hadoop.git
The following commit(s) were added to refs/heads/branch-3.1 by this push:
new 83ab853 HDFS-15161. When evictableMmapped or evictable size is zero, do not throw NoSuchElementException in ShortCircuitCache#close(). Contributed by Lisheng Sun
83ab853 is described below
commit 83ab85373386256bf8d38d1e7259ecee7132bfa6
Author: Ayush Saxena <ay...@apache.org>
AuthorDate: Wed Feb 12 20:22:51 2020 +0530
HDFS-15161. When evictableMmapped or evictable size is zero, do not throw NoSuchElementException in ShortCircuitCache#close(). Contributed by Lisheng Sun
---
.../hdfs/shortcircuit/ShortCircuitCache.java | 23 ++++++----------------
1 file changed, 6 insertions(+), 17 deletions(-)
diff --git a/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/shortcircuit/ShortCircuitCache.java b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/shortcircuit/ShortCircuitCache.java
index d91dd7d..9b16ba2 100644
--- a/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/shortcircuit/ShortCircuitCache.java
+++ b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/shortcircuit/ShortCircuitCache.java
@@ -26,7 +26,6 @@ import java.nio.MappedByteBuffer;
import java.util.HashMap;
import java.util.Map;
import java.util.Map.Entry;
-import java.util.NoSuchElementException;
import java.util.concurrent.ScheduledFuture;
import java.util.concurrent.ScheduledThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
@@ -864,23 +863,13 @@ public class ShortCircuitCache implements Closeable {
// Close and join cacheCleaner thread.
IOUtilsClient.cleanup(LOG, cacheCleaner);
// Purge all replicas.
- while (true) {
- Object eldestKey;
- try {
- eldestKey = evictable.firstKey();
- } catch (NoSuchElementException e) {
- break;
- }
- purge((ShortCircuitReplica)evictable.get(eldestKey));
+ while (!evictable.isEmpty()) {
+ Object eldestKey = evictable.firstKey();
+ purge((ShortCircuitReplica) evictable.get(eldestKey));
}
- while (true) {
- Object eldestKey;
- try {
- eldestKey = evictableMmapped.firstKey();
- } catch (NoSuchElementException e) {
- break;
- }
- purge((ShortCircuitReplica)evictableMmapped.get(eldestKey));
+ while (!evictableMmapped.isEmpty()) {
+ Object eldestKey = evictableMmapped.firstKey();
+ purge((ShortCircuitReplica) evictableMmapped.get(eldestKey));
}
} finally {
lock.unlock();
---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-commits-help@hadoop.apache.org