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 2023/09/15 17:31:06 UTC

[cassandra] branch cassandra-4.0 updated (b2093ef321 -> edde699a06)

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

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


    from b2093ef321 Select automatic native port when starting the server in CQLTester
     new edf22ed776 Revert 18543 but retain properties
     new edde699a06 Merge branch 'cassandra-3.11' into cassandra-4.0

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 | 47 ++-----------------------
 2 files changed, 4 insertions(+), 44 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.11' into cassandra-4.0

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

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

commit edde699a062701345133b6f0648a744b426a6f94
Merge: b2093ef321 edf22ed776
Author: Brandon Williams <br...@apache.org>
AuthorDate: Fri Sep 15 12:22:53 2023 -0500

    Merge branch 'cassandra-3.11' into cassandra-4.0

 CHANGES.txt                                     |  1 +
 src/java/org/apache/cassandra/gms/Gossiper.java | 47 ++-----------------------
 2 files changed, 4 insertions(+), 44 deletions(-)

diff --cc CHANGES.txt
index 4a3f90770a,2d9e2059e1..62c49d6fd0
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@@ -1,10 -1,6 +1,11 @@@
 -3.11.17
 +4.0.12
 + * Fix NTS log message when an unrecognized strategy option is passed (CASSANDRA-18679)
 + * Fix BulkLoader ignoring cipher suites options (CASSANDRA-18582)
 + * Migrate Python optparse to argparse (CASSANDRA-17914)
 +Merged from 3.11:
+  * Revert CASSANDRA-18543 (CASSANDRA-18854)
   * Fix NPE when using udfContext in UDF after a restart of a node (CASSANDRA-18739)
 + * Moved jflex from runtime to build dependencies (CASSANDRA-18664)
  Merged from 3.0:
   * Add cqlshrc.sample and credentials.sample into Debian package (CASSANDRA-18818)
   * Refactor validation logic in StorageService.rebuild (CASSANDRA-18803)
diff --cc src/java/org/apache/cassandra/gms/Gossiper.java
index ad9c8c3784,b3783cd5b5..2b3c48ed77
--- a/src/java/org/apache/cassandra/gms/Gossiper.java
+++ b/src/java/org/apache/cassandra/gms/Gossiper.java
@@@ -38,15 -38,8 +38,14 @@@ import com.google.common.collect.Sets
  import com.google.common.util.concurrent.ListenableFutureTask;
  import com.google.common.util.concurrent.Uninterruptibles;
  
 -import io.netty.util.concurrent.FastThreadLocal;
 +import org.apache.cassandra.concurrent.JMXEnabledSingleThreadExecutor;
 +import org.apache.cassandra.config.CassandraRelevantProperties;
- import org.apache.cassandra.exceptions.RequestFailureReason;
 +import org.apache.cassandra.locator.InetAddressAndPort;
 +import org.apache.cassandra.net.NoPayload;
 +import org.apache.cassandra.net.Verb;
 +import org.apache.cassandra.utils.CassandraVersion;
  import org.apache.cassandra.utils.ExecutorUtils;
 +import org.apache.cassandra.utils.ExpiringMemoizingSupplier;
  import org.apache.cassandra.utils.MBeanWrapper;
  import org.apache.cassandra.utils.NoSpamLogger;
  import org.apache.cassandra.utils.Pair;
@@@ -127,21 -119,24 +126,18 @@@ public class Gossiper implements IFailu
  
      // Maximimum difference between generation value and local time we are willing to accept about a peer
      static final int MAX_GENERATION_DIFFERENCE = 86400 * 365;
 -    private long fatClientTimeout;
 +    private final long fatClientTimeout;
      private final Random random = new Random();
 -    private final Comparator<InetAddress> inetcomparator = new Comparator<InetAddress>()
 -    {
 -        public int compare(InetAddress addr1, InetAddress addr2)
 -        {
 -            return addr1.getHostAddress().compareTo(addr2.getHostAddress());
 -        }
 -    };
  
      /* subscribers for interest in EndpointState change */
 -    private final List<IEndpointStateChangeSubscriber> subscribers = new CopyOnWriteArrayList<IEndpointStateChangeSubscriber>();
 +    private final List<IEndpointStateChangeSubscriber> subscribers = new CopyOnWriteArrayList<>();
  
      /* live member set */
 -    private final Set<InetAddress> liveEndpoints = new ConcurrentSkipListSet<InetAddress>(inetcomparator);
 +    @VisibleForTesting
 +    final Set<InetAddressAndPort> liveEndpoints = new ConcurrentSkipListSet<>();
  
-     /* Inflight echo requests. */
-     private final Set<InetAddressAndPort> inflightEcho = new ConcurrentSkipListSet<>();
- 
      /* unreachable member set */
 -    private final Map<InetAddress, Long> unreachableEndpoints = new ConcurrentHashMap<InetAddress, Long>();
 +    private final Map<InetAddressAndPort, Long> unreachableEndpoints = new ConcurrentHashMap<>();
  
      /* initial seeds for joining the cluster */
      @VisibleForTesting
@@@ -638,14 -529,12 +634,13 @@@
          }
  
          liveEndpoints.remove(endpoint);
-         inflightEcho.remove(endpoint);
          unreachableEndpoints.remove(endpoint);
 -        MessagingService.instance().resetVersion(endpoint);
 +        MessagingService.instance().versions.reset(endpoint);
          quarantineEndpoint(endpoint);
 -        MessagingService.instance().destroyConnectionPool(endpoint);
 -        if (logger.isDebugEnabled())
 -            logger.debug("removing endpoint {}", endpoint);
 +        MessagingService.instance().closeOutbound(endpoint);
 +        MessagingService.instance().removeInbound(endpoint);
 +        logger.debug("removing endpoint {}", endpoint);
 +        GossiperDiagnostics.removedEndpoint(this, endpoint);
      }
  
      /**
@@@ -1279,52 -1118,32 +1274,20 @@@
  
      }
  
 -    private void markAlive(final InetAddress addr, final EndpointState localState)
 +    private void markAlive(final InetAddressAndPort addr, final EndpointState localState)
      {
-         if (inflightEcho.contains(addr))
 -        if (MessagingService.instance().getVersion(addr) < MessagingService.VERSION_20)
--        {
 -            realMarkAlive(addr, localState);
--            return;
--        }
-         inflightEcho.add(addr);
--
          localState.markDead();
  
 -        MessageOut<EchoMessage> echoMessage = new MessageOut<EchoMessage>(MessagingService.Verb.ECHO, EchoMessage.instance, EchoMessage.serializer);
 -        logger.trace("Sending a EchoMessage to {}", addr);
 -        IAsyncCallback echoHandler = new IAsyncCallback()
 +        Message<NoPayload> echoMessage = Message.out(ECHO_REQ, noPayload);
 +        logger.trace("Sending ECHO_REQ to {}", addr);
-         RequestCallback echoHandler = new RequestCallback()
++        RequestCallback echoHandler = msg ->
          {
-             @Override
-             public void onResponse(Message msg)
-             {
-                 // force processing of the echo response onto the gossip stage, as it comes in on the REQUEST_RESPONSE stage
-                 runInGossipStageBlocking(() -> {
-                     try
-                     {
-                         realMarkAlive(addr, localState);
-                     }
-                     finally
-                     {
-                         inflightEcho.remove(addr);
-                     }
-                 });
-             }
- 
-             @Override
-             public boolean invokeOnFailure()
 -            public boolean isLatencyForSnitch()
--            {
-                 return true;
 -                return false;
--            }
--
-             @Override
-             public void onFailure(InetAddressAndPort from, RequestFailureReason failureReason)
 -            public void response(MessageIn msg)
--            {
-                 inflightEcho.remove(addr);
 -                runInGossipStageBlocking(() -> realMarkAlive(addr, localState));
--            }
++            runInGossipStageBlocking(() -> realMarkAlive(addr, localState));
          };
  
 -        MessagingService.instance().sendRR(echoMessage, addr, echoHandler);
 +        MessagingService.instance().sendWithCallback(echoMessage, addr, echoHandler);
 +
 +        GossiperDiagnostics.markedAlive(this, addr, localState);
      }
  
      @VisibleForTesting
@@@ -1360,21 -1179,6 +1323,20 @@@
              subscriber.onDead(addr, localState);
          if (logger.isTraceEnabled())
              logger.trace("Notified {}", subscribers);
 +
 +        GossiperDiagnostics.markedDead(this, addr, localState);
 +    }
 +
 +    /**
 +     * Used by {@link #markDead(InetAddressAndPort, EndpointState)} and {@link #addSavedEndpoint(InetAddressAndPort)}
 +     * to register a endpoint as dead.  This method is "silent" to avoid triggering listeners, diagnostics, or logs
 +     * on startup via addSavedEndpoint.
 +     */
 +    private void silentlyMarkDead(InetAddressAndPort addr, EndpointState localState)
 +    {
 +        localState.markDead();
 +        liveEndpoints.remove(addr);
-         inflightEcho.remove(addr);
 +        unreachableEndpoints.put(addr, System.nanoTime());
      }
  
      /**
@@@ -2246,15 -1870,13 +2208,13 @@@
          Uninterruptibles.sleepUninterruptibly(GOSSIP_SETTLE_MIN_WAIT_MS, TimeUnit.MILLISECONDS);
          int totalPolls = 0;
          int numOkay = 0;
 -        int epSize = Gossiper.instance.getEndpointStates().size();
 +        int epSize = Gossiper.instance.getEndpointCount();
-         int liveSize = Gossiper.instance.getLiveMembers().size();
          while (numOkay < GOSSIP_SETTLE_POLL_SUCCESSES_REQUIRED)
          {
              Uninterruptibles.sleepUninterruptibly(GOSSIP_SETTLE_POLL_INTERVAL_MS, TimeUnit.MILLISECONDS);
 -            int currentSize = Gossiper.instance.getEndpointStates().size();
 +            int currentSize = Gossiper.instance.getEndpointCount();
-             int currentLive = Gossiper.instance.getLiveMembers().size();
              totalPolls++;
-             if (currentSize == epSize && currentLive == liveSize)
+             if (currentSize == epSize)
              {
                  logger.debug("Gossip looks settled.");
                  numOkay++;


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