keith-turner commented on code in PR #3968:
URL: https://github.com/apache/accumulo/pull/3968#discussion_r1426953663


##########
core/src/main/java/org/apache/accumulo/core/iterators/user/HasWalsFilter.java:
##########
@@ -0,0 +1,40 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.accumulo.core.iterators.user;
+
+import java.util.EnumSet;
+import java.util.function.Predicate;
+
+import org.apache.accumulo.core.metadata.schema.TabletMetadata;
+
+public class HasWalsFilter extends TabletMetadataFilter {
+
+  private final static Predicate<TabletMetadata> HAS_WALS =
+      tabletMetadata -> !tabletMetadata.getLogs().isEmpty();
+
+  @Override
+  public EnumSet<TabletMetadata.ColumnType> getColumns() {
+    return EnumSet.of(TabletMetadata.ColumnType.LOGS);
+  }

Review Comment:
   It would be nice to only create the set once like in the following.  However 
to do this safely the set needs to be immutable.  Looked around and found that 
guava has a method for doing this.  Could also use the built in 
`Collections.unmodifiableSet(EnumSet.of(...))`
   
   ```suggestion
     private static final Set<TabletMetadata.ColumnType> COLUMNS = 
Sets.immutableEnumSet(TabletMetadata.ColumnType.LOGS);
   
     @Override
     public EnumSet<TabletMetadata.ColumnType> getColumns() {
       return COLUMNS;
     }
   ```



##########
core/src/main/java/org/apache/accumulo/core/metadata/schema/TabletsMetadata.java:
##########
@@ -168,9 +170,19 @@ private TabletsMetadata buildExtents(AccumuloClient 
client) {
             scanner.setRanges(ranges);
 
             configureColumns(scanner);
-            IteratorSetting iterSetting = new IteratorSetting(100, 
WholeRowIterator.class);
+            int iteratorPriority = 100;
+            IteratorSetting iterSetting =
+                new IteratorSetting(iteratorPriority, WholeRowIterator.class);
             scanner.addScanIterator(iterSetting);
 
+            if (!tabletMetadataFilters.isEmpty()) {

Review Comment:
   Could drop the empty checks since its only a for loop inside the if stmt.



##########
core/src/main/java/org/apache/accumulo/core/metadata/schema/TabletsMetadata.java:
##########
@@ -168,9 +170,19 @@ private TabletsMetadata buildExtents(AccumuloClient 
client) {
             scanner.setRanges(ranges);
 
             configureColumns(scanner);
-            IteratorSetting iterSetting = new IteratorSetting(100, 
WholeRowIterator.class);
+            int iteratorPriority = 100;
+            IteratorSetting iterSetting =

Review Comment:
   I think the WholeRowIterators priority should be set so that it comes last. 
It will encode entire rows into a single key value, so the filters will not see 
the individual columns when running after it.  So could add it after the for 
loop that adds filters with the highest prio. 



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