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


##########
hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/cache/CacheWriteContext.java:
##########
@@ -0,0 +1,187 @@
+/*
+ * 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.hadoop.hbase.io.hfile.BlockType.BlockCategory;
+import org.apache.yetus.audience.InterfaceAudience;
+
+/**
+ * Context for cache insertion.
+ * <p>
+ * This object carries insertion intent from read-miss population, write path 
population, prefetch,
+ * compaction, or promotion. It is intentionally small and immutable.
+ * </p>
+ */
[email protected]
+public final class CacheWriteContext {
+
+  private final boolean inMemory;
+  private final boolean waitWhenCache;
+  private final boolean cacheCompressed;
+  private final boolean cacheOnWrite;
+  private final BlockCategory blockCategory;
+  private final CacheWriteSource source;
+
+  private CacheWriteContext(Builder builder) {

Review Comment:
   I think "cacheCompactedDataOnWrite" and "cacheOnWrite" in general are 
redundant if CacheWriteSource already captures the insertion origin. The source 
tells us whether the insertion came from READ_MISS, FLUSH, COMPACTION, 
PREFETCH, or PROMOTION. Existing CacheConfig logic should already decide 
whether cache population is allowed before this context is created.
   So the policy should not use cacheOnWrite and cacheCompactedDataOnWrite as a 
second eligibility gate. For compatibility behavior, it should assume that the 
caller invokes cache insertion only after CacheConfig has allowed it. I’ll 
remove cacheOnWrite from CacheWriteContext and rely on CacheWriteSource plus 
existing call-site logic.



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