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 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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to