You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by aw...@apache.org on 2022/10/06 18:13:37 UTC

[cassandra] branch trunk updated (472dc30faa -> d62d845c7d)

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

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


    from 472dc30faa Merge branch 'cassandra-4.1' into trunk
     new 3bdd2caa22 Fix StorageService.getNativeaddress handling of IPv6 addresses
     new 9524c22990 Merge branch 'cassandra-4.0' into cassandra-4.1
     new d62d845c7d Merge branch 'cassandra-4.1' into trunk

The 3 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 +
 .../apache/cassandra/service/StorageService.java   | 27 +++++++++++++++++++---
 .../service/StorageServiceServerTest.java          | 22 ++++++++++++++++++
 3 files changed, 47 insertions(+), 3 deletions(-)


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


[cassandra] 01/03: Fix StorageService.getNativeaddress handling of IPv6 addresses

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

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

commit 3bdd2caa22a0413929188536b41d8117177574fa
Author: Andy Tolbert <68...@users.noreply.github.com>
AuthorDate: Thu Oct 6 14:04:38 2022 -0400

    Fix StorageService.getNativeaddress handling of IPv6 addresses
    
    StorageService.getNativeaddress does not currently correctly handle
    IPv6 addresses correctly when NATIVE_ADDRESS_AND_PORT are not present in
    that it simply concatenates the IP address with the default native port,
    e.g.:
    
    0:0:0:0:0:0:5a:3:9042
    
    This does not parse into an InetSocketAddress as the address and port
    can't be disambiguated.
    
    Such a case would usually be present when there are 3.x nodes present in a
    cluster with 4.0 nodes.
    
    Change updates RPC_ADDRESS and else case to create InetAddressAndPort instances
    with DatabaseDescriptor.getNativeTransportPort and returns the
    getHostAddress(withPort) which properly bracket encodes the address,
    e.g.:
    
    [0:0:0:0:0:0:5a:3]:9042
    
    which can be parsed as an InetSocketAddress.
    
    patch by Andy Tolbert; reviewed by Ariel Weisberg, Brandon Williams for CASSANDRA-17945
---
 CHANGES.txt                                        |  1 +
 .../apache/cassandra/service/StorageService.java   | 27 +++++++++++++++++++---
 .../service/StorageServiceServerTest.java          | 22 ++++++++++++++++++
 3 files changed, 47 insertions(+), 3 deletions(-)

diff --git a/CHANGES.txt b/CHANGES.txt
index 15bc6413ad..d48edb9a4f 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,4 +1,5 @@
 4.0.7
+ * Fix StorageService.getNativeaddress handling of IPv6 addresses (CASSANDRA-17945)
  * Mitigate direct buffer memory OOM on replacements (CASSANDRA-17895)
  * Fix repair failure on assertion if two peers have overlapping mismatching ranges (CASSANDRA-17900)
  * Better handle null state in Gossip schema migration to avoid NPE (CASSANDRA-17864)
diff --git a/src/java/org/apache/cassandra/service/StorageService.java b/src/java/org/apache/cassandra/service/StorageService.java
index 7e70e4ce20..b70347a301 100644
--- a/src/java/org/apache/cassandra/service/StorageService.java
+++ b/src/java/org/apache/cassandra/service/StorageService.java
@@ -1975,10 +1975,31 @@ public class StorageService extends NotificationBroadcasterSupport implements IE
                 throw new RuntimeException(e);
             }
         }
-        else if (Gossiper.instance.getEndpointStateForEndpoint(endpoint).getApplicationState(ApplicationState.RPC_ADDRESS) == null)
-            return endpoint.address.getHostAddress() + ":" + DatabaseDescriptor.getNativeTransportPort();
         else
-            return Gossiper.instance.getEndpointStateForEndpoint(endpoint).getApplicationState(ApplicationState.RPC_ADDRESS).value + ":" + DatabaseDescriptor.getNativeTransportPort();
+        {
+             final String ipAddress;
+             // If RPC_ADDRESS present in gossip for this endpoint use it.  This is expected for 3.x nodes.
+             if (Gossiper.instance.getEndpointStateForEndpoint(endpoint).getApplicationState(ApplicationState.RPC_ADDRESS) != null)
+             {
+                 ipAddress = Gossiper.instance.getEndpointStateForEndpoint(endpoint).getApplicationState(ApplicationState.RPC_ADDRESS).value;
+             }
+             else
+             {
+                 // otherwise just use the IP of the endpoint itself.
+                 ipAddress = endpoint.getHostAddress(false);
+             }
+
+             // include the configured native_transport_port.
+             try
+             {
+                 InetAddressAndPort address = InetAddressAndPort.getByNameOverrideDefaults(ipAddress, DatabaseDescriptor.getNativeTransportPort());
+                 return address.getHostAddress(withPort);
+             }
+             catch (UnknownHostException e)
+             {
+                 throw new RuntimeException(e);
+             }
+         }
     }
 
     public Map<List<String>, List<String>> getRangeToRpcaddressMap(String keyspace)
diff --git a/test/unit/org/apache/cassandra/service/StorageServiceServerTest.java b/test/unit/org/apache/cassandra/service/StorageServiceServerTest.java
index b5ddd35514..60bed4c64d 100644
--- a/test/unit/org/apache/cassandra/service/StorageServiceServerTest.java
+++ b/test/unit/org/apache/cassandra/service/StorageServiceServerTest.java
@@ -641,6 +641,28 @@ public class StorageServiceServerTest
         assertEquals("127.0.0.3:666", StorageService.instance.getNativeaddress(internalAddress, true));
     }
 
+    @Test
+    public void testGetNativeAddressIPV6() throws Exception
+    {
+        // Ensure IPv6 addresses are properly bracketed in RFC2732 (https://datatracker.ietf.org/doc/html/rfc2732) format when including ports.
+        // See https://issues.apache.org/jira/browse/CASSANDRA-17945 for more context.
+        String internalAddressIPV6String = "[0:0:0:0:0:0:0:3]:666";
+        InetAddressAndPort internalAddressIPV6 = InetAddressAndPort.getByName(internalAddressIPV6String);
+        Gossiper.instance.addSavedEndpoint(internalAddressIPV6);
+
+        //Default to using the provided address with the configured port
+        assertEquals("[0:0:0:0:0:0:0:3]:" + DatabaseDescriptor.getNativeTransportPort(), StorageService.instance.getNativeaddress(internalAddressIPV6, true));
+
+        VersionedValue.VersionedValueFactory valueFactory =  new VersionedValue.VersionedValueFactory(Murmur3Partitioner.instance);
+        //If RPC_ADDRESS is present with an IPv6 address, we should properly bracket encode the IP with the configured port.
+        Gossiper.instance.getEndpointStateForEndpoint(internalAddressIPV6).addApplicationState(ApplicationState.RPC_ADDRESS, valueFactory.rpcaddress(InetAddress.getByName("0:0:0:0:0:0:5a:3")));
+        assertEquals("[0:0:0:0:0:0:5a:3]:" + DatabaseDescriptor.getNativeTransportPort(), StorageService.instance.getNativeaddress(internalAddressIPV6, true));
+
+        //If we have the address and port in gossip use that
+        Gossiper.instance.getEndpointStateForEndpoint(internalAddressIPV6).addApplicationState(ApplicationState.NATIVE_ADDRESS_AND_PORT, valueFactory.nativeaddressAndPort(InetAddressAndPort.getByName("[0:0:0:0:0:0:5c:3]:8675")));
+        assertEquals("[0:0:0:0:0:0:5c:3]:8675", StorageService.instance.getNativeaddress(internalAddressIPV6, true));
+    }
+
     @Test
     public void testAuditLogEnableLoggerNotFound() throws Exception
     {


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


[cassandra] 03/03: Merge branch 'cassandra-4.1' into trunk

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

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

commit d62d845c7d86b6ca5ea4d63042123d1b3802ae5e
Merge: 472dc30faa 9524c22990
Author: Ariel Weisberg <aw...@apple.com>
AuthorDate: Thu Oct 6 14:11:50 2022 -0400

    Merge branch 'cassandra-4.1' into trunk

 CHANGES.txt                                        |  1 +
 .../apache/cassandra/service/StorageService.java   | 27 +++++++++++++++++++---
 .../service/StorageServiceServerTest.java          | 22 ++++++++++++++++++
 3 files changed, 47 insertions(+), 3 deletions(-)

diff --cc CHANGES.txt
index 3c4c1785d2,6a04c99148..c418c48ba9
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@@ -88,6 -37,6 +88,7 @@@ Merged from 4.1
   * Revert removal of withBufferSizeInMB(int size) in CQLSSTableWriter.Builder class and deprecate it in favor of withBufferSizeInMiB(int size) (CASSANDRA-17675)
   * Remove expired snapshots of dropped tables after restart (CASSANDRA-17619)
  Merged from 4.0:
++ * Fix StorageService.getNativeaddress handling of IPv6 addresses (CASSANDRA-17945)
   * Mitigate direct buffer memory OOM on replacements (CASSANDRA-17895)
   * Fix repair failure on assertion if two peers have overlapping mismatching ranges (CASSANDRA-17900)
   * Better handle null state in Gossip schema migration to avoid NPE (CASSANDRA-17864)


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


[cassandra] 02/03: Merge branch 'cassandra-4.0' into cassandra-4.1

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

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

commit 9524c22990de62d42c7909ff4e2635e238e7ee48
Merge: fb4974d455 3bdd2caa22
Author: Ariel Weisberg <aw...@apple.com>
AuthorDate: Thu Oct 6 14:11:00 2022 -0400

    Merge branch 'cassandra-4.0' into cassandra-4.1

 CHANGES.txt                                        |  1 +
 .../apache/cassandra/service/StorageService.java   | 27 +++++++++++++++++++---
 .../service/StorageServiceServerTest.java          | 22 ++++++++++++++++++
 3 files changed, 47 insertions(+), 3 deletions(-)

diff --cc CHANGES.txt
index 41a625cec9,d48edb9a4f..6a04c99148
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@@ -1,41 -1,5 +1,42 @@@
 -4.0.7
 +4.1-beta2
 + * Allow pre-V5 global limit on bytes in flight to revert to zero asynchronously in RateLimitingTest (CASSANDRA-17927)
 +Merged from 4.0:
+  * Fix StorageService.getNativeaddress handling of IPv6 addresses (CASSANDRA-17945)
 +Merged from 3.11:
 + * Make LongBufferPoolTest insensitive to timing (CASSANDRA-16681)
 +Merged from 3.0:
 + * Fix auto-completing "WITH" when creating a materialized view (CASSANDRA-17879)
 +
 +4.1-beta1
 + * We should not emit deprecation warning on startup for `key_cache_save_period`, `row_cache_save_period`, `counter_cache_save_period` (CASSANDRA-17904)
 + * upsert with adder support is not consistent with numbers and strings in LWT (CASSANDRA-17857)
 + * Fix race and return after failing connections (CASSANDRA-17618)
 + * Speculative execution threshold unit mismatch (CASSANDRA-17877)
 + * Fix BulkLoader to load entireSSTableThrottle and entireSSTableInterDcThrottle (CASSANDRA-17677)
 + * Fix a race condition where a keyspace can be oopened while it is being removed (CASSANDRA-17658)
 + * DatabaseDescriptor will set the default failure detector during client initialization (CASSANDRA-17782)
 + * Avoid initializing schema via SystemKeyspace.getPreferredIP() with the BulkLoader tool (CASSANDRA-17740)
 + * Improve JMX methods signatures, fix JMX and config backward compatibility (CASSANDRA-17725)
 + * Fix sstable_preemptive_open_interval disabled value. sstable_preemptive_open_interval = null backward compatible with
 +   sstable_preemptive_open_interval_in_mb = -1 (CASSANDRA-17737)
 + * Remove usages of Path#toFile() in the snapshot apparatus (CASSANDRA-17769)
 + * Fix Settings Virtual Table to update paxos_variant after startup and rename enable_uuid_sstable_identifiers to
 +   uuid_sstable_identifiers_enabled as per our config naming conventions (CASSANDRA-17738)
 + * index_summary_resize_interval_in_minutes = -1 is equivalent to index_summary_resize_interval being set to null or
 +   disabled. JMX MBean IndexSummaryManager, setResizeIntervalInMinutes method still takes resizeIntervalInMinutes = -1 for disabled (CASSANDRA-17735)
 + * min_tracked_partition_size_bytes parameter from 4.1 alpha1 was renamed to min_tracked_partition_size (CASSANDRA-17733)
 + * Remove commons-lang dependency during build runtime (CASSANDRA-17724)
 + * Relax synchronization on StreamSession#onError() to avoid deadlock (CASSANDRA-17706)
 + * Fix AbstractCell#toString throws MarshalException for cell in collection (CASSANDRA-17695)
 + * Add new vtable output option to compactionstats (CASSANDRA-17683)
 + * Fix commitLogUpperBound initialization in AbstractMemtableWithCommitlog (CASSANDRA-17587)
 + * Fix widening to long in getBatchSizeFailThreshold (CASSANDRA-17650)
 + * Fix widening from mebibytes to bytes in IntMebibytesBound (CASSANDRA-17716)
 + * Revert breaking change in nodetool clientstats and expose cient options through nodetool clientstats --client-options. (CASSANDRA-17715)
 + * Fix missed nowInSec values in QueryProcessor (CASSANDRA-17458)
 + * Revert removal of withBufferSizeInMB(int size) in CQLSSTableWriter.Builder class and deprecate it in favor of withBufferSizeInMiB(int size) (CASSANDRA-17675)
 + * Remove expired snapshots of dropped tables after restart (CASSANDRA-17619)
 +Merged from 4.0:
   * Mitigate direct buffer memory OOM on replacements (CASSANDRA-17895)
   * Fix repair failure on assertion if two peers have overlapping mismatching ranges (CASSANDRA-17900)
   * Better handle null state in Gossip schema migration to avoid NPE (CASSANDRA-17864)


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