VladRodionov commented on code in PR #8184:
URL: https://github.com/apache/hbase/pull/8184#discussion_r3205164675


##########
hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/cache/PromotionAction.java:
##########
@@ -0,0 +1,37 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.hadoop.hbase.io.hfile.cache;
+
+import org.apache.yetus.audience.InterfaceAudience;
+
+/**
+ * Promotion action selected by cache placement policy.
+ */
[email protected]
+public enum PromotionAction {

Review Comment:
   I think demotion is a separate topology operation and should not be encoded 
in PromotionAction.
   PromotionAction is intentionally scoped to cache-hit handling: after a hit 
in one tier, the policy may decide whether to promote the block to a 
higher-priority tier. Demotion, if needed later, would likely be modeled 
separately, for example as DemotionDecision / DemotionAction, or recorded in 
topology-level metrics when CacheTopology#demote(...) is invoked. I would avoid 
mixing promotion and demotion into the same enum because they are triggered by 
different events: promotion is hit-driven, while demotion is usually 
eviction/pressure-driven. Besides this, demotion is quite expensive (you will 
need to expose CacheEngine internal eviction pipeline to listen to these 
events, not all cache implementations can be efficient)
   
   For this PR, I’d keep PromotionAction limited to NONE and PROMOTE, and add 
demotion-specific decision/metrics later when we wire actual eviction callbacks 
or topology movement.
   
   Btw, promotion is hard as well, you have to make sure that object being 
promoted is really worth it, otherwise you introduce additional layer of cache 
data trashing.



-- 
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]

Reply via email to