cshannon commented on code in PR #4480:
URL: https://github.com/apache/accumulo/pull/4480#discussion_r1605141899


##########
server/base/src/main/java/org/apache/accumulo/server/compaction/CompactionJobGenerator.java:
##########
@@ -205,9 +209,22 @@ private Collection<CompactionJob> 
planCompactions(CompactionServiceId serviceId,
         // remove any files that are in active compactions
         tablet.getExternalCompactions().values().stream().flatMap(ecm -> 
ecm.getJobFiles().stream())
             .forEach(tmpFiles::remove);
-        // remove any files that are selected
-        if (tablet.getSelectedFiles() != null) {
-          tmpFiles.keySet().removeAll(tablet.getSelectedFiles().getFiles());
+        // remove any files that are selected and the user compaction has 
completed
+        // at least 1 job, otherwise we can keep the files
+        var selectedFiles = tablet.getSelectedFiles();
+
+        long selectedExpirationDuration =
+            
ConfigurationTypeHelper.getTimeInMillis(env.getConfiguration(tablet.getTableId())
+                .get(Property.TABLE_COMPACTION_SELECTION_EXPIRATION.getKey()));
+
+        // If jobs are completed, or selected time has not expired, the remove
+        // from the candidate list otherwise we can cancel the selection
+        if (selectedFiles != null) {
+          if (selectedFiles.getCompletedJobs() > 0 || 
(selectedFiles.getSelectedTime() != null
+              && (System.nanoTime() - 
selectedFiles.getSelectedTime().getNanos())

Review Comment:
   Thanks for pointing that out, yeah this was a mistake, I noticed this too 
today as I was re-looking at this when my IDE was giving me a warning about the 
SteadyTime object that is a private member never being used. The intent was to 
use it here just like that and it got missed.



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