You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@accumulo.apache.org by cs...@apache.org on 2022/11/10 23:31:27 UTC

[accumulo] branch 2.1 updated: Reduce logging when external compactions are cancelled (#3067)

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

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


The following commit(s) were added to refs/heads/2.1 by this push:
     new 1a9da5af4d Reduce logging when external compactions are cancelled (#3067)
1a9da5af4d is described below

commit 1a9da5af4d8e9f461fe2b8c07b83fad5e6987141
Author: Christopher L. Shannon <ch...@gmail.com>
AuthorDate: Thu Nov 10 18:31:21 2022 -0500

    Reduce logging when external compactions are cancelled (#3067)
    
    Reduce logging noise when external compactions are canceled
    
    Also only shows stack traces in FileCompactor on file writer close
    errors when canceled compaction is unexpected.
    
    This closes #3023
---
 .../accumulo/server/compaction/FileCompactor.java     | 19 +++++++++++++++++--
 .../java/org/apache/accumulo/compactor/Compactor.java |  2 ++
 2 files changed, 19 insertions(+), 2 deletions(-)

diff --git a/server/base/src/main/java/org/apache/accumulo/server/compaction/FileCompactor.java b/server/base/src/main/java/org/apache/accumulo/server/compaction/FileCompactor.java
index 903d5f2c90..a15f9a901e 100644
--- a/server/base/src/main/java/org/apache/accumulo/server/compaction/FileCompactor.java
+++ b/server/base/src/main/java/org/apache/accumulo/server/compaction/FileCompactor.java
@@ -258,6 +258,9 @@ public class FileCompactor implements Callable<CompactionStats> {
 
       majCStats.setFileSize(mfwTmp.getLength());
       return majCStats;
+    } catch (CompactionCanceledException e) {
+      log.debug("Compaction canceled {}", extent);
+      throw e;
     } catch (IOException | RuntimeException e) {
       log.error("{}", e.getMessage(), e);
       throw e;
@@ -280,7 +283,18 @@ public class FileCompactor implements Callable<CompactionStats> {
           }
         }
       } catch (IOException | RuntimeException e) {
-        log.warn("{}", e.getMessage(), e);
+        /*
+         * If compaction is enabled then the compaction didn't finish due to a real error condition
+         * so log any errors on the output file close as a warning. However, if not enabled, then
+         * the compaction was canceled due to something like tablet split, user cancellation, or
+         * table deletion which is not an error so log any errors on output file close as a debug as
+         * this may happen due to an InterruptedException thrown due to the cancellation.
+         */
+        if (env.isCompactionEnabled()) {
+          log.warn("{}", e.getMessage(), e);
+        } else {
+          log.debug("{}", e.getMessage(), e);
+        }
       }
     }
   }
@@ -392,7 +406,8 @@ public class FileCompactor implements Callable<CompactionStats> {
             try {
               mfw.close();
             } catch (IOException e) {
-              log.error("{}", e.getMessage(), e);
+              log.warn("{}", e.getMessage());
+              log.debug("{}", e.getMessage(), e);
             }
             fs.deleteRecursively(outputFile.getPath());
           } catch (Exception e) {
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 16f727b26e..627fbab088 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
@@ -578,6 +578,8 @@ public class Compactor extends AbstractServer implements MetricsProducer, Compac
         TCompactionStatusUpdate update2 = new TCompactionStatusUpdate(TCompactionState.SUCCEEDED,
             "Compaction completed successfully", -1, -1, -1);
         updateCompactionState(job, update2);
+      } catch (FileCompactor.CompactionCanceledException cce) {
+        LOG.debug("Compaction canceled {}", job.getExternalCompactionId());
       } catch (Exception e) {
         LOG.error("Compaction failed", e);
         err.set(e);