You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by al...@apache.org on 2016/09/22 01:16:12 UTC

[1/6] cassandra git commit: Fix exceptions when enabling gossip on nodes that haven't joined the ring

Repository: cassandra
Updated Branches:
  refs/heads/cassandra-2.2 50726e778 -> df819ec83
  refs/heads/cassandra-3.0 47b50b455 -> 82d1600d7
  refs/heads/trunk 81fd9c6c2 -> 703506c3c


Fix exceptions when enabling gossip on nodes that haven't joined the ring

Patch by Dikang Gu; reviewed by Joel Knighton for CASSANDRA-12253


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

Branch: refs/heads/cassandra-2.2
Commit: df819ec8334c7a215f8d409804186a8106e91097
Parents: 50726e7
Author: Joel Knighton <jo...@datastax.com>
Authored: Thu Sep 15 17:11:10 2016 -0500
Committer: Aleksey Yeschenko <al...@apache.org>
Committed: Wed Sep 21 18:13:28 2016 -0700

----------------------------------------------------------------------
 CHANGES.txt                                        |  1 +
 src/java/org/apache/cassandra/gms/Gossiper.java    |  4 ++--
 .../apache/cassandra/service/StorageService.java   | 17 ++++++++++++++---
 3 files changed, 17 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/df819ec8/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index ee4015e..bc9fc5b 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,4 +1,5 @@
 2.2.8
+ * Fix exceptions when enabling gossip on nodes that haven't joined the ring (CASSANDRA-12253)
  * Fix authentication problem when invoking clqsh copy from a SOURCE command (CASSANDRA-12642)
  * Decrement pending range calculator jobs counter in finally block
   (CASSANDRA-12554)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/df819ec8/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 a8f9524..06b14c4 100644
--- a/src/java/org/apache/cassandra/gms/Gossiper.java
+++ b/src/java/org/apache/cassandra/gms/Gossiper.java
@@ -1446,7 +1446,7 @@ public class Gossiper implements IFailureDetectionEventListener, GossiperMBean
     public void stop()
     {
         EndpointState mystate = endpointStateMap.get(FBUtilities.getBroadcastAddress());
-        if (mystate != null && !isSilentShutdownState(mystate))
+        if (mystate != null && !isSilentShutdownState(mystate) && StorageService.instance.isJoined())
         {
             logger.info("Announcing shutdown");
             addLocalApplicationState(ApplicationState.STATUS, StorageService.instance.valueFactory.shutdown(true));
@@ -1456,7 +1456,7 @@ public class Gossiper implements IFailureDetectionEventListener, GossiperMBean
             Uninterruptibles.sleepUninterruptibly(Integer.getInteger("cassandra.shutdown_announce_in_ms", 2000), TimeUnit.MILLISECONDS);
         }
         else
-            logger.warn("No local state or state is in silent shutdown, not announcing shutdown");
+            logger.warn("No local state, state is in silent shutdown, or node hasn't joined, not announcing shutdown");
         if (scheduledGossipTask != null)
             scheduledGossipTask.cancel(false);
     }

http://git-wip-us.apache.org/repos/asf/cassandra/blob/df819ec8/src/java/org/apache/cassandra/service/StorageService.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/service/StorageService.java b/src/java/org/apache/cassandra/service/StorageService.java
index 9197ab1..0b6e851 100644
--- a/src/java/org/apache/cassandra/service/StorageService.java
+++ b/src/java/org/apache/cassandra/service/StorageService.java
@@ -185,6 +185,7 @@ public class StorageService extends NotificationBroadcasterSupport implements IE
     // true when keeping strict consistency while bootstrapping
     private boolean useStrictConsistency = Boolean.parseBoolean(System.getProperty("cassandra.consistent.rangemovement", "true"));
     private static final boolean allowSimultaneousMoves = Boolean.valueOf(System.getProperty("cassandra.consistent.simultaneousmoves.allow","false"));
+    private static final boolean joinRing = Boolean.parseBoolean(System.getProperty("cassandra.join_ring", "true"));
     private boolean replacing;
     private UUID replacingId;
 
@@ -292,7 +293,17 @@ public class StorageService extends NotificationBroadcasterSupport implements IE
         if (!initialized)
         {
             logger.warn("Starting gossip by operator request");
-            setGossipTokens(getLocalTokens());
+            Collection<Token> tokens = SystemKeyspace.getSavedTokens();
+
+            boolean validTokens = tokens != null && !tokens.isEmpty();
+
+            // shouldn't be called before these are set if we intend to join the ring/are in the process of doing so
+            if (joined || joinRing)
+                assert validTokens : "Cannot start gossiping for a node intended to join without valid tokens";
+
+            if (validTokens)
+                setGossipTokens(tokens);
+
             Gossiper.instance.forceNewerGeneration();
             Gossiper.instance.start((int) (System.currentTimeMillis() / 1000));
             initialized = true;
@@ -631,7 +642,7 @@ public class StorageService extends NotificationBroadcasterSupport implements IE
             logger.warn("Error loading counter cache", t);
         }
 
-        if (Boolean.parseBoolean(System.getProperty("cassandra.join_ring", "true")))
+        if (joinRing)
         {
             joinTokenRing(delay);
         }
@@ -674,7 +685,7 @@ public class StorageService extends NotificationBroadcasterSupport implements IE
         {
             Map<ApplicationState, VersionedValue> appStates = new EnumMap<>(ApplicationState.class);
 
-            if (replacing && !(Boolean.parseBoolean(System.getProperty("cassandra.join_ring", "true"))))
+            if (replacing && !joinRing)
                 throw new ConfigurationException("Cannot set both join_ring=false and attempt to replace a node");
             if (DatabaseDescriptor.getReplaceTokens().size() > 0 || DatabaseDescriptor.getReplaceNode() != null)
                 throw new RuntimeException("Replace method removed; use cassandra.replace_address instead");


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

Posted by al...@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/82d1600d
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/82d1600d
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/82d1600d

Branch: refs/heads/trunk
Commit: 82d1600d78fca3879f2204d46c597c93c53c40b2
Parents: 47b50b4 df819ec
Author: Aleksey Yeschenko <al...@apache.org>
Authored: Wed Sep 21 18:13:41 2016 -0700
Committer: Aleksey Yeschenko <al...@apache.org>
Committed: Wed Sep 21 18:14:49 2016 -0700

----------------------------------------------------------------------
 CHANGES.txt                                        |  1 +
 src/java/org/apache/cassandra/gms/Gossiper.java    |  4 ++--
 .../apache/cassandra/service/StorageService.java   | 17 ++++++++++++++---
 3 files changed, 17 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/82d1600d/CHANGES.txt
----------------------------------------------------------------------
diff --cc CHANGES.txt
index d9db977,bc9fc5b..0524e49
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@@ -1,10 -1,5 +1,11 @@@
 -2.2.8
 +3.0.10
 + * Skip writing MV mutations to commitlog on mutation.applyUnsafe() (CASSANDRA-11670)
 + * Establish consistent distinction between non-existing partition and NULL value for LWTs on static columns (CASSANDRA-12060)
 + * Extend ColumnIdentifier.internedInstances key to include the type that generated the byte buffer (CASSANDRA-12516)
 + * Backport CASSANDRA-10756 (race condition in NativeTransportService shutdown) (CASSANDRA-12472)
 + * If CF has no clustering columns, any row cache is full partition cache (CASSANDRA-12499)
 +Merged from 2.2:
+  * Fix exceptions when enabling gossip on nodes that haven't joined the ring (CASSANDRA-12253)
   * Fix authentication problem when invoking clqsh copy from a SOURCE command (CASSANDRA-12642)
   * Decrement pending range calculator jobs counter in finally block
    (CASSANDRA-12554)

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

http://git-wip-us.apache.org/repos/asf/cassandra/blob/82d1600d/src/java/org/apache/cassandra/service/StorageService.java
----------------------------------------------------------------------
diff --cc src/java/org/apache/cassandra/service/StorageService.java
index c06bed2,0b6e851..15a0146
--- a/src/java/org/apache/cassandra/service/StorageService.java
+++ b/src/java/org/apache/cassandra/service/StorageService.java
@@@ -707,17 -685,7 +718,17 @@@ public class StorageService extends Not
          {
              Map<ApplicationState, VersionedValue> appStates = new EnumMap<>(ApplicationState.class);
  
 +            if (SystemKeyspace.wasDecommissioned())
 +            {
 +                if (Boolean.getBoolean("cassandra.override_decommission"))
 +                {
 +                    logger.warn("This node was decommissioned, but overriding by operator request.");
 +                    SystemKeyspace.setBootstrapState(SystemKeyspace.BootstrapState.COMPLETED);
 +                }
 +                else
 +                    throw new ConfigurationException("This node was decommissioned and will not rejoin the ring unless cassandra.override_decommission=true has been set, or all existing data is removed and the node is bootstrapped again");
 +            }
-             if (replacing && !(Boolean.parseBoolean(System.getProperty("cassandra.join_ring", "true"))))
+             if (replacing && !joinRing)
                  throw new ConfigurationException("Cannot set both join_ring=false and attempt to replace a node");
              if (DatabaseDescriptor.getReplaceTokens().size() > 0 || DatabaseDescriptor.getReplaceNode() != null)
                  throw new RuntimeException("Replace method removed; use cassandra.replace_address instead");


[3/6] cassandra git commit: Fix exceptions when enabling gossip on nodes that haven't joined the ring

Posted by al...@apache.org.
Fix exceptions when enabling gossip on nodes that haven't joined the ring

Patch by Dikang Gu; reviewed by Joel Knighton for CASSANDRA-12253


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

Branch: refs/heads/trunk
Commit: df819ec8334c7a215f8d409804186a8106e91097
Parents: 50726e7
Author: Joel Knighton <jo...@datastax.com>
Authored: Thu Sep 15 17:11:10 2016 -0500
Committer: Aleksey Yeschenko <al...@apache.org>
Committed: Wed Sep 21 18:13:28 2016 -0700

----------------------------------------------------------------------
 CHANGES.txt                                        |  1 +
 src/java/org/apache/cassandra/gms/Gossiper.java    |  4 ++--
 .../apache/cassandra/service/StorageService.java   | 17 ++++++++++++++---
 3 files changed, 17 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/df819ec8/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index ee4015e..bc9fc5b 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,4 +1,5 @@
 2.2.8
+ * Fix exceptions when enabling gossip on nodes that haven't joined the ring (CASSANDRA-12253)
  * Fix authentication problem when invoking clqsh copy from a SOURCE command (CASSANDRA-12642)
  * Decrement pending range calculator jobs counter in finally block
   (CASSANDRA-12554)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/df819ec8/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 a8f9524..06b14c4 100644
--- a/src/java/org/apache/cassandra/gms/Gossiper.java
+++ b/src/java/org/apache/cassandra/gms/Gossiper.java
@@ -1446,7 +1446,7 @@ public class Gossiper implements IFailureDetectionEventListener, GossiperMBean
     public void stop()
     {
         EndpointState mystate = endpointStateMap.get(FBUtilities.getBroadcastAddress());
-        if (mystate != null && !isSilentShutdownState(mystate))
+        if (mystate != null && !isSilentShutdownState(mystate) && StorageService.instance.isJoined())
         {
             logger.info("Announcing shutdown");
             addLocalApplicationState(ApplicationState.STATUS, StorageService.instance.valueFactory.shutdown(true));
@@ -1456,7 +1456,7 @@ public class Gossiper implements IFailureDetectionEventListener, GossiperMBean
             Uninterruptibles.sleepUninterruptibly(Integer.getInteger("cassandra.shutdown_announce_in_ms", 2000), TimeUnit.MILLISECONDS);
         }
         else
-            logger.warn("No local state or state is in silent shutdown, not announcing shutdown");
+            logger.warn("No local state, state is in silent shutdown, or node hasn't joined, not announcing shutdown");
         if (scheduledGossipTask != null)
             scheduledGossipTask.cancel(false);
     }

http://git-wip-us.apache.org/repos/asf/cassandra/blob/df819ec8/src/java/org/apache/cassandra/service/StorageService.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/service/StorageService.java b/src/java/org/apache/cassandra/service/StorageService.java
index 9197ab1..0b6e851 100644
--- a/src/java/org/apache/cassandra/service/StorageService.java
+++ b/src/java/org/apache/cassandra/service/StorageService.java
@@ -185,6 +185,7 @@ public class StorageService extends NotificationBroadcasterSupport implements IE
     // true when keeping strict consistency while bootstrapping
     private boolean useStrictConsistency = Boolean.parseBoolean(System.getProperty("cassandra.consistent.rangemovement", "true"));
     private static final boolean allowSimultaneousMoves = Boolean.valueOf(System.getProperty("cassandra.consistent.simultaneousmoves.allow","false"));
+    private static final boolean joinRing = Boolean.parseBoolean(System.getProperty("cassandra.join_ring", "true"));
     private boolean replacing;
     private UUID replacingId;
 
@@ -292,7 +293,17 @@ public class StorageService extends NotificationBroadcasterSupport implements IE
         if (!initialized)
         {
             logger.warn("Starting gossip by operator request");
-            setGossipTokens(getLocalTokens());
+            Collection<Token> tokens = SystemKeyspace.getSavedTokens();
+
+            boolean validTokens = tokens != null && !tokens.isEmpty();
+
+            // shouldn't be called before these are set if we intend to join the ring/are in the process of doing so
+            if (joined || joinRing)
+                assert validTokens : "Cannot start gossiping for a node intended to join without valid tokens";
+
+            if (validTokens)
+                setGossipTokens(tokens);
+
             Gossiper.instance.forceNewerGeneration();
             Gossiper.instance.start((int) (System.currentTimeMillis() / 1000));
             initialized = true;
@@ -631,7 +642,7 @@ public class StorageService extends NotificationBroadcasterSupport implements IE
             logger.warn("Error loading counter cache", t);
         }
 
-        if (Boolean.parseBoolean(System.getProperty("cassandra.join_ring", "true")))
+        if (joinRing)
         {
             joinTokenRing(delay);
         }
@@ -674,7 +685,7 @@ public class StorageService extends NotificationBroadcasterSupport implements IE
         {
             Map<ApplicationState, VersionedValue> appStates = new EnumMap<>(ApplicationState.class);
 
-            if (replacing && !(Boolean.parseBoolean(System.getProperty("cassandra.join_ring", "true"))))
+            if (replacing && !joinRing)
                 throw new ConfigurationException("Cannot set both join_ring=false and attempt to replace a node");
             if (DatabaseDescriptor.getReplaceTokens().size() > 0 || DatabaseDescriptor.getReplaceNode() != null)
                 throw new RuntimeException("Replace method removed; use cassandra.replace_address instead");


[2/6] cassandra git commit: Fix exceptions when enabling gossip on nodes that haven't joined the ring

Posted by al...@apache.org.
Fix exceptions when enabling gossip on nodes that haven't joined the ring

Patch by Dikang Gu; reviewed by Joel Knighton for CASSANDRA-12253


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

Branch: refs/heads/cassandra-3.0
Commit: df819ec8334c7a215f8d409804186a8106e91097
Parents: 50726e7
Author: Joel Knighton <jo...@datastax.com>
Authored: Thu Sep 15 17:11:10 2016 -0500
Committer: Aleksey Yeschenko <al...@apache.org>
Committed: Wed Sep 21 18:13:28 2016 -0700

----------------------------------------------------------------------
 CHANGES.txt                                        |  1 +
 src/java/org/apache/cassandra/gms/Gossiper.java    |  4 ++--
 .../apache/cassandra/service/StorageService.java   | 17 ++++++++++++++---
 3 files changed, 17 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/df819ec8/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index ee4015e..bc9fc5b 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,4 +1,5 @@
 2.2.8
+ * Fix exceptions when enabling gossip on nodes that haven't joined the ring (CASSANDRA-12253)
  * Fix authentication problem when invoking clqsh copy from a SOURCE command (CASSANDRA-12642)
  * Decrement pending range calculator jobs counter in finally block
   (CASSANDRA-12554)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/df819ec8/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 a8f9524..06b14c4 100644
--- a/src/java/org/apache/cassandra/gms/Gossiper.java
+++ b/src/java/org/apache/cassandra/gms/Gossiper.java
@@ -1446,7 +1446,7 @@ public class Gossiper implements IFailureDetectionEventListener, GossiperMBean
     public void stop()
     {
         EndpointState mystate = endpointStateMap.get(FBUtilities.getBroadcastAddress());
-        if (mystate != null && !isSilentShutdownState(mystate))
+        if (mystate != null && !isSilentShutdownState(mystate) && StorageService.instance.isJoined())
         {
             logger.info("Announcing shutdown");
             addLocalApplicationState(ApplicationState.STATUS, StorageService.instance.valueFactory.shutdown(true));
@@ -1456,7 +1456,7 @@ public class Gossiper implements IFailureDetectionEventListener, GossiperMBean
             Uninterruptibles.sleepUninterruptibly(Integer.getInteger("cassandra.shutdown_announce_in_ms", 2000), TimeUnit.MILLISECONDS);
         }
         else
-            logger.warn("No local state or state is in silent shutdown, not announcing shutdown");
+            logger.warn("No local state, state is in silent shutdown, or node hasn't joined, not announcing shutdown");
         if (scheduledGossipTask != null)
             scheduledGossipTask.cancel(false);
     }

http://git-wip-us.apache.org/repos/asf/cassandra/blob/df819ec8/src/java/org/apache/cassandra/service/StorageService.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/service/StorageService.java b/src/java/org/apache/cassandra/service/StorageService.java
index 9197ab1..0b6e851 100644
--- a/src/java/org/apache/cassandra/service/StorageService.java
+++ b/src/java/org/apache/cassandra/service/StorageService.java
@@ -185,6 +185,7 @@ public class StorageService extends NotificationBroadcasterSupport implements IE
     // true when keeping strict consistency while bootstrapping
     private boolean useStrictConsistency = Boolean.parseBoolean(System.getProperty("cassandra.consistent.rangemovement", "true"));
     private static final boolean allowSimultaneousMoves = Boolean.valueOf(System.getProperty("cassandra.consistent.simultaneousmoves.allow","false"));
+    private static final boolean joinRing = Boolean.parseBoolean(System.getProperty("cassandra.join_ring", "true"));
     private boolean replacing;
     private UUID replacingId;
 
@@ -292,7 +293,17 @@ public class StorageService extends NotificationBroadcasterSupport implements IE
         if (!initialized)
         {
             logger.warn("Starting gossip by operator request");
-            setGossipTokens(getLocalTokens());
+            Collection<Token> tokens = SystemKeyspace.getSavedTokens();
+
+            boolean validTokens = tokens != null && !tokens.isEmpty();
+
+            // shouldn't be called before these are set if we intend to join the ring/are in the process of doing so
+            if (joined || joinRing)
+                assert validTokens : "Cannot start gossiping for a node intended to join without valid tokens";
+
+            if (validTokens)
+                setGossipTokens(tokens);
+
             Gossiper.instance.forceNewerGeneration();
             Gossiper.instance.start((int) (System.currentTimeMillis() / 1000));
             initialized = true;
@@ -631,7 +642,7 @@ public class StorageService extends NotificationBroadcasterSupport implements IE
             logger.warn("Error loading counter cache", t);
         }
 
-        if (Boolean.parseBoolean(System.getProperty("cassandra.join_ring", "true")))
+        if (joinRing)
         {
             joinTokenRing(delay);
         }
@@ -674,7 +685,7 @@ public class StorageService extends NotificationBroadcasterSupport implements IE
         {
             Map<ApplicationState, VersionedValue> appStates = new EnumMap<>(ApplicationState.class);
 
-            if (replacing && !(Boolean.parseBoolean(System.getProperty("cassandra.join_ring", "true"))))
+            if (replacing && !joinRing)
                 throw new ConfigurationException("Cannot set both join_ring=false and attempt to replace a node");
             if (DatabaseDescriptor.getReplaceTokens().size() > 0 || DatabaseDescriptor.getReplaceNode() != null)
                 throw new RuntimeException("Replace method removed; use cassandra.replace_address instead");


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

Posted by al...@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/82d1600d
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/82d1600d
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/82d1600d

Branch: refs/heads/cassandra-3.0
Commit: 82d1600d78fca3879f2204d46c597c93c53c40b2
Parents: 47b50b4 df819ec
Author: Aleksey Yeschenko <al...@apache.org>
Authored: Wed Sep 21 18:13:41 2016 -0700
Committer: Aleksey Yeschenko <al...@apache.org>
Committed: Wed Sep 21 18:14:49 2016 -0700

----------------------------------------------------------------------
 CHANGES.txt                                        |  1 +
 src/java/org/apache/cassandra/gms/Gossiper.java    |  4 ++--
 .../apache/cassandra/service/StorageService.java   | 17 ++++++++++++++---
 3 files changed, 17 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/82d1600d/CHANGES.txt
----------------------------------------------------------------------
diff --cc CHANGES.txt
index d9db977,bc9fc5b..0524e49
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@@ -1,10 -1,5 +1,11 @@@
 -2.2.8
 +3.0.10
 + * Skip writing MV mutations to commitlog on mutation.applyUnsafe() (CASSANDRA-11670)
 + * Establish consistent distinction between non-existing partition and NULL value for LWTs on static columns (CASSANDRA-12060)
 + * Extend ColumnIdentifier.internedInstances key to include the type that generated the byte buffer (CASSANDRA-12516)
 + * Backport CASSANDRA-10756 (race condition in NativeTransportService shutdown) (CASSANDRA-12472)
 + * If CF has no clustering columns, any row cache is full partition cache (CASSANDRA-12499)
 +Merged from 2.2:
+  * Fix exceptions when enabling gossip on nodes that haven't joined the ring (CASSANDRA-12253)
   * Fix authentication problem when invoking clqsh copy from a SOURCE command (CASSANDRA-12642)
   * Decrement pending range calculator jobs counter in finally block
    (CASSANDRA-12554)

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

http://git-wip-us.apache.org/repos/asf/cassandra/blob/82d1600d/src/java/org/apache/cassandra/service/StorageService.java
----------------------------------------------------------------------
diff --cc src/java/org/apache/cassandra/service/StorageService.java
index c06bed2,0b6e851..15a0146
--- a/src/java/org/apache/cassandra/service/StorageService.java
+++ b/src/java/org/apache/cassandra/service/StorageService.java
@@@ -707,17 -685,7 +718,17 @@@ public class StorageService extends Not
          {
              Map<ApplicationState, VersionedValue> appStates = new EnumMap<>(ApplicationState.class);
  
 +            if (SystemKeyspace.wasDecommissioned())
 +            {
 +                if (Boolean.getBoolean("cassandra.override_decommission"))
 +                {
 +                    logger.warn("This node was decommissioned, but overriding by operator request.");
 +                    SystemKeyspace.setBootstrapState(SystemKeyspace.BootstrapState.COMPLETED);
 +                }
 +                else
 +                    throw new ConfigurationException("This node was decommissioned and will not rejoin the ring unless cassandra.override_decommission=true has been set, or all existing data is removed and the node is bootstrapped again");
 +            }
-             if (replacing && !(Boolean.parseBoolean(System.getProperty("cassandra.join_ring", "true"))))
+             if (replacing && !joinRing)
                  throw new ConfigurationException("Cannot set both join_ring=false and attempt to replace a node");
              if (DatabaseDescriptor.getReplaceTokens().size() > 0 || DatabaseDescriptor.getReplaceNode() != null)
                  throw new RuntimeException("Replace method removed; use cassandra.replace_address instead");


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

Posted by al...@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/703506c3
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/703506c3
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/703506c3

Branch: refs/heads/trunk
Commit: 703506c3c7f42da49f56421467533471b0c6ddda
Parents: 81fd9c6 82d1600
Author: Aleksey Yeschenko <al...@apache.org>
Authored: Wed Sep 21 18:14:58 2016 -0700
Committer: Aleksey Yeschenko <al...@apache.org>
Committed: Wed Sep 21 18:15:48 2016 -0700

----------------------------------------------------------------------
 CHANGES.txt                                        |  1 +
 src/java/org/apache/cassandra/gms/Gossiper.java    |  4 ++--
 .../apache/cassandra/service/StorageService.java   | 17 ++++++++++++++---
 3 files changed, 17 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/703506c3/CHANGES.txt
----------------------------------------------------------------------
diff --cc CHANGES.txt
index d6fcab8,0524e49..df3c775
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@@ -82,56 -29,12 +82,57 @@@ Merged from 3.0
   * Disk failure policy should not be invoked on out of space (CASSANDRA-12385)
   * Calculate last compacted key on startup (CASSANDRA-6216)
   * Add schema to snapshot manifest, add USING TIMESTAMP clause to ALTER TABLE statements (CASSANDRA-7190)
 + * If CF has no clustering columns, any row cache is full partition cache (CASSANDRA-12499)
 +Merged from 2.2:
++ * Fix exceptions when enabling gossip on nodes that haven't joined the ring (CASSANDRA-12253)
 + * Fix authentication problem when invoking clqsh copy from a SOURCE command (CASSANDRA-12642)
 + * Decrement pending range calculator jobs counter in finally block
 + * cqlshlib tests: increase default execute timeout (CASSANDRA-12481)
 + * Forward writes to replacement node when replace_address != broadcast_address (CASSANDRA-8523)
 + * Fail repair on non-existing table (CASSANDRA-12279)
 + * Enable repair -pr and -local together (fix regression of CASSANDRA-7450) (CASSANDRA-12522)
 +
 +
 +3.8, 3.9
 + * Fix value skipping with counter columns (CASSANDRA-11726)
 + * Fix nodetool tablestats miss SSTable count (CASSANDRA-12205)
 + * Fixed flacky SSTablesIteratedTest (CASSANDRA-12282)
 + * Fixed flacky SSTableRewriterTest: check file counts before calling validateCFS (CASSANDRA-12348)
 + * cqlsh: Fix handling of $$-escaped strings (CASSANDRA-12189)
 + * Fix SSL JMX requiring truststore containing server cert (CASSANDRA-12109)
 + * RTE from new CDC column breaks in flight queries (CASSANDRA-12236)
 + * Fix hdr logging for single operation workloads (CASSANDRA-12145)
 + * Fix SASI PREFIX search in CONTAINS mode with partial terms (CASSANDRA-12073)
 + * Increase size of flushExecutor thread pool (CASSANDRA-12071)
 + * Partial revert of CASSANDRA-11971, cannot recycle buffer in SP.sendMessagesToNonlocalDC (CASSANDRA-11950)
 + * Upgrade netty to 4.0.39 (CASSANDRA-12032, CASSANDRA-12034)
 + * Improve details in compaction log message (CASSANDRA-12080)
 + * Allow unset values in CQLSSTableWriter (CASSANDRA-11911)
 + * Chunk cache to request compressor-compatible buffers if pool space is exhausted (CASSANDRA-11993)
 + * Remove DatabaseDescriptor dependencies from SequentialWriter (CASSANDRA-11579)
 + * Move skip_stop_words filter before stemming (CASSANDRA-12078)
 + * Support seek() in EncryptedFileSegmentInputStream (CASSANDRA-11957)
 + * SSTable tools mishandling LocalPartitioner (CASSANDRA-12002)
 + * When SEPWorker assigned work, set thread name to match pool (CASSANDRA-11966)
 + * Add cross-DC latency metrics (CASSANDRA-11596)
 + * Allow terms in selection clause (CASSANDRA-10783)
 + * Add bind variables to trace (CASSANDRA-11719)
 + * Switch counter shards' clock to timestamps (CASSANDRA-9811)
 + * Introduce HdrHistogram and response/service/wait separation to stress tool (CASSANDRA-11853)
 + * entry-weighers in QueryProcessor should respect partitionKeyBindIndexes field (CASSANDRA-11718)
 + * Support older ant versions (CASSANDRA-11807)
 + * Estimate compressed on disk size when deciding if sstable size limit reached (CASSANDRA-11623)
 + * cassandra-stress profiles should support case sensitive schemas (CASSANDRA-11546)
 + * Remove DatabaseDescriptor dependency from FileUtils (CASSANDRA-11578)
 + * Faster streaming (CASSANDRA-9766)
 + * Add prepared query parameter to trace for "Execute CQL3 prepared query" session (CASSANDRA-11425)
 + * Add repaired percentage metric (CASSANDRA-11503)
 + * Add Change-Data-Capture (CASSANDRA-8844)
 +Merged from 3.0:
 + * Fix paging for 2.x to 3.x upgrades (CASSANDRA-11195)
   * Fix clean interval not sent to commit log for empty memtable flush (CASSANDRA-12436)
   * Fix potential resource leak in RMIServerSocketFactoryImpl (CASSANDRA-12331)
 - * Backport CASSANDRA-12002 (CASSANDRA-12177)
   * Make sure compaction stats are updated when compaction is interrupted (CASSANDRA-12100)
 - * Fix potential bad messaging service message for paged range reads
 -   within mixed-version 3.x clusters (CASSANDRA-12249)
   * Change commitlog and sstables to track dirty and clean intervals (CASSANDRA-11828)
   * NullPointerException during compaction on table with static columns (CASSANDRA-12336)
   * Fixed ConcurrentModificationException when reading metrics in GraphiteReporter (CASSANDRA-11823)

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

http://git-wip-us.apache.org/repos/asf/cassandra/blob/703506c3/src/java/org/apache/cassandra/service/StorageService.java
----------------------------------------------------------------------
diff --cc src/java/org/apache/cassandra/service/StorageService.java
index 24b10ea,15a0146..4f11800
--- a/src/java/org/apache/cassandra/service/StorageService.java
+++ b/src/java/org/apache/cassandra/service/StorageService.java
@@@ -201,9 -192,11 +201,10 @@@ public class StorageService extends Not
      private Collection<Token> bootstrapTokens = null;
  
      // true when keeping strict consistency while bootstrapping
 -    private boolean useStrictConsistency = Boolean.parseBoolean(System.getProperty("cassandra.consistent.rangemovement", "true"));
 -    private static final boolean allowSimultaneousMoves = Boolean.valueOf(System.getProperty("cassandra.consistent.simultaneousmoves.allow","false"));
 +    private static final boolean useStrictConsistency = Boolean.parseBoolean(System.getProperty("cassandra.consistent.rangemovement", "true"));
 +    private static final boolean allowSimultaneousMoves = Boolean.parseBoolean(System.getProperty("cassandra.consistent.simultaneousmoves.allow","false"));
+     private static final boolean joinRing = Boolean.parseBoolean(System.getProperty("cassandra.join_ring", "true"));
      private boolean replacing;
 -    private UUID replacingId;
  
      private final StreamStateStore streamStateStore = new StreamStateStore();
  
@@@ -310,13 -303,23 +311,23 @@@
      // should only be called via JMX
      public void startGossiping()
      {
 -        if (!initialized)
 +        if (!gossipActive)
          {
              logger.warn("Starting gossip by operator request");
-             setGossipTokens(getLocalTokens());
+             Collection<Token> tokens = SystemKeyspace.getSavedTokens();
+ 
+             boolean validTokens = tokens != null && !tokens.isEmpty();
+ 
+             // shouldn't be called before these are set if we intend to join the ring/are in the process of doing so
+             if (joined || joinRing)
+                 assert validTokens : "Cannot start gossiping for a node intended to join without valid tokens";
+ 
+             if (validTokens)
+                 setGossipTokens(tokens);
+ 
              Gossiper.instance.forceNewerGeneration();
              Gossiper.instance.start((int) (System.currentTimeMillis() / 1000));
 -            initialized = true;
 +            gossipActive = true;
          }
      }
  
@@@ -449,34 -447,32 +460,34 @@@
          daemon.deactivate();
      }
  
 -    public synchronized Collection<Token> prepareReplacementInfo() throws ConfigurationException
 +    private synchronized UUID prepareForReplacement() throws ConfigurationException
      {
 -        logger.info("Gathering node replacement information for {}", DatabaseDescriptor.getReplaceAddress());
 -        if (!MessagingService.instance().isListening())
 -            MessagingService.instance().listen();
 +        if (SystemKeyspace.bootstrapComplete())
 +            throw new RuntimeException("Cannot replace address with a node that is already bootstrapped");
 +
-         if (!(Boolean.parseBoolean(System.getProperty("cassandra.join_ring", "true"))))
++        if (!joinRing)
 +            throw new ConfigurationException("Cannot set both join_ring=false and attempt to replace a node");
  
 -        // make magic happen
 +        if (!DatabaseDescriptor.isAutoBootstrap() && !Boolean.getBoolean("cassandra.allow_unsafe_replace"))
 +            throw new RuntimeException("Replacing a node without bootstrapping risks invalidating consistency " +
 +                                       "guarantees as the expected data may not be present until repair is run. " +
 +                                       "To perform this operation, please restart with " +
 +                                       "-Dcassandra.allow_unsafe_replace=true");
 +
 +        InetAddress replaceAddress = DatabaseDescriptor.getReplaceAddress();
 +        logger.info("Gathering node replacement information for {}", replaceAddress);
          Gossiper.instance.doShadowRound();
 +        // as we've completed the shadow round of gossip, we should be able to find the node we're replacing
 +        if (Gossiper.instance.getEndpointStateForEndpoint(replaceAddress) == null)
 +            throw new RuntimeException(String.format("Cannot replace_address %s because it doesn't exist in gossip", replaceAddress));
  
 -        // now that we've gossiped at least once, we should be able to find the node we're replacing
 -        if (Gossiper.instance.getEndpointStateForEndpoint(DatabaseDescriptor.getReplaceAddress())== null)
 -            throw new RuntimeException("Cannot replace_address " + DatabaseDescriptor.getReplaceAddress() + " because it doesn't exist in gossip");
 -        replacingId = Gossiper.instance.getHostId(DatabaseDescriptor.getReplaceAddress());
          try
          {
 -            VersionedValue tokensVersionedValue = Gossiper.instance.getEndpointStateForEndpoint(DatabaseDescriptor.getReplaceAddress()).getApplicationState(ApplicationState.TOKENS);
 +            VersionedValue tokensVersionedValue = Gossiper.instance.getEndpointStateForEndpoint(replaceAddress).getApplicationState(ApplicationState.TOKENS);
              if (tokensVersionedValue == null)
 -                throw new RuntimeException("Could not find tokens for " + DatabaseDescriptor.getReplaceAddress() + " to replace");
 -            Collection<Token> tokens = TokenSerializer.deserialize(tokenMetadata.partitioner, new DataInputStream(new ByteArrayInputStream(tokensVersionedValue.toBytes())));
 +                throw new RuntimeException(String.format("Could not find tokens for %s to replace", replaceAddress));
  
 -            if (isReplacingSameAddress())
 -            {
 -                SystemKeyspace.setLocalHostId(replacingId); // use the replacee's host Id as our own so we receive hints, etc
 -            }
 -            Gossiper.instance.resetEndpointStateMap(); // clean up since we have what we need
 -            return tokens;
 +            bootstrapTokens = TokenSerializer.deserialize(tokenMetadata.partitioner, new DataInputStream(new ByteArrayInputStream(tokensVersionedValue.toBytes())));
          }
          catch (IOException e)
          {