You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@accumulo.apache.org by GitBox <gi...@apache.org> on 2021/09/01 13:50:58 UTC

[GitHub] [accumulo] keith-turner commented on a change in pull request #2248: Make Compactable File use copy of runningJobs

keith-turner commented on a change in pull request #2248:
URL: https://github.com/apache/accumulo/pull/2248#discussion_r700233583



##########
File path: server/tserver/src/main/java/org/apache/accumulo/tserver/compactions/Compactable.java
##########
@@ -68,7 +68,7 @@ public Files(SortedMap<StoredTabletFile,DataFileValue> allFiles,
       this.candidates = Collections.unmodifiableSet(candidates.stream()
           .map(stf -> new CompactableFileImpl(stf, allFiles.get(stf))).collect(Collectors.toSet()));
 
-      this.compacting = Set.copyOf(running);
+      this.compacting = runningJobsCopy;

Review comment:
       I think its ok to leave this as `this.compacting = Set.copyOf(running);`. I just looked at the impl of Set.copyOf and it looks like the following.
   
   ```java
       static <E> Set<E> copyOf(Collection<? extends E> coll) {
           if (coll instanceof ImmutableCollections.AbstractImmutableSet) {
               return (Set<E>)coll;
           } else {
               return (Set<E>)Set.of(new HashSet<>(coll).toArray());
           }
       }
   ```
   
   So if it when its something created by Set.of or Set.copyOf, is seems copyOf will not copy.   Leaving the copyOf call in the code currently avoids a second copy while being robust to changes outside the constructors.




-- 
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: notifications-unsubscribe@accumulo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org