Skip to content

Remove deprecated LRUBlockCache - #6596

Open
Amemeda wants to merge 5 commits into
apache:mainfrom
Amemeda:4921-remove-lru
Open

Amemeda wants to merge 5 commits into
apache:mainfrom
Amemeda:4921-remove-lru

Conversation

@Amemeda

@Amemeda Amemeda commented Oct 16, 2026 •

Copy link
Copy Markdown
Collaborator

LruBlockCache was deprecated in #4920 and replaced with TinyLfuBlockCache, this pr removes LruBlockCache and related code:

  • LruBlockCache.java: Deleted
  • LruBlockCacheConfiguration.java: Deleted
  • LruBlockCacheManager.java: Deleted
  • TestlLruBlockCache.java: Deleted
  • BlockCacheFactoryTest: Updated to remove deprecated test testCreateLruBlockCacheFactory()
  • CachedBlock.java: Deleted (only uses were in deleted test file)
  • CacheBlockQueue.java: Deleted (only uses were in deleted test file)
  • HeapSize.java: Deleted (only uses were in deleted test file)
  • TestCachedBlockQueue: Deleted, only tested lru cache using the above 3 files
  • SynchronizedLoadingBlockCache.java: Deleted
  • blockfile.cache.lru subfolder: Emptied and deleted

Closes #4921

@Amemeda
Amemeda marked this pull request as ready for review October 16, 2026 19:10
@Amemeda

Amemeda commented Oct 16, 2026

Copy link
Copy Markdown
Collaborator Author

There are 4 files remaining in the cache.lru subfolder where all the lru files were deleted from. The only usage of these files is in TestCachedBlockQueue.java which is testing using lru.CachedBlock.java. All tests in this file still pass with the LRU deleted. So I am wondering, should TestCachedBlockQueue.java be deleted along with the remaining 4 files in lru package? Or I can refactor the remaining 4 files from the lru package, probably to rename the package to util or something similar.

image

@Amemeda Amemeda changed the title Remove deprecated LRUCacheBlock Remove deprecated LRUBlockCache Oct 16, 2026
@dlmarion

Copy link
Copy Markdown
Contributor

I think you can remove TestCachedBlockQueue as well

@Amemeda

Amemeda commented Oct 16, 2026

Copy link
Copy Markdown
Collaborator Author

There is a method in BlockCacheManager.java that still has documentation referencing LRU. Unsure if this needs to be updated to TinyLFU or its talking about a different LRU like the LRU Map I see throughout the code

   /**
     * This method provides a way for a cache implementation to access arbitrary configuration set
     * by a user.
     *
     * <p>
     * When running in a tserver, returns all Accumulo properties that have a prefix of
     * {@code tserver.cache.config.<prefix>.<type>.} or
     * {@code tserver.cache.config.<prefix>.default.} with values for specific cache types
     * overriding defaults.
     *
     * <p>
     * When running in a scan server, returns all Accumulo properties that have a prefix of
     * {@code sserver.cache.config.<prefix>.<type>.} or
     * {@code sserver.cache.config.<prefix>.default.} with values for specific cache types
     * overriding defaults.
     *
     * <p>
     * For example assume the following data is in Accumulo's system config and the plugin is
     * running in a tserver.
     *
     * <pre>
     * tserver.cache.config.lru.default.evictAfter=3600
     * tserver.cache.config.lru.default.loadFactor=.75
     * tserver.cache.config.lru.index.loadFactor=.55
     * tserver.cache.config.lru.data.loadFactor=.65
     * </pre>
     *
     * <p>
     * If this method is called with {@code prefix=lru} and {@code type=INDEX} then it would return
     * a map with the following key values. The load factor setting for index overrides the default
     * value.
     *
     * <pre>
     * evictAfter=3600
     * loadFactor=.55
     * </pre>
     *
     * @param prefix A unique identifier that corresponds to a particular BlockCacheManager
     *        implementation.
     */
    Map<String,String> getProperties(String prefix, CacheType type);

@Amemeda
Amemeda requested a review from dlmarion October 19, 2026 15:04
@Amemeda
Amemeda requested a review from ctubbsii October 28, 2026 18:11
@dlmarion

dlmarion commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

@Amemeda - can you merge main into this branch to get it up to date. Then I'll merge it.

@DomGarguilo

Copy link
Copy Markdown
Member

SynchronizedLoadingBlockCache.java: Moved to spi.cache subfolder. Still used elsewhere in code.

I can't find where else its used in the code? I don't think moving it into spi.cache is a good idea since that makes it public API. Could we just delete it instead?

@DomGarguilo

DomGarguilo commented Nov 10, 2026 •

Copy link
Copy Markdown
Member

There is a method in BlockCacheManager.java that still has documentation referencing LRU. Unsure if this needs to be updated to TinyLFU or its talking about a different LRU like the LRU Map I see throughout the code

Yea I think this should be updated. Maybe just swap the example to use a generic prefix like tserver.cache.config.myplugin.default.* with prefix=myplugin for example.

@DomGarguilo

Copy link
Copy Markdown
Member

Users who have general.block.cache.manager.class set to LruBlockCacheManager will fail to start after upgrading to 4.0. Could we add a release note telling them to unset the property or switch to TinyLfuBlockCacheManager?

@Amemeda

Amemeda commented Nov 12, 2026 •

Copy link
Copy Markdown
Collaborator Author

I can't find where else its used in the code? I don't think moving it into spi.cache is a good idea since that makes it public API. Could we just delete it instead?

SynchronizedLoadingBlochCache has no usages, but it is referenced in BlockCache.getBlock documentation, so I was assuming it was still usable, I will still remove it for now

 /**
   * This method allows a cache to prevent concurrent loads of the same block. However a cache
   * implementation is not required to prevent concurrent loads.
   * {@link SynchronousLoadingBlockCache} is an abstract class that a cache can extent which does
   * prevent concurrent loading of the same block.
   *
   *
   * @param blockName Block name to fetch
   * @param loader If the block is not present in the cache, the loader can be called to load it.
   * @return Block or null if block is not in the cache or didn't load.
   */
  CacheEntry getBlock(String blockName, Loader loader);

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Remove LRU block cache

3 participants