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

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


The following commit(s) were added to refs/heads/1.9 by this push:
     new 18e8239  Move MinorCompaction method call into retry catch block. 
Fixes #1298 (#1675)
18e8239 is described below

commit 18e82394898352c9dcf682b2086a6145af36c06e
Author: Mike Miller <[email protected]>
AuthorDate: Wed Aug 12 08:30:40 2020 -0400

    Move MinorCompaction method call into retry catch block. Fixes #1298 (#1675)
    
    * Fixes the situation when MinorCompactionTask creates a
    new File and an IOException leaves the Tablet in a bad state
    * Moves the new file code into the try/catch block that will
    retry during an IOException
---
 .../accumulo/tserver/tablet/MinorCompactionTask.java       | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

diff --git 
a/server/tserver/src/main/java/org/apache/accumulo/tserver/tablet/MinorCompactionTask.java
 
b/server/tserver/src/main/java/org/apache/accumulo/tserver/tablet/MinorCompactionTask.java
index 7f44be7..8f922d2 100644
--- 
a/server/tserver/src/main/java/org/apache/accumulo/tserver/tablet/MinorCompactionTask.java
+++ 
b/server/tserver/src/main/java/org/apache/accumulo/tserver/tablet/MinorCompactionTask.java
@@ -59,16 +59,20 @@ class MinorCompactionTask implements Runnable {
     ProbabilitySampler sampler = new ProbabilitySampler(tracePercent);
     Span minorCompaction = Trace.on("minorCompaction", sampler);
     try {
-      FileRef newMapfileLocation = tablet.getNextMapFilename(mergeFile == null 
? "F" : "M");
-      FileRef tmpFileRef = new FileRef(newMapfileLocation.path() + "_tmp");
       Span span = Trace.start("waitForCommits");
       synchronized (tablet) {
         commitSession.waitForCommitsToFinish();
       }
       span.stop();
       span = Trace.start("start");
+      FileRef newMapfileLocation = null;
+      FileRef tmpFileRef = null;
       while (true) {
         try {
+          if (newMapfileLocation == null) {
+            newMapfileLocation = tablet.getNextMapFilename(mergeFile == null ? 
"F" : "M");
+            tmpFileRef = new FileRef(newMapfileLocation.path() + "_tmp");
+          }
           // the purpose of the minor compaction start event is to keep track 
of the filename... in
           // the case
           // where the metadata table write for the minor compaction finishes 
and the process dies
@@ -82,7 +86,11 @@ class MinorCompactionTask implements Runnable {
               commitSession.getWALogSeq() + 1, 
newMapfileLocation.path().toString());
           break;
         } catch (IOException e) {
-          log.warn("Failed to write to write ahead log {}", e.getMessage(), e);
+          // An IOException could have occurred while creating the new file
+          if (newMapfileLocation == null)
+            log.warn("Failed to create new file for minor compaction {}", 
e.getMessage(), e);
+          else
+            log.warn("Failed to write to write ahead log {}", e.getMessage(), 
e);
         }
       }
       span.stop();

Reply via email to