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


##########
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:
   Yes, I will make the change. We are calling initReader here as the reader is 
null and we need to access reader.getMaximumTimestamp(). This is the cause of 
NPE which we are trying to fix. 



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