taklwu commented on code in PR #8903:
URL: https://github.com/apache/hbase/pull/8903#discussion_r4674257546
##########
hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/cache/AdaptiveLruCachePlacementAdmissionPolicy.java:
##########
@@ -121,29 +119,32 @@ public
AdaptiveLruCachePlacementAdmissionPolicy(Configuration conf) {
* @param block block to cache
* @param context cache write context
* @param priority admission priority
+ * @param tier cache tier being evaluated for admission
* @param topologyView read-only topology view
* @return admission decision
*/
@Override
public AdmissionDecision shouldAdmit(BlockCacheKey cacheKey, Cacheable block,
- CacheWriteContext context, AdmissionPriority priority, CacheTopologyView
topologyView) {
+ CacheWriteContext context, AdmissionPriority priority, CacheTier tier,
+ CacheTopologyView topologyView) {
Objects.requireNonNull(cacheKey, "cacheKey must not be null");
Objects.requireNonNull(block, "block must not be null");
Objects.requireNonNull(context, "context must not be null");
Objects.requireNonNull(priority, "priority must not be null");
+ Objects.requireNonNull(tier, "tier must not be null");
Objects.requireNonNull(topologyView, "topologyView must not be null");
AdmissionDecision decision =
- DELEGATE.shouldAdmit(cacheKey, block, context, priority, topologyView);
+ DELEGATE.shouldAdmit(cacheKey, block, context, priority, tier,
topologyView);
if (!decision.isAdmitted()) {
return decision;
}
if (
- topologyView.getType() == CacheTopologyType.SINGLE_TIER
+ (tier == CacheTier.SINGLE || tier == CacheTier.L1)
Review Comment:
nit: does that mean SINGLE or L1 mean this is one tier cache ?
##########
hbase-server/src/test/java/org/apache/hadoop/hbase/io/hfile/cache/TestAdaptiveLruCachePlacementAdmissionPolicy.java:
##########
@@ -225,20 +235,19 @@ void testExclusiveTopologyKeepsDefaultDataPlacementInL2()
{
BlockCacheKey cacheKey = new BlockCacheKey("file", 99L);
- AdmissionDecision admission =
- policy.shouldAdmit(cacheKey, dataBlock, context,
AdmissionPriority.NORMAL, topologyView);
TierDecision placement = policy.selectTier(cacheKey, dataBlock, context,
topologyView);
+ AdmissionDecision admission = policy.shouldAdmit(cacheKey, dataBlock,
context,
+ AdmissionPriority.NORMAL, CacheTier.L2, topologyView);
- assertTrue(admission.isAdmitted());
assertEquals(List.of(CacheTier.L2), placement.getTiers());
+ assertTrue(admission.isAdmitted());
Review Comment:
nit: why do we need to move this line down ?
##########
hbase-server/src/test/java/org/apache/hadoop/hbase/io/hfile/cache/TestSingleTierTopologyBackedCacheAccessService.java:
##########
@@ -401,7 +401,9 @@ private static CachePlacementAdmissionPolicy
admitToTiersPolicy(CacheTier... tie
*/
private static CachePlacementAdmissionPolicy rejectPolicy() {
CachePlacementAdmissionPolicy policy =
mock(CachePlacementAdmissionPolicy.class);
- when(policy.shouldAdmit(any(), any(), any(), any(), any()))
+ when(policy.selectTier(any(), any(), any(), any()))
+ .thenReturn(TierDecision.single(CacheTier.L1));
Review Comment:
can you check this ?
--
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]