You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@accumulo.apache.org by kt...@apache.org on 2025/07/24 19:32:22 UTC

(accumulo) branch main updated: Fixes NPE in compactor when reporting failure (#5754)

This is an automated email from the ASF dual-hosted git repository.

kturner pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/accumulo.git


The following commit(s) were added to refs/heads/main by this push:
     new 84f38d031a Fixes NPE in compactor when reporting failure (#5754)
84f38d031a is described below

commit 84f38d031a5cf74c2d2b50b91178848d92d05324
Author: Keith Turner <kt...@apache.org>
AuthorDate: Thu Jul 24 15:32:17 2025 -0400

    Fixes NPE in compactor when reporting failure (#5754)
    
    When a compaction was interrupted the compactor would experience a NPE
    when trying to report the failure to the manager.  This was causing a few
    ITs that check that split cancels a compacton to fail.
---
 .../src/main/java/org/apache/accumulo/compactor/Compactor.java   | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/server/compactor/src/main/java/org/apache/accumulo/compactor/Compactor.java b/server/compactor/src/main/java/org/apache/accumulo/compactor/Compactor.java
index 97e0561e4d..8cd85d40fa 100644
--- a/server/compactor/src/main/java/org/apache/accumulo/compactor/Compactor.java
+++ b/server/compactor/src/main/java/org/apache/accumulo/compactor/Compactor.java
@@ -487,17 +487,16 @@ public class Compactor extends AbstractServer implements MetricsProducer, Compac
    * Notify the CompactionCoordinator the job failed
    *
    * @param job current compaction job
-   * @param exception cause of failure
    * @throws RetriesExceededException thrown when retries have been exceeded
    */
-  protected void updateCompactionFailed(TExternalCompactionJob job, Throwable exception)
+  protected void updateCompactionFailed(TExternalCompactionJob job, String cause)
       throws RetriesExceededException {
     RetryableThriftCall<String> thriftCall =
         new RetryableThriftCall<>(1000, RetryableThriftCall.MAX_WAIT_TIME, 25, () -> {
           Client coordinatorClient = getCoordinatorClient();
           try {
             coordinatorClient.compactionFailed(TraceUtil.traceInfo(), getContext().rpcCreds(),
-                job.getExternalCompactionId(), job.extent, exception.getClass().getName());
+                job.getExternalCompactionId(), job.extent, cause);
             return "";
           } finally {
             ThriftUtil.returnClient(coordinatorClient, getContext());
@@ -956,7 +955,7 @@ public class Compactor extends AbstractServer implements MetricsProducer, Compac
                     new TCompactionStatusUpdate(TCompactionState.CANCELLED, "Compaction cancelled",
                         -1, -1, -1, fcr.getCompactionAge().toNanos());
                 updateCompactionState(job, update);
-                updateCompactionFailed(job, null);
+                updateCompactionFailed(job, InterruptedException.class.getName());
                 cancelled.incrementAndGet();
               } catch (RetriesExceededException e) {
                 LOG.error("Error updating coordinator with compaction cancellation.", e);
@@ -972,7 +971,7 @@ public class Compactor extends AbstractServer implements MetricsProducer, Compac
                     TCompactionState.FAILED, "Compaction failed due to: " + err.get().getMessage(),
                     -1, -1, -1, fcr.getCompactionAge().toNanos());
                 updateCompactionState(job, update);
-                updateCompactionFailed(job, err.get());
+                updateCompactionFailed(job, err.get().getClass().getName());
                 failed.incrementAndGet();
                 errorHistory.addError(fromThriftExtent.tableId(), err.get());
               } catch (RetriesExceededException e) {