cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jbel...@apache.org
Subject [2/3] git commit: disallow bloom filter false positive chance of 0 patch by jbellis and brandonwilliams for CASSANDRA-5013
Date Mon, 07 Jan 2013 15:40:32 GMT
disallow bloom filter false positive chance of 0
patch by jbellis and brandonwilliams for CASSANDRA-5013


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

Branch: refs/heads/trunk
Commit: dac6048c50a8dff0b4522c669c2f7115876483eb
Parents: 3d787b7
Author: Jonathan Ellis <jbellis@apache.org>
Authored: Fri Jan 4 12:16:33 2013 -0600
Committer: Jonathan Ellis <jbellis@apache.org>
Committed: Mon Jan 7 09:36:41 2013 -0600

----------------------------------------------------------------------
 CHANGES.txt                                        |    1 +
 .../org/apache/cassandra/config/CFMetaData.java    |    6 +++++-
 .../apache/cassandra/io/sstable/SSTableWriter.java |   10 +---------
 3 files changed, 7 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/dac6048c/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index 95aad22..78643d5 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,4 +1,5 @@
 1.2.1
+ * disallow bloom filter false positive chance of 0 (CASSANDRA-5013)
  * add threadpool size adjustment methods to JMXEnabledThreadPoolExecutor and 
    CompactionManagerMBean (CASSANDRA-5044)
  * Improve handling a changing target throttle rate mid-compaction (CASSANDRA-5087)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/dac6048c/src/java/org/apache/cassandra/config/CFMetaData.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/config/CFMetaData.java b/src/java/org/apache/cassandra/config/CFMetaData.java
index 3a2e2b6..5f6c1fe 100644
--- a/src/java/org/apache/cassandra/config/CFMetaData.java
+++ b/src/java/org/apache/cassandra/config/CFMetaData.java
@@ -536,7 +536,8 @@ public final class CFMetaData
 
     public double getBloomFilterFpChance()
     {
-        return bloomFilterFpChance == null
+        // we disallow bFFPC==null starting in 1.2.1 but tolerated it before that
+        return (bloomFilterFpChance == null || bloomFilterFpChance == 0)
                ? compactionStrategyClass == LeveledCompactionStrategy.class ? 0.1 : 0.01
                : bloomFilterFpChance;
     }
@@ -1125,6 +1126,9 @@ public final class CFMetaData
 
         validateCompactionThresholds();
 
+        if (bloomFilterFpChance != null && bloomFilterFpChance == 0)
+            throw new ConfigurationException("Zero false positives is impossible; bloom filter
false positive chance bffpc must be 0 < bffpc <= 1");
+
         return this;
     }
 

http://git-wip-us.apache.org/repos/asf/cassandra/blob/dac6048c/src/java/org/apache/cassandra/io/sstable/SSTableWriter.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/io/sstable/SSTableWriter.java b/src/java/org/apache/cassandra/io/sstable/SSTableWriter.java
index a3a8fe9..f578064 100644
--- a/src/java/org/apache/cassandra/io/sstable/SSTableWriter.java
+++ b/src/java/org/apache/cassandra/io/sstable/SSTableWriter.java
@@ -442,15 +442,7 @@ public class SSTableWriter extends SSTable
                                               !DatabaseDescriptor.populateIOCacheOnFlush());
             builder = SegmentedFile.getBuilder(DatabaseDescriptor.getIndexAccessMode());
             summary = new IndexSummary(keyCount);
-
-            double fpChance = metadata.getBloomFilterFpChance();
-            if (fpChance == 0)
-            {
-                // paranoia -- we've had bugs in the thrift <-> avro <-> CfDef
dance before, let's not let that break things
-                logger.error("Bloom filter FP chance of zero isn't supposed to happen");
-                fpChance = 0.01;
-            }
-            bf = FilterFactory.getFilter(keyCount, fpChance, true);
+            bf = FilterFactory.getFilter(keyCount, metadata.getBloomFilterFpChance(), true);
         }
 
         public void append(DecoratedKey key, RowIndexEntry indexEntry)


Mime
View raw message