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/06/09 15:40:29 UTC

[GitHub] [accumulo] keith-turner commented on a change in pull request #2152: Adds Ample support for tablets and uses this in compaction finalizer

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



##########
File path: core/src/main/java/org/apache/accumulo/core/metadata/schema/TabletsMetadata.java
##########
@@ -233,6 +269,19 @@ public Options forTablet(KeyExtent extent) {
       return this;
     }
 
+    @Override
+    public Options forTablets(Collection<KeyExtent> extents) {
+      if (!extents.stream().map(e -> DataLevel.of(e.tableId()))
+          .allMatch(dl -> dl == DataLevel.USER)) {

Review comment:
       These are not equivalent. Wrote the little test below.
   
   ```java
   	var dlset = List.of(DataLevel.USER, DataLevel.USER, DataLevel.USER);
   	System.out.println(!dlset.stream().allMatch(dl -> dl == DataLevel.USER));
   	System.out.println(dlset.stream().anyMatch(dl -> dl == DataLevel.USER));
   ```  
   
   prints
   
   ```
   false
   true
   ```
   
   The following pattern is equivalent and uses anyMatch.  I think it makes the code longer so not sure its worthwhile.  Also not too worried about efficiency because the expected case is all USER, so normally it will iterator through all with anyMatch or allMatch.
   
   ```java
   	EnumSet<DataLevel> unsupportedLevels = EnumSet.complementOf(EnumSet.of(DataLevel.USER));
   	
   	var dlset = List.of(DataLevel.USER, DataLevel.USER, DataLevel.USER);
   	System.out.println(!dlset.stream().allMatch(dl -> dl == DataLevel.USER));
   	System.out.println(dlset.stream().anyMatch(dl -> unsupportedLevels.contains(dl)));
   	
   	dlset = List.of(DataLevel.USER, DataLevel.ROOT, DataLevel.USER);
   	System.out.println(!dlset.stream().allMatch(dl -> dl == DataLevel.USER));
   	System.out.println(dlset.stream().anyMatch(dl -> unsupportedLevels.contains(dl)));
   ```
   
   This prints 
   
   ```
   false
   false
   true
   true
   ```
   
   




-- 
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:
users@infra.apache.org