anmolnar commented on PR #8876: URL: https://github.com/apache/hbase/pull/8876#issuecomment-6863714255
> 🤖 *AI-assisted review: drafted by Claude on behalf of @anmolnar* Thanks @VladRodionov. The single-tier path looks equivalent to the legacy `IndexOnlyLruBlockCache`: the predicate matches `isMetaBlock` exactly, and `TestCacheConfig` is stronger than before now that it asserts the data block is rejected. One behaviour change needs addressing before merge; the rest is minor. **1. Tiered topologies no longer cache data blocks in L2** `CacheAccessServices.createPlacementAdmissionPolicy` applies the policy to every topology, and `TopologyBackedCacheAccessService.cacheBlockToSelectedTiers` calls `shouldAdmit` before `selectTier`. A rejected DATA block is therefore rejected for the whole service. Previously `IndexOnlyLruBlockCache` was only the L1: - L1 + BucketCache (exclusive): data blocks went to L2. Now they are not cached at all. - L1 + external cache (inclusive): L1 rejected, L2 cached. Now they are not cached at all. `ClientSideRegionScanner` unsets the bucket IO engine but not `hbase.blockcache.use.external`, so the inclusive case is reachable from the scanner itself, and `hfile.block.cache.policy=IndexOnlyLRU` can be set alongside a bucket cache. Could we mirror `AdaptiveLruCachePlacementAdmissionPolicy`: reject in `shouldAdmit` only for `SINGLE_TIER`, and otherwise drop L1 from the `selectTier` result for data blocks? A test with a tiered topology would be good too; the current ones only cover single tier. **2. Discarded `super.shouldAdmit(...)` result** Agree with @taklwu that this is harmless today, since the parent only null-checks and admits. It would silently ignore a rejection if the default policy ever starts returning one, though. Suggest capturing the decision and returning early when it is not admitted, as the Adaptive policy does. **3. Allocation per rejected data block** `AdmissionDecision.reject(String)` allocates a new object per call, and this path rejects every data block read in a client-side scan. A `private static final` decision would avoid that. A second constant for the `blockType == null` case would also fix the misleading reason text, and the existing null-type test could assert on it. **4. Leftovers** - The comment in `ClientSideRegionScanner` (around line 75) still says it uses `IndexOnlyLruBlockCache`. - `IndexOnlyLruBlockCache` is now only referenced from the legacy `createFirstLevelCache`. Is removing it planned for a follow-up? - +1 to @taklwu's enum suggestion, now that the policy name literals live in both `BlockCacheFactory` and `CacheAccessServices`. Fine as a follow-up. Note: this review is from reading the code; I did not build or run the tests locally. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
