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 2021/09/09 19:20:32 UTC
[cassandra] branch trunk updated: Reduce max native frame size to
16MB
This is an automated email from the ASF dual-hosted git repository.
brandonwilliams pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/cassandra.git
The following commit(s) were added to refs/heads/trunk by this push:
new 08444cb Reduce max native frame size to 16MB
08444cb is described below
commit 08444cbc3f6378f281a811d74c9cb152c8ad19ca
Author: Brandon Williams <br...@apache.org>
AuthorDate: Thu Aug 26 10:16:42 2021 -0500
Reduce max native frame size to 16MB
Patch by brandonwilliams; reviewed by blerer for CASSANDRA-16886
---
CHANGES.txt | 1 +
conf/cassandra.yaml | 4 ++--
src/java/org/apache/cassandra/config/Config.java | 2 +-
src/java/org/apache/cassandra/config/DatabaseDescriptor.java | 10 ++++++++++
.../unit/org/apache/cassandra/transport/CQLConnectionTest.java | 3 +++
5 files changed, 17 insertions(+), 3 deletions(-)
diff --git a/CHANGES.txt b/CHANGES.txt
index f0a0dfb..80ee45c 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,4 +1,5 @@
4.1
+ * Reduce native transport max frame size to 16MB (CASSANDRA-16886)
* Add support for filtering using IN restrictions (CASSANDRA-14344)
* Provide a nodetool command to invalidate auth caches (CASSANDRA-16404)
* Catch read repair timeout exceptions and add metric (CASSANDRA-16880)
diff --git a/conf/cassandra.yaml b/conf/cassandra.yaml
index ff073da..25f6eb1 100644
--- a/conf/cassandra.yaml
+++ b/conf/cassandra.yaml
@@ -710,9 +710,9 @@ native_transport_port: 9042
# native_transport_max_threads: 128
#
# The maximum size of allowed frame. Frame (requests) larger than this will
-# be rejected as invalid. The default is 256MB. If you're changing this parameter,
+# be rejected as invalid. The default is 16MB. If you're changing this parameter,
# you may want to adjust max_value_size_in_mb accordingly. This should be positive and less than 2048.
-# native_transport_max_frame_size_in_mb: 256
+# native_transport_max_frame_size_in_mb: 16
# The maximum number of concurrent client connections.
# The default is -1, which means unlimited.
diff --git a/src/java/org/apache/cassandra/config/Config.java b/src/java/org/apache/cassandra/config/Config.java
index 731b466..77607ed 100644
--- a/src/java/org/apache/cassandra/config/Config.java
+++ b/src/java/org/apache/cassandra/config/Config.java
@@ -186,7 +186,7 @@ public class Config
public int native_transport_port = 9042;
public Integer native_transport_port_ssl = null;
public int native_transport_max_threads = 128;
- public int native_transport_max_frame_size_in_mb = 256;
+ public int native_transport_max_frame_size_in_mb = 16;
public volatile long native_transport_max_concurrent_connections = -1L;
public volatile long native_transport_max_concurrent_connections_per_ip = -1L;
public boolean native_transport_flush_in_batches_legacy = false;
diff --git a/src/java/org/apache/cassandra/config/DatabaseDescriptor.java b/src/java/org/apache/cassandra/config/DatabaseDescriptor.java
index 7e80485..7a0eeb0 100644
--- a/src/java/org/apache/cassandra/config/DatabaseDescriptor.java
+++ b/src/java/org/apache/cassandra/config/DatabaseDescriptor.java
@@ -2257,6 +2257,11 @@ public class DatabaseDescriptor
return (int) ByteUnit.MEBI_BYTES.toBytes(conf.native_transport_max_frame_size_in_mb);
}
+ public static void setNativeTransportMaxFrameSize(int bytes)
+ {
+ conf.native_transport_max_frame_size_in_mb = (int) ByteUnit.MEBI_BYTES.fromBytes(bytes);
+ }
+
public static long getNativeTransportMaxConcurrentConnections()
{
return conf.native_transport_max_concurrent_connections;
@@ -3298,6 +3303,11 @@ public class DatabaseDescriptor
{
return val * multiplier;
}
+
+ public long fromBytes(int val)
+ {
+ return val / multiplier;
+ }
}
/**
diff --git a/test/unit/org/apache/cassandra/transport/CQLConnectionTest.java b/test/unit/org/apache/cassandra/transport/CQLConnectionTest.java
index 73950ae..adc82ea 100644
--- a/test/unit/org/apache/cassandra/transport/CQLConnectionTest.java
+++ b/test/unit/org/apache/cassandra/transport/CQLConnectionTest.java
@@ -59,6 +59,7 @@ import org.apache.cassandra.utils.concurrent.SimpleCondition;
import org.apache.cassandra.utils.concurrent.NonBlockingRateLimiter;
import static org.apache.cassandra.config.EncryptionOptions.TlsEncryptionPolicy.UNENCRYPTED;
+import static org.apache.cassandra.io.util.FileUtils.ONE_MB;
import static org.apache.cassandra.net.FramingTest.randomishBytes;
import static org.apache.cassandra.transport.Flusher.MAX_FRAMED_PAYLOAD_SIZE;
import static org.apache.cassandra.utils.concurrent.NonBlockingRateLimiter.NO_OP_LIMITER;
@@ -104,6 +105,8 @@ public class CQLConnectionTest
alloc = GlobalBufferPoolAllocator.instance;
// set connection-local queue size to 0 so that all capacity is allocated from reserves
DatabaseDescriptor.setNativeTransportReceiveQueueCapacityInBytes(0);
+ // set transport to max frame size possible
+ DatabaseDescriptor.setNativeTransportMaxFrameSize(256 * (int) ONE_MB);
}
@Test
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cassandra.apache.org
For additional commands, e-mail: commits-help@cassandra.apache.org