keith-turner closed pull request #374: ACCUMULO-4790 Avoid creating FileRef
URL: https://github.com/apache/accumulo/pull/374
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git 
a/server/tserver/src/main/java/org/apache/accumulo/tserver/FileManager.java 
b/server/tserver/src/main/java/org/apache/accumulo/tserver/FileManager.java
index 8bc0fedc0a..a707251463 100644
--- a/server/tserver/src/main/java/org/apache/accumulo/tserver/FileManager.java
+++ b/server/tserver/src/main/java/org/apache/accumulo/tserver/FileManager.java
@@ -510,6 +510,14 @@ public void setInterruptFlag(AtomicBoolean flag) {
 
       ArrayList<InterruptibleIterator> iters = new ArrayList<>();
 
+      boolean sawTimeSet = false;
+      for (DataFileValue dfv : files.values()) {
+        if (dfv.isTimeSet()) {
+          sawTimeSet = true;
+          break;
+        }
+      }
+
       for (FileSKVIterator reader : newlyReservedReaders) {
         String filename = getReservedReadeFilename(reader);
         InterruptibleIterator iter;
@@ -530,9 +538,13 @@ public void setInterruptFlag(AtomicBoolean flag) {
         } else {
           iter = new ProblemReportingIterator(context, tablet.getTableId(), 
filename, continueOnFailure, source);
         }
-        DataFileValue value = files.get(new FileRef(filename));
-        if (value.isTimeSet()) {
-          iter = new TimeSettingIterator(iter, value.getTime());
+
+        if (sawTimeSet) {
+          // constucting FileRef is expensive so avoid if not needed
+          DataFileValue value = files.get(new FileRef(filename));
+          if (value.isTimeSet()) {
+            iter = new TimeSettingIterator(iter, value.getTime());
+          }
         }
 
         iters.add(iter);


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on 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