keith-turner opened a new issue, #3933:
URL: https://github.com/apache/accumulo/issues/3933

   As outlined in [this 
comment](https://github.com/apache/accumulo/pull/3929#discussion_r1382616473) 
it may be useful to add filters to Ample.  These filters could configure an 
iterator on the scanner to do server side filtering.
   
   A use case for this could be the GarbageCollectWriteAheadLogs class which 
needs to find all tablets with write ahead logs.  In #3904 the WAL GC class was 
moved away from using the TabletManagmentIterator to just using Ample.  This 
was done because the TabletMgmtIter is tightly coupled to the 
TabletGroupWatcher and using it elsewhere may introduce bugs (because when it 
is modified, only the TGW uses cases may be considered).  When 
GarbageCollectWriteAheadLogs was using the TabletManagmentIterator it was 
getting some server side filtering (although it was tricky to reason about the 
correctness of that filtering).
   
   Looking at [this 
code](https://github.com/apache/accumulo/blob/84419e33fc601e52626df25a1032dc0a20488eac/server/gc/src/main/java/org/apache/accumulo/gc/GarbageCollectWriteAheadLogs.java#L85)
 maybe it could be modified to look like the following.
   
   ```java
       this.store = () -> Iterators.concat(
           context.getAmple().readTablets().forLevel(DataLevel.ROOT).filter(new 
HasWalsFilter())
               .fetch(LOCATION, LAST, LOGS, PREV_ROW, 
SUSPEND).checkConsistency().build().iterator(),
           
context.getAmple().readTablets().forLevel(DataLevel.METADATA).filter(new 
HasWalsFilter())
               .fetch(LOCATION, LAST, LOGS, PREV_ROW, 
SUSPEND).checkConsistency().build().iterator(),
           context.getAmple().readTablets().forLevel(DataLevel.USER).filter(new 
HasWalsFilter())
               .fetch(LOCATION, LAST, LOGS, PREV_ROW, 
SUSPEND).checkConsistency().build().iterator());
   ```
   
   In the example above `.filter(new HasWalsFilter())` add a custom filter to 
the Ample read that knows how to only returns tablet metadata rows from the 
server side that have write ahead logs.  


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