anoopsjohn commented on a change in pull request #939: HBASE-23349 : Force 
archive compacted storefiles after current scanne…
URL: https://github.com/apache/hbase/pull/939#discussion_r357918648
 
 

 ##########
 File path: 
hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/StoreScanner.java
 ##########
 @@ -934,6 +935,47 @@ public void updateReaders(List<HStoreFile> sfs, 
List<KeyValueScanner> memStoreSc
     // Let the next() call handle re-creating and seeking
   }
 
+  // Implementation of ChangedReadersObserver
+  // reset current scanners
+  @Override
+  public void updateReaders(List<HStoreFile> storeFiles) throws IOException {
+    if (CollectionUtils.isEmpty(storeFiles)) {
+      return;
+    }
+    try {
+      if (this.closing) {
+        if (LOG.isDebugEnabled()) {
+          LOG.debug("StoreScanner already closing. There is no need to 
re-create scanners");
+        }
+        return;
+      }
+      List<KeyValueScanner> fileScanners = currentScanners.stream()
+        .filter(KeyValueScanner::isFileScanner)
+        .collect(Collectors.toList());
+      fileScanners.forEach(KeyValueScanner::close);
+      if (fileScanners.size() == currentScanners.size()) {
+        currentScanners.clear();
+      } else {
+        List<KeyValueScanner> memScanners = currentScanners.stream()
+          .filter(e -> !e.isFileScanner())
+          .collect(Collectors.toList());
+        currentScanners.clear();
+        currentScanners.addAll(memScanners);
+      }
+      final boolean usePRead = get || scanUsePread;
+      final boolean isCompaction = false;
+      final boolean includeMemstoreScanner = false;
+      List<KeyValueScanner> scanners = store.getScanners(storeFiles, 
cacheBlocks, get, usePRead,
+        isCompaction, matcher, scan.getStartRow(), scan.getStopRow(), 
this.readPt,
+        includeMemstoreScanner);
+      addCurrentScanners(scanners);
 
 Review comment:
   Ya each of these ops needs a reset if the compacted (volatile) marker is 
set.  Just mentioned next() alone.  So in effect what we are doing here is 
making the optimization work done in HBASE-13082  been configurable using the 
new config that this patch adds.  And then that has to be defaults to false BTW.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to