accumulo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mwa...@apache.org
Subject [accumulo] branch master updated: Adding better handling of WAL close exceptions (#516)
Date Wed, 06 Jun 2018 21:21:30 GMT
This is an automated email from the ASF dual-hosted git repository.

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


The following commit(s) were added to refs/heads/master by this push:
     new cee1f50  Adding better handling of WAL close exceptions (#516)
cee1f50 is described below

commit cee1f507c52796bab184deecd1b6eeb5eb761900
Author: bbux-atg <39766417+bbux-atg@users.noreply.github.com>
AuthorDate: Wed Jun 6 17:21:27 2018 -0400

    Adding better handling of WAL close exceptions (#516)
---
 .../main/java/org/apache/accumulo/tserver/log/DfsLogger.java | 12 +++++++++---
 .../org/apache/accumulo/tserver/log/TabletServerLogger.java  |  3 ++-
 2 files changed, 11 insertions(+), 4 deletions(-)

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 9e7a753..b19b2c2 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 class DfsLogger implements Comparable<DfsLogger> {
     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 class DfsLogger implements Comparable<DfsLogger> {
   }
 
   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 a34fc82..44cad40 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 @@ public class TabletServerLogger {
           // 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);

-- 
To stop receiving notification emails like this one, please contact
mwalch@apache.org.

Mime
View raw message