[Backport 2.x] [Tiered Caching] Stats rework (2/4): Gates CacheStatsHolder logic behind FeatureFlags.PLUGGABLE_CACHE setting #13432
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Original PR
Description
Part of tiered caching stats. Tiered/pluggable caching is currently an experimental feature with the feature flag PLUGGABLE_CACHE. We want to gate the new CacheStatsHolder logic, which is run in the search path within cache implementations, behind this feature flag in case of any unexpected behavior.
With this PR, if PLUGGABLE_CACHE is true, cache implementations use the existing CacheStatsHolder class to keep track of their stats. If it's false, they instead use a DummyCacheStatsHolder, which keeps track of count only. In this case, the new cache stats API exposed in this PR will return all-zero stats and not support aggregating by any levels.
Because TieredSpilloverCache will store its own stats in #13236, NoopCacheStatsHolder will also be used in the individual tiers of the TieredSpilloverCache to avoid storing redundant stats.
Related Issues
Follow up to #12531.
Check List
- [N/A] Public documentation issue/PR createdBy submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.