cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject [1/3] cassandra git commit: Check connection errors more reliably in CqlRecordWriter
Date Wed, 20 May 2015 10:09:46 GMT
Repository: cassandra
Updated Branches:
  refs/heads/cassandra-2.2 e4eba2538 -> f970de557
  refs/heads/trunk eaf7d81e7 -> 16736314b


Check connection errors more reliably in CqlRecordWriter

Patch by Philip Thompson; reviewed by Sam Tunnicliffe for CASSANDRA-9419


Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/f970de55
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/f970de55
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/f970de55

Branch: refs/heads/cassandra-2.2
Commit: f970de55746dd074843d8cfd5385b12acda56ee9
Parents: e4eba25
Author: Philip Thompson <ptnapoleon@gmail.com>
Authored: Wed May 20 10:49:02 2015 +0100
Committer: Sam Tunnicliffe <sam@beobal.com>
Committed: Wed May 20 10:51:45 2015 +0100

----------------------------------------------------------------------
 .../org/apache/cassandra/hadoop/cql3/CqlRecordWriter.java     | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/f970de55/src/java/org/apache/cassandra/hadoop/cql3/CqlRecordWriter.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/hadoop/cql3/CqlRecordWriter.java b/src/java/org/apache/cassandra/hadoop/cql3/CqlRecordWriter.java
index 132273c..c507197 100644
--- a/src/java/org/apache/cassandra/hadoop/cql3/CqlRecordWriter.java
+++ b/src/java/org/apache/cassandra/hadoop/cql3/CqlRecordWriter.java
@@ -28,6 +28,7 @@ import org.slf4j.LoggerFactory;
 
 
 import com.datastax.driver.core.exceptions.AuthenticationException;
+import com.datastax.driver.core.exceptions.DriverException;
 import com.datastax.driver.core.exceptions.InvalidQueryException;
 import com.datastax.driver.core.exceptions.NoHostAvailableException;
 import com.datastax.driver.core.BoundStatement;
@@ -321,7 +322,10 @@ class CqlRecordWriter extends RecordWriter<Map<String, ByteBuffer>,
List<ByteBuf
                     catch (Exception e)
                     {
                         //If connection died due to Interrupt, just try connecting to the
endpoint again.
-                        if (Thread.interrupted()) {
+                        //There are too many ways for the Thread.interrupted() state to be
cleared, so
+                        //we can't rely on that here. Until the java driver gives us a better
way of knowing
+                        //that this exception came from an InterruptedException, this is
the best solution.
+                        if (e instanceof DriverException && e.getMessage().contains("Connection
thread interrupted")) {
                             lastException = new IOException(e);
                             iter.previous();
                         }
@@ -334,6 +338,7 @@ class CqlRecordWriter extends RecordWriter<Map<String, ByteBuffer>,
List<ByteBuf
                             lastException = new IOException(e);
                             break outer;
                         }
+                        continue;
                     }
 
                     try


Mime
View raw message