keith-turner commented on PR #4566:
URL: https://github.com/apache/accumulo/pull/4566#issuecomment-2116102184

   This is an example of using these draft APIs to print the example table in 
#4564
   
   ```java
     public void printTableCompactions(AccumuloClient client) {
       
client.instanceOperations().getTableCompactions().forEach(tableCompaction -> {
         AtomicLong running = new AtomicLong(0);
         AtomicLong completed = new AtomicLong(0);
         AtomicLong total = new AtomicLong(0);
         tableCompaction.getTablets().forEach(tabletInformation -> {
           if 
(tabletInformation.getCompletedTableCompactions().contains(tableCompaction.getId()))
 {
             completed.incrementAndGet();
           }
   
           for (var runningCompaction : 
tabletInformation.getRunningCompactions()) {
             if (runningCompaction.getTableCompactionId()
                 .map(tcid -> 
tcid.equals(tableCompaction.getId())).orElse(false)) {
               running.incrementAndGet();
             }
           }
   
           total.incrementAndGet();
         });
   
         var id = tableCompaction.getId();
         var table = tableCompaction.getTableName();
         var startRow = tableCompaction.getConfig().getStartRow();
         var endRow = tableCompaction.getConfig().getEndRow();
         var startTime = tableCompaction.getStartTime();
         var config = tableCompaction.getConfig();
   
         System.out.printf("%s %s %s %s %s %,d %,d %,d %s\n", id, table, 
startRow, endRow, startTime,
             completed.get(), running.get(), total.get(), config);
       });
     }
   ```


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