You are viewing a plain text version of this content. The canonical link for it is here.
Posted to hdfs-dev@hadoop.apache.org by "Lisheng Sun (Jira)" <ji...@apache.org> on 2020/02/11 08:05:00 UTC

[jira] [Created] (HDFS-15161) When evictableMmapped or evictable size is zero, do not throw NoSuchElementException in ShortCircuitCache#close()

Lisheng Sun created HDFS-15161:
----------------------------------

             Summary: When evictableMmapped or evictable size is zero, do not throw NoSuchElementException in ShortCircuitCache#close() 
                 Key: HDFS-15161
                 URL: https://issues.apache.org/jira/browse/HDFS-15161
             Project: Hadoop HDFS
          Issue Type: Bug
            Reporter: Lisheng Sun
            Assignee: Lisheng Sun


detail see 
 # HDFS-14541

 # HDFS-14541

 # HDFS-14541

 

 
{code:java}
/**
 * Close the cache and free all associated resources.
 */
@Override
public void close() {
  try {
    lock.lock();
    if (closed) return;
    closed = true;
    LOG.info(this + ": closing");
    maxNonMmappedEvictableLifespanMs = 0;
    maxEvictableMmapedSize = 0;
    // Close and join cacheCleaner thread.
    IOUtilsClient.cleanupWithLogger(LOG, cacheCleaner);
    // Purge all replicas.
    while (true) {
      Object eldestKey;
      try {
        eldestKey = evictable.firstKey();
      } catch (NoSuchElementException e) {
        break;
      }
      purge((ShortCircuitReplica)evictable.get(eldestKey));
    }
    while (true) {
      Object eldestKey;
      try {
        eldestKey = evictableMmapped.firstKey();
      } catch (NoSuchElementException e) {
        break;
      }
      purge((ShortCircuitReplica)evictableMmapped.get(eldestKey));
    }
  } finally {
    lock.unlock();
  }
{code}
 



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

---------------------------------------------------------------------
To unsubscribe, e-mail: hdfs-dev-unsubscribe@hadoop.apache.org
For additional commands, e-mail: hdfs-dev-help@hadoop.apache.org