You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by sl...@apache.org on 2015/11/20 14:01:26 UTC

[1/3] cassandra git commit: Try next replica if not possible to connect to primary replica on ColumnFamilyRecordReader

Repository: cassandra
Updated Branches:
  refs/heads/cassandra-3.0 039ff1f88 -> 8a0615b4a


Try next replica if not possible to connect to primary replica on ColumnFamilyRecordReader

patch by pauloricardomg; reviewed by pkolaczk for CASSANDRA-2388


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

Branch: refs/heads/cassandra-3.0
Commit: 882adf0ae638c69928e14ed7e34de7364ed65ba1
Parents: 851aed7
Author: Paulo Motta <pa...@gmail.com>
Authored: Mon Aug 24 17:21:57 2015 -0300
Committer: Sylvain Lebresne <sy...@datastax.com>
Committed: Fri Nov 20 13:59:46 2015 +0100

----------------------------------------------------------------------
 CHANGES.txt                                     |  2 ++
 .../hadoop/ColumnFamilyRecordReader.java        | 35 +++++++++++---------
 2 files changed, 21 insertions(+), 16 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/882adf0a/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index 66423c7..9e2869e 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,4 +1,6 @@
 2.1.12
+ * Try next replica if not possible to connect to primary replica on
+   ColumnFamilyRecordReader (CASSANDRA-2388)
  * Limit window size in DTCS (CASSANDRA-10280)
  * sstableloader does not use MAX_HEAP_SIZE env parameter (CASSANDRA-10188)
  * (cqlsh) Improve COPY TO performance and error handling (CASSANDRA-9304)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/882adf0a/src/java/org/apache/cassandra/hadoop/ColumnFamilyRecordReader.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/hadoop/ColumnFamilyRecordReader.java b/src/java/org/apache/cassandra/hadoop/ColumnFamilyRecordReader.java
index 0b52904..dc44a43 100644
--- a/src/java/org/apache/cassandra/hadoop/ColumnFamilyRecordReader.java
+++ b/src/java/org/apache/cassandra/hadoop/ColumnFamilyRecordReader.java
@@ -151,22 +151,25 @@ public class ColumnFamilyRecordReader extends RecordReader<ByteBuffer, SortedMap
         if (batchSize < 2)
             throw new IllegalArgumentException("Minimum batchSize is 2.  Suggested batchSize is 100 or more");
 
-        try
-        {
-            if (client != null)
-                return;
-
-            // create connection using thrift
-            String location = getLocation();
+        String[] locations = getLocations();
+        int port = ConfigHelper.getInputRpcPort(conf);
 
-            int port = ConfigHelper.getInputRpcPort(conf);
-            client = ColumnFamilyInputFormat.createAuthenticatedClient(location, port, conf);
-
-        }
-        catch (Exception e)
+        Exception lastException = null;
+        for (String location : locations)
         {
-            throw new RuntimeException(e);
+            try
+            {
+                client = ColumnFamilyInputFormat.createAuthenticatedClient(location, port, conf);
+                break;
+            }
+            catch (Exception e)
+            {
+                lastException = e;
+                logger.warn("Failed to create authenticated client to {}:{}", location , port);
+            }
         }
+        if (client == null && lastException != null)
+            throw new RuntimeException(lastException);
 
         iter = widerows ? new WideRowIterator() : new StaticRowIterator();
         logger.debug("created {}", iter);
@@ -186,7 +189,7 @@ public class ColumnFamilyRecordReader extends RecordReader<ByteBuffer, SortedMap
 
     // we don't use endpointsnitch since we are trying to support hadoop nodes that are
     // not necessarily on Cassandra machines, too.  This should be adequate for single-DC clusters, at least.
-    private String getLocation()
+    private String[] getLocations()
     {
         Collection<InetAddress> localAddresses = FBUtilities.getAllLocalAddresses();
 
@@ -205,11 +208,11 @@ public class ColumnFamilyRecordReader extends RecordReader<ByteBuffer, SortedMap
                 }
                 if (address.equals(locationAddress))
                 {
-                    return location;
+                    return new String[]{location};
                 }
             }
         }
-        return split.getLocations()[0];
+        return split.getLocations();
     }
 
     private abstract class RowIterator extends AbstractIterator<Pair<ByteBuffer, SortedMap<ByteBuffer, Cell>>>


[2/3] cassandra git commit: Merge branch 'cassandra-2.1' into cassandra-2.2

Posted by sl...@apache.org.
Merge branch 'cassandra-2.1' into cassandra-2.2


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

Branch: refs/heads/cassandra-3.0
Commit: da4b97164a89d57990ef19b553cb4a25937efe4a
Parents: 3851670 882adf0
Author: Sylvain Lebresne <sy...@datastax.com>
Authored: Fri Nov 20 14:00:35 2015 +0100
Committer: Sylvain Lebresne <sy...@datastax.com>
Committed: Fri Nov 20 14:00:35 2015 +0100

----------------------------------------------------------------------
 CHANGES.txt                                     |  2 ++
 .../hadoop/ColumnFamilyRecordReader.java        | 35 +++++++++++---------
 2 files changed, 21 insertions(+), 16 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/da4b9716/CHANGES.txt
----------------------------------------------------------------------
diff --cc CHANGES.txt
index 867226f,9e2869e..17c5047
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@@ -1,17 -1,6 +1,19 @@@
 -2.1.12
 +2.2.4
 + * Don't do anticompaction after subrange repair (CASSANDRA-10422)
 + * Fix SimpleDateType type compatibility (CASSANDRA-10027)
 + * (Hadoop) fix splits calculation (CASSANDRA-10640)
 + * (Hadoop) ensure that Cluster instances are always closed (CASSANDRA-10058)
 + * (cqlsh) show partial trace if incomplete after max_trace_wait (CASSANDRA-7645)
 + * Use most up-to-date version of schema for system tables (CASSANDRA-10652)
 + * Deprecate memory_allocator in cassandra.yaml (CASSANDRA-10581,10628)
 + * Expose phi values from failure detector via JMX and tweak debug
 +   and trace logging (CASSANDRA-9526)
 + * Fix RangeNamesQueryPager (CASSANDRA-10509)
 + * Deprecate Pig support (CASSANDRA-10542)
 + * Reduce contention getting instances of CompositeType (CASSANDRA-10433)
 +Merged from 2.1:
+  * Try next replica if not possible to connect to primary replica on
+    ColumnFamilyRecordReader (CASSANDRA-2388)
   * Limit window size in DTCS (CASSANDRA-10280)
   * sstableloader does not use MAX_HEAP_SIZE env parameter (CASSANDRA-10188)
   * (cqlsh) Improve COPY TO performance and error handling (CASSANDRA-9304)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/da4b9716/src/java/org/apache/cassandra/hadoop/ColumnFamilyRecordReader.java
----------------------------------------------------------------------
diff --cc src/java/org/apache/cassandra/hadoop/ColumnFamilyRecordReader.java
index 97dc497,dc44a43..9d1d10c
--- a/src/java/org/apache/cassandra/hadoop/ColumnFamilyRecordReader.java
+++ b/src/java/org/apache/cassandra/hadoop/ColumnFamilyRecordReader.java
@@@ -152,25 -151,28 +152,28 @@@ public class ColumnFamilyRecordReader e
          if (batchSize < 2)
              throw new IllegalArgumentException("Minimum batchSize is 2.  Suggested batchSize is 100 or more");
  
-         try
-         {
-             if (client != null)
-                 return;
- 
-             // create connection using thrift
-             String location = getLocation();
- 
-             int port = ConfigHelper.getInputRpcPort(conf);
-             client = ColumnFamilyInputFormat.createAuthenticatedClient(location, port, conf);
+         String[] locations = getLocations();
+         int port = ConfigHelper.getInputRpcPort(conf);
  
-         }
-         catch (Exception e)
+         Exception lastException = null;
+         for (String location : locations)
          {
-             throw new RuntimeException(e);
+             try
+             {
+                 client = ColumnFamilyInputFormat.createAuthenticatedClient(location, port, conf);
+                 break;
+             }
+             catch (Exception e)
+             {
+                 lastException = e;
+                 logger.warn("Failed to create authenticated client to {}:{}", location , port);
+             }
          }
+         if (client == null && lastException != null)
+             throw new RuntimeException(lastException);
  
          iter = widerows ? new WideRowIterator() : new StaticRowIterator();
 -        logger.debug("created {}", iter);
 +        logger.trace("created {}", iter);
      }
  
      public boolean nextKeyValue() throws IOException
@@@ -210,10 -212,10 +213,10 @@@
                  }
              }
          }
-         return split.getLocations()[0];
+         return split.getLocations();
      }
  
 -    private abstract class RowIterator extends AbstractIterator<Pair<ByteBuffer, SortedMap<ByteBuffer, Cell>>>
 +    private abstract class RowIterator extends AbstractIterator<Pair<ByteBuffer, SortedMap<ByteBuffer, Column>>>
      {
          protected List<KeySlice> rows;
          protected int totalRead = 0;


[3/3] cassandra git commit: Merge branch 'cassandra-2.2' into cassandra-3.0

Posted by sl...@apache.org.
Merge branch 'cassandra-2.2' into cassandra-3.0


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

Branch: refs/heads/cassandra-3.0
Commit: 8a0615b4a7d1fa6864b95e1bb72a5417a54472e2
Parents: 039ff1f da4b971
Author: Sylvain Lebresne <sy...@datastax.com>
Authored: Fri Nov 20 14:01:17 2015 +0100
Committer: Sylvain Lebresne <sy...@datastax.com>
Committed: Fri Nov 20 14:01:17 2015 +0100

----------------------------------------------------------------------
 CHANGES.txt | 2 ++
 1 file changed, 2 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/8a0615b4/CHANGES.txt
----------------------------------------------------------------------
diff --cc CHANGES.txt
index c3469bc,17c5047..d6f0379
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@@ -9,7 -3,17 +9,9 @@@ Merged from 2.2
   * Fix SimpleDateType type compatibility (CASSANDRA-10027)
   * (Hadoop) fix splits calculation (CASSANDRA-10640)
   * (Hadoop) ensure that Cluster instances are always closed (CASSANDRA-10058)
 - * (cqlsh) show partial trace if incomplete after max_trace_wait (CASSANDRA-7645)
 - * Use most up-to-date version of schema for system tables (CASSANDRA-10652)
 - * Deprecate memory_allocator in cassandra.yaml (CASSANDRA-10581,10628)
 - * Expose phi values from failure detector via JMX and tweak debug
 -   and trace logging (CASSANDRA-9526)
 - * Fix RangeNamesQueryPager (CASSANDRA-10509)
 - * Deprecate Pig support (CASSANDRA-10542)
 - * Reduce contention getting instances of CompositeType (CASSANDRA-10433)
  Merged from 2.1:
+  * Try next replica if not possible to connect to primary replica on
+    ColumnFamilyRecordReader (CASSANDRA-2388)
   * Limit window size in DTCS (CASSANDRA-10280)
   * sstableloader does not use MAX_HEAP_SIZE env parameter (CASSANDRA-10188)
   * (cqlsh) Improve COPY TO performance and error handling (CASSANDRA-9304)