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


The following commit(s) were added to refs/heads/cassandra-4.0 by this push:
     new 6fa548f9e9 Revert "Allow internal address to change with reconnecting 
snitches"
6fa548f9e9 is described below

commit 6fa548f9e97ff317307ba23411e570f292a23793
Author: Brandon Williams <[email protected]>
AuthorDate: Mon Jul 10 10:04:32 2023 -0500

    Revert "Allow internal address to change with reconnecting snitches"
    
    This reverts commit b791644fda91b343a679bb0c2c1e33e594524636.
    
    Patch by brandonwilliams; reviewed by bereng for CASSANDRa-18560
---
 CHANGES.txt                                             |  1 +
 src/java/org/apache/cassandra/gms/EndpointState.java    |  5 -----
 src/java/org/apache/cassandra/gms/Gossiper.java         | 17 -----------------
 .../cassandra/locator/ReconnectableSnitchHelper.java    |  8 ++------
 src/java/org/apache/cassandra/net/MessagingService.java |  7 -------
 .../cassandra/net/OutboundConnectionSettings.java       |  4 ++--
 6 files changed, 5 insertions(+), 37 deletions(-)

diff --git a/CHANGES.txt b/CHANGES.txt
index 937dd869e9..c151e9dc78 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,4 +1,5 @@
 4.0.11
+ * Revert CASSANDRA-16718 (CASSANDRA-18560)
  * Upgrade snappy to 1.1.10.1 (CASSANDRA-18608)
  * Fix assertion error when describing mv as table (CASSANDRA-18596)
  * Track the amount of read data per row (CASSANDRA-18513)
diff --git a/src/java/org/apache/cassandra/gms/EndpointState.java 
b/src/java/org/apache/cassandra/gms/EndpointState.java
index fe29c4bbcc..b8d56263e7 100644
--- a/src/java/org/apache/cassandra/gms/EndpointState.java
+++ b/src/java/org/apache/cassandra/gms/EndpointState.java
@@ -86,11 +86,6 @@ public class EndpointState
         return applicationState.get().get(key);
     }
 
-    public void removeApplicationState(ApplicationState key)
-    {
-        applicationState.get().remove(key);
-    }
-
     public boolean containsApplicationState(ApplicationState key)
     {
         return applicationState.get().containsKey(key);
diff --git a/src/java/org/apache/cassandra/gms/Gossiper.java 
b/src/java/org/apache/cassandra/gms/Gossiper.java
index 4e1e6e14fa..ad9c8c3784 100644
--- a/src/java/org/apache/cassandra/gms/Gossiper.java
+++ b/src/java/org/apache/cassandra/gms/Gossiper.java
@@ -1153,23 +1153,6 @@ public class Gossiper implements 
IFailureDetectionEventListener, GossiperMBean
         return 
UUID.fromString(epStates.get(endpoint).getApplicationState(ApplicationState.HOST_ID).value);
     }
 
-    public InetAddressAndPort getInternalAddressAndPort(InetAddressAndPort 
endpoint)
-    {
-        try
-        {
-            String internal = getApplicationState(endpoint, 
ApplicationState.INTERNAL_ADDRESS_AND_PORT);
-            if (internal == null)
-                internal = getApplicationState(endpoint, 
ApplicationState.INTERNAL_IP);
-            if (internal == null)
-                return endpoint;
-            return InetAddressAndPort.getByName(internal);
-        }
-        catch (UnknownHostException e)
-        {
-            throw new RuntimeException(e);
-        }
-    }
-
     /**
      * The value for the provided application state for the provided endpoint 
as currently known by this Gossip instance.
      *
diff --git 
a/src/java/org/apache/cassandra/locator/ReconnectableSnitchHelper.java 
b/src/java/org/apache/cassandra/locator/ReconnectableSnitchHelper.java
index 7bb38cb491..dea8c76f4e 100644
--- a/src/java/org/apache/cassandra/locator/ReconnectableSnitchHelper.java
+++ b/src/java/org/apache/cassandra/locator/ReconnectableSnitchHelper.java
@@ -91,7 +91,7 @@ public class ReconnectableSnitchHelper implements 
IEndpointStateChangeSubscriber
             VersionedValue address = 
epState.getApplicationState(ApplicationState.INTERNAL_ADDRESS_AND_PORT);
             if (address == null)
             {
-                address = 
epState.getApplicationState(ApplicationState.INTERNAL_IP);
+                address = 
epState.getApplicationState(ApplicationState.INTERNAL_ADDRESS_AND_PORT);
             }
             if (address != null)
             {
@@ -129,11 +129,7 @@ public class ReconnectableSnitchHelper implements 
IEndpointStateChangeSubscriber
 
     public void onDead(InetAddressAndPort endpoint, EndpointState state)
     {
-        if (preferLocal && 
state.getApplicationState(ApplicationState.INTERNAL_ADDRESS_AND_PORT) != null)
-            
state.removeApplicationState(ApplicationState.INTERNAL_ADDRESS_AND_PORT);
-        if (preferLocal && 
state.getApplicationState(ApplicationState.INTERNAL_IP) != null)
-            state.removeApplicationState(ApplicationState.INTERNAL_IP);
-        MessagingService.instance().closeOutboundNow(endpoint);
+        // do nothing.
     }
 
     public void onRemove(InetAddressAndPort endpoint)
diff --git a/src/java/org/apache/cassandra/net/MessagingService.java 
b/src/java/org/apache/cassandra/net/MessagingService.java
index cd124ad719..71f2231eb2 100644
--- a/src/java/org/apache/cassandra/net/MessagingService.java
+++ b/src/java/org/apache/cassandra/net/MessagingService.java
@@ -370,13 +370,6 @@ public final class MessagingService extends 
MessagingServiceMBeanImpl
                 .addListener(future -> channelManagers.remove(to, pool));
     }
 
-    public void closeOutboundNow(InetAddressAndPort to)
-    {
-        OutboundConnections pool = channelManagers.get(to);
-        if (pool != null)
-            closeOutboundNow(pool);
-    }
-
     /**
      * Only to be invoked once we believe the connections will never be used 
again.
      */
diff --git a/src/java/org/apache/cassandra/net/OutboundConnectionSettings.java 
b/src/java/org/apache/cassandra/net/OutboundConnectionSettings.java
index d9038ee487..92a1f52bc3 100644
--- a/src/java/org/apache/cassandra/net/OutboundConnectionSettings.java
+++ b/src/java/org/apache/cassandra/net/OutboundConnectionSettings.java
@@ -27,7 +27,7 @@ import org.apache.cassandra.config.Config;
 import org.apache.cassandra.config.DatabaseDescriptor;
 import org.apache.cassandra.config.EncryptionOptions;
 import org.apache.cassandra.config.EncryptionOptions.ServerEncryptionOptions;
-import org.apache.cassandra.gms.Gossiper;
+import org.apache.cassandra.db.SystemKeyspace;
 import org.apache.cassandra.locator.IEndpointSnitch;
 import org.apache.cassandra.locator.InetAddressAndPort;
 import org.apache.cassandra.utils.FBUtilities;
@@ -452,7 +452,7 @@ public class OutboundConnectionSettings
     {
         InetAddressAndPort connectTo = this.connectTo;
         if (connectTo == null)
-            connectTo = Gossiper.instance.getInternalAddressAndPort(to);
+            connectTo = SystemKeyspace.getPreferredIP(to);
         if (FBUtilities.getBroadcastAddressAndPort().equals(connectTo))
             return FBUtilities.getLocalAddressAndPort();
         return connectTo;


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

Reply via email to