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

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

commit d8babd01911fc3301950df2b7ce5839b644c8a8b
Merge: e415019f64 332341b9b6
Author: Sam Tunnicliffe <s...@apache.org>
AuthorDate: Mon Jan 13 09:53:59 2025 +0000

    Merge branch 'cassandra-5.0' into trunk

 CHANGES.txt                                        |   1 +
 src/java/org/apache/cassandra/config/Config.java   |   1 +
 .../cassandra/config/DatabaseDescriptor.java       |  52 +++++++
 .../exceptions/OversizedCQLMessageException.java   |  27 ++++
 .../cassandra/net/AbstractMessageHandler.java      |   4 +-
 .../cassandra/transport/CQLMessageHandler.java     | 112 +++++++++++++-
 .../cassandra/transport/ExceptionHandlers.java     |   5 +
 .../transport/InitialConnectionHandler.java        |   3 +-
 .../cassandra/transport/PipelineConfigurator.java  |   2 +
 .../apache/cassandra/transport/SimpleClient.java   |   1 +
 .../transport/AuthMessageSizeLimitTest.java        | 104 +++++++++++++
 .../transport/ClientResourceLimitsTest.java        | 105 ++++---------
 .../cassandra/transport/MessageSizeLimitTest.java  | 124 ++++++++++++++++
 .../transport/NativeProtocolLimitsTestBase.java    | 165 +++++++++++++++++++++
 .../cassandra/transport/RateLimitingTest.java      |  69 +++------
 15 files changed, 635 insertions(+), 140 deletions(-)

diff --cc CHANGES.txt
index a61f78fed7,46ab465be2..c4f76c6fd1
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@@ -137,19 -48,7 +137,20 @@@ Merged from 5.0
   * Prioritize built indexes in IndexStatusManager (CASSANDRA-19400)
   * Add java.base/java.lang.reflect among opens for jvm11-client.options 
(CASSANDRA-19780)
  Merged from 4.1:
++ * Enforce CQL message size limit on multiframe messages (CASSANDRA-20052)
 + * Fix race condition in DecayingEstimatedHistogramReservoir during rescale 
(CASSANDRA-19365)
  Merged from 4.0:
 + * IndexOutOfBoundsException when accessing partition where the column was 
deleted (CASSANDRA-20108)
 + * Enhance CQLSSTableWriter to notify clients on sstable production 
(CASSANDRA-19800)
 + * Change the resolution of AbstractCommitLogService#lastSyncedAt to nanos to 
be aligned with later comparisons (CASSANDRA-20074)
 + * Support UDTs and vectors as clustering keys in descending order 
(CASSANDRA-20050)
 + * Fix CQL in snapshot's schema which did not contained UDTs used as reverse 
clustering columns (CASSANDRA-20036)
 + * Add configurable batchlog endpoint strategies: random_remote, 
prefer_local, dynamic_remote, and dynamic (CASSANDRA-18120)
 + * Fix bash-completion for debian distro (CASSANDRA-19999)
 + * Ensure thread-safety for CommitLogArchiver in CommitLog (CASSANDRA-19960)
 + * Fix text containing "/*" being interpreted as multiline comment in cqlsh 
(CASSANDRA-17667)
 + * Fix indexing of a frozen collection that is the clustering key and 
reversed (CASSANDRA-19889)
 + * Emit error when altering a table with non-frozen UDTs with nested 
non-frozen collections the same way as done upon table creation 
(CASSANDRA-19925)
   * Safer handling of out-of-range tokens (CASSANDRA-13704)
   * Fix memory leak in BTree.FastBuilder (CASSANDRA-19785)
   * Fix millisecond and microsecond precision for commit log replay 
(CASSANDRA-19448)
diff --cc src/java/org/apache/cassandra/config/DatabaseDescriptor.java
index fe44930ed0,89b47ba9ae..0f0e6e6177
--- a/src/java/org/apache/cassandra/config/DatabaseDescriptor.java
+++ b/src/java/org/apache/cassandra/config/DatabaseDescriptor.java
@@@ -228,6 -202,11 +228,9 @@@ public class DatabaseDescripto
      private static long counterCacheSizeInMiB;
      private static long indexSummaryCapacityInMiB;
  
+     private static volatile long nativeTransportMaxMessageSizeInBytes;
+     private static volatile boolean 
nativeTransportMaxMessageSizeConfiguredExplicitly;
+ 
 -    private static String localDC;
 -    private static Comparator<Replica> localComparator;
      private static EncryptionContext encryptionContext;
      private static boolean hasLoggedConfig;
  
@@@ -969,24 -897,44 +972,41 @@@
          else if (conf.commitlog_segment_size.toKibibytes() < 2 * 
conf.max_mutation_size.toKibibytes())
              throw new ConfigurationException("commitlog_segment_size must be 
at least twice the size of max_mutation_size / 1024", false);
  
+         if (conf.native_transport_max_message_size == null)
+         {
+             conf.native_transport_max_message_size = new 
DataStorageSpec.LongBytesBound(calculateDefaultNativeTransportMaxMessageSizeInBytes());
+         }
+         else
+         {
+             nativeTransportMaxMessageSizeConfiguredExplicitly = true;
+             long maxCqlMessageSize = 
conf.native_transport_max_message_size.toBytes();
+             if (maxCqlMessageSize > 
conf.native_transport_max_request_data_in_flight.toBytes())
+                 throw new 
ConfigurationException("native_transport_max_message_size must not exceed 
native_transport_max_request_data_in_flight", false);
+ 
+             if (maxCqlMessageSize > 
conf.native_transport_max_request_data_in_flight_per_ip.toBytes())
+                 throw new 
ConfigurationException("native_transport_max_message_size must not exceed 
native_transport_max_request_data_in_flight_per_ip", false);
+ 
+         }
+         nativeTransportMaxMessageSizeInBytes = 
conf.native_transport_max_message_size.toBytes();
+ 
          // native transport encryption options
          if (conf.client_encryption_options != null)
 -        {
              conf.client_encryption_options.applyConfig();
  
 -            if (conf.native_transport_port_ssl != null)
 -            {
 -                logger.warn("Usage of dual ports (native_transport_port 
together with native_transport_port_ssl) is " +
 -                            "deprecated since Cassandra 5.0 and it will be 
removed in next releases. Please consider to use one port only " +
 -                            "(native_transport_port) which can support 
unencrypted as well as encrypted traffic. This feature " +
 -                            "is effectively not functioning properly except a 
corner-case of having a cluster " +
 -                            "consisting of just one node. For more 
information, please consult deprecation " +
 -                            "section in NEWS.txt");
 -                if (conf.native_transport_port_ssl != 
conf.native_transport_port
 -                    && (conf.client_encryption_options.tlsEncryptionPolicy() 
== EncryptionOptions.TlsEncryptionPolicy.UNENCRYPTED))
 -                {
 -                    throw new ConfigurationException("Encryption must be 
enabled in client_encryption_options for native_transport_port_ssl", false);
 -                }
 -            }
 +        if (conf.jmx_server_options == null)
 +        {
 +            conf.jmx_server_options = 
JMXServerOptions.createParsingSystemProperties();
 +        }
 +        else if (JMXServerOptions.isEnabledBySystemProperties())
 +        {
 +            throw new ConfigurationException("Configure either 
jmx_server_options in cassandra.yaml and comment out " +
 +                                             "configure_jmx function call in 
cassandra-env.sh or keep cassandra-env.sh " +
 +                                             "to call configure_jmx function 
but you have to keep jmx_server_options " +
 +                                             "in cassandra.yaml commented 
out.");
          }
  
 +        conf.jmx_server_options.jmx_encryption_options.applyConfig();
 +
          if (conf.snapshot_links_per_second < 0)
              throw new ConfigurationException("snapshot_links_per_second must 
be >= 0");
  


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

Reply via email to