leosunli commented on a change in pull request #977: (HDFS-14541)when
evictableMmapped or evictable size is zero, do not throw NoSuchE…
URL: https://github.com/apache/hadoop/pull/977#discussion_r296693866
##########
File path:
hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/shortcircuit/ShortCircuitCache.java
##########
@@ -533,23 +523,15 @@ private void trimEvictionMaps() {
long now = Time.monotonicNow();
demoteOldEvictableMmaped(now);
- while (true) {
- long evictableSize = evictable.size();
- long evictableMmappedSize = evictableMmapped.size();
- if (evictableSize + evictableMmappedSize <= maxTotalSize) {
- return;
- }
+ while (evictable.size() + evictableMmapped.size() > maxTotalSize) {
ShortCircuitReplica replica;
- try {
- if (evictableSize == 0) {
- replica = (ShortCircuitReplica)evictableMmapped.get(evictableMmapped
- .firstKey());
- } else {
- replica = (ShortCircuitReplica)evictable.get(evictable.firstKey());
- }
- } catch (NoSuchElementException e) {
- break;
+ if (evictable.size() == 0) {
Review comment:
@goiri Thanks for your comments . I have updated this patch. Could you have
time to help review this patch? Thank you.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]