Repository: cassandra
Updated Branches:
  refs/heads/trunk d31ed0f51 -> 9192e4dff


Simplify TableParams defaults

patch by Aleksey Yeschenko; reviewed by Jason Brown for CASSANDRA-14378


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

Branch: refs/heads/trunk
Commit: 9192e4dff3e800749e0da1f8853d2144bdd8c938
Parents: d31ed0f
Author: Aleksey Yeshchenko <alek...@apple.com>
Authored: Wed Apr 11 19:08:13 2018 +0100
Committer: Aleksey Yeshchenko <alek...@apple.com>
Committed: Mon Apr 16 15:07:57 2018 +0100

----------------------------------------------------------------------
 .../apache/cassandra/schema/TableParams.java    | 35 +++++++-------------
 .../reads/PercentileSpeculativeRetryPolicy.java |  2 ++
 .../org/apache/cassandra/hints/HintTest.java    |  2 +-
 3 files changed, 15 insertions(+), 24 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/9192e4df/src/java/org/apache/cassandra/schema/TableParams.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/schema/TableParams.java 
b/src/java/org/apache/cassandra/schema/TableParams.java
index 1489c81..b7f6806 100644
--- a/src/java/org/apache/cassandra/schema/TableParams.java
+++ b/src/java/org/apache/cassandra/schema/TableParams.java
@@ -34,6 +34,8 @@ 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,
@@ -60,19 +62,6 @@ public final class TableParams
         }
     }
 
-    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 static final SpeculativeRetryPolicy DEFAULT_SPECULATIVE_RETRY = new 
PercentileSpeculativeRetryPolicy(99.0);
-
-    public static final TableParams DEFAULT = TableParams.builder().build();
-
     public final String comment;
     public final double readRepairChance;
     public final double dcLocalReadRepairChance;
@@ -282,17 +271,17 @@ public final class TableParams
 
     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 String comment = "";
+        private double readRepairChance = 0.0;
+        private double dcLocalReadRepairChance = 0.1;
         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 SpeculativeRetryPolicy speculativeRetry = 
DEFAULT_SPECULATIVE_RETRY;
+        public Double crcCheckChance = 1.0;
+        private int gcGraceSeconds = 864000; // 10 days
+        private int defaultTimeToLive = 0;
+        private int memtableFlushPeriodInMs = 0;
+        private int minIndexInterval = 128;
+        private int maxIndexInterval = 2048;
+        private SpeculativeRetryPolicy speculativeRetry = 
PercentileSpeculativeRetryPolicy.NINETY_NINE_P;
         private CachingParams caching = CachingParams.DEFAULT;
         private CompactionParams compaction = CompactionParams.DEFAULT;
         private CompressionParams compression = CompressionParams.DEFAULT;

http://git-wip-us.apache.org/repos/asf/cassandra/blob/9192e4df/src/java/org/apache/cassandra/service/reads/PercentileSpeculativeRetryPolicy.java
----------------------------------------------------------------------
diff --git 
a/src/java/org/apache/cassandra/service/reads/PercentileSpeculativeRetryPolicy.java
 
b/src/java/org/apache/cassandra/service/reads/PercentileSpeculativeRetryPolicy.java
index b7ccd4c..9bf5d95 100644
--- 
a/src/java/org/apache/cassandra/service/reads/PercentileSpeculativeRetryPolicy.java
+++ 
b/src/java/org/apache/cassandra/service/reads/PercentileSpeculativeRetryPolicy.java
@@ -29,6 +29,8 @@ import org.apache.cassandra.schema.TableParams;
 
 public class PercentileSpeculativeRetryPolicy implements SpeculativeRetryPolicy
 {
+    public static final PercentileSpeculativeRetryPolicy NINETY_NINE_P = new 
PercentileSpeculativeRetryPolicy(99.0);
+
     private static final Pattern PATTERN = 
Pattern.compile("^(?<val>[0-9.]+)p(ercentile)?$", Pattern.CASE_INSENSITIVE);
     private static final DecimalFormat FORMATTER = new DecimalFormat("#.####");
 

http://git-wip-us.apache.org/repos/asf/cassandra/blob/9192e4df/test/unit/org/apache/cassandra/hints/HintTest.java
----------------------------------------------------------------------
diff --git a/test/unit/org/apache/cassandra/hints/HintTest.java 
b/test/unit/org/apache/cassandra/hints/HintTest.java
index e8960f5..aac975b 100644
--- a/test/unit/org/apache/cassandra/hints/HintTest.java
+++ b/test/unit/org/apache/cassandra/hints/HintTest.java
@@ -87,7 +87,7 @@ public class HintTest
         tokenMeta.updateNormalTokens(BootStrapper.getRandomTokens(tokenMeta, 
1), local);
 
         for (TableMetadata table : Schema.instance.getTablesAndViews(KEYSPACE))
-            
MigrationManager.announceTableUpdate(table.unbuild().gcGraceSeconds(TableParams.DEFAULT_GC_GRACE_SECONDS).build(),
 true);
+            
MigrationManager.announceTableUpdate(table.unbuild().gcGraceSeconds(864000).build(),
 true);
     }
 
     @Test


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

Reply via email to