joshelser commented on a change in pull request #3389:
URL: https://github.com/apache/hbase/pull/3389#discussion_r674267085
##########
File path:
hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/compactions/Compactor.java
##########
@@ -558,18 +559,19 @@ protected InternalScanner createScanner(HStore store,
ScanInfo scanInfo,
* @param cr the compaction request.
* @param newFiles the new files created by this compaction under a temp dir.
* @param user the running user.
+ * @param fileAcessor a lambda expression with logic for loading a
HStoreFile given a Path.
* @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 {
+ public List<HStoreFile> commitCompaction(CompactionRequestImpl cr,
List<Path> newFiles,
+ User user, Function<Path, HStoreFile> fileAcessor) throws IOException {
Review comment:
I like the idea of giving the callback -- do you think it would make a
nicer API to define our own FunctionalInterface that has some javadoc
associated with it? I think it will leave your calling code in HStore as
simple, but give the casual observer some more understanding what this function
is supposed to do.
##########
File path:
hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HStore.java
##########
@@ -1505,7 +1505,14 @@ public void
deleteChangedReaderObserver(ChangedReadersObserver o) {
List<Path> newFiles) throws IOException {
// Do the steps necessary to complete the compaction.
setStoragePolicyFromFileName(newFiles);
- List<HStoreFile> sfs = this.storeEngine.compactor.commitCompaction(cr,
newFiles, user);
+ List<HStoreFile> sfs = this.storeEngine.compactor.commitCompaction(cr,
newFiles, user,
+ p -> {
+ try {
+ return this.createStoreFileAndReader((Path) p);
+ }catch(IOException e){
Review comment:
nit whitespace/checkstyle
but I like the solution!
--
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]