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


##########
server/compactor/src/main/java/org/apache/accumulo/compactor/Compactor.java:
##########
@@ -145,6 +147,54 @@ public interface FileCompactorRunnable extends Runnable {
 
   private static final SecureRandom random = new SecureRandom();
 
+  private static class ErrorHistory extends 
HashMap<TableId,HashMap<String,AtomicLong>> {
+
+    private static final long serialVersionUID = 1L;
+
+    public long getTotalFailures() {
+      long total = 0;
+      for (TableId tid : keySet()) {
+        total += getTotalTableFailures(tid);
+      }
+      return total;
+    }
+
+    public long getTotalTableFailures(TableId tid) {
+      long total = 0;
+      for (AtomicLong failures : get(tid).values()) {
+        total += failures.get();
+      }
+      return total;
+    }
+
+    /**
+     * Add error for table, and return total number of failures for the table
+     *
+     * @param tid table id
+     * @param error exception
+     * @return total number of failures for table
+     */
+    public long addError(TableId tid, Throwable error) {
+      computeIfAbsent(tid, t -> new HashMap<String,AtomicLong>())
+          .computeIfAbsent(error.toString(), e -> new 
AtomicLong(0)).incrementAndGet();
+      return getTotalTableFailures(tid);
+    }
+
+    @Override
+    public String toString() {
+      StringBuilder buf = new StringBuilder();
+      buf.append("\n");
+      for (TableId tid : keySet()) {
+        buf.append("Table: ").append(tid).append("\n");
+        for (Entry<String,AtomicLong> error : get(tid).entrySet()) {
+          buf.append("\tException: ").append(error.getKey()).append(", count: 
")
+              .append(error.getValue().get());
+        }

Review Comment:
   Somewhere in here a new line is needed.  Seeing the following in the logs.
   
   ```
   2025-07-15T21:39:17,223 [compactor.Compactor] WARN : This Compactor has had 
8 consecutive failures. Failures: 
   Table: 1
           Exception: java.lang.ClassNotFoundException: 
org.apache.accumulo.testing.continuous.ValidatingIterator, count: 4Table: 2
           Exception: java.lang.ClassNotFoundException: 
org.apache.accumulo.testing.continuous.MissingIter, count: 4
   ```



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