mikewalch closed pull request #516: Adding better handling of WAL close 
exceptions
URL: https://github.com/apache/accumulo/pull/516
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git 
a/server/tserver/src/main/java/org/apache/accumulo/tserver/log/DfsLogger.java 
b/server/tserver/src/main/java/org/apache/accumulo/tserver/log/DfsLogger.java
index 9e7a7531e8..b19b2c28d5 100644
--- 
a/server/tserver/src/main/java/org/apache/accumulo/tserver/log/DfsLogger.java
+++ 
b/server/tserver/src/main/java/org/apache/accumulo/tserver/log/DfsLogger.java
@@ -618,6 +618,8 @@ public synchronized void defineTablet(long seq, int tid, 
KeyExtent tablet) throw
     key.tablet = tablet;
     try {
       write(key, EMPTY);
+    } catch (ClosedChannelException ex) {
+      throw new LogClosedException();
     } catch (IllegalArgumentException e) {
       log.error("Signature of sync method changed. Accumulo is likely"
           + " incompatible with this version of Hadoop.");
@@ -626,9 +628,13 @@ public synchronized void defineTablet(long seq, int tid, 
KeyExtent tablet) throw
   }
 
   private synchronized void write(LogFileKey key, LogFileValue value) throws 
IOException {
-    key.write(encryptingLogFile);
-    value.write(encryptingLogFile);
-    encryptingLogFile.flush();
+    try {
+      key.write(encryptingLogFile);
+      value.write(encryptingLogFile);
+      encryptingLogFile.flush();
+    } catch (ClosedChannelException e) {
+      throw new LogClosedException();
+    }
   }
 
   public LoggerOperation log(long seq, int tid, Mutation mutation, Durability 
durability)
diff --git 
a/server/tserver/src/main/java/org/apache/accumulo/tserver/log/TabletServerLogger.java
 
b/server/tserver/src/main/java/org/apache/accumulo/tserver/log/TabletServerLogger.java
index a34fc829fd..44cad40e6e 100644
--- 
a/server/tserver/src/main/java/org/apache/accumulo/tserver/log/TabletServerLogger.java
+++ 
b/server/tserver/src/main/java/org/apache/accumulo/tserver/log/TabletServerLogger.java
@@ -17,6 +17,7 @@
 package org.apache.accumulo.tserver.log;
 
 import java.io.IOException;
+import java.nio.channels.ClosedChannelException;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Collections;
@@ -423,7 +424,7 @@ private void write(final Collection<CommitSession> 
sessions, boolean mincFinish,
           // double-check: did the log set change?
           success = (currentLogId == logId.get());
         }
-      } catch (DfsLogger.LogClosedException ex) {
+      } catch (DfsLogger.LogClosedException | ClosedChannelException ex) {
         writeRetry.logRetry(log, "Logs closed while writing", ex);
       } catch (Exception t) {
         writeRetry.logRetry(log, "Failed to write to WAL", t);


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to