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

ifesdjeen pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/cassandra.git

commit bf1ea945b6fb1efb1730a3b8973325a26d51be39
Merge: 095540d 56f6cd9
Author: Alex Petrov <[email protected]>
AuthorDate: Thu Oct 22 09:50:14 2020 +0200

    Merge branch 'cassandra-3.11' into trunk

 src/java/org/apache/cassandra/gms/Gossiper.java            | 14 +++++++++-----
 src/java/org/apache/cassandra/service/LoadBroadcaster.java |  2 ++
 2 files changed, 11 insertions(+), 5 deletions(-)

diff --cc src/java/org/apache/cassandra/gms/Gossiper.java
index 8f8d535,0e46767..316a3cd
--- a/src/java/org/apache/cassandra/gms/Gossiper.java
+++ b/src/java/org/apache/cassandra/gms/Gossiper.java
@@@ -32,8 -31,7 +32,9 @@@ import com.google.common.annotations.Vi
  import com.google.common.base.Throwables;
  import com.google.common.collect.ImmutableList;
  import com.google.common.collect.ImmutableMap;
 +import com.google.common.collect.Iterables;
 +import com.google.common.collect.ImmutableSet;
+ import com.google.common.collect.Sets;
  import com.google.common.util.concurrent.ListenableFutureTask;
  import com.google.common.util.concurrent.Uninterruptibles;
  
@@@ -757,9 -692,6 +758,8 @@@ public class Gossiper implements IFailu
                  tokens = 
Collections.singletonList(StorageService.instance.getTokenMetadata().partitioner.getRandomToken());
              }
  
-             // do not pass go, do not collect 200 dollars, just gtfo
 +            long expireTime = computeExpireTime();
 +            epState.addApplicationState(ApplicationState.STATUS_WITH_PORT, 
StorageService.instance.valueFactory.left(tokens, expireTime));
              epState.addApplicationState(ApplicationState.STATUS, 
StorageService.instance.valueFactory.left(tokens, computeExpireTime()));
              handleMajorStateChange(endpoint, epState);
              Uninterruptibles.sleepUninterruptibly(intervalInMillis * 4, 
TimeUnit.MILLISECONDS);
@@@ -784,16 -716,16 +784,16 @@@
       * @param epSet   a set of endpoint from which a random endpoint is 
chosen.
       * @return true if the chosen endpoint is also a seed.
       */
 -    private boolean sendGossip(MessageOut<GossipDigestSyn> message, 
Set<InetAddress> epSet)
 +    private boolean sendGossip(Message<GossipDigestSyn> message, 
Set<InetAddressAndPort> epSet)
      {
-         List<InetAddressAndPort> liveEndpoints = ImmutableList.copyOf(epSet);
 -        List<InetAddress> endpoints = ImmutableList.copyOf(epSet);
++        List<InetAddressAndPort> endpoints = ImmutableList.copyOf(epSet);
  
-         int size = liveEndpoints.size();
+         int size = endpoints.size();
          if (size < 1)
              return false;
          /* Generate a random number from 0 -> size */
          int index = (size == 1) ? 0 : random.nextInt(size);
-         InetAddressAndPort to = liveEndpoints.get(index);
 -        InetAddress to = endpoints.get(index);
++        InetAddressAndPort to = endpoints.get(index);
          if (logger.isTraceEnabled())
              logger.trace("Sending a GossipDigestSyn to {} ...", to);
          if (firstSynSendAt == 0)
@@@ -825,7 -754,8 +825,10 @@@
              double prob = unreachableEndpointCount / (liveEndpointCount + 1);
              double randDbl = random.nextDouble();
              if (randDbl < prob)
-                 sendGossip(message, unreachableEndpoints.keySet());
++            {
+                 sendGossip(message, Sets.filter(unreachableEndpoints.keySet(),
 -                                                ep -> 
!isDeadState(endpointStateMap.get(ep))));
++                                                ep -> 
!isDeadState(getEndpointStateMap().get(ep))));
++            }
          }
      }
  


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to