You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by al...@apache.org on 2015/03/04 05:57:01 UTC
[1/2] cassandra git commit: Fix top partitions reporting wrong
cardinality
Repository: cassandra
Updated Branches:
refs/heads/trunk 3f8806d23 -> 0014d929f
Fix top partitions reporting wrong cardinality
patch by Chris Lohfink; reviewed by Aleksey Yeschenko for CASSANDRA-8834
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/0127b696
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/0127b696
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/0127b696
Branch: refs/heads/trunk
Commit: 0127b6963ebf1c4fa407c71c12f10748b509b189
Parents: 9499f7c
Author: Chris Lohfink <Ch...@datastax.com>
Authored: Tue Mar 3 22:31:50 2015 -0600
Committer: Aleksey Yeschenko <al...@apache.org>
Committed: Tue Mar 3 20:37:17 2015 -0800
----------------------------------------------------------------------
CHANGES.txt | 1 +
src/java/org/apache/cassandra/db/ColumnFamilyStore.java | 4 ++--
src/java/org/apache/cassandra/utils/TopKSampler.java | 6 +++---
test/unit/org/apache/cassandra/utils/TopKSamplerTest.java | 8 ++++++--
4 files changed, 12 insertions(+), 7 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cassandra/blob/0127b696/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index a90dd48..7ce6200 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,4 +1,5 @@
2.1.4
+ * Fix top partitions reporting wrong cardinality (CASSANDRA-8834)
* Fix rare NPE in KeyCacheSerializer (CASSANDRA-8067)
* Pick sstables for validation as late as possible inc repairs (CASSANDRA-8366)
* Fix commitlog getPendingTasks to not increment (CASSANDRA-8856)
http://git-wip-us.apache.org/repos/asf/cassandra/blob/0127b696/src/java/org/apache/cassandra/db/ColumnFamilyStore.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/db/ColumnFamilyStore.java b/src/java/org/apache/cassandra/db/ColumnFamilyStore.java
index e4531f2..9b792b6 100644
--- a/src/java/org/apache/cassandra/db/ColumnFamilyStore.java
+++ b/src/java/org/apache/cassandra/db/ColumnFamilyStore.java
@@ -1179,7 +1179,7 @@ public class ColumnFamilyStore implements ColumnFamilyStoreMBean
Memtable mt = data.getMemtableFor(opGroup, replayPosition);
final long timeDelta = mt.put(key, columnFamily, indexer, opGroup);
maybeUpdateRowCache(key);
- metric.samplers.get(Sampler.WRITES).addSample(key.getKey());
+ metric.samplers.get(Sampler.WRITES).addSample(key.getKey(), key.hashCode(), 1);
metric.writeLatency.addNano(System.nanoTime() - start);
if(timeDelta < Long.MAX_VALUE)
metric.colUpdateTimeDeltaHistogram.update(timeDelta);
@@ -1915,7 +1915,7 @@ public class ColumnFamilyStore implements ColumnFamilyStoreMBean
columns = controller.getTopLevelColumns(Memtable.MEMORY_POOL.needToCopyOnHeap());
}
if (columns != null)
- metric.samplers.get(Sampler.READS).addSample(filter.key.getKey());
+ metric.samplers.get(Sampler.READS).addSample(filter.key.getKey(), filter.key.hashCode(), 1);
metric.updateSSTableIterated(controller.getSstablesIterated());
return columns;
}
http://git-wip-us.apache.org/repos/asf/cassandra/blob/0127b696/src/java/org/apache/cassandra/utils/TopKSampler.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/utils/TopKSampler.java b/src/java/org/apache/cassandra/utils/TopKSampler.java
index 29d46286..a8bd602 100644
--- a/src/java/org/apache/cassandra/utils/TopKSampler.java
+++ b/src/java/org/apache/cassandra/utils/TopKSampler.java
@@ -81,7 +81,7 @@ public class TopKSampler<T>
public void addSample(T item)
{
- addSample(item, 1);
+ addSample(item, item.hashCode(), 1);
}
/**
@@ -89,7 +89,7 @@ public class TopKSampler<T>
* use the "Sampler" thread pool to record results if the sampler is enabled. If not
* sampling this is a NOOP
*/
- public void addSample(final T item, final int value)
+ public void addSample(final T item, final long hash, final int value)
{
if (enabled)
{
@@ -107,7 +107,7 @@ public class TopKSampler<T>
try
{
summary.offer(item, value);
- hll.offer(item);
+ hll.offerHashed(hash);
} catch (Exception e)
{
logger.debug("Failure to offer sample", e);
http://git-wip-us.apache.org/repos/asf/cassandra/blob/0127b696/test/unit/org/apache/cassandra/utils/TopKSamplerTest.java
----------------------------------------------------------------------
diff --git a/test/unit/org/apache/cassandra/utils/TopKSamplerTest.java b/test/unit/org/apache/cassandra/utils/TopKSamplerTest.java
index dc3b91c..085fa76 100644
--- a/test/unit/org/apache/cassandra/utils/TopKSamplerTest.java
+++ b/test/unit/org/apache/cassandra/utils/TopKSamplerTest.java
@@ -12,6 +12,7 @@ import org.apache.cassandra.concurrent.StageManager;
import org.apache.cassandra.utils.TopKSampler.SamplerResult;
import org.junit.Test;
+import com.clearspring.analytics.hash.MurmurHash;
import com.clearspring.analytics.stream.Counter;
import com.google.common.collect.Maps;
import com.google.common.util.concurrent.Uninterruptibles;
@@ -32,10 +33,12 @@ public class TopKSamplerTest
sampler2.beginSampling(10);
for(int i = 1; i <= 10; i++)
{
- sampler2.addSample("item" + i, i);
+ String key = "item" + i;
+ sampler2.addSample(key, MurmurHash.hash64(key), i);
}
waitForEmpty(1000);
Assert.assertEquals(countMap(single.topK), countMap(sampler2.finishSampling(10).topK));
+ Assert.assertEquals(sampler2.hll.cardinality(), 10);
Assert.assertEquals(sampler.hll.cardinality(), sampler2.hll.cardinality());
}
@@ -116,7 +119,8 @@ public class TopKSamplerTest
{
for(int j = 0; j < i; j++)
{
- sampler.addSample("item" + i);
+ String key = "item" + i;
+ sampler.addSample(key, MurmurHash.hash64(key), 1);
}
}
}
[2/2] cassandra git commit: Merge branch 'cassandra-2.1' into trunk
Posted by al...@apache.org.
Merge branch 'cassandra-2.1' into trunk
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/0014d929
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/0014d929
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/0014d929
Branch: refs/heads/trunk
Commit: 0014d929f7504e2f41209af4d311d8105a1cd3aa
Parents: 3f8806d 0127b69
Author: Aleksey Yeschenko <al...@apache.org>
Authored: Tue Mar 3 20:56:09 2015 -0800
Committer: Aleksey Yeschenko <al...@apache.org>
Committed: Tue Mar 3 20:56:09 2015 -0800
----------------------------------------------------------------------
CHANGES.txt | 1 +
src/java/org/apache/cassandra/db/ColumnFamilyStore.java | 4 ++--
src/java/org/apache/cassandra/utils/TopKSampler.java | 6 +++---
test/unit/org/apache/cassandra/utils/TopKSamplerTest.java | 8 ++++++--
4 files changed, 12 insertions(+), 7 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cassandra/blob/0014d929/CHANGES.txt
----------------------------------------------------------------------
diff --cc CHANGES.txt
index b877cbe,7ce6200..d6cb9b4
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@@ -1,65 -1,5 +1,66 @@@
+3.0
+ * Add role based access control (CASSANDRA-7653, 8650, 7216, 8760, 8849)
+ * Avoid accessing partitioner through StorageProxy (CASSANDRA-8244, 8268)
+ * Upgrade Metrics library and remove depricated metrics (CASSANDRA-5657)
+ * Serializing Row cache alternative, fully off heap (CASSANDRA-7438)
+ * Duplicate rows returned when in clause has repeated values (CASSANDRA-6707)
+ * Make CassandraException unchecked, extend RuntimeException (CASSANDRA-8560)
+ * Support direct buffer decompression for reads (CASSANDRA-8464)
+ * DirectByteBuffer compatible LZ4 methods (CASSANDRA-7039)
+ * Group sstables for anticompaction correctly (CASSANDRA-8578)
+ * Add ReadFailureException to native protocol, respond
+ immediately when replicas encounter errors while handling
+ a read request (CASSANDRA-7886)
+ * Switch CommitLogSegment from RandomAccessFile to nio (CASSANDRA-8308)
+ * Allow mixing token and partition key restrictions (CASSANDRA-7016)
+ * Support index key/value entries on map collections (CASSANDRA-8473)
+ * Modernize schema tables (CASSANDRA-8261)
+ * Support for user-defined aggregation functions (CASSANDRA-8053)
+ * Fix NPE in SelectStatement with empty IN values (CASSANDRA-8419)
+ * Refactor SelectStatement, return IN results in natural order instead
+ of IN value list order and ignore duplicate values in partition key IN restrictions (CASSANDRA-7981)
+ * Support UDTs, tuples, and collections in user-defined
+ functions (CASSANDRA-7563)
+ * Fix aggregate fn results on empty selection, result column name,
+ and cqlsh parsing (CASSANDRA-8229)
+ * Mark sstables as repaired after full repair (CASSANDRA-7586)
+ * Extend Descriptor to include a format value and refactor reader/writer
+ APIs (CASSANDRA-7443)
+ * Integrate JMH for microbenchmarks (CASSANDRA-8151)
+ * Keep sstable levels when bootstrapping (CASSANDRA-7460)
+ * Add Sigar library and perform basic OS settings check on startup (CASSANDRA-7838)
+ * Support for aggregation functions (CASSANDRA-4914)
+ * Remove cassandra-cli (CASSANDRA-7920)
+ * Accept dollar quoted strings in CQL (CASSANDRA-7769)
+ * Make assassinate a first class command (CASSANDRA-7935)
+ * Support IN clause on any partition key column (CASSANDRA-7855)
+ * Support IN clause on any clustering column (CASSANDRA-4762)
+ * Improve compaction logging (CASSANDRA-7818)
+ * Remove YamlFileNetworkTopologySnitch (CASSANDRA-7917)
+ * Do anticompaction in groups (CASSANDRA-6851)
+ * Support user-defined functions (CASSANDRA-7395, 7526, 7562, 7740, 7781, 7929,
+ 7924, 7812, 8063, 7813, 7708)
+ * Permit configurable timestamps with cassandra-stress (CASSANDRA-7416)
+ * Move sstable RandomAccessReader to nio2, which allows using the
+ FILE_SHARE_DELETE flag on Windows (CASSANDRA-4050)
+ * Remove CQL2 (CASSANDRA-5918)
+ * Add Thrift get_multi_slice call (CASSANDRA-6757)
+ * Optimize fetching multiple cells by name (CASSANDRA-6933)
+ * Allow compilation in java 8 (CASSANDRA-7028)
+ * Make incremental repair default (CASSANDRA-7250)
+ * Enable code coverage thru JaCoCo (CASSANDRA-7226)
+ * Switch external naming of 'column families' to 'tables' (CASSANDRA-4369)
+ * Shorten SSTable path (CASSANDRA-6962)
+ * Use unsafe mutations for most unit tests (CASSANDRA-6969)
+ * Fix race condition during calculation of pending ranges (CASSANDRA-7390)
+ * Fail on very large batch sizes (CASSANDRA-8011)
+ * Improve concurrency of repair (CASSANDRA-6455, 8208)
+ * Select optimal CRC32 implementation at runtime (CASSANDRA-8614)
+ * Evaluate MurmurHash of Token once per query (CASSANDRA-7096)
+
+
2.1.4
+ * Fix top partitions reporting wrong cardinality (CASSANDRA-8834)
* Fix rare NPE in KeyCacheSerializer (CASSANDRA-8067)
* Pick sstables for validation as late as possible inc repairs (CASSANDRA-8366)
* Fix commitlog getPendingTasks to not increment (CASSANDRA-8856)
http://git-wip-us.apache.org/repos/asf/cassandra/blob/0014d929/src/java/org/apache/cassandra/db/ColumnFamilyStore.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cassandra/blob/0014d929/test/unit/org/apache/cassandra/utils/TopKSamplerTest.java
----------------------------------------------------------------------