SwaraliJoshi commented on code in PR #7552:
URL: https://github.com/apache/hbase/pull/7552#discussion_r3366042238


##########
hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/DefaultStoreFileManager.java:
##########
@@ -179,9 +179,30 @@ public void addCompactionResults(Collection<HStoreFile> 
newCompactedfiles,
     // Let a background thread close the actual reader on these compacted 
files and also
     // ensure to evict the blocks from block cache so that they are no longer 
in
     // cache
-    newCompactedfiles.forEach(HStoreFile::markCompactedAway);
-    compactedfiles = ImmutableList.sortedCopyOf(storeFileComparator,
-      Iterables.concat(compactedfiles, newCompactedfiles));
+    List<HStoreFile> filesToClose = new ArrayList<>(newCompactedfiles);
+    try {
+      HStoreFile.increaseStoreFilesRefeCount(newCompactedfiles);
+      newCompactedfiles.forEach(hStoreFile -> {
+        StoreFileReader reader = hStoreFile.getReader();
+        try {
+          if (reader == null) {
+            hStoreFile.initReader();
+          } else {
+            filesToClose.remove(hStoreFile);
+          }
+        } catch (IOException e) {
+          LOG.warn("Couldn't initialize reader for " + hStoreFile, e);
+          throw new RuntimeException(e);

Review Comment:
   New changes avoids calling initReader completely. I have simply added a try 
catch block for logging purposes so we know if there is anything else that can 
cause issues with compaction in this method. 



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