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

Remove dependency on old version of Guava in TestDFSClientCache#testEviction

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 2.6.0
    • 2.7.0
    • test
    • None

    Description

      TestDFSClientCache.testEviction() is not entirely accurate in its usage of the guava LoadingCache.

      It sets the max size at 2, but asserts the loading cache will contain only 1 entry after inserting two entries. Guava's CacheBuilder.maximumSize() makes only the following promise:

      Specifies the maximum number of entries the cache may contain. Note that the cache may evict an entry before this limit is exceeded.

      Thus, the only invariant is that the loading cache will hold the maximum size number of entries or fewer. The DFSClientCache.testEviction asserts it holds maximum size - 1 exactly.

      For guava 11.0.2 this happens to be true at maximum size = 2 because of the way it sets the maximum segment weight. With later versions of guava, the maximum segment weight is set higher, and the eviction is less aggressive.

      The test should be fixed to assert only the true invariant.

      Attachments

        1. HDFS-7598.001.patch
          1 kB
          Sangjin Lee

        Issue Links

          Activity

            People

              sjlee0 Sangjin Lee
              sjlee0 Sangjin Lee
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: