kadirozde commented on code in PR #5545:
URL: https://github.com/apache/hbase/pull/5545#discussion_r1412493239


##########
hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/StoreFileScanner.java:
##########
@@ -135,11 +136,17 @@ public static List<StoreFileScanner> 
getScannersForStoreFiles(Collection<HStoreF
     for (HStoreFile file : files) {
       // The sort function needs metadata so we need to open reader first 
before sorting the list.
       file.initReader();
-      sortedFiles.add(file);
+      if (onlyLatestVersion) {
+        if (file.hasLatestVersion()) {
+          sortedFiles.add(file);
+        }
+      } else {
+        sortedFiles.add(file);
+      }
     }
     boolean succ = false;
     try {
-      for (int i = 0, n = files.size(); i < n; i++) {
+      for (int i = 0, n = files.size(); i < n && !sortedFiles.isEmpty(); i++) {

Review Comment:
   I did not want to iterate over over sorted files for the same reason the 
existing code does not iterate over sorted files since sorted files are 
modified within the loop. I do not see the NPE issue here.



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