taklwu commented on code in PR #7124:
URL: https://github.com/apache/hbase/pull/7124#discussion_r2191407646


##########
hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/CacheConfig.java:
##########
@@ -282,7 +282,8 @@ public boolean shouldCacheBlockOnRead(BlockCategory 
category) {
   public boolean shouldCacheBlockOnRead(BlockCategory category, HFileInfo 
hFileInfo,

Review Comment:
   is this branch based on master? I didn't find this function on the master 
branch.



##########
hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/HFile.java:
##########
@@ -217,6 +218,12 @@ public interface Writer extends Closeable, CellSink, 
ShipperListener {
      */
     void appendTrackedTimestampsToMetadata() throws IOException;
 
+    /**
+     * Add Custom cell timestamp to Metadata
+     */
+    public void appendCustomCellTimestampsToMetadata(TimeRangeTracker 
timeRangeTracker)

Review Comment:
   nit: why do we need `TimeRangeTracker` instead of max timestamp here?



##########
hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/HFileReaderImpl.java:
##########
@@ -1380,7 +1380,7 @@ public HFileBlock readBlock(long dataBlockOffset, long 
onDiskBlockSize, final bo
         HFileBlock unpackedNoChecksum = 
BlockCacheUtil.getBlockForCaching(cacheConf, unpacked);
         // Cache the block if necessary
         cacheConf.getBlockCache().ifPresent(cache -> {
-          if (cacheBlock && cacheConf.shouldCacheBlockOnRead(category)) {
+          if (cacheBlock && cacheOnRead) {

Review Comment:
   nit: we change from cacheConf.shouldCacheBlockOnRead(category) to  
`cacheOnRead = cacheConf.shouldCacheBlockOnRead(category, getHFileInfo(), 
conf);` , is it right about only caching DATA block?



##########
hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/HFileWriterImpl.java:
##########
@@ -186,7 +194,9 @@ public HFileWriterImpl(final Configuration conf, 
CacheConfig cacheConf, Path pat
     this.path = path;
     this.name = path != null ? path.getName() : outputStream.toString();
     this.hFileContext = fileContext;
+    // TODO: Move this back to upper layer

Review Comment:
   nit : should we delete this TODO ? or should we have new JIRA for it?



##########
hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/compactions/CustomTieredCompactionPolicy.java:
##########
@@ -0,0 +1,155 @@
+/*
+ * 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.regionserver.compactions;
+
+import static 
org.apache.hadoop.hbase.regionserver.CustomTieringMultiFileWriter.CUSTOM_TIERING_TIME_RANGE;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+import org.apache.commons.lang3.mutable.MutableLong;
+import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.hbase.HDFSBlocksDistribution;
+import org.apache.hadoop.hbase.regionserver.HStoreFile;
+import org.apache.hadoop.hbase.regionserver.StoreConfigInformation;
+import org.apache.hadoop.hbase.regionserver.StoreUtils;
+import org.apache.hadoop.hbase.regionserver.TimeRangeTracker;
+import org.apache.hadoop.hbase.util.EnvironmentEdgeManager;
+import org.apache.yetus.audience.InterfaceAudience;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Custom implementation of DateTieredCompactionPolicy that calculates 
compaction boundaries based
+ * on the <b>hbase.hstore.compaction.date.tiered.custom.age.limit.millis</b> 
configuration property
+ * and the TIERING_CELL_MIN/TIERING_CELL_MAX stored on metadata of each store 
file. This policy
+ * would produce either one or two tiers: - One tier if either all files data 
age are older than the
+ * configured age limit or all files data age are younger than the configured 
age limit. - Two tiers
+ * if files have both younger and older data than the configured age limit.
+ */
[email protected]
+public class CustomTieredCompactionPolicy extends DateTieredCompactionPolicy {

Review Comment:
   nit: would it be better to call it as `CustomDateTieredCompactionPolicy` 
because it's still using timestamp to calculate the compaction time range?



##########
hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/compactions/CustomCellTieringValueProvider.java:
##########
@@ -0,0 +1,109 @@
+/*
+ * 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.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.
+ */

Review Comment:
   looks like we need to fix the redundant 



##########
hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/DataTieringManager.java:
##########
@@ -299,7 +254,7 @@ private HStore getHStore(Path hFilePath) throws 
DataTieringException {
   private HStoreFile getHStoreFile(Path hFilePath) throws DataTieringException 
{
     HStore hStore = getHStore(hFilePath);
     for (HStoreFile file : hStore.getStorefiles()) {
-      if (file.getPath().equals(hFilePath)) {
+      if 
(file.getPath().toUri().getPath().toString().equals(hFilePath.toString())) {

Review Comment:
   nit: doesn't `getPath.toString` would first check `this.uri.getPath() != 
null` and append URI before compare? 



##########
hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/HFileWriterImpl.java:
##########
@@ -899,12 +909,19 @@ public void appendTrackedTimestampsToMetadata() throws 
IOException {
     appendFileInfo(EARLIEST_PUT_TS, Bytes.toBytes(earliestPutTs));
   }
 
+  public void appendCustomCellTimestampsToMetadata(TimeRangeTracker 
timeRangeTracker)
+    throws IOException {
+    // TODO: The StoreFileReader always converts the byte[] to TimeRange
+    // via TimeRangeTracker, so we should write the serialization data of 
TimeRange directly.

Review Comment:
   nit: new JIRA need?



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