cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jbel...@apache.org
Subject [1/6] git commit: restrict max_num_tokens to 1536 patch by jbellis; reviewed by brandonwilliams and Quentin Conner for CASSANDRA-6267
Date Wed, 30 Oct 2013 15:46:18 GMT
Updated Branches:
  refs/heads/cassandra-1.2 7793a8521 -> 620bb80ec
  refs/heads/cassandra-2.0 d4b5b0dbc -> 392be16b6
  refs/heads/trunk d39ec221b -> 91d60fbce


restrict max_num_tokens to 1536
patch by jbellis; reviewed by brandonwilliams and Quentin Conner for CASSANDRA-6267


Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/620bb80e
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/620bb80e
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/620bb80e

Branch: refs/heads/cassandra-1.2
Commit: 620bb80eccda228573e0c8f821d766c16f89d2ea
Parents: 7793a85
Author: Jonathan Ellis <jbellis@apache.org>
Authored: Wed Oct 30 10:44:33 2013 -0500
Committer: Jonathan Ellis <jbellis@apache.org>
Committed: Wed Oct 30 10:44:33 2013 -0500

----------------------------------------------------------------------
 CHANGES.txt                                                 | 1 +
 .../org/apache/cassandra/config/DatabaseDescriptor.java     | 9 +++++++++
 2 files changed, 10 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/620bb80e/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index 8d47047..6d95cef 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -6,6 +6,7 @@
  * Fix potential stack overflow during range tombstones insertion (CASSANDRA-6181)
  * (Hadoop) Make LOCAL_ONE the default consistency level (CASSANDRA-6214)
  * Require logging in for Thrift CQL2/3 statement preparation (CASSANDRA-6254)
+ * restrict max_num_tokens to 1536 (CASSANDRA-6267)
 
 
 1.2.11

http://git-wip-us.apache.org/repos/asf/cassandra/blob/620bb80e/src/java/org/apache/cassandra/config/DatabaseDescriptor.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/config/DatabaseDescriptor.java b/src/java/org/apache/cassandra/config/DatabaseDescriptor.java
index 65a20cc..2d29dde 100644
--- a/src/java/org/apache/cassandra/config/DatabaseDescriptor.java
+++ b/src/java/org/apache/cassandra/config/DatabaseDescriptor.java
@@ -62,6 +62,12 @@ public class DatabaseDescriptor
 {
     private static final Logger logger = LoggerFactory.getLogger(DatabaseDescriptor.class);
 
+    /**
+     * Tokens are serialized in a Gossip VersionedValue String.  VV are restricted to 64KB
+     * when we send them over the wire, which works out to about 1700 tokens.
+     */
+    private static final int MAX_NUM_TOKENS = 1536;
+
     private static IEndpointSnitch snitch;
     private static InetAddress listenAddress; // leave null so we can fall through to getLocalHost
     private static InetAddress broadcastAddress;
@@ -448,6 +454,9 @@ public class DatabaseDescriptor
                 for (String token : tokensFromString(conf.initial_token))
                     partitioner.getTokenFactory().validate(token);
 
+            if (conf.num_tokens > MAX_NUM_TOKENS)
+                throw new ConfigurationException(String.format("A maximum number of %d tokens
per node is supported", MAX_NUM_TOKENS));
+
             try
             {
                 // if key_cache_size_in_mb option was set to "auto" then size of the cache
should be "min(5% of Heap (in MB), 100MB)


Mime
View raw message