This is an automated email from the ASF dual-hosted git repository.

wchevreuil pushed a commit to branch HBASE-29427
in repository https://gitbox.apache.org/repos/asf/hbase.git

commit aa1bd2bcbe9c590388bbd90d846ff438cdc00da6
Author: Wellington Ramos Chevreuil <[email protected]>
AuthorDate: Tue Jul 8 16:03:59 2025 +0100

    addressing review comments
    
    Change-Id: I434e61aafd31a0c47f656e23eee5239aef7910f1
---
 .../hadoop/hbase/io/hfile/HFileWriterImpl.java     | 10 +++----
 .../regionserver/CustomTieredStoreEngine.java      |  4 +--
 .../regionserver/CustomTieringMultiFileWriter.java |  2 +-
 .../CustomCellTieringValueProvider.java            | 17 ------------
 ....java => CustomDateTieredCompactionPolicy.java} |  6 ++--
 .../TestCustomCellTieredCompactionPolicy.java      | 32 +++++++++++-----------
 6 files changed, 27 insertions(+), 44 deletions(-)

diff --git 
a/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/HFileWriterImpl.java
 
b/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/HFileWriterImpl.java
index 7e3a415d7d7..04bf3ff7b32 100644
--- 
a/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/HFileWriterImpl.java
+++ 
b/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/HFileWriterImpl.java
@@ -129,11 +129,11 @@ public class HFileWriterImpl implements HFile.Writer {
   /** Cache configuration for caching data on write. */
   protected final CacheConfig cacheConf;
 
-  public void setTimeRangeToTrack(Supplier<TimeRangeTracker> timeRangeToTrack) 
{
-    this.timeRangeToTrack = timeRangeToTrack;
+  public void setTimeRangeTrackerForTiering(Supplier<TimeRangeTracker> 
timeRangeTrackerForTiering) {
+    this.timeRangeTrackerForTiering = timeRangeTrackerForTiering;
   }
 
-  private Supplier<TimeRangeTracker> timeRangeToTrack;
+  private Supplier<TimeRangeTracker> timeRangeTrackerForTiering;
 
   /**
    * Name for this object used when logging or in toString. Is either the 
result of a toString on
@@ -196,7 +196,7 @@ public class HFileWriterImpl implements HFile.Writer {
     this.hFileContext = fileContext;
     // TODO: Move this back to upper layer
     this.timeRangeTracker = 
TimeRangeTracker.create(TimeRangeTracker.Type.NON_SYNC);
-    this.timeRangeToTrack = () -> this.timeRangeTracker;
+    this.timeRangeTrackerForTiering = () -> this.timeRangeTracker;
     DataBlockEncoding encoding = hFileContext.getDataBlockEncoding();
     if (encoding != DataBlockEncoding.NONE) {
       this.blockEncoder = new HFileDataBlockEncoderImpl(encoding);
@@ -598,7 +598,7 @@ public class HFileWriterImpl implements HFile.Writer {
   }
 
   private boolean shouldCacheBlock(BlockCache cache, BlockCacheKey key) {
-    Optional<Boolean> result = cache.shouldCacheBlock(key, 
timeRangeToTrack.get().getMax(), conf);
+    Optional<Boolean> result = cache.shouldCacheBlock(key, 
timeRangeTrackerForTiering.get().getMax(), conf);
     return result.orElse(true);
   }
 
diff --git 
a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/CustomTieredStoreEngine.java
 
b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/CustomTieredStoreEngine.java
index 8ba5a0d5cf1..354a14c3bed 100644
--- 
a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/CustomTieredStoreEngine.java
+++ 
b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/CustomTieredStoreEngine.java
@@ -23,7 +23,7 @@ import java.io.IOException;
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.hbase.CellComparator;
 import org.apache.hadoop.hbase.CompoundConfiguration;
-import 
org.apache.hadoop.hbase.regionserver.compactions.CustomTieredCompactionPolicy;
+import 
org.apache.hadoop.hbase.regionserver.compactions.CustomDateTieredCompactionPolicy;
 import org.apache.hadoop.hbase.regionserver.compactions.CustomTieredCompactor;
 import org.apache.yetus.audience.InterfaceAudience;
 
@@ -44,7 +44,7 @@ public class CustomTieredStoreEngine extends 
DateTieredStoreEngine {
     CompoundConfiguration config = new CompoundConfiguration();
     config.add(conf);
     config.add(store.conf);
-    config.set(DEFAULT_COMPACTION_POLICY_CLASS_KEY, 
CustomTieredCompactionPolicy.class.getName());
+    config.set(DEFAULT_COMPACTION_POLICY_CLASS_KEY, 
CustomDateTieredCompactionPolicy.class.getName());
     createCompactionPolicy(config, store);
     this.storeFileManager = new DefaultStoreFileManager(kvComparator,
       StoreFileComparators.SEQ_ID_MAX_TIMESTAMP, config, 
compactionPolicy.getConf());
diff --git 
a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/CustomTieringMultiFileWriter.java
 
b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/CustomTieringMultiFileWriter.java
index 905b542a182..d2b88a501ec 100644
--- 
a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/CustomTieringMultiFileWriter.java
+++ 
b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/CustomTieringMultiFileWriter.java
@@ -57,7 +57,7 @@ public class CustomTieringMultiFileWriter extends 
DateTieredMultiFileWriter {
       timeRangeTracker.setMax(tieringValue);
       lowerBoundary2TimeRanger.put(entry.getKey(), timeRangeTracker);
       ((HFileWriterImpl) 
lowerBoundary2Writer.get(entry.getKey()).getLiveFileWriter())
-        .setTimeRangeToTrack(() -> timeRangeTracker);
+        .setTimeRangeTrackerForTiering(() -> timeRangeTracker);
     } else {
       TimeRangeTracker timeRangeTracker = entry.getValue();
       if (timeRangeTracker.getMin() > tieringValue) {
diff --git 
a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/compactions/CustomCellTieringValueProvider.java
 
b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/compactions/CustomCellTieringValueProvider.java
index 0c9d212a03a..7de9ba1851e 100644
--- 
a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/compactions/CustomCellTieringValueProvider.java
+++ 
b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/compactions/CustomCellTieringValueProvider.java
@@ -17,23 +17,6 @@
  */
 package org.apache.hadoop.hbase.regionserver.compactions;
 
-/*
- * 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.
- */
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.List;
diff --git 
a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/compactions/CustomTieredCompactionPolicy.java
 
b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/compactions/CustomDateTieredCompactionPolicy.java
similarity index 96%
rename from 
hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/compactions/CustomTieredCompactionPolicy.java
rename to 
hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/compactions/CustomDateTieredCompactionPolicy.java
index 665f29fdc81..63a6d1c5b59 100644
--- 
a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/compactions/CustomTieredCompactionPolicy.java
+++ 
b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/compactions/CustomDateTieredCompactionPolicy.java
@@ -44,7 +44,7 @@ import org.slf4j.LoggerFactory;
  * if files have both younger and older data than the configured age limit.
  */
 @InterfaceAudience.Private
-public class CustomTieredCompactionPolicy extends DateTieredCompactionPolicy {
+public class CustomDateTieredCompactionPolicy extends 
DateTieredCompactionPolicy {
 
   public static final String AGE_LIMIT_MILLIS =
     "hbase.hstore.compaction.date.tiered.custom.age.limit.millis";
@@ -53,11 +53,11 @@ public class CustomTieredCompactionPolicy extends 
DateTieredCompactionPolicy {
   public static final long DEFAULT_AGE_LIMIT_MILLIS =
     (long) (10L * 365.25 * 24L * 60L * 60L * 1000L);
 
-  private static final Logger LOG = 
LoggerFactory.getLogger(CustomTieredCompactionPolicy.class);
+  private static final Logger LOG = 
LoggerFactory.getLogger(CustomDateTieredCompactionPolicy.class);
 
   private long cutOffTimestamp;
 
-  public CustomTieredCompactionPolicy(Configuration conf, 
StoreConfigInformation storeConfigInfo)
+  public CustomDateTieredCompactionPolicy(Configuration conf, 
StoreConfigInformation storeConfigInfo)
     throws IOException {
     super(conf, storeConfigInfo);
     cutOffTimestamp = EnvironmentEdgeManager.currentTime()
diff --git 
a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestCustomCellTieredCompactionPolicy.java
 
b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestCustomCellTieredCompactionPolicy.java
index eedbad83f2c..b0c6de9195d 100644
--- 
a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestCustomCellTieredCompactionPolicy.java
+++ 
b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestCustomCellTieredCompactionPolicy.java
@@ -34,7 +34,7 @@ import org.apache.hadoop.hbase.HBaseTestingUtil;
 import org.apache.hadoop.hbase.HConstants;
 import org.apache.hadoop.hbase.client.ColumnFamilyDescriptorBuilder;
 import org.apache.hadoop.hbase.client.RegionInfo;
-import 
org.apache.hadoop.hbase.regionserver.compactions.CustomTieredCompactionPolicy;
+import 
org.apache.hadoop.hbase.regionserver.compactions.CustomDateTieredCompactionPolicy;
 import 
org.apache.hadoop.hbase.regionserver.compactions.DateTieredCompactionRequest;
 import 
org.apache.hadoop.hbase.regionserver.storefiletracker.StoreFileTrackerForTest;
 import org.apache.hadoop.hbase.testclassification.RegionServerTests;
@@ -81,16 +81,16 @@ public class TestCustomCellTieredCompactionPolicy {
     return msf;
   }
 
-  private CustomTieredCompactionPolicy mockAndCreatePolicy() throws Exception {
+  private CustomDateTieredCompactionPolicy mockAndCreatePolicy() throws 
Exception {
     RegionInfo mockedRegionInfo = mockRegionInfo();
     return mockAndCreatePolicy(mockedRegionInfo);
   }
 
-  private CustomTieredCompactionPolicy mockAndCreatePolicy(RegionInfo 
regionInfo) throws Exception {
+  private CustomDateTieredCompactionPolicy mockAndCreatePolicy(RegionInfo 
regionInfo) throws Exception {
     StoreConfigInformation mockedStoreConfig = 
mock(StoreConfigInformation.class);
     when(mockedStoreConfig.getRegionInfo()).thenReturn(regionInfo);
-    CustomTieredCompactionPolicy policy =
-      new CustomTieredCompactionPolicy(TEST_UTIL.getConfiguration(), 
mockedStoreConfig);
+    CustomDateTieredCompactionPolicy policy =
+      new CustomDateTieredCompactionPolicy(TEST_UTIL.getConfiguration(), 
mockedStoreConfig);
     return policy;
   }
 
@@ -110,7 +110,7 @@ public class TestCustomCellTieredCompactionPolicy {
 
   @Test
   public void testGetCompactBoundariesForMajorNoOld() throws Exception {
-    CustomTieredCompactionPolicy policy = mockAndCreatePolicy();
+    CustomDateTieredCompactionPolicy policy = mockAndCreatePolicy();
     Path file = preparePath();
     ArrayList<HStoreFile> files = new ArrayList<>();
     files.add(createFile(file, EnvironmentEdgeManager.currentTime(),
@@ -123,7 +123,7 @@ public class TestCustomCellTieredCompactionPolicy {
 
   @Test
   public void testGetCompactBoundariesForMajorAllOld() throws Exception {
-    CustomTieredCompactionPolicy policy = mockAndCreatePolicy();
+    CustomDateTieredCompactionPolicy policy = mockAndCreatePolicy();
     Path file = preparePath();
     ArrayList<HStoreFile> files = new ArrayList<>();
     // The default cut off age is 10 years, so any of the min/max value there 
should get in the old
@@ -136,7 +136,7 @@ public class TestCustomCellTieredCompactionPolicy {
 
   @Test
   public void testGetCompactBoundariesForMajorOneOnEachSide() throws Exception 
{
-    CustomTieredCompactionPolicy policy = mockAndCreatePolicy();
+    CustomDateTieredCompactionPolicy policy = mockAndCreatePolicy();
     Path file = preparePath();
     ArrayList<HStoreFile> files = new ArrayList<>();
     files.add(createFile(file, 0, 1, 1024, 0));
@@ -148,7 +148,7 @@ public class TestCustomCellTieredCompactionPolicy {
 
   @Test
   public void testGetCompactBoundariesForMajorOneCrossing() throws Exception {
-    CustomTieredCompactionPolicy policy = mockAndCreatePolicy();
+    CustomDateTieredCompactionPolicy policy = mockAndCreatePolicy();
     Path file = preparePath();
     ArrayList<HStoreFile> files = new ArrayList<>();
     files.add(createFile(file, 0, EnvironmentEdgeManager.currentTime(), 1024, 
0));
@@ -162,9 +162,9 @@ public class TestCustomCellTieredCompactionPolicy {
   }
 
   private void testShouldPerformMajorCompaction(long min, long max, int 
numFiles,
-    PolicyValidator<CustomTieredCompactionPolicy, ArrayList<HStoreFile>> 
validation)
+    PolicyValidator<CustomDateTieredCompactionPolicy, ArrayList<HStoreFile>> 
validation)
     throws Exception {
-    CustomTieredCompactionPolicy policy = mockAndCreatePolicy();
+    CustomDateTieredCompactionPolicy policy = mockAndCreatePolicy();
     RegionInfo mockedRegionInfo = mockRegionInfo();
     Path file = preparePath();
     ArrayList<HStoreFile> files = new ArrayList<>();
@@ -209,7 +209,7 @@ public class TestCustomCellTieredCompactionPolicy {
 
   @Test
   public void testSelectMinorCompactionTwoFilesNoOld() throws Exception {
-    CustomTieredCompactionPolicy policy = mockAndCreatePolicy();
+    CustomDateTieredCompactionPolicy policy = mockAndCreatePolicy();
     Path file = preparePath();
     ArrayList<HStoreFile> files = new ArrayList<>();
     files.add(createFile(file, EnvironmentEdgeManager.currentTime(),
@@ -223,7 +223,7 @@ public class TestCustomCellTieredCompactionPolicy {
 
   @Test
   public void testSelectMinorCompactionThreeFilesNoOld() throws Exception {
-    CustomTieredCompactionPolicy policy = mockAndCreatePolicy();
+    CustomDateTieredCompactionPolicy policy = mockAndCreatePolicy();
     Path file = preparePath();
     ArrayList<HStoreFile> files = new ArrayList<>();
     files.add(createFile(file, EnvironmentEdgeManager.currentTime(),
@@ -237,7 +237,7 @@ public class TestCustomCellTieredCompactionPolicy {
 
   @Test
   public void testSelectMinorCompactionThreeFilesAllOld() throws Exception {
-    CustomTieredCompactionPolicy policy = mockAndCreatePolicy();
+    CustomDateTieredCompactionPolicy policy = mockAndCreatePolicy();
     Path file = preparePath();
     ArrayList<HStoreFile> files = new ArrayList<>();
     files.add(createFile(file, 0, 1, 1024, 0));
@@ -248,7 +248,7 @@ public class TestCustomCellTieredCompactionPolicy {
 
   @Test
   public void testSelectMinorCompactionThreeFilesOneOldTwoNew() throws 
Exception {
-    CustomTieredCompactionPolicy policy = mockAndCreatePolicy();
+    CustomDateTieredCompactionPolicy policy = mockAndCreatePolicy();
     Path file = preparePath();
     ArrayList<HStoreFile> files = new ArrayList<>();
     files.add(createFile(file, 0, 1, 1024, 0));
@@ -261,7 +261,7 @@ public class TestCustomCellTieredCompactionPolicy {
 
   @Test
   public void testSelectMinorCompactionThreeFilesTwoOldOneNew() throws 
Exception {
-    CustomTieredCompactionPolicy policy = mockAndCreatePolicy();
+    CustomDateTieredCompactionPolicy policy = mockAndCreatePolicy();
     Path file = preparePath();
     ArrayList<HStoreFile> files = new ArrayList<>();
     files.add(createFile(file, 0, 1, 1024, 0));

Reply via email to