wchevreuil commented on a change in pull request #3389:
URL: https://github.com/apache/hbase/pull/3389#discussion_r655650248



##########
File path: 
hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/compactions/Compactor.java
##########
@@ -266,6 +266,7 @@ public InternalScanner createScanner(ScanInfo scanInfo, 
List<StoreFileScanner> s
    * @param fd The file details.
    * @return Writer for a new StoreFile in the tmp dir.
    * @throws IOException if creation failed
+   * @deprecated Use initWriter instead.

Review comment:
       You mean the one in line #271?

##########
File path: 
hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/compactions/Compactor.java
##########
@@ -266,6 +266,7 @@ public InternalScanner createScanner(ScanInfo scanInfo, 
List<StoreFileScanner> s
    * @param fd The file details.
    * @return Writer for a new StoreFile in the tmp dir.
    * @throws IOException if creation failed
+   * @deprecated Use initWriter instead.

Review comment:
       You mean the one in line #271? Original commit didn't have it, but I had 
added on the second commit from last week.

##########
File path: 
hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/compactions/Compactor.java
##########
@@ -533,4 +549,46 @@ protected InternalScanner createScanner(HStore store, 
ScanInfo scanInfo,
     return new StoreScanner(store, scanInfo, scanners, smallestReadPoint, 
earliestPutTs,
         dropDeletesFromRow, dropDeletesToRow);
   }
+
+  /**
+   * Default implementation for committing store files created after a 
compaction. Assumes new files
+   * had been created on a temp directory, so it renames those files into the 
actual store dir,
+   * then create a reader and cache it into the store.
+   * @param cr the compaction request.
+   * @param newFiles the new files created by this compaction under a temp dir.
+   * @param user the running user/
+   * @return A list of the resulting store files already placed in the store 
dir and loaded into the
+   * store cache.
+   * @throws IOException
+   */
+  public List<HStoreFile> commitCompaction(CompactionRequestImpl cr, 
List<Path> newFiles, User user)
+      throws IOException {
+    List<HStoreFile> sfs = new ArrayList<>(newFiles.size());
+    for (Path newFile : newFiles) {
+      assert newFile != null;
+      this.store.validateStoreFile(newFile);

Review comment:
       This was already been called before, indirectly, in HStore, via 
`doCompaction -> moveCompactedFilesIntoPlace -> moveFileIntoPlace -> 
validateStoreFile`. I had just merged some of the methods and moved this new 
method in the Compactor class itself.

##########
File path: 
hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/compactions/TestDefaultCompactor.java
##########
@@ -0,0 +1,123 @@
+/**
+ * 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 junit.framework.TestCase.assertEquals;
+import static org.mockito.Mockito.mock;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.fs.Path;
+import org.apache.hadoop.hbase.HBaseClassTestRule;
+import org.apache.hadoop.hbase.HBaseTestingUtility;
+import org.apache.hadoop.hbase.TableName;
+import org.apache.hadoop.hbase.client.Put;
+import org.apache.hadoop.hbase.client.Table;
+import org.apache.hadoop.hbase.regionserver.HStore;
+import org.apache.hadoop.hbase.regionserver.HStoreFile;
+import org.apache.hadoop.hbase.regionserver.StoreFileWriter;
+import org.apache.hadoop.hbase.testclassification.MediumTests;
+import org.apache.hadoop.hbase.testclassification.RegionServerTests;
+import org.apache.hadoop.hbase.util.Bytes;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.ClassRule;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+import org.junit.rules.TestName;
+
+/**
+ * Test class for DirectInStoreCompactor.
+ */

Review comment:
       Indeed, addressing it on next commit.




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

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


Reply via email to