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 78222bc83f8245b7ba373b16a0b5dec5d978d467 Author: Wellington Ramos Chevreuil <[email protected]> AuthorDate: Wed Jul 9 11:48:16 2025 +0100 addressing another round of reviews and spotless failures Change-Id: I992f3eebe00943c4f073d1c7ea96010db21d07e6 --- .../org/apache/hadoop/hbase/io/hfile/HFileWriterImpl.java | 3 ++- .../hadoop/hbase/regionserver/CustomTieredStoreEngine.java | 3 ++- .../compactions/CustomCellTieringValueProvider.java | 11 +++-------- .../compactions/CustomDateTieredCompactionPolicy.java | 4 ++-- .../regionserver/TestCustomCellTieredCompactionPolicy.java | 3 ++- 5 files changed, 11 insertions(+), 13 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 04bf3ff7b32..684aee3beac 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 @@ -598,7 +598,8 @@ public class HFileWriterImpl implements HFile.Writer { } private boolean shouldCacheBlock(BlockCache cache, BlockCacheKey key) { - Optional<Boolean> result = cache.shouldCacheBlock(key, timeRangeTrackerForTiering.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 354a14c3bed..518b31fb5be 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 @@ -44,7 +44,8 @@ public class CustomTieredStoreEngine extends DateTieredStoreEngine { CompoundConfiguration config = new CompoundConfiguration(); config.add(conf); config.add(store.conf); - config.set(DEFAULT_COMPACTION_POLICY_CLASS_KEY, CustomDateTieredCompactionPolicy.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/compactions/CustomCellTieringValueProvider.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/compactions/CustomCellTieringValueProvider.java index 7de9ba1851e..fca76bae8f8 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 @@ -18,12 +18,12 @@ package org.apache.hadoop.hbase.regionserver.compactions; import java.util.ArrayList; -import java.util.Arrays; import java.util.List; import java.util.Optional; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.hbase.ArrayBackedTag; import org.apache.hadoop.hbase.Cell; +import org.apache.hadoop.hbase.CellUtil; import org.apache.hadoop.hbase.ExtendedCell; import org.apache.hadoop.hbase.PrivateCellUtil; import org.apache.hadoop.hbase.Tag; @@ -52,13 +52,8 @@ public class CustomCellTieringValueProvider implements CustomTieredCompactor.Tie byte[] tieringValue = null; // first iterates through the cells within a row, to find the tiering value for the row for (Cell cell : cells) { - byte[] qualifier = new byte[cell.getQualifierLength()]; - System.arraycopy(cell.getQualifierArray(), cell.getQualifierOffset(), qualifier, 0, - cell.getQualifierLength()); - if (Arrays.equals(qualifier, tieringQualifier)) { - tieringValue = new byte[cell.getValueLength()]; - System.arraycopy(cell.getValueArray(), cell.getValueOffset(), tieringValue, 0, - cell.getValueLength()); + if (CellUtil.matchingQualifier(cell, tieringQualifier)) { + tieringValue = CellUtil.cloneValue(cell); break; } } diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/compactions/CustomDateTieredCompactionPolicy.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/compactions/CustomDateTieredCompactionPolicy.java index 63a6d1c5b59..dcc97c63d02 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/compactions/CustomDateTieredCompactionPolicy.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/compactions/CustomDateTieredCompactionPolicy.java @@ -57,8 +57,8 @@ public class CustomDateTieredCompactionPolicy extends DateTieredCompactionPolicy private long cutOffTimestamp; - public CustomDateTieredCompactionPolicy(Configuration conf, StoreConfigInformation storeConfigInfo) - throws IOException { + public CustomDateTieredCompactionPolicy(Configuration conf, + StoreConfigInformation storeConfigInfo) throws IOException { super(conf, storeConfigInfo); cutOffTimestamp = EnvironmentEdgeManager.currentTime() - conf.getLong(AGE_LIMIT_MILLIS, DEFAULT_AGE_LIMIT_MILLIS); 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 b0c6de9195d..c89e9919717 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 @@ -86,7 +86,8 @@ public class TestCustomCellTieredCompactionPolicy { return mockAndCreatePolicy(mockedRegionInfo); } - private CustomDateTieredCompactionPolicy mockAndCreatePolicy(RegionInfo regionInfo) throws Exception { + private CustomDateTieredCompactionPolicy mockAndCreatePolicy(RegionInfo regionInfo) + throws Exception { StoreConfigInformation mockedStoreConfig = mock(StoreConfigInformation.class); when(mockedStoreConfig.getRegionInfo()).thenReturn(regionInfo); CustomDateTieredCompactionPolicy policy =
