Uploaded image for project: 'Hadoop HDFS'
  1. Hadoop HDFS
  2. HDFS-15161

When evictableMmapped or evictable size is zero, do not throw NoSuchElementException in ShortCircuitCache#close()

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 3.3.0, 2.9.3, 3.1.4, 3.2.2, 2.10.1
    • Component/s: None
    • Labels:
      None
    • Hadoop Flags:
      Reviewed

      Description

      detail see HDFS-14541

      /**
       * 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();
        }
      

       

        Attachments

        1. HDFS-15161.002.patch
          2 kB
          Lisheng Sun
        2. HDFS-15161.001.patch
          2 kB
          Lisheng Sun

          Issue Links

            Activity

              People

              • Assignee:
                leosun08 Lisheng Sun
                Reporter:
                leosun08 Lisheng Sun
              • Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: