@Test
  public void testOnConfigurationChange() throws Exception {
    BucketCache bucketCache = null;
    try {
      final Path dataTestDir = createAndGetTestDir();

      String ioEngineName = "file:" + dataTestDir + "/bucketNoRecycler.cache";

      Configuration config = HBASE_TESTING_UTILITY.getConfiguration();

      bucketCache = new BucketCache(ioEngineName, capacitySize, constructedBlockSize,
        constructedBlockSizes, 1, 1, null, DEFAULT_ERROR_TOLERATION_DURATION, config);

      assertTrue(bucketCache.waitForCacheInitialization(10000));

      config.setFloat(ACCEPT_FACTOR_CONFIG_NAME, 0.9f);
      config.setFloat(MIN_FACTOR_CONFIG_NAME, 0.8f);
      config.setFloat(EXTRA_FREE_FACTOR_CONFIG_NAME, 0.15f);
      config.setFloat(SINGLE_FACTOR_CONFIG_NAME, 0.2f);
      config.setFloat(MULTI_FACTOR_CONFIG_NAME, 0.6f);
      config.setFloat(MEMORY_FACTOR_CONFIG_NAME, 0.2f);
      config.setLong(QUEUE_ADDITION_WAIT_TIME, 100);
      config.setLong(BUCKETCACHE_PERSIST_INTERVAL_KEY, 500);
      config.setLong(BACKING_MAP_PERSISTENCE_CHUNK_SIZE, 1000);

      bucketCache.onConfigurationChange(config);

      assertEquals(0.9f, bucketCache.getAcceptableFactor(), 0.01);
      assertEquals(0.8f, bucketCache.getMinFactor(), 0.01);
      assertEquals(0.15f, bucketCache.getExtraFreeFactor(), 0.01);
      assertEquals(0.2f, bucketCache.getSingleFactor(), 0.01);
      assertEquals(0.6f, bucketCache.getMultiFactor(), 0.01);
      assertEquals(0.2f, bucketCache.getMemoryFactor(), 0.01);
      assertEquals(100L, bucketCache.getQueueAdditionWaitTime());
      assertEquals(500L, bucketCache.getBucketcachePersistInterval());
      assertEquals(1000L, bucketCache.getPersistenceChunkSize());

    } finally {
      if (bucketCache != null) {
        bucketCache.shutdown();
      }
      HBASE_TESTING_UTILITY.cleanupTestDir();
    }
  }
This test is for HBASE-26295, {@link BucketEntry} which is restored from a persistence file
could not be freed even if corresponding {@link HFileBlock} is evicted from
{@link BucketCache}.
hbase-server/src/test/java/org/apache/hadoop/hbase/io/hfile/bucket/TestBucketCache.java