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



##########
File path: 
hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/compactions/Compactor.java
##########
@@ -533,4 +550,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 if the commit fails.
+   */
+  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);
+      // Move the file into the right spot
+      HStoreFile sf = createFileInStoreDir(newFile);
+      if (this.store.getCoprocessorHost() != null) {
+        this.store.getCoprocessorHost().postCompact(this.store, sf, 
cr.getTracker(), cr, user);
+      }
+      assert sf != null;
+      sfs.add(sf);
+    }
+    return sfs;
+  }
+
+  /**
+   * Assumes new file was created initially on a temp folder.

Review comment:
       > it immediately broke StripeCompactor and DateTieredCompactor, which 
are relying in this logic, but not extending DefaultCompactor.
   
   Devil's advocate: do you think that's correct for StripeC and DTC to do?




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