You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by ty...@apache.org on 2016/06/21 16:15:07 UTC

[1/3] cassandra git commit: Validate bloom_filter_fp_chance during table creation

Repository: cassandra
Updated Branches:
  refs/heads/trunk 063e91754 -> 6a7985d87


Validate bloom_filter_fp_chance during table creation

Patch by Arinadm Gupta; reviewed by Tyler Hobbs for CASSANDRA-11920


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

Branch: refs/heads/trunk
Commit: 9e85e85bf259cc7839226a7c93475505d262946a
Parents: 5a09627
Author: Arindam Gupta <ar...@cisco.com>
Authored: Fri Jun 17 16:06:22 2016 -0500
Committer: Tyler Hobbs <ty...@gmail.com>
Committed: Tue Jun 21 11:12:15 2016 -0500

----------------------------------------------------------------------
 CHANGES.txt                                     |  5 +-
 .../cassandra/cql3/statements/CFPropDefs.java   | 13 ++++-
 .../cassandra/utils/BloomCalculations.java      | 15 +++++-
 .../schema/CreateTableValidationTest.java       | 51 ++++++++++++++++++++
 4 files changed, 78 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/9e85e85b/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index fe4728d..36009c5 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,5 +1,6 @@
-<<<<<<< HEAD
 2.2.7
+ * Validate bloom_filter_fp_chance against lowest supported
+   value when the table is created (CASSANDRA-11920)
  * RandomAccessReader: call isEOF() only when rebuffering, not for every read operation (CASSANDRA-12013)
  * Don't send erroneous NEW_NODE notifications on restart (CASSANDRA-11038)
  * StorageService shutdown hook should use a volatile variable (CASSANDRA-11984)
@@ -28,10 +29,8 @@
  * Always close cluster with connection in CqlRecordWriter (CASSANDRA-11553)
  * Fix slice queries on ordered COMPACT tables (CASSANDRA-10988)
 Merged from 2.1:
-=======
 2.1.15
  * Remove distinction between non-existing static columns and existing but null in LWTs (CASSANDRA-9842)
->>>>>>> asf/cassandra-2.1
  * Support mlockall on IBM POWER arch (CASSANDRA-11576)
  * Cache local ranges when calculating repair neighbors (CASSANDRA-11933)
  * Allow LWT operation on static column with only partition keys (CASSANDRA-10532)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/9e85e85b/src/java/org/apache/cassandra/cql3/statements/CFPropDefs.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/cql3/statements/CFPropDefs.java b/src/java/org/apache/cassandra/cql3/statements/CFPropDefs.java
index d897cb7..c02e78e 100644
--- a/src/java/org/apache/cassandra/cql3/statements/CFPropDefs.java
+++ b/src/java/org/apache/cassandra/cql3/statements/CFPropDefs.java
@@ -26,6 +26,7 @@ import org.apache.cassandra.db.compaction.AbstractCompactionStrategy;
 import org.apache.cassandra.exceptions.ConfigurationException;
 import org.apache.cassandra.exceptions.SyntaxException;
 import org.apache.cassandra.io.compress.CompressionParameters;
+import org.apache.cassandra.utils.BloomCalculations;
 
 public class CFPropDefs extends PropertyDefinitions
 {
@@ -211,7 +212,17 @@ public class CFPropDefs extends PropertyDefinitions
             cfm.compactionStrategyOptions(new HashMap<>(getCompactionOptions()));
         }
 
-        cfm.bloomFilterFpChance(getDouble(KW_BF_FP_CHANCE, cfm.getBloomFilterFpChance()));
+        double bloomFilterFpChance = getDouble(KW_BF_FP_CHANCE, cfm.getBloomFilterFpChance());
+        double minBloomFilterFpChanceValue = BloomCalculations.minSupportedBloomFilterFpChance();
+        if (bloomFilterFpChance <=  minBloomFilterFpChanceValue || bloomFilterFpChance > 1)
+        {
+            throw new ConfigurationException(String.format(
+                    "%s must be larger than %s and less than or equal to 1.0 (got %s)",
+                    KW_BF_FP_CHANCE,
+                    minBloomFilterFpChanceValue,
+                    bloomFilterFpChance));
+        }
+        cfm.bloomFilterFpChance(bloomFilterFpChance);
 
         if (!getCompressionOptions().isEmpty())
             cfm.compressionParameters(CompressionParameters.create(getCompressionOptions()));

http://git-wip-us.apache.org/repos/asf/cassandra/blob/9e85e85b/src/java/org/apache/cassandra/utils/BloomCalculations.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/utils/BloomCalculations.java b/src/java/org/apache/cassandra/utils/BloomCalculations.java
index b73f531..7ba5452 100644
--- a/src/java/org/apache/cassandra/utils/BloomCalculations.java
+++ b/src/java/org/apache/cassandra/utils/BloomCalculations.java
@@ -26,8 +26,8 @@ package org.apache.cassandra.utils;
  * Filter class by helping to choose correct values of 'bits per element' and
  * 'number of hash functions, k'.
  */
-class BloomCalculations {
-
+public class BloomCalculations
+{
     private static final int minBuckets = 2;
     private static final int minK = 1;
 
@@ -182,4 +182,15 @@ class BloomCalculations {
         }
         return Math.min(BloomCalculations.probs.length - 1, (int)v);
     }
+
+    /**
+     * Retrieves the minimum supported BloomFilterFpChance value
+     * @return Minimum supported value for BloomFilterFpChance
+     */
+    public static double minSupportedBloomFilterFpChance()
+    {
+        int maxBuckets = probs.length - 1;
+        int maxK = probs[maxBuckets].length - 1;
+        return probs[maxBuckets][maxK];
+    }
 }

http://git-wip-us.apache.org/repos/asf/cassandra/blob/9e85e85b/test/unit/org/apache/cassandra/schema/CreateTableValidationTest.java
----------------------------------------------------------------------
diff --git a/test/unit/org/apache/cassandra/schema/CreateTableValidationTest.java b/test/unit/org/apache/cassandra/schema/CreateTableValidationTest.java
new file mode 100644
index 0000000..9708552
--- /dev/null
+++ b/test/unit/org/apache/cassandra/schema/CreateTableValidationTest.java
@@ -0,0 +1,51 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.cassandra.schema;
+
+import org.apache.cassandra.cql3.CQLTester;
+import org.apache.cassandra.exceptions.ConfigurationException;
+import org.junit.Test;
+
+import static org.junit.Assert.fail;
+
+public class CreateTableValidationTest extends CQLTester
+{
+    private static final String KEYSPACE1 = "CreateTableValidationTest";
+
+    @Test
+    public void testInvalidBloomFilterFPRatio() throws Throwable
+    {
+        try
+        {
+            createTableMayThrow("CREATE TABLE %s (a int PRIMARY KEY, b int) WITH bloom_filter_fp_chance = 0.0000001");
+            fail("Expected an fp chance of 0.0000001 to be rejected");
+        }
+        catch (ConfigurationException exc) { }
+
+        try
+        {
+            createTableMayThrow("CREATE TABLE %s (a int PRIMARY KEY, b int) WITH bloom_filter_fp_chance = 1.1");
+            fail("Expected an fp chance of 1.1 to be rejected");
+        }
+        catch (ConfigurationException exc) { }
+
+        // sanity check
+        createTable("CREATE TABLE %s (a int PRIMARY KEY, b int) WITH bloom_filter_fp_chance = 0.1");
+    }
+}


[3/3] cassandra git commit: Merge branch 'cassandra-3.0' into trunk

Posted by ty...@apache.org.
Merge branch 'cassandra-3.0' into trunk

Conflicts:
	src/java/org/apache/cassandra/schema/TableParams.java


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

Branch: refs/heads/trunk
Commit: 6a7985d87a794e95c5e17a3aa9d73c5ed42177ff
Parents: 063e917 621d08a
Author: Tyler Hobbs <ty...@gmail.com>
Authored: Tue Jun 21 11:14:09 2016 -0500
Committer: Tyler Hobbs <ty...@gmail.com>
Committed: Tue Jun 21 11:14:09 2016 -0500

----------------------------------------------------------------------
 CHANGES.txt                                     |  2 +
 .../apache/cassandra/schema/TableParams.java    |  7 ++-
 .../cassandra/utils/BloomCalculations.java      | 15 +++++-
 .../schema/CreateTableValidationTest.java       | 51 ++++++++++++++++++++
 4 files changed, 71 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/6a7985d8/CHANGES.txt
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/cassandra/blob/6a7985d8/src/java/org/apache/cassandra/schema/TableParams.java
----------------------------------------------------------------------
diff --cc src/java/org/apache/cassandra/schema/TableParams.java
index 16b4427,29d3e29..02112af
--- a/src/java/org/apache/cassandra/schema/TableParams.java
+++ b/src/java/org/apache/cassandra/schema/TableParams.java
@@@ -25,7 -25,7 +25,8 @@@ import com.google.common.base.Objects
  import com.google.common.collect.ImmutableMap;
  
  import org.apache.cassandra.exceptions.ConfigurationException;
+ import org.apache.cassandra.utils.BloomCalculations;
 +
  import static java.lang.String.format;
  
  public final class TableParams


[2/3] cassandra git commit: Merge branch 'cassandra-2.2' into cassandra-3.0

Posted by ty...@apache.org.
Merge branch 'cassandra-2.2' into cassandra-3.0


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

Branch: refs/heads/trunk
Commit: 621d08a1464d43d828c8eceed57f45268e89a3c3
Parents: 723a143 9e85e85
Author: Tyler Hobbs <ty...@gmail.com>
Authored: Tue Jun 21 11:13:12 2016 -0500
Committer: Tyler Hobbs <ty...@gmail.com>
Committed: Tue Jun 21 11:13:12 2016 -0500

----------------------------------------------------------------------
 CHANGES.txt                                     |  2 +
 .../apache/cassandra/schema/TableParams.java    |  7 ++-
 .../cassandra/utils/BloomCalculations.java      | 15 +++++-
 .../schema/CreateTableValidationTest.java       | 51 ++++++++++++++++++++
 4 files changed, 71 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/621d08a1/CHANGES.txt
----------------------------------------------------------------------
diff --cc CHANGES.txt
index cc682c4,36009c5..134a5e1
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@@ -1,33 -1,9 +1,35 @@@
 -2.2.7
 +3.0.8
 + * Fix upgrading schema with super columns with non-text subcomparators (CASSANDRA-12023)
 + * Add TimeWindowCompactionStrategy (CASSANDRA-9666)
 +Merged from 2.2:
+  * Validate bloom_filter_fp_chance against lowest supported
+    value when the table is created (CASSANDRA-11920)
 - * RandomAccessReader: call isEOF() only when rebuffering, not for every read operation (CASSANDRA-12013)
   * Don't send erroneous NEW_NODE notifications on restart (CASSANDRA-11038)
   * StorageService shutdown hook should use a volatile variable (CASSANDRA-11984)
 +Merged from 2.1:
 + * Cache local ranges when calculating repair neighbors (CASSANDRA-11934)
 + * Allow LWT operation on static column with only partition keys (CASSANDRA-10532)
 + * Create interval tree over canonical sstables to avoid missing sstables during streaming (CASSANDRA-11886)
 + * cqlsh COPY FROM: shutdown parent cluster after forking, to avoid corrupting SSL connections (CASSANDRA-11749)
 +
 +
 +3.0.7
 + * Fix legacy serialization of Thrift-generated non-compound range tombstones
 +   when communicating with 2.x nodes (CASSANDRA-11930)
 + * Fix Directories instantiations where CFS.initialDirectories should be used (CASSANDRA-11849)
 + * Avoid referencing DatabaseDescriptor in AbstractType (CASSANDRA-11912)
 + * Fix sstables not being protected from removal during index build (CASSANDRA-11905)
 + * cqlsh: Suppress stack trace from Read/WriteFailures (CASSANDRA-11032)
 + * Remove unneeded code to repair index summaries that have
 +   been improperly down-sampled (CASSANDRA-11127)
 + * Avoid WriteTimeoutExceptions during commit log replay due to materialized
 +   view lock contention (CASSANDRA-11891)
 + * Prevent OOM failures on SSTable corruption, improve tests for corruption detection (CASSANDRA-9530)
 + * Use CFS.initialDirectories when clearing snapshots (CASSANDRA-11705)
 + * Allow compaction strategies to disable early open (CASSANDRA-11754)
 + * Refactor Materialized View code (CASSANDRA-11475)
 + * Update Java Driver (CASSANDRA-11615)
 +Merged from 2.2:
   * Persist local metadata earlier in startup sequence (CASSANDRA-11742)
   * Run CommitLog tests with different compression settings (CASSANDRA-9039)
   * cqlsh: fix tab completion for case-sensitive identifiers (CASSANDRA-11664)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/621d08a1/src/java/org/apache/cassandra/schema/TableParams.java
----------------------------------------------------------------------
diff --cc src/java/org/apache/cassandra/schema/TableParams.java
index 7e44e73,0000000..29d3e29
mode 100644,000000..100644
--- a/src/java/org/apache/cassandra/schema/TableParams.java
+++ b/src/java/org/apache/cassandra/schema/TableParams.java
@@@ -1,377 -1,0 +1,380 @@@
 +/*
 + * Licensed to the Apache Software Foundation (ASF) under one
 + * or more contributor license agreements.  See the NOTICE file
 + * distributed with this work for additional information
 + * regarding copyright ownership.  The ASF licenses this file
 + * to you under the Apache License, Version 2.0 (the
 + * "License"); you may not use this file except in compliance
 + * with the License.  You may obtain a copy of the License at
 + *
 + *     http://www.apache.org/licenses/LICENSE-2.0
 + *
 + * Unless required by applicable law or agreed to in writing, software
 + * distributed under the License is distributed on an "AS IS" BASIS,
 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 + * See the License for the specific language governing permissions and
 + * limitations under the License.
 + */
 +package org.apache.cassandra.schema;
 +
 +import java.nio.ByteBuffer;
 +import java.util.Map;
 +
 +import com.google.common.base.MoreObjects;
 +import com.google.common.base.Objects;
 +import com.google.common.collect.ImmutableMap;
 +
 +import org.apache.cassandra.exceptions.ConfigurationException;
++import org.apache.cassandra.utils.BloomCalculations;
 +import static java.lang.String.format;
 +
 +public final class TableParams
 +{
 +    public static final TableParams DEFAULT = TableParams.builder().build();
 +
 +    public enum Option
 +    {
 +        BLOOM_FILTER_FP_CHANCE,
 +        CACHING,
 +        COMMENT,
 +        COMPACTION,
 +        COMPRESSION,
 +        DCLOCAL_READ_REPAIR_CHANCE,
 +        DEFAULT_TIME_TO_LIVE,
 +        EXTENSIONS,
 +        GC_GRACE_SECONDS,
 +        MAX_INDEX_INTERVAL,
 +        MEMTABLE_FLUSH_PERIOD_IN_MS,
 +        MIN_INDEX_INTERVAL,
 +        READ_REPAIR_CHANCE,
 +        SPECULATIVE_RETRY,
 +        CRC_CHECK_CHANCE;
 +
 +        @Override
 +        public String toString()
 +        {
 +            return name().toLowerCase();
 +        }
 +    }
 +
 +    public static final String DEFAULT_COMMENT = "";
 +    public static final double DEFAULT_READ_REPAIR_CHANCE = 0.0;
 +    public static final double DEFAULT_DCLOCAL_READ_REPAIR_CHANCE = 0.1;
 +    public static final int DEFAULT_GC_GRACE_SECONDS = 864000; // 10 days
 +    public static final int DEFAULT_DEFAULT_TIME_TO_LIVE = 0;
 +    public static final int DEFAULT_MEMTABLE_FLUSH_PERIOD_IN_MS = 0;
 +    public static final int DEFAULT_MIN_INDEX_INTERVAL = 128;
 +    public static final int DEFAULT_MAX_INDEX_INTERVAL = 2048;
 +    public static final double DEFAULT_CRC_CHECK_CHANCE = 1.0;
 +
 +    public final String comment;
 +    public final double readRepairChance;
 +    public final double dcLocalReadRepairChance;
 +    public final double bloomFilterFpChance;
 +    public final double crcCheckChance;
 +    public final int gcGraceSeconds;
 +    public final int defaultTimeToLive;
 +    public final int memtableFlushPeriodInMs;
 +    public final int minIndexInterval;
 +    public final int maxIndexInterval;
 +    public final SpeculativeRetryParam speculativeRetry;
 +    public final CachingParams caching;
 +    public final CompactionParams compaction;
 +    public final CompressionParams compression;
 +    public final ImmutableMap<String, ByteBuffer> extensions;
 +
 +    private TableParams(Builder builder)
 +    {
 +        comment = builder.comment;
 +        readRepairChance = builder.readRepairChance;
 +        dcLocalReadRepairChance = builder.dcLocalReadRepairChance;
 +        bloomFilterFpChance = builder.bloomFilterFpChance == null
 +                            ? builder.compaction.defaultBloomFilterFbChance()
 +                            : builder.bloomFilterFpChance;
 +        crcCheckChance = builder.crcCheckChance;
 +        gcGraceSeconds = builder.gcGraceSeconds;
 +        defaultTimeToLive = builder.defaultTimeToLive;
 +        memtableFlushPeriodInMs = builder.memtableFlushPeriodInMs;
 +        minIndexInterval = builder.minIndexInterval;
 +        maxIndexInterval = builder.maxIndexInterval;
 +        speculativeRetry = builder.speculativeRetry;
 +        caching = builder.caching;
 +        compaction = builder.compaction;
 +        compression = builder.compression;
 +        extensions = builder.extensions;
 +    }
 +
 +    public static Builder builder()
 +    {
 +        return new Builder();
 +    }
 +
 +    public static Builder builder(TableParams params)
 +    {
 +        return new Builder().bloomFilterFpChance(params.bloomFilterFpChance)
 +                            .caching(params.caching)
 +                            .comment(params.comment)
 +                            .compaction(params.compaction)
 +                            .compression(params.compression)
 +                            .dcLocalReadRepairChance(params.dcLocalReadRepairChance)
 +                            .crcCheckChance(params.crcCheckChance)
 +                            .defaultTimeToLive(params.defaultTimeToLive)
 +                            .gcGraceSeconds(params.gcGraceSeconds)
 +                            .maxIndexInterval(params.maxIndexInterval)
 +                            .memtableFlushPeriodInMs(params.memtableFlushPeriodInMs)
 +                            .minIndexInterval(params.minIndexInterval)
 +                            .readRepairChance(params.readRepairChance)
 +                            .speculativeRetry(params.speculativeRetry)
 +                            .extensions(params.extensions);
 +    }
 +
 +    public void validate()
 +    {
 +        compaction.validate();
 +        compression.validate();
 +
-         if (bloomFilterFpChance <= 0 || bloomFilterFpChance > 1)
++        double minBloomFilterFpChanceValue = BloomCalculations.minSupportedBloomFilterFpChance();
++        if (bloomFilterFpChance <=  minBloomFilterFpChanceValue || bloomFilterFpChance > 1)
 +        {
-             fail("%s must be larger than 0.0 and less than or equal to 1.0 (got %s)",
++            fail("%s must be larger than %s and less than or equal to 1.0 (got %s)",
 +                 Option.BLOOM_FILTER_FP_CHANCE,
++                 minBloomFilterFpChanceValue,
 +                 bloomFilterFpChance);
 +        }
 +
 +        if (dcLocalReadRepairChance < 0 || dcLocalReadRepairChance > 1.0)
 +        {
 +            fail("%s must be larger than or equal to 0 and smaller than or equal to 1.0 (got %s)",
 +                 Option.DCLOCAL_READ_REPAIR_CHANCE,
 +                 dcLocalReadRepairChance);
 +        }
 +
 +        if (readRepairChance < 0 || readRepairChance > 1.0)
 +        {
 +            fail("%s must be larger than or equal to 0 and smaller than or equal to 1.0 (got %s)",
 +                 Option.READ_REPAIR_CHANCE,
 +                 readRepairChance);
 +        }
 +
 +        if (crcCheckChance < 0 || crcCheckChance > 1.0)
 +        {
 +            fail("%s must be larger than or equal to 0 and smaller than or equal to 1.0 (got %s)",
 +                 Option.CRC_CHECK_CHANCE,
 +                 crcCheckChance);
 +        }
 +
 +        if (defaultTimeToLive < 0)
 +            fail("%s must be greater than or equal to 0 (got %s)", Option.DEFAULT_TIME_TO_LIVE, defaultTimeToLive);
 +
 +        if (gcGraceSeconds < 0)
 +            fail("%s must be greater than or equal to 0 (got %s)", Option.GC_GRACE_SECONDS, gcGraceSeconds);
 +
 +        if (minIndexInterval < 1)
 +            fail("%s must be greater than or equal to 1 (got %s)", Option.MIN_INDEX_INTERVAL, minIndexInterval);
 +
 +        if (maxIndexInterval < minIndexInterval)
 +        {
 +            fail("%s must be greater than or equal to %s (%s) (got %s)",
 +                 Option.MAX_INDEX_INTERVAL,
 +                 Option.MIN_INDEX_INTERVAL,
 +                 minIndexInterval,
 +                 maxIndexInterval);
 +        }
 +
 +        if (memtableFlushPeriodInMs < 0)
 +            fail("%s must be greater than or equal to 0 (got %s)", Option.MEMTABLE_FLUSH_PERIOD_IN_MS, memtableFlushPeriodInMs);
 +    }
 +
 +    private static void fail(String format, Object... args)
 +    {
 +        throw new ConfigurationException(format(format, args));
 +    }
 +
 +    @Override
 +    public boolean equals(Object o)
 +    {
 +        if (this == o)
 +            return true;
 +
 +        if (!(o instanceof TableParams))
 +            return false;
 +
 +        TableParams p = (TableParams) o;
 +
 +        return comment.equals(p.comment)
 +            && readRepairChance == p.readRepairChance
 +            && dcLocalReadRepairChance == p.dcLocalReadRepairChance
 +            && bloomFilterFpChance == p.bloomFilterFpChance
 +            && crcCheckChance == p.crcCheckChance
 +            && gcGraceSeconds == p.gcGraceSeconds
 +            && defaultTimeToLive == p.defaultTimeToLive
 +            && memtableFlushPeriodInMs == p.memtableFlushPeriodInMs
 +            && minIndexInterval == p.minIndexInterval
 +            && maxIndexInterval == p.maxIndexInterval
 +            && speculativeRetry.equals(p.speculativeRetry)
 +            && caching.equals(p.caching)
 +            && compaction.equals(p.compaction)
 +            && compression.equals(p.compression)
 +            && extensions.equals(p.extensions);
 +    }
 +
 +    @Override
 +    public int hashCode()
 +    {
 +        return Objects.hashCode(comment,
 +                                readRepairChance,
 +                                dcLocalReadRepairChance,
 +                                bloomFilterFpChance,
 +                                crcCheckChance,
 +                                gcGraceSeconds,
 +                                defaultTimeToLive,
 +                                memtableFlushPeriodInMs,
 +                                minIndexInterval,
 +                                maxIndexInterval,
 +                                speculativeRetry,
 +                                caching,
 +                                compaction,
 +                                compression,
 +                                extensions);
 +    }
 +
 +    @Override
 +    public String toString()
 +    {
 +        return MoreObjects.toStringHelper(this)
 +                          .add(Option.COMMENT.toString(), comment)
 +                          .add(Option.READ_REPAIR_CHANCE.toString(), readRepairChance)
 +                          .add(Option.DCLOCAL_READ_REPAIR_CHANCE.toString(), dcLocalReadRepairChance)
 +                          .add(Option.BLOOM_FILTER_FP_CHANCE.toString(), bloomFilterFpChance)
 +                          .add(Option.CRC_CHECK_CHANCE.toString(), crcCheckChance)
 +                          .add(Option.GC_GRACE_SECONDS.toString(), gcGraceSeconds)
 +                          .add(Option.DEFAULT_TIME_TO_LIVE.toString(), defaultTimeToLive)
 +                          .add(Option.MEMTABLE_FLUSH_PERIOD_IN_MS.toString(), memtableFlushPeriodInMs)
 +                          .add(Option.MIN_INDEX_INTERVAL.toString(), minIndexInterval)
 +                          .add(Option.MAX_INDEX_INTERVAL.toString(), maxIndexInterval)
 +                          .add(Option.SPECULATIVE_RETRY.toString(), speculativeRetry)
 +                          .add(Option.CACHING.toString(), caching)
 +                          .add(Option.COMPACTION.toString(), compaction)
 +                          .add(Option.COMPRESSION.toString(), compression)
 +                          .add(Option.EXTENSIONS.toString(), extensions)
 +                          .toString();
 +    }
 +
 +    public static final class Builder
 +    {
 +        private String comment = DEFAULT_COMMENT;
 +        private double readRepairChance = DEFAULT_READ_REPAIR_CHANCE;
 +        private double dcLocalReadRepairChance = DEFAULT_DCLOCAL_READ_REPAIR_CHANCE;
 +        private Double bloomFilterFpChance;
 +        public Double crcCheckChance = DEFAULT_CRC_CHECK_CHANCE;
 +        private int gcGraceSeconds = DEFAULT_GC_GRACE_SECONDS;
 +        private int defaultTimeToLive = DEFAULT_DEFAULT_TIME_TO_LIVE;
 +        private int memtableFlushPeriodInMs = DEFAULT_MEMTABLE_FLUSH_PERIOD_IN_MS;
 +        private int minIndexInterval = DEFAULT_MIN_INDEX_INTERVAL;
 +        private int maxIndexInterval = DEFAULT_MAX_INDEX_INTERVAL;
 +        private SpeculativeRetryParam speculativeRetry = SpeculativeRetryParam.DEFAULT;
 +        private CachingParams caching = CachingParams.DEFAULT;
 +        private CompactionParams compaction = CompactionParams.DEFAULT;
 +        private CompressionParams compression = CompressionParams.DEFAULT;
 +        private ImmutableMap<String, ByteBuffer> extensions = ImmutableMap.of();
 +
 +        public Builder()
 +        {
 +        }
 +
 +        public TableParams build()
 +        {
 +            return new TableParams(this);
 +        }
 +
 +        public Builder comment(String val)
 +        {
 +            comment = val;
 +            return this;
 +        }
 +
 +        public Builder readRepairChance(double val)
 +        {
 +            readRepairChance = val;
 +            return this;
 +        }
 +
 +        public Builder dcLocalReadRepairChance(double val)
 +        {
 +            dcLocalReadRepairChance = val;
 +            return this;
 +        }
 +
 +        public Builder bloomFilterFpChance(double val)
 +        {
 +            bloomFilterFpChance = val;
 +            return this;
 +        }
 +
 +        public Builder crcCheckChance(double val)
 +        {
 +            crcCheckChance = val;
 +            return this;
 +        }
 +
 +        public Builder gcGraceSeconds(int val)
 +        {
 +            gcGraceSeconds = val;
 +            return this;
 +        }
 +
 +        public Builder defaultTimeToLive(int val)
 +        {
 +            defaultTimeToLive = val;
 +            return this;
 +        }
 +
 +        public Builder memtableFlushPeriodInMs(int val)
 +        {
 +            memtableFlushPeriodInMs = val;
 +            return this;
 +        }
 +
 +        public Builder minIndexInterval(int val)
 +        {
 +            minIndexInterval = val;
 +            return this;
 +        }
 +
 +        public Builder maxIndexInterval(int val)
 +        {
 +            maxIndexInterval = val;
 +            return this;
 +        }
 +
 +        public Builder speculativeRetry(SpeculativeRetryParam val)
 +        {
 +            speculativeRetry = val;
 +            return this;
 +        }
 +
 +        public Builder caching(CachingParams val)
 +        {
 +            caching = val;
 +            return this;
 +        }
 +
 +        public Builder compaction(CompactionParams val)
 +        {
 +            compaction = val;
 +            return this;
 +        }
 +
 +        public Builder compression(CompressionParams val)
 +        {
 +            compression = val;
 +            return this;
 +        }
 +
 +        public Builder extensions(Map<String, ByteBuffer> val)
 +        {
 +            extensions = ImmutableMap.copyOf(val);
 +            return this;
 +        }
 +    }
 +}