Skip to content

Commit 63a290a

Browse files
committed
addressing another round of reviews and spotless failures
Change-Id: I992f3eebe00943c4f073d1c7ea96010db21d07e6
1 parent 2833205 commit 63a290a

File tree

5 files changed

+11
-13
lines changed

5 files changed

+11
-13
lines changed

hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/HFileWriterImpl.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -598,7 +598,8 @@ private BlockCacheKey buildCacheBlockKey(long offset, BlockType blockType) {
598598
}
599599

600600
private boolean shouldCacheBlock(BlockCache cache, BlockCacheKey key) {
601-
Optional<Boolean> result = cache.shouldCacheBlock(key, timeRangeTrackerForTiering.get().getMax(), conf);
601+
Optional<Boolean> result =
602+
cache.shouldCacheBlock(key, timeRangeTrackerForTiering.get().getMax(), conf);
602603
return result.orElse(true);
603604
}
604605

hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/CustomTieredStoreEngine.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,8 @@ protected void createComponents(Configuration conf, HStore store, CellComparator
4444
CompoundConfiguration config = new CompoundConfiguration();
4545
config.add(conf);
4646
config.add(store.conf);
47-
config.set(DEFAULT_COMPACTION_POLICY_CLASS_KEY, CustomDateTieredCompactionPolicy.class.getName());
47+
config.set(DEFAULT_COMPACTION_POLICY_CLASS_KEY,
48+
CustomDateTieredCompactionPolicy.class.getName());
4849
createCompactionPolicy(config, store);
4950
this.storeFileManager = new DefaultStoreFileManager(kvComparator,
5051
StoreFileComparators.SEQ_ID_MAX_TIMESTAMP, config, compactionPolicy.getConf());

hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/compactions/CustomCellTieringValueProvider.java

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,12 @@
1818
package org.apache.hadoop.hbase.regionserver.compactions;
1919

2020
import java.util.ArrayList;
21-
import java.util.Arrays;
2221
import java.util.List;
2322
import java.util.Optional;
2423
import org.apache.hadoop.conf.Configuration;
2524
import org.apache.hadoop.hbase.ArrayBackedTag;
2625
import org.apache.hadoop.hbase.Cell;
26+
import org.apache.hadoop.hbase.CellUtil;
2727
import org.apache.hadoop.hbase.ExtendedCell;
2828
import org.apache.hadoop.hbase.PrivateCellUtil;
2929
import org.apache.hadoop.hbase.Tag;
@@ -52,13 +52,8 @@ public List<ExtendedCell> decorateCells(List<ExtendedCell> cells) {
5252
byte[] tieringValue = null;
5353
// first iterates through the cells within a row, to find the tiering value for the row
5454
for (Cell cell : cells) {
55-
byte[] qualifier = new byte[cell.getQualifierLength()];
56-
System.arraycopy(cell.getQualifierArray(), cell.getQualifierOffset(), qualifier, 0,
57-
cell.getQualifierLength());
58-
if (Arrays.equals(qualifier, tieringQualifier)) {
59-
tieringValue = new byte[cell.getValueLength()];
60-
System.arraycopy(cell.getValueArray(), cell.getValueOffset(), tieringValue, 0,
61-
cell.getValueLength());
55+
if (CellUtil.matchingQualifier(cell, tieringQualifier)) {
56+
tieringValue = CellUtil.cloneValue(cell);
6257
break;
6358
}
6459
}

hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/compactions/CustomDateTieredCompactionPolicy.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,8 @@ public class CustomDateTieredCompactionPolicy extends DateTieredCompactionPolicy
5757

5858
private long cutOffTimestamp;
5959

60-
public CustomDateTieredCompactionPolicy(Configuration conf, StoreConfigInformation storeConfigInfo)
61-
throws IOException {
60+
public CustomDateTieredCompactionPolicy(Configuration conf,
61+
StoreConfigInformation storeConfigInfo) throws IOException {
6262
super(conf, storeConfigInfo);
6363
cutOffTimestamp = EnvironmentEdgeManager.currentTime()
6464
- conf.getLong(AGE_LIMIT_MILLIS, DEFAULT_AGE_LIMIT_MILLIS);

hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestCustomCellTieredCompactionPolicy.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,8 @@ private CustomDateTieredCompactionPolicy mockAndCreatePolicy() throws Exception
8686
return mockAndCreatePolicy(mockedRegionInfo);
8787
}
8888

89-
private CustomDateTieredCompactionPolicy mockAndCreatePolicy(RegionInfo regionInfo) throws Exception {
89+
private CustomDateTieredCompactionPolicy mockAndCreatePolicy(RegionInfo regionInfo)
90+
throws Exception {
9091
StoreConfigInformation mockedStoreConfig = mock(StoreConfigInformation.class);
9192
when(mockedStoreConfig.getRegionInfo()).thenReturn(regionInfo);
9293
CustomDateTieredCompactionPolicy policy =

0 commit comments

Comments
 (0)