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 2020/08/04 22:43:10 UTC

[cassandra] branch cassandra-3.11 updated (0310a7e -> 7976777)

This is an automated email from the ASF dual-hosted git repository.

brandonwilliams pushed a change to branch cassandra-3.11
in repository https://gitbox.apache.org/repos/asf/cassandra.git.


    from 0310a7e  Merge branch 'cassandra-3.0' into cassandra-3.11
     new c94ecec  Check for endpoint collision with hibernating nodes
     new 7976777  Merge branch 'cassandra-3.0' into cassandra-3.11

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 CHANGES.txt                                     |  1 +
 src/java/org/apache/cassandra/gms/Gossiper.java | 19 ++++++++++++++++---
 2 files changed, 17 insertions(+), 3 deletions(-)


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cassandra.apache.org
For additional commands, e-mail: commits-help@cassandra.apache.org


[cassandra] 01/01: Merge branch 'cassandra-3.0' into cassandra-3.11

Posted by br...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

brandonwilliams pushed a commit to branch cassandra-3.11
in repository https://gitbox.apache.org/repos/asf/cassandra.git

commit 7976777bccbe8b90db7d41cb666bcb9060d78bd4
Merge: 0310a7e c94ecec
Author: Brandon Williams <br...@apache.org>
AuthorDate: Tue Aug 4 17:32:45 2020 -0500

    Merge branch 'cassandra-3.0' into cassandra-3.11

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

diff --cc CHANGES.txt
index 9dbbd1c,7d4b7a9..749aba2
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@@ -1,11 -1,10 +1,12 @@@
 -3.0.22:
 +3.11.8
 + * Frozen RawTuple is not annotated with frozen in the toString method (CASSANDRA-15857)
 +Merged from 3.0:
+  * Check for endpoint collision with hibernating nodes (CASSANDRA-14599)
   * Operational improvements and hardening for replica filtering protection (CASSANDRA-15907)
   * stop_paranoid disk failure policy is ignored on CorruptSSTableException after node is up (CASSANDRA-15191)
 - * 3.x fails to start if commit log has range tombstones from a column which is also deleted (CASSANDRA-15970)
   * Forbid altering UDTs used in partition keys (CASSANDRA-15933)
   * Fix empty/null json string representation (CASSANDRA-15896)
 + * 3.x fails to start if commit log has range tombstones from a column which is also deleted (CASSANDRA-15970)
  Merged from 2.2:
   * Fix CQL parsing of collections when the column type is reversed (CASSANDRA-15814)
  
diff --cc src/java/org/apache/cassandra/gms/Gossiper.java
index d227200,7d708c1..b201763
--- a/src/java/org/apache/cassandra/gms/Gossiper.java
+++ b/src/java/org/apache/cassandra/gms/Gossiper.java
@@@ -47,7 -46,6 +47,8 @@@ import org.apache.cassandra.concurrent.
  import org.apache.cassandra.concurrent.Stage;
  import org.apache.cassandra.concurrent.StageManager;
  import org.apache.cassandra.config.DatabaseDescriptor;
 +import org.apache.cassandra.config.Schema;
++import org.apache.cassandra.db.SystemKeyspace;
  import org.apache.cassandra.dht.Token;
  import org.apache.cassandra.net.IAsyncCallback;
  import org.apache.cassandra.net.MessageIn;
@@@ -794,48 -785,38 +795,60 @@@ public class Gossiper implements IFailu
      }
  
      /**
 -     * Check if this endpoint can safely bootstrap into the cluster.
 +     * Check if this node can safely be started and join the ring.
 +     * If the node is bootstrapping, examines gossip state for any previous status to decide whether
 +     * it's safe to allow this node to start and bootstrap. If not bootstrapping, compares the host ID
 +     * that the node itself has (obtained by reading from system.local or generated if not present)
 +     * with the host ID obtained from gossip for the endpoint address (if any). This latter case
 +     * prevents a non-bootstrapping, new node from being started with the same address of a
 +     * previously started, but currently down predecessor.
       *
       * @param endpoint - the endpoint to check
 +     * @param localHostUUID - the host id to check
 +     * @param isBootstrapping - whether the node intends to bootstrap when joining
       * @param epStates - endpoint states in the cluster
 -     * @return true if the endpoint can join the cluster
 +     * @return true if it is safe to start the node, false otherwise
       */
 -    public boolean isSafeForBootstrap(InetAddress endpoint, Map<InetAddress, EndpointState> epStates)
 +    public boolean isSafeForStartup(InetAddress endpoint, UUID localHostUUID, boolean isBootstrapping,
 +                                    Map<InetAddress, EndpointState> epStates)
      {
          EndpointState epState = epStates.get(endpoint);
-         // if there's no previous state, or the node was previously removed from the cluster, we're good
-         if (epState == null || isDeadState(epState))
 -
+         // if there's no previous state, we're good
+         if (epState == null)
+             return true;
+ 
+         String status = getGossipStatus(epState);
+ 
+         if (status.equals(VersionedValue.HIBERNATE)
+             && !SystemKeyspace.bootstrapComplete())
+         {
+             logger.warn("A node with the same IP in hibernate status was detected. Was a replacement already attempted?");
+             return false;
+         }
+ 
++        //the node was previously removed from the cluster
+         if (isDeadState(epState))
              return true;
  
 -        // these states are not allowed to join the cluster as it would not be safe
 -        final List<String> unsafeStatuses = new ArrayList<String>() {{
 -            add(""); // failed bootstrap but we did start gossiping
 -            add(VersionedValue.STATUS_NORMAL); // node is legit in the cluster or it was stopped with kill -9
 -            add(VersionedValue.SHUTDOWN); }}; // node was shutdown
 -        return !unsafeStatuses.contains(status);
 +        if (isBootstrapping)
 +        {
-             String status = getGossipStatus(epState);
 +            // these states are not allowed to join the cluster as it would not be safe
 +            final List<String> unsafeStatuses = new ArrayList<String>()
 +            {{
 +                add("");                           // failed bootstrap but we did start gossiping
 +                add(VersionedValue.STATUS_NORMAL); // node is legit in the cluster or it was stopped with kill -9
 +                add(VersionedValue.SHUTDOWN);      // node was shutdown
 +            }};
 +            return !unsafeStatuses.contains(status);
 +        }
 +        else
 +        {
 +            // if the previous UUID matches what we currently have (i.e. what was read from
 +            // system.local at startup), then we're good to start up. Otherwise, something
 +            // is amiss and we need to replace the previous node
 +            VersionedValue previous = epState.getApplicationState(ApplicationState.HOST_ID);
 +            return UUID.fromString(previous.value).equals(localHostUUID);
 +        }
      }
  
      @VisibleForTesting


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cassandra.apache.org
For additional commands, e-mail: commits-help@cassandra.apache.org