You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by br...@apache.org on 2015/09/17 22:06:38 UTC

[01/17] cassandra git commit: Fix IndexOutOfBoundsException when using empty BATCH statements

Repository: cassandra
Updated Branches:
  refs/heads/cassandra-2.0 718e47f08 -> 6f8e07ab0
  refs/heads/cassandra-2.2 416ba6e8b -> 6dcc89f81
  refs/heads/cassandra-3.0 caadcf69e -> 41a4a538b
  refs/heads/trunk d6d5698b8 -> 44f1ee3c5


Fix IndexOutOfBoundsException when using empty BATCH statements

patch by Vovodroid; reviewed by Benjamin Lerer for CASSANDRA-10277


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

Branch: refs/heads/cassandra-3.0
Commit: 1a2a1d2c24b777d4c9ea9106e0e7199c7b91fa29
Parents: b62fde1
Author: Vovodroid <vo...@gmail.com>
Authored: Thu Sep 17 20:57:51 2015 +0200
Committer: blerer <be...@datastax.com>
Committed: Thu Sep 17 20:57:51 2015 +0200

----------------------------------------------------------------------
 .../org/apache/cassandra/cql3/statements/BatchStatement.java   | 2 +-
 .../apache/cassandra/cql3/validation/operations/BatchTest.java | 6 ++++++
 2 files changed, 7 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/1a2a1d2c/src/java/org/apache/cassandra/cql3/statements/BatchStatement.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/cql3/statements/BatchStatement.java b/src/java/org/apache/cassandra/cql3/statements/BatchStatement.java
index 0661b56..46dfda5 100644
--- a/src/java/org/apache/cassandra/cql3/statements/BatchStatement.java
+++ b/src/java/org/apache/cassandra/cql3/statements/BatchStatement.java
@@ -510,7 +510,7 @@ public class BatchStatement implements CQLStatement
 
             // Use the CFMetadata of the first statement for partition key bind indexes.  If the statements affect
             // multiple tables, we won't send partition key bind indexes.
-            Short[] partitionKeyBindIndexes = haveMultipleCFs ? null
+            Short[] partitionKeyBindIndexes = (haveMultipleCFs || batchStatement.statements.isEmpty())? null
                                                               : boundNames.getPartitionKeyBindIndexes(batchStatement.statements.get(0).cfm);
 
             return new ParsedStatement.Prepared(batchStatement, boundNames, partitionKeyBindIndexes);

http://git-wip-us.apache.org/repos/asf/cassandra/blob/1a2a1d2c/test/unit/org/apache/cassandra/cql3/validation/operations/BatchTest.java
----------------------------------------------------------------------
diff --git a/test/unit/org/apache/cassandra/cql3/validation/operations/BatchTest.java b/test/unit/org/apache/cassandra/cql3/validation/operations/BatchTest.java
index 1447845..07117fd 100644
--- a/test/unit/org/apache/cassandra/cql3/validation/operations/BatchTest.java
+++ b/test/unit/org/apache/cassandra/cql3/validation/operations/BatchTest.java
@@ -103,4 +103,10 @@ public class BatchTest extends CQLTester
                    row(111, "batchtext", null)
         );
     }
+
+    @Test
+    public void testBatchEmpty() throws Throwable
+    {
+        execute("BEGIN BATCH APPLY BATCH;");
+    }
 }


[07/17] cassandra git commit: Fix rare race where older gossip states can be shadowed

Posted by br...@apache.org.
Fix rare race where older gossip states can be shadowed

Patch by brandonwilliams, reviewed by Richard Low for CASSANDRA-10366


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

Branch: refs/heads/cassandra-3.0
Commit: 6f8e07ab06c071cabc20c5cde06122ebf5a5aa78
Parents: 718e47f
Author: Brandon Williams <br...@apache.org>
Authored: Thu Sep 17 14:58:33 2015 -0500
Committer: Brandon Williams <br...@apache.org>
Committed: Thu Sep 17 14:58:33 2015 -0500

----------------------------------------------------------------------
 CHANGES.txt                                     |  1 +
 src/java/org/apache/cassandra/gms/Gossiper.java | 11 ++++++++---
 2 files changed, 9 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/6f8e07ab/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index 3c47427..658c19f 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,4 +1,5 @@
 2.0.17
+ * Fix rare race where older gossip states can be shadowed (CASSANDRA-10366)
  * Fix consolidating racks violating the RF contract (CASSANDRA-10238)
  * Disallow decommission when node is in drained state (CASSANDRA-8741)
  * Backport CASSANDRA-8013 to 2.0 (CASSANDRA-10144)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/6f8e07ab/src/java/org/apache/cassandra/gms/Gossiper.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/gms/Gossiper.java b/src/java/org/apache/cassandra/gms/Gossiper.java
index 8c36223..44e464a 100644
--- a/src/java/org/apache/cassandra/gms/Gossiper.java
+++ b/src/java/org/apache/cassandra/gms/Gossiper.java
@@ -1139,7 +1139,6 @@ public class Gossiper implements IFailureDetectionEventListener, GossiperMBean
         localState.setHeartBeatState(remoteState.getHeartBeatState());
         if (logger.isTraceEnabled())
             logger.trace("Updating heartbeat state version to " + localState.getHeartBeatState().getHeartBeatVersion() + " from " + oldVersion + " for " + addr + " ...");
-
         // we need to make two loops here, one to apply, then another to notify, this way all states in an update are present and current when the notifications are received
         for (Entry<ApplicationState, VersionedValue> remoteEntry : remoteState.getApplicationStateMap().entrySet())
         {
@@ -1385,8 +1384,9 @@ public class Gossiper implements IFailureDetectionEventListener, GossiperMBean
             logger.trace("Adding saved endpoint " + ep + " " + epState.getHeartBeatState().getGeneration());
     }
 
-    public void addLocalApplicationState(ApplicationState state, VersionedValue value)
+    private void addLocalApplicationStateInternal(ApplicationState state, VersionedValue value)
     {
+        assert taskLock.isHeldByCurrentThread();
         EndpointState epState = endpointStateMap.get(FBUtilities.getBroadcastAddress());
         InetAddress epAddr = FBUtilities.getBroadcastAddress();
         assert epState != null;
@@ -1401,6 +1401,11 @@ public class Gossiper implements IFailureDetectionEventListener, GossiperMBean
         doOnChangeNotifications(epAddr, state, value);
     }
 
+    public void addLocalApplicationState(ApplicationState applicationState, VersionedValue value)
+    {
+        addLocalApplicationStates(Arrays.asList(Pair.create(applicationState, value)));
+    }
+
     public void addLocalApplicationStates(List<Pair<ApplicationState, VersionedValue>> states)
     {
         taskLock.lock();
@@ -1408,7 +1413,7 @@ public class Gossiper implements IFailureDetectionEventListener, GossiperMBean
         {
             for (Pair<ApplicationState, VersionedValue> pair : states)
             {
-               addLocalApplicationState(pair.left, pair.right);
+               addLocalApplicationStateInternal(pair.left, pair.right);
             }
         }
         finally


[09/17] cassandra git commit: Merge branch 'cassandra-2.0' into cassandra-2.1

Posted by br...@apache.org.
Merge branch 'cassandra-2.0' into cassandra-2.1

Conflicts:
	CHANGES.txt


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

Branch: refs/heads/cassandra-2.2
Commit: a5e282bff22ab81c8898161c8508215f2d766aff
Parents: ba5837e 6f8e07a
Author: Brandon Williams <br...@apache.org>
Authored: Thu Sep 17 15:02:23 2015 -0500
Committer: Brandon Williams <br...@apache.org>
Committed: Thu Sep 17 15:02:23 2015 -0500

----------------------------------------------------------------------
 CHANGES.txt                                     |  1 +
 src/java/org/apache/cassandra/gms/Gossiper.java | 11 ++++++++---
 2 files changed, 9 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/a5e282bf/CHANGES.txt
----------------------------------------------------------------------
diff --cc CHANGES.txt
index 207f16a,658c19f..5af30a5
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@@ -1,49 -1,8 +1,50 @@@
 -2.0.17
 +2.1.10
 + * Fix cache handling of 2i and base tables (CASSANDRA-10155)
 + * Fix NPE in nodetool compactionhistory (CASSANDRA-9758)
 + * (Pig) support BulkOutputFormat as a URL parameter (CASSANDRA-7410)
 + * BATCH statement is broken in cqlsh (CASSANDRA-10272)
 + * Added configurable warning threshold for GC duration (CASSANDRA-8907)
 + * (cqlsh) Make cqlsh PEP8 compliant (CASSANDRA-10066)
 + * (cqlsh) Fix error when starting cqlsh with --debug (CASSANDRA-10282)
 + * Scrub, Cleanup and Upgrade do not unmark compacting until all operations
 +   have completed, regardless of the occurence of exceptions (CASSANDRA-10274)
 + * Fix handling of streaming EOF (CASSANDRA-10206)
 + * Only check KeyCache when it is enabled
 + * Change streaming_socket_timeout_in_ms default to 1 hour (CASSANDRA-8611)
 + * (cqlsh) update list of CQL keywords (CASSANDRA-9232)
 +Merged from 2.0:
+  * Fix rare race where older gossip states can be shadowed (CASSANDRA-10366)
   * Fix consolidating racks violating the RF contract (CASSANDRA-10238)
   * Disallow decommission when node is in drained state (CASSANDRA-8741)
 - * Backport CASSANDRA-8013 to 2.0 (CASSANDRA-10144)
 +
 +
 +2.1.9
 + * Avoid race condition during read repair (CASSANDRA-9460)
 + * (cqlsh) default load-from-file encoding to utf-8 (CASSANDRA-9898)
 + * Avoid returning Permission.NONE when failing to query users table (CASSANDRA-10168)
 + * (cqlsh) Allow encoding to be set through command line (CASSANDRA-10004)
 + * Add new JMX methods to change local compaction strategy (CASSANDRA-9965)
 + * Write hints for paxos commits (CASSANDRA-7342)
 + * (cqlsh) Fix timestamps before 1970 on Windows, always
 +   use UTC for timestamp display (CASSANDRA-10000)
 + * (cqlsh) Avoid overwriting new config file with old config
 +   when both exist (CASSANDRA-9777)
 + * Release snapshot selfRef when doing snapshot repair (CASSANDRA-9998)
 + * Cannot replace token does not exist - DN node removed as Fat Client (CASSANDRA-9871)
 + * Fix handling of enable/disable autocompaction (CASSANDRA-9899)
 + * Commit log segment recycling is disabled by default (CASSANDRA-9896)
 + * Add consistency level to tracing ouput (CASSANDRA-9827)
 + * Fix MarshalException when upgrading superColumn family (CASSANDRA-9582)
 + * Fix broken logging for "empty" flushes in Memtable (CASSANDRA-9837)
 + * Handle corrupt files on startup (CASSANDRA-9686)
 + * Fix clientutil jar and tests (CASSANDRA-9760)
 + * (cqlsh) Allow the SSL protocol version to be specified through the
 +   config file or environment variables (CASSANDRA-9544)
 + * Remove repair snapshot leftover on startup (CASSANDRA-7357)
 + * Use random nodes for batch log when only 2 racks (CASSANDRA-8735)
 + * Ensure atomicity inside thrift and stream session (CASSANDRA-7757)
 + * Fix nodetool info error when the node is not joined (CASSANDRA-9031)
 +Merged from 2.0:
   * Make getFullyExpiredSSTables less expensive (CASSANDRA-9882)
   * Add tool to find why expired sstables are not getting dropped (CASSANDRA-10015)
   * Remove erroneous pending HH tasks from tpstats/jmx (CASSANDRA-9129)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/a5e282bf/src/java/org/apache/cassandra/gms/Gossiper.java
----------------------------------------------------------------------


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

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

Conflicts:
	test/unit/org/apache/cassandra/cql3/validation/operations/BatchTest.java


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

Branch: refs/heads/trunk
Commit: 41a4a538be25348434fe29a12c130ba8acd0cb5c
Parents: caadcf6 6dcc89f
Author: Brandon Williams <br...@apache.org>
Authored: Thu Sep 17 15:06:18 2015 -0500
Committer: Brandon Williams <br...@apache.org>
Committed: Thu Sep 17 15:06:18 2015 -0500

----------------------------------------------------------------------
 CHANGES.txt                                     |  1 +
 NEWS.txt                                        |  6 ++++++
 src/java/org/apache/cassandra/gms/Gossiper.java | 11 ++++++++---
 3 files changed, 15 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/41a4a538/CHANGES.txt
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/cassandra/blob/41a4a538/NEWS.txt
----------------------------------------------------------------------
diff --cc NEWS.txt
index b6730a1,49744cf..61989f4
--- a/NEWS.txt
+++ b/NEWS.txt
@@@ -117,12 -28,16 +117,18 @@@ Changed Default
     - commitlog_total_space_in_mb will use the smaller of 8192, and 1/4
       of the total space of the commitlog volume. (Before: always used
       8192)
 -   - Incremental repair is on by default since 2.2.0, run full repairs by
 -     providing the '-full' parameter to nodetool repair.
 -   - Parallel repairs are the default since 2.2.0, run sequential repairs
 -     by providing the '-seq' parameter to nodetool repair.
 +
 +New features
 +------------
 +   - Custom QueryHandlers can retrieve the column specifications for the bound
 +     variables from QueryOptions by using the hasColumnSpecifications()
 +     and getColumnSpecifications() methods.
+ 
+ New features
+ ------------
+    - Custom QueryHandlers can retrieve the column specifications for the bound
+      variables from QueryOptions by using the hasColumnSpecifications()
+      and getColumnSpecifications() methods.
  
  
  2.2.1

http://git-wip-us.apache.org/repos/asf/cassandra/blob/41a4a538/src/java/org/apache/cassandra/gms/Gossiper.java
----------------------------------------------------------------------


[14/17] cassandra git commit: Merge branch 'cassandra-2.1' into cassandra-2.2

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

Conflicts:
	src/java/org/apache/cassandra/gms/Gossiper.java


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

Branch: refs/heads/trunk
Commit: 6dcc89f814b9e9511353eb46decb64db572106f4
Parents: 416ba6e a5e282b
Author: Brandon Williams <br...@apache.org>
Authored: Thu Sep 17 15:03:13 2015 -0500
Committer: Brandon Williams <br...@apache.org>
Committed: Thu Sep 17 15:03:13 2015 -0500

----------------------------------------------------------------------
 CHANGES.txt                                     |  1 +
 src/java/org/apache/cassandra/gms/Gossiper.java | 11 ++++++++---
 2 files changed, 9 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/6dcc89f8/CHANGES.txt
----------------------------------------------------------------------
diff --cc CHANGES.txt
index 96ec0fa,5af30a5..f9314f6
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@@ -22,8 -12,8 +22,9 @@@ Merged from 2.1
   * Only check KeyCache when it is enabled
   * Change streaming_socket_timeout_in_ms default to 1 hour (CASSANDRA-8611)
   * (cqlsh) update list of CQL keywords (CASSANDRA-9232)
 + * Add nodetool gettraceprobability command (CASSANDRA-10234)
  Merged from 2.0:
+  * Fix rare race where older gossip states can be shadowed (CASSANDRA-10366)
   * Fix consolidating racks violating the RF contract (CASSANDRA-10238)
   * Disallow decommission when node is in drained state (CASSANDRA-8741)
  

http://git-wip-us.apache.org/repos/asf/cassandra/blob/6dcc89f8/src/java/org/apache/cassandra/gms/Gossiper.java
----------------------------------------------------------------------
diff --cc src/java/org/apache/cassandra/gms/Gossiper.java
index e61a35a,808972a..b6d1afc
--- a/src/java/org/apache/cassandra/gms/Gossiper.java
+++ b/src/java/org/apache/cassandra/gms/Gossiper.java
@@@ -1143,8 -1149,7 +1143,7 @@@ public class Gossiper implements IFailu
  
          localState.setHeartBeatState(remoteState.getHeartBeatState());
          if (logger.isTraceEnabled())
 -            logger.trace("Updating heartbeat state version to " + localState.getHeartBeatState().getHeartBeatVersion() + " from " + oldVersion + " for " + addr + " ...");
 +            logger.trace("Updating heartbeat state version to {} from {} for {} ...", localState.getHeartBeatState().getHeartBeatVersion(), oldVersion, addr);
- 
          // we need to make two loops here, one to apply, then another to notify, this way all states in an update are present and current when the notifications are received
          for (Entry<ApplicationState, VersionedValue> remoteEntry : remoteState.getApplicationStateMap().entrySet())
          {
@@@ -1387,11 -1392,12 +1386,12 @@@
          endpointStateMap.put(ep, epState);
          unreachableEndpoints.put(ep, System.nanoTime());
          if (logger.isTraceEnabled())
 -            logger.trace("Adding saved endpoint " + ep + " " + epState.getHeartBeatState().getGeneration());
 +            logger.trace("Adding saved endpoint {} {}", ep, epState.getHeartBeatState().getGeneration());
      }
  
-     public void addLocalApplicationState(ApplicationState state, VersionedValue value)
+     private void addLocalApplicationStateInternal(ApplicationState state, VersionedValue value)
      {
+         assert taskLock.isHeldByCurrentThread();
          EndpointState epState = endpointStateMap.get(FBUtilities.getBroadcastAddress());
          InetAddress epAddr = FBUtilities.getBroadcastAddress();
          assert epState != null;


[06/17] cassandra git commit: Fix rare race where older gossip states can be shadowed

Posted by br...@apache.org.
Fix rare race where older gossip states can be shadowed

Patch by brandonwilliams, reviewed by Richard Low for CASSANDRA-10366


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

Branch: refs/heads/cassandra-2.0
Commit: 6f8e07ab06c071cabc20c5cde06122ebf5a5aa78
Parents: 718e47f
Author: Brandon Williams <br...@apache.org>
Authored: Thu Sep 17 14:58:33 2015 -0500
Committer: Brandon Williams <br...@apache.org>
Committed: Thu Sep 17 14:58:33 2015 -0500

----------------------------------------------------------------------
 CHANGES.txt                                     |  1 +
 src/java/org/apache/cassandra/gms/Gossiper.java | 11 ++++++++---
 2 files changed, 9 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/6f8e07ab/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index 3c47427..658c19f 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,4 +1,5 @@
 2.0.17
+ * Fix rare race where older gossip states can be shadowed (CASSANDRA-10366)
  * Fix consolidating racks violating the RF contract (CASSANDRA-10238)
  * Disallow decommission when node is in drained state (CASSANDRA-8741)
  * Backport CASSANDRA-8013 to 2.0 (CASSANDRA-10144)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/6f8e07ab/src/java/org/apache/cassandra/gms/Gossiper.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/gms/Gossiper.java b/src/java/org/apache/cassandra/gms/Gossiper.java
index 8c36223..44e464a 100644
--- a/src/java/org/apache/cassandra/gms/Gossiper.java
+++ b/src/java/org/apache/cassandra/gms/Gossiper.java
@@ -1139,7 +1139,6 @@ public class Gossiper implements IFailureDetectionEventListener, GossiperMBean
         localState.setHeartBeatState(remoteState.getHeartBeatState());
         if (logger.isTraceEnabled())
             logger.trace("Updating heartbeat state version to " + localState.getHeartBeatState().getHeartBeatVersion() + " from " + oldVersion + " for " + addr + " ...");
-
         // we need to make two loops here, one to apply, then another to notify, this way all states in an update are present and current when the notifications are received
         for (Entry<ApplicationState, VersionedValue> remoteEntry : remoteState.getApplicationStateMap().entrySet())
         {
@@ -1385,8 +1384,9 @@ public class Gossiper implements IFailureDetectionEventListener, GossiperMBean
             logger.trace("Adding saved endpoint " + ep + " " + epState.getHeartBeatState().getGeneration());
     }
 
-    public void addLocalApplicationState(ApplicationState state, VersionedValue value)
+    private void addLocalApplicationStateInternal(ApplicationState state, VersionedValue value)
     {
+        assert taskLock.isHeldByCurrentThread();
         EndpointState epState = endpointStateMap.get(FBUtilities.getBroadcastAddress());
         InetAddress epAddr = FBUtilities.getBroadcastAddress();
         assert epState != null;
@@ -1401,6 +1401,11 @@ public class Gossiper implements IFailureDetectionEventListener, GossiperMBean
         doOnChangeNotifications(epAddr, state, value);
     }
 
+    public void addLocalApplicationState(ApplicationState applicationState, VersionedValue value)
+    {
+        addLocalApplicationStates(Arrays.asList(Pair.create(applicationState, value)));
+    }
+
     public void addLocalApplicationStates(List<Pair<ApplicationState, VersionedValue>> states)
     {
         taskLock.lock();
@@ -1408,7 +1413,7 @@ public class Gossiper implements IFailureDetectionEventListener, GossiperMBean
         {
             for (Pair<ApplicationState, VersionedValue> pair : states)
             {
-               addLocalApplicationState(pair.left, pair.right);
+               addLocalApplicationStateInternal(pair.left, pair.right);
             }
         }
         finally


[02/17] cassandra git commit: Fix IndexOutOfBoundsException when using empty BATCH statements

Posted by br...@apache.org.
Fix IndexOutOfBoundsException when using empty BATCH statements

patch by Vovodroid; reviewed by Benjamin Lerer for CASSANDRA-10277


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

Branch: refs/heads/trunk
Commit: 1a2a1d2c24b777d4c9ea9106e0e7199c7b91fa29
Parents: b62fde1
Author: Vovodroid <vo...@gmail.com>
Authored: Thu Sep 17 20:57:51 2015 +0200
Committer: blerer <be...@datastax.com>
Committed: Thu Sep 17 20:57:51 2015 +0200

----------------------------------------------------------------------
 .../org/apache/cassandra/cql3/statements/BatchStatement.java   | 2 +-
 .../apache/cassandra/cql3/validation/operations/BatchTest.java | 6 ++++++
 2 files changed, 7 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/1a2a1d2c/src/java/org/apache/cassandra/cql3/statements/BatchStatement.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/cql3/statements/BatchStatement.java b/src/java/org/apache/cassandra/cql3/statements/BatchStatement.java
index 0661b56..46dfda5 100644
--- a/src/java/org/apache/cassandra/cql3/statements/BatchStatement.java
+++ b/src/java/org/apache/cassandra/cql3/statements/BatchStatement.java
@@ -510,7 +510,7 @@ public class BatchStatement implements CQLStatement
 
             // Use the CFMetadata of the first statement for partition key bind indexes.  If the statements affect
             // multiple tables, we won't send partition key bind indexes.
-            Short[] partitionKeyBindIndexes = haveMultipleCFs ? null
+            Short[] partitionKeyBindIndexes = (haveMultipleCFs || batchStatement.statements.isEmpty())? null
                                                               : boundNames.getPartitionKeyBindIndexes(batchStatement.statements.get(0).cfm);
 
             return new ParsedStatement.Prepared(batchStatement, boundNames, partitionKeyBindIndexes);

http://git-wip-us.apache.org/repos/asf/cassandra/blob/1a2a1d2c/test/unit/org/apache/cassandra/cql3/validation/operations/BatchTest.java
----------------------------------------------------------------------
diff --git a/test/unit/org/apache/cassandra/cql3/validation/operations/BatchTest.java b/test/unit/org/apache/cassandra/cql3/validation/operations/BatchTest.java
index 1447845..07117fd 100644
--- a/test/unit/org/apache/cassandra/cql3/validation/operations/BatchTest.java
+++ b/test/unit/org/apache/cassandra/cql3/validation/operations/BatchTest.java
@@ -103,4 +103,10 @@ public class BatchTest extends CQLTester
                    row(111, "batchtext", null)
         );
     }
+
+    @Test
+    public void testBatchEmpty() throws Throwable
+    {
+        execute("BEGIN BATCH APPLY BATCH;");
+    }
 }


[03/17] cassandra git commit: Preserve the names of query parameters in QueryOptions

Posted by br...@apache.org.
Preserve the names of query parameters in QueryOptions

patch by Benjamin Lerer; reviewed by Sam Tunnicliffe for CASSANDRA-9632


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

Branch: refs/heads/cassandra-3.0
Commit: 416ba6e8b2729c671d66be43cbcbc7c76d1c8a91
Parents: 1a2a1d2
Author: blerer <be...@datastax.com>
Authored: Thu Sep 17 21:06:21 2015 +0200
Committer: blerer <be...@datastax.com>
Committed: Thu Sep 17 21:06:21 2015 +0200

----------------------------------------------------------------------
 NEWS.txt                                        |  6 ++
 .../cassandra/cql3/BatchQueryOptions.java       | 28 ++++++++
 .../cassandra/cql3/ColumnSpecification.java     | 10 +++
 .../org/apache/cassandra/cql3/QueryOptions.java | 70 +++++++++++++++++++-
 .../transport/messages/BatchMessage.java        |  2 +-
 .../transport/messages/ExecuteMessage.java      |  5 +-
 6 files changed, 117 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/416ba6e8/NEWS.txt
----------------------------------------------------------------------
diff --git a/NEWS.txt b/NEWS.txt
index 198e8e9..49744cf 100644
--- a/NEWS.txt
+++ b/NEWS.txt
@@ -33,6 +33,12 @@ Changed Defaults
    - Parallel repairs are the default since 2.2.0, run sequential repairs
      by providing the '-seq' parameter to nodetool repair.
 
+New features
+------------
+   - Custom QueryHandlers can retrieve the column specifications for the bound
+     variables from QueryOptions by using the hasColumnSpecifications()
+     and getColumnSpecifications() methods.
+
 
 2.2.1
 =====

http://git-wip-us.apache.org/repos/asf/cassandra/blob/416ba6e8/src/java/org/apache/cassandra/cql3/BatchQueryOptions.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/cql3/BatchQueryOptions.java b/src/java/org/apache/cassandra/cql3/BatchQueryOptions.java
index 2fcee5b..db7fa39 100644
--- a/src/java/org/apache/cassandra/cql3/BatchQueryOptions.java
+++ b/src/java/org/apache/cassandra/cql3/BatchQueryOptions.java
@@ -22,6 +22,8 @@ import java.util.ArrayList;
 import java.util.Collections;
 import java.util.List;
 
+import org.apache.cassandra.utils.MD5Digest;
+
 import org.apache.cassandra.db.ConsistencyLevel;
 import org.apache.cassandra.service.QueryState;
 
@@ -50,6 +52,11 @@ public abstract class BatchQueryOptions
 
     public abstract QueryOptions forStatement(int i);
 
+    public void prepareStatement(int i, List<ColumnSpecification> boundNames)
+    {
+        forStatement(i).prepare(boundNames);
+    }
+
     public ConsistencyLevel getConsistency()
     {
         return wrapped.getConsistency();
@@ -107,5 +114,26 @@ public abstract class BatchQueryOptions
         {
             return perStatementOptions.get(i);
         }
+
+        @Override
+        public void prepareStatement(int i, List<ColumnSpecification> boundNames)
+        {
+            if (isPreparedStatement(i))
+            {
+                QueryOptions options = perStatementOptions.get(i);
+                options.prepare(boundNames);
+                options = QueryOptions.addColumnSpecifications(options, boundNames);
+                perStatementOptions.set(i, options);
+            }
+            else
+            {
+                super.prepareStatement(i, boundNames);
+            }
+        }
+
+        private boolean isPreparedStatement(int i)
+        {
+            return getQueryOrIdList().get(i) instanceof MD5Digest;
+        }
     }
 }

http://git-wip-us.apache.org/repos/asf/cassandra/blob/416ba6e8/src/java/org/apache/cassandra/cql3/ColumnSpecification.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/cql3/ColumnSpecification.java b/src/java/org/apache/cassandra/cql3/ColumnSpecification.java
index e12a57e..e64f5f9 100644
--- a/src/java/org/apache/cassandra/cql3/ColumnSpecification.java
+++ b/src/java/org/apache/cassandra/cql3/ColumnSpecification.java
@@ -18,6 +18,7 @@
 package org.apache.cassandra.cql3;
 
 import com.google.common.base.Objects;
+
 import org.apache.cassandra.db.marshal.AbstractType;
 import org.apache.cassandra.db.marshal.ReversedType;
 
@@ -91,4 +92,13 @@ public class ColumnSpecification
     {
         return Objects.hashCode(ksName, cfName, name, type);
     }
+
+    @Override
+    public String toString()
+    {
+        return Objects.toStringHelper(this)
+                      .add("name", name)
+                      .add("type", type)
+                      .toString();
+    }
 }

http://git-wip-us.apache.org/repos/asf/cassandra/blob/416ba6e8/src/java/org/apache/cassandra/cql3/QueryOptions.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/cql3/QueryOptions.java b/src/java/org/apache/cassandra/cql3/QueryOptions.java
index fb46b9b..7fc0997 100644
--- a/src/java/org/apache/cassandra/cql3/QueryOptions.java
+++ b/src/java/org/apache/cassandra/cql3/QueryOptions.java
@@ -23,8 +23,9 @@ import java.util.Collections;
 import java.util.EnumSet;
 import java.util.List;
 
-import io.netty.buffer.ByteBuf;
+import com.google.common.collect.ImmutableList;
 
+import io.netty.buffer.ByteBuf;
 import org.apache.cassandra.db.ConsistencyLevel;
 import org.apache.cassandra.service.QueryState;
 import org.apache.cassandra.service.pager.PagingState;
@@ -82,10 +83,43 @@ public abstract class QueryOptions
         return new DefaultQueryOptions(consistency, values, skipMetadata, new SpecificOptions(pageSize, pagingState, serialConsistency, -1L), 0);
     }
 
+    public static QueryOptions addColumnSpecifications(QueryOptions options, List<ColumnSpecification> columnSpecs)
+    {
+        return new OptionsWithColumnSpecifications(options, columnSpecs);
+    }
+
     public abstract ConsistencyLevel getConsistency();
     public abstract List<ByteBuffer> getValues();
     public abstract boolean skipMetadata();
 
+    /**
+     * Tells whether or not this <code>QueryOptions</code> contains the column specifications for the bound variables.
+     * <p>The column specifications will be present only for prepared statements.</p>
+     * @return <code>true</code> this <code>QueryOptions</code> contains the column specifications for the bound
+     * variables, <code>false</code> otherwise.
+     */
+    public boolean hasColumnSpecifications()
+    {
+        return false;
+    }
+
+    /**
+     * Returns the column specifications for the bound variables (<i>optional operation</i>).
+     *
+     * <p>The column specifications will be present only for prepared statements.</p>
+     *
+     * <p>Invoke the {@link hasColumnSpecifications} method before invoking this method in order to ensure that this
+     * <code>QueryOptions</code> contains the column specifications.</p>
+     *
+     * @return the option names
+     * @throws UnsupportedOperationException If this <code>QueryOptions</code> does not contains the column
+     * specifications.
+     */
+    public ImmutableList<ColumnSpecification> getColumnSpecifications()
+    {
+        throw new UnsupportedOperationException();
+    }
+
     /**  The pageSize for this query. Will be <= 0 if not relevant for the query.  */
     public int getPageSize()
     {
@@ -169,7 +203,7 @@ public abstract class QueryOptions
         }
     }
 
-    static abstract class QueryOptionsWrapper extends QueryOptions
+    static class QueryOptionsWrapper extends QueryOptions
     {
         protected final QueryOptions wrapped;
 
@@ -178,6 +212,11 @@ public abstract class QueryOptions
             this.wrapped = wrapped;
         }
 
+        public List<ByteBuffer> getValues()
+        {
+            return this.wrapped.getValues();
+        }
+
         public ConsistencyLevel getConsistency()
         {
             return wrapped.getConsistency();
@@ -206,6 +245,32 @@ public abstract class QueryOptions
         }
     }
 
+    /**
+     * <code>QueryOptions</code> decorator that provides access to the column specifications.
+     */
+    static class OptionsWithColumnSpecifications extends QueryOptionsWrapper
+    {
+        private final ImmutableList<ColumnSpecification> columnSpecs;
+
+        OptionsWithColumnSpecifications(QueryOptions wrapped, List<ColumnSpecification> columnSpecs)
+        {
+            super(wrapped);
+            this.columnSpecs = ImmutableList.copyOf(columnSpecs);
+        }
+
+        @Override
+        public boolean hasColumnSpecifications()
+        {
+            return true;
+        }
+
+        @Override
+        public ImmutableList<ColumnSpecification> getColumnSpecifications()
+        {
+            return columnSpecs;
+        }
+    }
+
     static class OptionsWithNames extends QueryOptionsWrapper
     {
         private final List<String> names;
@@ -238,6 +303,7 @@ public abstract class QueryOptions
             return this;
         }
 
+        @Override
         public List<ByteBuffer> getValues()
         {
             assert orderedValues != null; // We should have called prepare first!

http://git-wip-us.apache.org/repos/asf/cassandra/blob/416ba6e8/src/java/org/apache/cassandra/transport/messages/BatchMessage.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/transport/messages/BatchMessage.java b/src/java/org/apache/cassandra/transport/messages/BatchMessage.java
index 2db380b..d86bb1a 100644
--- a/src/java/org/apache/cassandra/transport/messages/BatchMessage.java
+++ b/src/java/org/apache/cassandra/transport/messages/BatchMessage.java
@@ -208,7 +208,7 @@ public class BatchMessage extends Message.Request
             for (int i = 0; i < prepared.size(); i++)
             {
                 ParsedStatement.Prepared p = prepared.get(i);
-                batchOptions.forStatement(i).prepare(p.boundNames);
+                batchOptions.prepareStatement(i, p.boundNames);
 
                 if (!(p.statement instanceof ModificationStatement))
                     throw new InvalidRequestException("Invalid statement in batch: only UPDATE, INSERT and DELETE statements are allowed.");

http://git-wip-us.apache.org/repos/asf/cassandra/blob/416ba6e8/src/java/org/apache/cassandra/transport/messages/ExecuteMessage.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/transport/messages/ExecuteMessage.java b/src/java/org/apache/cassandra/transport/messages/ExecuteMessage.java
index 718595c..11a227c 100644
--- a/src/java/org/apache/cassandra/transport/messages/ExecuteMessage.java
+++ b/src/java/org/apache/cassandra/transport/messages/ExecuteMessage.java
@@ -136,7 +136,10 @@ public class ExecuteMessage extends Message.Request
                 Tracing.instance.begin("Execute CQL3 prepared query", state.getClientAddress(), builder.build());
             }
 
-            Message.Response response = handler.processPrepared(statement, state, options, getCustomPayload());
+            // Some custom QueryHandlers are interested by the bound names. We provide them this information
+            // by wrapping the QueryOptions.
+            QueryOptions queryOptions = QueryOptions.addColumnSpecifications(options, prepared.boundNames);
+            Message.Response response = handler.processPrepared(statement, state, queryOptions, getCustomPayload());
             if (options.skipMetadata() && response instanceof ResultMessage.Rows)
                 ((ResultMessage.Rows)response).result.metadata.setSkipMetadata();
 


[10/17] cassandra git commit: Merge branch 'cassandra-2.0' into cassandra-2.1

Posted by br...@apache.org.
Merge branch 'cassandra-2.0' into cassandra-2.1

Conflicts:
	CHANGES.txt


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

Branch: refs/heads/trunk
Commit: a5e282bff22ab81c8898161c8508215f2d766aff
Parents: ba5837e 6f8e07a
Author: Brandon Williams <br...@apache.org>
Authored: Thu Sep 17 15:02:23 2015 -0500
Committer: Brandon Williams <br...@apache.org>
Committed: Thu Sep 17 15:02:23 2015 -0500

----------------------------------------------------------------------
 CHANGES.txt                                     |  1 +
 src/java/org/apache/cassandra/gms/Gossiper.java | 11 ++++++++---
 2 files changed, 9 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/a5e282bf/CHANGES.txt
----------------------------------------------------------------------
diff --cc CHANGES.txt
index 207f16a,658c19f..5af30a5
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@@ -1,49 -1,8 +1,50 @@@
 -2.0.17
 +2.1.10
 + * Fix cache handling of 2i and base tables (CASSANDRA-10155)
 + * Fix NPE in nodetool compactionhistory (CASSANDRA-9758)
 + * (Pig) support BulkOutputFormat as a URL parameter (CASSANDRA-7410)
 + * BATCH statement is broken in cqlsh (CASSANDRA-10272)
 + * Added configurable warning threshold for GC duration (CASSANDRA-8907)
 + * (cqlsh) Make cqlsh PEP8 compliant (CASSANDRA-10066)
 + * (cqlsh) Fix error when starting cqlsh with --debug (CASSANDRA-10282)
 + * Scrub, Cleanup and Upgrade do not unmark compacting until all operations
 +   have completed, regardless of the occurence of exceptions (CASSANDRA-10274)
 + * Fix handling of streaming EOF (CASSANDRA-10206)
 + * Only check KeyCache when it is enabled
 + * Change streaming_socket_timeout_in_ms default to 1 hour (CASSANDRA-8611)
 + * (cqlsh) update list of CQL keywords (CASSANDRA-9232)
 +Merged from 2.0:
+  * Fix rare race where older gossip states can be shadowed (CASSANDRA-10366)
   * Fix consolidating racks violating the RF contract (CASSANDRA-10238)
   * Disallow decommission when node is in drained state (CASSANDRA-8741)
 - * Backport CASSANDRA-8013 to 2.0 (CASSANDRA-10144)
 +
 +
 +2.1.9
 + * Avoid race condition during read repair (CASSANDRA-9460)
 + * (cqlsh) default load-from-file encoding to utf-8 (CASSANDRA-9898)
 + * Avoid returning Permission.NONE when failing to query users table (CASSANDRA-10168)
 + * (cqlsh) Allow encoding to be set through command line (CASSANDRA-10004)
 + * Add new JMX methods to change local compaction strategy (CASSANDRA-9965)
 + * Write hints for paxos commits (CASSANDRA-7342)
 + * (cqlsh) Fix timestamps before 1970 on Windows, always
 +   use UTC for timestamp display (CASSANDRA-10000)
 + * (cqlsh) Avoid overwriting new config file with old config
 +   when both exist (CASSANDRA-9777)
 + * Release snapshot selfRef when doing snapshot repair (CASSANDRA-9998)
 + * Cannot replace token does not exist - DN node removed as Fat Client (CASSANDRA-9871)
 + * Fix handling of enable/disable autocompaction (CASSANDRA-9899)
 + * Commit log segment recycling is disabled by default (CASSANDRA-9896)
 + * Add consistency level to tracing ouput (CASSANDRA-9827)
 + * Fix MarshalException when upgrading superColumn family (CASSANDRA-9582)
 + * Fix broken logging for "empty" flushes in Memtable (CASSANDRA-9837)
 + * Handle corrupt files on startup (CASSANDRA-9686)
 + * Fix clientutil jar and tests (CASSANDRA-9760)
 + * (cqlsh) Allow the SSL protocol version to be specified through the
 +   config file or environment variables (CASSANDRA-9544)
 + * Remove repair snapshot leftover on startup (CASSANDRA-7357)
 + * Use random nodes for batch log when only 2 racks (CASSANDRA-8735)
 + * Ensure atomicity inside thrift and stream session (CASSANDRA-7757)
 + * Fix nodetool info error when the node is not joined (CASSANDRA-9031)
 +Merged from 2.0:
   * Make getFullyExpiredSSTables less expensive (CASSANDRA-9882)
   * Add tool to find why expired sstables are not getting dropped (CASSANDRA-10015)
   * Remove erroneous pending HH tasks from tpstats/jmx (CASSANDRA-9129)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/a5e282bf/src/java/org/apache/cassandra/gms/Gossiper.java
----------------------------------------------------------------------


[17/17] cassandra git commit: Merge branch 'cassandra-3.0' into trunk

Posted by br...@apache.org.
Merge branch 'cassandra-3.0' into trunk


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

Branch: refs/heads/trunk
Commit: 44f1ee3c59100f016a1708ea5772a5acb53b01f8
Parents: d6d5698 41a4a53
Author: Brandon Williams <br...@apache.org>
Authored: Thu Sep 17 15:06:28 2015 -0500
Committer: Brandon Williams <br...@apache.org>
Committed: Thu Sep 17 15:06:28 2015 -0500

----------------------------------------------------------------------
 CHANGES.txt                                     |  1 +
 NEWS.txt                                        |  6 ++++++
 src/java/org/apache/cassandra/gms/Gossiper.java | 11 ++++++++---
 3 files changed, 15 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/44f1ee3c/CHANGES.txt
----------------------------------------------------------------------


[11/17] cassandra git commit: Merge branch 'cassandra-2.0' into cassandra-2.1

Posted by br...@apache.org.
Merge branch 'cassandra-2.0' into cassandra-2.1

Conflicts:
	CHANGES.txt


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

Branch: refs/heads/cassandra-3.0
Commit: a5e282bff22ab81c8898161c8508215f2d766aff
Parents: ba5837e 6f8e07a
Author: Brandon Williams <br...@apache.org>
Authored: Thu Sep 17 15:02:23 2015 -0500
Committer: Brandon Williams <br...@apache.org>
Committed: Thu Sep 17 15:02:23 2015 -0500

----------------------------------------------------------------------
 CHANGES.txt                                     |  1 +
 src/java/org/apache/cassandra/gms/Gossiper.java | 11 ++++++++---
 2 files changed, 9 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/a5e282bf/CHANGES.txt
----------------------------------------------------------------------
diff --cc CHANGES.txt
index 207f16a,658c19f..5af30a5
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@@ -1,49 -1,8 +1,50 @@@
 -2.0.17
 +2.1.10
 + * Fix cache handling of 2i and base tables (CASSANDRA-10155)
 + * Fix NPE in nodetool compactionhistory (CASSANDRA-9758)
 + * (Pig) support BulkOutputFormat as a URL parameter (CASSANDRA-7410)
 + * BATCH statement is broken in cqlsh (CASSANDRA-10272)
 + * Added configurable warning threshold for GC duration (CASSANDRA-8907)
 + * (cqlsh) Make cqlsh PEP8 compliant (CASSANDRA-10066)
 + * (cqlsh) Fix error when starting cqlsh with --debug (CASSANDRA-10282)
 + * Scrub, Cleanup and Upgrade do not unmark compacting until all operations
 +   have completed, regardless of the occurence of exceptions (CASSANDRA-10274)
 + * Fix handling of streaming EOF (CASSANDRA-10206)
 + * Only check KeyCache when it is enabled
 + * Change streaming_socket_timeout_in_ms default to 1 hour (CASSANDRA-8611)
 + * (cqlsh) update list of CQL keywords (CASSANDRA-9232)
 +Merged from 2.0:
+  * Fix rare race where older gossip states can be shadowed (CASSANDRA-10366)
   * Fix consolidating racks violating the RF contract (CASSANDRA-10238)
   * Disallow decommission when node is in drained state (CASSANDRA-8741)
 - * Backport CASSANDRA-8013 to 2.0 (CASSANDRA-10144)
 +
 +
 +2.1.9
 + * Avoid race condition during read repair (CASSANDRA-9460)
 + * (cqlsh) default load-from-file encoding to utf-8 (CASSANDRA-9898)
 + * Avoid returning Permission.NONE when failing to query users table (CASSANDRA-10168)
 + * (cqlsh) Allow encoding to be set through command line (CASSANDRA-10004)
 + * Add new JMX methods to change local compaction strategy (CASSANDRA-9965)
 + * Write hints for paxos commits (CASSANDRA-7342)
 + * (cqlsh) Fix timestamps before 1970 on Windows, always
 +   use UTC for timestamp display (CASSANDRA-10000)
 + * (cqlsh) Avoid overwriting new config file with old config
 +   when both exist (CASSANDRA-9777)
 + * Release snapshot selfRef when doing snapshot repair (CASSANDRA-9998)
 + * Cannot replace token does not exist - DN node removed as Fat Client (CASSANDRA-9871)
 + * Fix handling of enable/disable autocompaction (CASSANDRA-9899)
 + * Commit log segment recycling is disabled by default (CASSANDRA-9896)
 + * Add consistency level to tracing ouput (CASSANDRA-9827)
 + * Fix MarshalException when upgrading superColumn family (CASSANDRA-9582)
 + * Fix broken logging for "empty" flushes in Memtable (CASSANDRA-9837)
 + * Handle corrupt files on startup (CASSANDRA-9686)
 + * Fix clientutil jar and tests (CASSANDRA-9760)
 + * (cqlsh) Allow the SSL protocol version to be specified through the
 +   config file or environment variables (CASSANDRA-9544)
 + * Remove repair snapshot leftover on startup (CASSANDRA-7357)
 + * Use random nodes for batch log when only 2 racks (CASSANDRA-8735)
 + * Ensure atomicity inside thrift and stream session (CASSANDRA-7757)
 + * Fix nodetool info error when the node is not joined (CASSANDRA-9031)
 +Merged from 2.0:
   * Make getFullyExpiredSSTables less expensive (CASSANDRA-9882)
   * Add tool to find why expired sstables are not getting dropped (CASSANDRA-10015)
   * Remove erroneous pending HH tasks from tpstats/jmx (CASSANDRA-9129)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/a5e282bf/src/java/org/apache/cassandra/gms/Gossiper.java
----------------------------------------------------------------------


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

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

Conflicts:
	test/unit/org/apache/cassandra/cql3/validation/operations/BatchTest.java


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

Branch: refs/heads/cassandra-3.0
Commit: 41a4a538be25348434fe29a12c130ba8acd0cb5c
Parents: caadcf6 6dcc89f
Author: Brandon Williams <br...@apache.org>
Authored: Thu Sep 17 15:06:18 2015 -0500
Committer: Brandon Williams <br...@apache.org>
Committed: Thu Sep 17 15:06:18 2015 -0500

----------------------------------------------------------------------
 CHANGES.txt                                     |  1 +
 NEWS.txt                                        |  6 ++++++
 src/java/org/apache/cassandra/gms/Gossiper.java | 11 ++++++++---
 3 files changed, 15 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/41a4a538/CHANGES.txt
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/cassandra/blob/41a4a538/NEWS.txt
----------------------------------------------------------------------
diff --cc NEWS.txt
index b6730a1,49744cf..61989f4
--- a/NEWS.txt
+++ b/NEWS.txt
@@@ -117,12 -28,16 +117,18 @@@ Changed Default
     - commitlog_total_space_in_mb will use the smaller of 8192, and 1/4
       of the total space of the commitlog volume. (Before: always used
       8192)
 -   - Incremental repair is on by default since 2.2.0, run full repairs by
 -     providing the '-full' parameter to nodetool repair.
 -   - Parallel repairs are the default since 2.2.0, run sequential repairs
 -     by providing the '-seq' parameter to nodetool repair.
 +
 +New features
 +------------
 +   - Custom QueryHandlers can retrieve the column specifications for the bound
 +     variables from QueryOptions by using the hasColumnSpecifications()
 +     and getColumnSpecifications() methods.
+ 
+ New features
+ ------------
+    - Custom QueryHandlers can retrieve the column specifications for the bound
+      variables from QueryOptions by using the hasColumnSpecifications()
+      and getColumnSpecifications() methods.
  
  
  2.2.1

http://git-wip-us.apache.org/repos/asf/cassandra/blob/41a4a538/src/java/org/apache/cassandra/gms/Gossiper.java
----------------------------------------------------------------------


[04/17] cassandra git commit: Preserve the names of query parameters in QueryOptions

Posted by br...@apache.org.
Preserve the names of query parameters in QueryOptions

patch by Benjamin Lerer; reviewed by Sam Tunnicliffe for CASSANDRA-9632


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

Branch: refs/heads/trunk
Commit: 416ba6e8b2729c671d66be43cbcbc7c76d1c8a91
Parents: 1a2a1d2
Author: blerer <be...@datastax.com>
Authored: Thu Sep 17 21:06:21 2015 +0200
Committer: blerer <be...@datastax.com>
Committed: Thu Sep 17 21:06:21 2015 +0200

----------------------------------------------------------------------
 NEWS.txt                                        |  6 ++
 .../cassandra/cql3/BatchQueryOptions.java       | 28 ++++++++
 .../cassandra/cql3/ColumnSpecification.java     | 10 +++
 .../org/apache/cassandra/cql3/QueryOptions.java | 70 +++++++++++++++++++-
 .../transport/messages/BatchMessage.java        |  2 +-
 .../transport/messages/ExecuteMessage.java      |  5 +-
 6 files changed, 117 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/416ba6e8/NEWS.txt
----------------------------------------------------------------------
diff --git a/NEWS.txt b/NEWS.txt
index 198e8e9..49744cf 100644
--- a/NEWS.txt
+++ b/NEWS.txt
@@ -33,6 +33,12 @@ Changed Defaults
    - Parallel repairs are the default since 2.2.0, run sequential repairs
      by providing the '-seq' parameter to nodetool repair.
 
+New features
+------------
+   - Custom QueryHandlers can retrieve the column specifications for the bound
+     variables from QueryOptions by using the hasColumnSpecifications()
+     and getColumnSpecifications() methods.
+
 
 2.2.1
 =====

http://git-wip-us.apache.org/repos/asf/cassandra/blob/416ba6e8/src/java/org/apache/cassandra/cql3/BatchQueryOptions.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/cql3/BatchQueryOptions.java b/src/java/org/apache/cassandra/cql3/BatchQueryOptions.java
index 2fcee5b..db7fa39 100644
--- a/src/java/org/apache/cassandra/cql3/BatchQueryOptions.java
+++ b/src/java/org/apache/cassandra/cql3/BatchQueryOptions.java
@@ -22,6 +22,8 @@ import java.util.ArrayList;
 import java.util.Collections;
 import java.util.List;
 
+import org.apache.cassandra.utils.MD5Digest;
+
 import org.apache.cassandra.db.ConsistencyLevel;
 import org.apache.cassandra.service.QueryState;
 
@@ -50,6 +52,11 @@ public abstract class BatchQueryOptions
 
     public abstract QueryOptions forStatement(int i);
 
+    public void prepareStatement(int i, List<ColumnSpecification> boundNames)
+    {
+        forStatement(i).prepare(boundNames);
+    }
+
     public ConsistencyLevel getConsistency()
     {
         return wrapped.getConsistency();
@@ -107,5 +114,26 @@ public abstract class BatchQueryOptions
         {
             return perStatementOptions.get(i);
         }
+
+        @Override
+        public void prepareStatement(int i, List<ColumnSpecification> boundNames)
+        {
+            if (isPreparedStatement(i))
+            {
+                QueryOptions options = perStatementOptions.get(i);
+                options.prepare(boundNames);
+                options = QueryOptions.addColumnSpecifications(options, boundNames);
+                perStatementOptions.set(i, options);
+            }
+            else
+            {
+                super.prepareStatement(i, boundNames);
+            }
+        }
+
+        private boolean isPreparedStatement(int i)
+        {
+            return getQueryOrIdList().get(i) instanceof MD5Digest;
+        }
     }
 }

http://git-wip-us.apache.org/repos/asf/cassandra/blob/416ba6e8/src/java/org/apache/cassandra/cql3/ColumnSpecification.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/cql3/ColumnSpecification.java b/src/java/org/apache/cassandra/cql3/ColumnSpecification.java
index e12a57e..e64f5f9 100644
--- a/src/java/org/apache/cassandra/cql3/ColumnSpecification.java
+++ b/src/java/org/apache/cassandra/cql3/ColumnSpecification.java
@@ -18,6 +18,7 @@
 package org.apache.cassandra.cql3;
 
 import com.google.common.base.Objects;
+
 import org.apache.cassandra.db.marshal.AbstractType;
 import org.apache.cassandra.db.marshal.ReversedType;
 
@@ -91,4 +92,13 @@ public class ColumnSpecification
     {
         return Objects.hashCode(ksName, cfName, name, type);
     }
+
+    @Override
+    public String toString()
+    {
+        return Objects.toStringHelper(this)
+                      .add("name", name)
+                      .add("type", type)
+                      .toString();
+    }
 }

http://git-wip-us.apache.org/repos/asf/cassandra/blob/416ba6e8/src/java/org/apache/cassandra/cql3/QueryOptions.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/cql3/QueryOptions.java b/src/java/org/apache/cassandra/cql3/QueryOptions.java
index fb46b9b..7fc0997 100644
--- a/src/java/org/apache/cassandra/cql3/QueryOptions.java
+++ b/src/java/org/apache/cassandra/cql3/QueryOptions.java
@@ -23,8 +23,9 @@ import java.util.Collections;
 import java.util.EnumSet;
 import java.util.List;
 
-import io.netty.buffer.ByteBuf;
+import com.google.common.collect.ImmutableList;
 
+import io.netty.buffer.ByteBuf;
 import org.apache.cassandra.db.ConsistencyLevel;
 import org.apache.cassandra.service.QueryState;
 import org.apache.cassandra.service.pager.PagingState;
@@ -82,10 +83,43 @@ public abstract class QueryOptions
         return new DefaultQueryOptions(consistency, values, skipMetadata, new SpecificOptions(pageSize, pagingState, serialConsistency, -1L), 0);
     }
 
+    public static QueryOptions addColumnSpecifications(QueryOptions options, List<ColumnSpecification> columnSpecs)
+    {
+        return new OptionsWithColumnSpecifications(options, columnSpecs);
+    }
+
     public abstract ConsistencyLevel getConsistency();
     public abstract List<ByteBuffer> getValues();
     public abstract boolean skipMetadata();
 
+    /**
+     * Tells whether or not this <code>QueryOptions</code> contains the column specifications for the bound variables.
+     * <p>The column specifications will be present only for prepared statements.</p>
+     * @return <code>true</code> this <code>QueryOptions</code> contains the column specifications for the bound
+     * variables, <code>false</code> otherwise.
+     */
+    public boolean hasColumnSpecifications()
+    {
+        return false;
+    }
+
+    /**
+     * Returns the column specifications for the bound variables (<i>optional operation</i>).
+     *
+     * <p>The column specifications will be present only for prepared statements.</p>
+     *
+     * <p>Invoke the {@link hasColumnSpecifications} method before invoking this method in order to ensure that this
+     * <code>QueryOptions</code> contains the column specifications.</p>
+     *
+     * @return the option names
+     * @throws UnsupportedOperationException If this <code>QueryOptions</code> does not contains the column
+     * specifications.
+     */
+    public ImmutableList<ColumnSpecification> getColumnSpecifications()
+    {
+        throw new UnsupportedOperationException();
+    }
+
     /**  The pageSize for this query. Will be <= 0 if not relevant for the query.  */
     public int getPageSize()
     {
@@ -169,7 +203,7 @@ public abstract class QueryOptions
         }
     }
 
-    static abstract class QueryOptionsWrapper extends QueryOptions
+    static class QueryOptionsWrapper extends QueryOptions
     {
         protected final QueryOptions wrapped;
 
@@ -178,6 +212,11 @@ public abstract class QueryOptions
             this.wrapped = wrapped;
         }
 
+        public List<ByteBuffer> getValues()
+        {
+            return this.wrapped.getValues();
+        }
+
         public ConsistencyLevel getConsistency()
         {
             return wrapped.getConsistency();
@@ -206,6 +245,32 @@ public abstract class QueryOptions
         }
     }
 
+    /**
+     * <code>QueryOptions</code> decorator that provides access to the column specifications.
+     */
+    static class OptionsWithColumnSpecifications extends QueryOptionsWrapper
+    {
+        private final ImmutableList<ColumnSpecification> columnSpecs;
+
+        OptionsWithColumnSpecifications(QueryOptions wrapped, List<ColumnSpecification> columnSpecs)
+        {
+            super(wrapped);
+            this.columnSpecs = ImmutableList.copyOf(columnSpecs);
+        }
+
+        @Override
+        public boolean hasColumnSpecifications()
+        {
+            return true;
+        }
+
+        @Override
+        public ImmutableList<ColumnSpecification> getColumnSpecifications()
+        {
+            return columnSpecs;
+        }
+    }
+
     static class OptionsWithNames extends QueryOptionsWrapper
     {
         private final List<String> names;
@@ -238,6 +303,7 @@ public abstract class QueryOptions
             return this;
         }
 
+        @Override
         public List<ByteBuffer> getValues()
         {
             assert orderedValues != null; // We should have called prepare first!

http://git-wip-us.apache.org/repos/asf/cassandra/blob/416ba6e8/src/java/org/apache/cassandra/transport/messages/BatchMessage.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/transport/messages/BatchMessage.java b/src/java/org/apache/cassandra/transport/messages/BatchMessage.java
index 2db380b..d86bb1a 100644
--- a/src/java/org/apache/cassandra/transport/messages/BatchMessage.java
+++ b/src/java/org/apache/cassandra/transport/messages/BatchMessage.java
@@ -208,7 +208,7 @@ public class BatchMessage extends Message.Request
             for (int i = 0; i < prepared.size(); i++)
             {
                 ParsedStatement.Prepared p = prepared.get(i);
-                batchOptions.forStatement(i).prepare(p.boundNames);
+                batchOptions.prepareStatement(i, p.boundNames);
 
                 if (!(p.statement instanceof ModificationStatement))
                     throw new InvalidRequestException("Invalid statement in batch: only UPDATE, INSERT and DELETE statements are allowed.");

http://git-wip-us.apache.org/repos/asf/cassandra/blob/416ba6e8/src/java/org/apache/cassandra/transport/messages/ExecuteMessage.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/transport/messages/ExecuteMessage.java b/src/java/org/apache/cassandra/transport/messages/ExecuteMessage.java
index 718595c..11a227c 100644
--- a/src/java/org/apache/cassandra/transport/messages/ExecuteMessage.java
+++ b/src/java/org/apache/cassandra/transport/messages/ExecuteMessage.java
@@ -136,7 +136,10 @@ public class ExecuteMessage extends Message.Request
                 Tracing.instance.begin("Execute CQL3 prepared query", state.getClientAddress(), builder.build());
             }
 
-            Message.Response response = handler.processPrepared(statement, state, options, getCustomPayload());
+            // Some custom QueryHandlers are interested by the bound names. We provide them this information
+            // by wrapping the QueryOptions.
+            QueryOptions queryOptions = QueryOptions.addColumnSpecifications(options, prepared.boundNames);
+            Message.Response response = handler.processPrepared(statement, state, queryOptions, getCustomPayload());
             if (options.skipMetadata() && response instanceof ResultMessage.Rows)
                 ((ResultMessage.Rows)response).result.metadata.setSkipMetadata();
 


[12/17] cassandra git commit: Merge branch 'cassandra-2.1' into cassandra-2.2

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

Conflicts:
	src/java/org/apache/cassandra/gms/Gossiper.java


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

Branch: refs/heads/cassandra-3.0
Commit: 6dcc89f814b9e9511353eb46decb64db572106f4
Parents: 416ba6e a5e282b
Author: Brandon Williams <br...@apache.org>
Authored: Thu Sep 17 15:03:13 2015 -0500
Committer: Brandon Williams <br...@apache.org>
Committed: Thu Sep 17 15:03:13 2015 -0500

----------------------------------------------------------------------
 CHANGES.txt                                     |  1 +
 src/java/org/apache/cassandra/gms/Gossiper.java | 11 ++++++++---
 2 files changed, 9 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/6dcc89f8/CHANGES.txt
----------------------------------------------------------------------
diff --cc CHANGES.txt
index 96ec0fa,5af30a5..f9314f6
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@@ -22,8 -12,8 +22,9 @@@ Merged from 2.1
   * Only check KeyCache when it is enabled
   * Change streaming_socket_timeout_in_ms default to 1 hour (CASSANDRA-8611)
   * (cqlsh) update list of CQL keywords (CASSANDRA-9232)
 + * Add nodetool gettraceprobability command (CASSANDRA-10234)
  Merged from 2.0:
+  * Fix rare race where older gossip states can be shadowed (CASSANDRA-10366)
   * Fix consolidating racks violating the RF contract (CASSANDRA-10238)
   * Disallow decommission when node is in drained state (CASSANDRA-8741)
  

http://git-wip-us.apache.org/repos/asf/cassandra/blob/6dcc89f8/src/java/org/apache/cassandra/gms/Gossiper.java
----------------------------------------------------------------------
diff --cc src/java/org/apache/cassandra/gms/Gossiper.java
index e61a35a,808972a..b6d1afc
--- a/src/java/org/apache/cassandra/gms/Gossiper.java
+++ b/src/java/org/apache/cassandra/gms/Gossiper.java
@@@ -1143,8 -1149,7 +1143,7 @@@ public class Gossiper implements IFailu
  
          localState.setHeartBeatState(remoteState.getHeartBeatState());
          if (logger.isTraceEnabled())
 -            logger.trace("Updating heartbeat state version to " + localState.getHeartBeatState().getHeartBeatVersion() + " from " + oldVersion + " for " + addr + " ...");
 +            logger.trace("Updating heartbeat state version to {} from {} for {} ...", localState.getHeartBeatState().getHeartBeatVersion(), oldVersion, addr);
- 
          // we need to make two loops here, one to apply, then another to notify, this way all states in an update are present and current when the notifications are received
          for (Entry<ApplicationState, VersionedValue> remoteEntry : remoteState.getApplicationStateMap().entrySet())
          {
@@@ -1387,11 -1392,12 +1386,12 @@@
          endpointStateMap.put(ep, epState);
          unreachableEndpoints.put(ep, System.nanoTime());
          if (logger.isTraceEnabled())
 -            logger.trace("Adding saved endpoint " + ep + " " + epState.getHeartBeatState().getGeneration());
 +            logger.trace("Adding saved endpoint {} {}", ep, epState.getHeartBeatState().getGeneration());
      }
  
-     public void addLocalApplicationState(ApplicationState state, VersionedValue value)
+     private void addLocalApplicationStateInternal(ApplicationState state, VersionedValue value)
      {
+         assert taskLock.isHeldByCurrentThread();
          EndpointState epState = endpointStateMap.get(FBUtilities.getBroadcastAddress());
          InetAddress epAddr = FBUtilities.getBroadcastAddress();
          assert epState != null;


[08/17] cassandra git commit: Fix rare race where older gossip states can be shadowed

Posted by br...@apache.org.
Fix rare race where older gossip states can be shadowed

Patch by brandonwilliams, reviewed by Richard Low for CASSANDRA-10366


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

Branch: refs/heads/cassandra-2.2
Commit: 6f8e07ab06c071cabc20c5cde06122ebf5a5aa78
Parents: 718e47f
Author: Brandon Williams <br...@apache.org>
Authored: Thu Sep 17 14:58:33 2015 -0500
Committer: Brandon Williams <br...@apache.org>
Committed: Thu Sep 17 14:58:33 2015 -0500

----------------------------------------------------------------------
 CHANGES.txt                                     |  1 +
 src/java/org/apache/cassandra/gms/Gossiper.java | 11 ++++++++---
 2 files changed, 9 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/6f8e07ab/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index 3c47427..658c19f 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,4 +1,5 @@
 2.0.17
+ * Fix rare race where older gossip states can be shadowed (CASSANDRA-10366)
  * Fix consolidating racks violating the RF contract (CASSANDRA-10238)
  * Disallow decommission when node is in drained state (CASSANDRA-8741)
  * Backport CASSANDRA-8013 to 2.0 (CASSANDRA-10144)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/6f8e07ab/src/java/org/apache/cassandra/gms/Gossiper.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/gms/Gossiper.java b/src/java/org/apache/cassandra/gms/Gossiper.java
index 8c36223..44e464a 100644
--- a/src/java/org/apache/cassandra/gms/Gossiper.java
+++ b/src/java/org/apache/cassandra/gms/Gossiper.java
@@ -1139,7 +1139,6 @@ public class Gossiper implements IFailureDetectionEventListener, GossiperMBean
         localState.setHeartBeatState(remoteState.getHeartBeatState());
         if (logger.isTraceEnabled())
             logger.trace("Updating heartbeat state version to " + localState.getHeartBeatState().getHeartBeatVersion() + " from " + oldVersion + " for " + addr + " ...");
-
         // we need to make two loops here, one to apply, then another to notify, this way all states in an update are present and current when the notifications are received
         for (Entry<ApplicationState, VersionedValue> remoteEntry : remoteState.getApplicationStateMap().entrySet())
         {
@@ -1385,8 +1384,9 @@ public class Gossiper implements IFailureDetectionEventListener, GossiperMBean
             logger.trace("Adding saved endpoint " + ep + " " + epState.getHeartBeatState().getGeneration());
     }
 
-    public void addLocalApplicationState(ApplicationState state, VersionedValue value)
+    private void addLocalApplicationStateInternal(ApplicationState state, VersionedValue value)
     {
+        assert taskLock.isHeldByCurrentThread();
         EndpointState epState = endpointStateMap.get(FBUtilities.getBroadcastAddress());
         InetAddress epAddr = FBUtilities.getBroadcastAddress();
         assert epState != null;
@@ -1401,6 +1401,11 @@ public class Gossiper implements IFailureDetectionEventListener, GossiperMBean
         doOnChangeNotifications(epAddr, state, value);
     }
 
+    public void addLocalApplicationState(ApplicationState applicationState, VersionedValue value)
+    {
+        addLocalApplicationStates(Arrays.asList(Pair.create(applicationState, value)));
+    }
+
     public void addLocalApplicationStates(List<Pair<ApplicationState, VersionedValue>> states)
     {
         taskLock.lock();
@@ -1408,7 +1413,7 @@ public class Gossiper implements IFailureDetectionEventListener, GossiperMBean
         {
             for (Pair<ApplicationState, VersionedValue> pair : states)
             {
-               addLocalApplicationState(pair.left, pair.right);
+               addLocalApplicationStateInternal(pair.left, pair.right);
             }
         }
         finally


[05/17] cassandra git commit: Fix rare race where older gossip states can be shadowed

Posted by br...@apache.org.
Fix rare race where older gossip states can be shadowed

Patch by brandonwilliams, reviewed by Richard Low for CASSANDRA-10366


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

Branch: refs/heads/trunk
Commit: 6f8e07ab06c071cabc20c5cde06122ebf5a5aa78
Parents: 718e47f
Author: Brandon Williams <br...@apache.org>
Authored: Thu Sep 17 14:58:33 2015 -0500
Committer: Brandon Williams <br...@apache.org>
Committed: Thu Sep 17 14:58:33 2015 -0500

----------------------------------------------------------------------
 CHANGES.txt                                     |  1 +
 src/java/org/apache/cassandra/gms/Gossiper.java | 11 ++++++++---
 2 files changed, 9 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/6f8e07ab/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index 3c47427..658c19f 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,4 +1,5 @@
 2.0.17
+ * Fix rare race where older gossip states can be shadowed (CASSANDRA-10366)
  * Fix consolidating racks violating the RF contract (CASSANDRA-10238)
  * Disallow decommission when node is in drained state (CASSANDRA-8741)
  * Backport CASSANDRA-8013 to 2.0 (CASSANDRA-10144)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/6f8e07ab/src/java/org/apache/cassandra/gms/Gossiper.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/gms/Gossiper.java b/src/java/org/apache/cassandra/gms/Gossiper.java
index 8c36223..44e464a 100644
--- a/src/java/org/apache/cassandra/gms/Gossiper.java
+++ b/src/java/org/apache/cassandra/gms/Gossiper.java
@@ -1139,7 +1139,6 @@ public class Gossiper implements IFailureDetectionEventListener, GossiperMBean
         localState.setHeartBeatState(remoteState.getHeartBeatState());
         if (logger.isTraceEnabled())
             logger.trace("Updating heartbeat state version to " + localState.getHeartBeatState().getHeartBeatVersion() + " from " + oldVersion + " for " + addr + " ...");
-
         // we need to make two loops here, one to apply, then another to notify, this way all states in an update are present and current when the notifications are received
         for (Entry<ApplicationState, VersionedValue> remoteEntry : remoteState.getApplicationStateMap().entrySet())
         {
@@ -1385,8 +1384,9 @@ public class Gossiper implements IFailureDetectionEventListener, GossiperMBean
             logger.trace("Adding saved endpoint " + ep + " " + epState.getHeartBeatState().getGeneration());
     }
 
-    public void addLocalApplicationState(ApplicationState state, VersionedValue value)
+    private void addLocalApplicationStateInternal(ApplicationState state, VersionedValue value)
     {
+        assert taskLock.isHeldByCurrentThread();
         EndpointState epState = endpointStateMap.get(FBUtilities.getBroadcastAddress());
         InetAddress epAddr = FBUtilities.getBroadcastAddress();
         assert epState != null;
@@ -1401,6 +1401,11 @@ public class Gossiper implements IFailureDetectionEventListener, GossiperMBean
         doOnChangeNotifications(epAddr, state, value);
     }
 
+    public void addLocalApplicationState(ApplicationState applicationState, VersionedValue value)
+    {
+        addLocalApplicationStates(Arrays.asList(Pair.create(applicationState, value)));
+    }
+
     public void addLocalApplicationStates(List<Pair<ApplicationState, VersionedValue>> states)
     {
         taskLock.lock();
@@ -1408,7 +1413,7 @@ public class Gossiper implements IFailureDetectionEventListener, GossiperMBean
         {
             for (Pair<ApplicationState, VersionedValue> pair : states)
             {
-               addLocalApplicationState(pair.left, pair.right);
+               addLocalApplicationStateInternal(pair.left, pair.right);
             }
         }
         finally


[13/17] cassandra git commit: Merge branch 'cassandra-2.1' into cassandra-2.2

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

Conflicts:
	src/java/org/apache/cassandra/gms/Gossiper.java


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

Branch: refs/heads/cassandra-2.2
Commit: 6dcc89f814b9e9511353eb46decb64db572106f4
Parents: 416ba6e a5e282b
Author: Brandon Williams <br...@apache.org>
Authored: Thu Sep 17 15:03:13 2015 -0500
Committer: Brandon Williams <br...@apache.org>
Committed: Thu Sep 17 15:03:13 2015 -0500

----------------------------------------------------------------------
 CHANGES.txt                                     |  1 +
 src/java/org/apache/cassandra/gms/Gossiper.java | 11 ++++++++---
 2 files changed, 9 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/6dcc89f8/CHANGES.txt
----------------------------------------------------------------------
diff --cc CHANGES.txt
index 96ec0fa,5af30a5..f9314f6
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@@ -22,8 -12,8 +22,9 @@@ Merged from 2.1
   * Only check KeyCache when it is enabled
   * Change streaming_socket_timeout_in_ms default to 1 hour (CASSANDRA-8611)
   * (cqlsh) update list of CQL keywords (CASSANDRA-9232)
 + * Add nodetool gettraceprobability command (CASSANDRA-10234)
  Merged from 2.0:
+  * Fix rare race where older gossip states can be shadowed (CASSANDRA-10366)
   * Fix consolidating racks violating the RF contract (CASSANDRA-10238)
   * Disallow decommission when node is in drained state (CASSANDRA-8741)
  

http://git-wip-us.apache.org/repos/asf/cassandra/blob/6dcc89f8/src/java/org/apache/cassandra/gms/Gossiper.java
----------------------------------------------------------------------
diff --cc src/java/org/apache/cassandra/gms/Gossiper.java
index e61a35a,808972a..b6d1afc
--- a/src/java/org/apache/cassandra/gms/Gossiper.java
+++ b/src/java/org/apache/cassandra/gms/Gossiper.java
@@@ -1143,8 -1149,7 +1143,7 @@@ public class Gossiper implements IFailu
  
          localState.setHeartBeatState(remoteState.getHeartBeatState());
          if (logger.isTraceEnabled())
 -            logger.trace("Updating heartbeat state version to " + localState.getHeartBeatState().getHeartBeatVersion() + " from " + oldVersion + " for " + addr + " ...");
 +            logger.trace("Updating heartbeat state version to {} from {} for {} ...", localState.getHeartBeatState().getHeartBeatVersion(), oldVersion, addr);
- 
          // we need to make two loops here, one to apply, then another to notify, this way all states in an update are present and current when the notifications are received
          for (Entry<ApplicationState, VersionedValue> remoteEntry : remoteState.getApplicationStateMap().entrySet())
          {
@@@ -1387,11 -1392,12 +1386,12 @@@
          endpointStateMap.put(ep, epState);
          unreachableEndpoints.put(ep, System.nanoTime());
          if (logger.isTraceEnabled())
 -            logger.trace("Adding saved endpoint " + ep + " " + epState.getHeartBeatState().getGeneration());
 +            logger.trace("Adding saved endpoint {} {}", ep, epState.getHeartBeatState().getGeneration());
      }
  
-     public void addLocalApplicationState(ApplicationState state, VersionedValue value)
+     private void addLocalApplicationStateInternal(ApplicationState state, VersionedValue value)
      {
+         assert taskLock.isHeldByCurrentThread();
          EndpointState epState = endpointStateMap.get(FBUtilities.getBroadcastAddress());
          InetAddress epAddr = FBUtilities.getBroadcastAddress();
          assert epState != null;