wchevreuil commented on code in PR #5545:
URL: https://github.com/apache/hbase/pull/5545#discussion_r1410561791


##########
hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/DualFileStoreEngine.java:
##########
@@ -0,0 +1,127 @@
+/*
+ * 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;
+
+import java.io.IOException;
+import java.util.List;
+import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.fs.Path;
+import org.apache.hadoop.hbase.CellComparator;
+import org.apache.hadoop.hbase.regionserver.compactions.CompactionContext;
+import org.apache.hadoop.hbase.regionserver.compactions.DualFileCompactor;
+import 
org.apache.hadoop.hbase.regionserver.compactions.ExploringCompactionPolicy;
+import 
org.apache.hadoop.hbase.regionserver.compactions.RatioBasedCompactionPolicy;
+import org.apache.hadoop.hbase.regionserver.throttle.ThroughputController;
+import org.apache.hadoop.hbase.security.User;
+import org.apache.hadoop.hbase.util.ReflectionUtils;
+import org.apache.yetus.audience.InterfaceAudience;
+
+/**
+ * HBASE-25972 This store engine allows us to store data in two files,
+ * one for the latest put cells and the other for the rest of the cells (i.e.,
+ * older put cells and delete markers).
+ */
+@InterfaceAudience.Private
+public class DualFileStoreEngine extends StoreEngine<DefaultStoreFlusher,

Review Comment:
   Can't we extend DefaultStoreEngine instead? There are few methods that are 
getting duplicated (entirely or partially) from there (needsCompaction, 
createComponents, createCompactor). 



##########
hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/StoreFileScanner.java:
##########
@@ -135,11 +136,17 @@ public static List<StoreFileScanner> 
getScannersForStoreFiles(Collection<HStoreF
     for (HStoreFile file : files) {
       // The sort function needs metadata so we need to open reader first 
before sorting the list.
       file.initReader();
-      sortedFiles.add(file);
+      if (onlyLatestVersion) {
+        if (file.hasLatestVersion()) {
+          sortedFiles.add(file);
+        }
+      } else {
+        sortedFiles.add(file);
+      }
     }
     boolean succ = false;
     try {
-      for (int i = 0, n = files.size(); i < n; i++) {
+      for (int i = 0, n = files.size(); i < n && !sortedFiles.isEmpty(); i++) {

Review Comment:
   Do we really need this extra check?



##########
hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/StoreFileScanner.java:
##########
@@ -135,11 +136,17 @@ public static List<StoreFileScanner> 
getScannersForStoreFiles(Collection<HStoreF
     for (HStoreFile file : files) {
       // The sort function needs metadata so we need to open reader first 
before sorting the list.
       file.initReader();

Review Comment:
   I wonder if we could have a DualStoreFileManager as well. That way, we could 
already keep separate list of store files there and it would contain the logic 
about which files should be returned for the scanner. It would also avoid us 
from having to open a reader on files we may not be interested.



-- 
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: issues-unsubscr...@hbase.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to