private void testReaderBlockAllocationWithCombinedCache(boolean cacheConfigCacheBlockOnRead,
    boolean cacheBlock, BlockType blockType, boolean expectSharedMem) throws IOException {
    int bufCount = 1024, blockSize = 64 * 1024;
    ByteBuffAllocator alloc = initAllocator(true, blockSize, bufCount, 0);
    fillByteBuffAllocator(alloc, bufCount);
    Path storeFilePath = writeStoreFile();
    // Open the file reader with CombinedBlockCache
    BlockCache combined = initCombinedBlockCache("LRU");
    Configuration myConf = new Configuration(conf);

    myConf.setBoolean(CacheConfig.CACHE_DATA_ON_READ_KEY, cacheConfigCacheBlockOnRead);
    myConf.setBoolean(EVICT_BLOCKS_ON_CLOSE_KEY, true);

    CacheConfig cacheConfig = new CacheConfig(myConf, null, combined, alloc);
    HFile.Reader reader = HFile.createReader(fs, storeFilePath, cacheConfig, true, myConf);
    long offset = 0;
    while (offset < reader.getTrailer().getLoadOnOpenDataOffset()) {
      long read = readAtOffsetWithAllocationAsserts(alloc, reader, offset, cacheBlock, blockType,
        expectSharedMem);
      if (read < 0) {
        break;
      }

      offset += read;
    }

    reader.close();
    combined.shutdown();
    Assert.assertEquals(bufCount, alloc.getFreeBufferCount());
    alloc.clean();
  }
Tests that we properly allocate from the off-heap or on-heap when CombinedCache is configured.
In this case, we should always use off-heap unless the block is an INDEX (which always goes to
L1 cache which is on-heap)
hbase-server/src/test/java/org/apache/hadoop/hbase/io/hfile/TestHFile.java