You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by bl...@apache.org on 2015/10/12 21:41:40 UTC
[1/2] cassandra git commit: Fix regression in select count with limit
Repository: cassandra
Updated Branches:
refs/heads/cassandra-3.0 319157d94 -> fce444f68
Fix regression in select count with limit
patch by Benjamin Lerer; reviewed by Sylvain Lebresne for CASSANDRA-10487
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/20c0acc1
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/20c0acc1
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/20c0acc1
Branch: refs/heads/cassandra-3.0
Commit: 20c0acc149c2e1a921ca1e7d64a017207077687b
Parents: 0c051a4
Author: blerer <be...@datastax.com>
Authored: Mon Oct 12 21:37:06 2015 +0200
Committer: blerer <be...@datastax.com>
Committed: Mon Oct 12 21:37:06 2015 +0200
----------------------------------------------------------------------
CHANGES.txt | 3 ++-
NEWS.txt | 3 +++
.../org/apache/cassandra/cql3/statements/SelectStatement.java | 4 ++++
.../cassandra/cql3/validation/operations/AggregationTest.java | 7 +++++++
4 files changed, 16 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cassandra/blob/20c0acc1/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index efae4ab..0714076 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,3 +1,5 @@
+2.2.4
+ * Fix the regression when using LIMIT with aggregates (CASSANDRA-10487)
2.2.3
* Avoid NoClassDefFoundError during DataDescriptor initialization on windows (CASSANDRA-10412)
* Preserve case of quoted Role & User names (CASSANDRA-10394)
@@ -8,7 +10,6 @@ Merged from 2.1:
* Allow LOCAL_JMX to be easily overridden (CASSANDRA-10275)
* Mark nodes as dead even if they've already left (CASSANDRA-10205)
* Update internal python driver used by cqlsh (CASSANDRA-10161)
-
2.2.2
* cqlsh prompt includes name of keyspace after failed `use` statement (CASSANDRA-10369)
* Configurable page size in cqlsh (CASSANDRA-9855)
http://git-wip-us.apache.org/repos/asf/cassandra/blob/20c0acc1/NEWS.txt
----------------------------------------------------------------------
diff --git a/NEWS.txt b/NEWS.txt
index 69f2412..5808cdf 100644
--- a/NEWS.txt
+++ b/NEWS.txt
@@ -75,6 +75,9 @@ New features
New features
------------
+ - The LIMIT clause applies now only to the number of rows returned to the user,
+ not to the number of row queried. By consequence, queries using aggregates will not
+ be impacted by the LIMIT clause anymore.
- Very large batches will now be rejected (defaults to 50kb). This
can be customized by modifying batch_size_fail_threshold_in_kb.
- Selecting columns,scalar functions, UDT fields, writetime or ttl together
http://git-wip-us.apache.org/repos/asf/cassandra/blob/20c0acc1/src/java/org/apache/cassandra/cql3/statements/SelectStatement.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/cql3/statements/SelectStatement.java b/src/java/org/apache/cassandra/cql3/statements/SelectStatement.java
index 3edb7d0..e6ac6c0 100644
--- a/src/java/org/apache/cassandra/cql3/statements/SelectStatement.java
+++ b/src/java/org/apache/cassandra/cql3/statements/SelectStatement.java
@@ -536,6 +536,10 @@ public class SelectStatement implements CQLStatement
private int updateLimitForQuery(int limit)
{
+ // If the query is for an aggregate, we do not want to limit the number of rows retrieved. The LIMIT
+ // clause apply to the number of rows returned to the user and not to the number of rows retrieved.
+ if (selection.isAggregate())
+ return Integer.MAX_VALUE;
// Internally, we don't support exclusive bounds for slices. Instead, we query one more element if necessary
// and exclude it later (in processColumnFamily)
return restrictions.isNonCompositeSliceWithExclusiveBounds() && limit != Integer.MAX_VALUE
http://git-wip-us.apache.org/repos/asf/cassandra/blob/20c0acc1/test/unit/org/apache/cassandra/cql3/validation/operations/AggregationTest.java
----------------------------------------------------------------------
diff --git a/test/unit/org/apache/cassandra/cql3/validation/operations/AggregationTest.java b/test/unit/org/apache/cassandra/cql3/validation/operations/AggregationTest.java
index b2ecd04..1649654 100644
--- a/test/unit/org/apache/cassandra/cql3/validation/operations/AggregationTest.java
+++ b/test/unit/org/apache/cassandra/cql3/validation/operations/AggregationTest.java
@@ -90,6 +90,10 @@ public class AggregationTest extends CQLTester
assertRows(execute("SELECT COUNT(*) FROM %s"), row(4L));
assertRows(execute("SELECT COUNT(1) FROM %s"), row(4L));
assertRows(execute("SELECT COUNT(b), count(c), count(e), count(f) FROM %s"), row(4L, 3L, 3L, 3L));
+ // Makes sure that LIMIT does not affect the result of aggregates
+ assertRows(execute("SELECT COUNT(b), count(c), count(e), count(f) FROM %s LIMIT 2"), row(4L, 3L, 3L, 3L));
+ assertRows(execute("SELECT COUNT(b), count(c), count(e), count(f) FROM %s WHERE a = 1 LIMIT 2"),
+ row(4L, 3L, 3L, 3L));
}
@Test
@@ -129,6 +133,9 @@ public class AggregationTest extends CQLTester
assertRows(execute("SELECT COUNT(1) FROM %s"), row(4L));
assertRows(execute("SELECT max(b), b, COUNT(*) FROM %s"), row(5, 1, 4L));
assertRows(execute("SELECT max(b), COUNT(1), b FROM %s"), row(5, 4L, 1));
+ // Makes sure that LIMIT does not affect the result of aggregates
+ assertRows(execute("SELECT max(b), COUNT(1), b FROM %s LIMIT 2"), row(5, 4L, 1));
+ assertRows(execute("SELECT max(b), COUNT(1), b FROM %s WHERE a = 1 LIMIT 2"), row(5, 4L, 1));
}
@Test
[2/2] cassandra git commit: Merge branch cassandra-2.2 into
cassandra-3.0
Posted by bl...@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/fce444f6
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/fce444f6
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/fce444f6
Branch: refs/heads/cassandra-3.0
Commit: fce444f6835d43cd4ad38d2a2003473956908c7d
Parents: 319157d 20c0acc
Author: blerer <be...@datastax.com>
Authored: Mon Oct 12 21:39:57 2015 +0200
Committer: blerer <be...@datastax.com>
Committed: Mon Oct 12 21:40:55 2015 +0200
----------------------------------------------------------------------
CHANGES.txt | 1 +
NEWS.txt | 6 +++---
.../cassandra/cql3/validation/operations/AggregationTest.java | 3 +++
3 files changed, 7 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cassandra/blob/fce444f6/CHANGES.txt
----------------------------------------------------------------------
diff --cc CHANGES.txt
index f72929f,0714076..0d80a8d
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@@ -1,11 -1,6 +1,12 @@@
-2.2.4
+3.0
+ * Only include modified cell data in indexing deltas (CASSANDRA-10438)
+ * Do not load keyspace when creating sstable writer (CASSANDRA-10443)
+ * If node is not yet gossiping write all MV updates to batchlog only (CASSANDRA-10413)
+ * Re-populate token metadata after commit log recovery (CASSANDRA-10293)
+ * Provide additional metrics for materialized views (CASSANDRA-10323)
+ * Flush system schema tables after local schema changes (CASSANDRA-10429)
+Merged from 2.2:
+ * Fix the regression when using LIMIT with aggregates (CASSANDRA-10487)
-2.2.3
* Avoid NoClassDefFoundError during DataDescriptor initialization on windows (CASSANDRA-10412)
* Preserve case of quoted Role & User names (CASSANDRA-10394)
* cqlsh pg-style-strings broken (CASSANDRA-10484)
http://git-wip-us.apache.org/repos/asf/cassandra/blob/fce444f6/NEWS.txt
----------------------------------------------------------------------
diff --cc NEWS.txt
index 1f32001,5808cdf..61fb9ba
--- a/NEWS.txt
+++ b/NEWS.txt
@@@ -44,82 -18,8 +44,79 @@@ New feature
Upgrading
---------
- - Nothing specific to this release, but please see 2.2 if you are upgrading
- from a previous version.
+ - Upgrade to 3.0 is supported from Cassandra 2.1 versions greater or equal to 2.1.9,
+ or Cassandra 2.2 versions greater or equal to 2.2.1. Upgrade from Cassandra 2.0 and
+ older versions is not supported.
+ - The 'memtable_allocation_type: offheap_objects' option has been removed. It should
+ be re-introduced in a future release and you can follow CASSANDRA-9472 to know more.
- - The LIMIT clause applies now only to the number of rows returned to the user,
- not to the number of row queried. By consequence, queries using aggregates will not
- be impacted by the LIMIT clause anymore.
+ - The native protocol versions 1 and 2 are not supported anymore.
+ - Max mutation size is now configurable via max_mutation_size_in_kb setting in
+ cassandra.yaml; the default is half the size commitlog_segment_size_in_mb * 1024.
+ - 3.0 requires Java 8u40 or later.
+ - The default JVM GC has been changed to G1GC.
+ - The default JVM flag -XX:+PerfDisableSharedMem will cause the following tools JVM
+ to stop working: jps, jstack, jinfo, jmc, jcmd as well as 3rd party tools like Jolokia.
+ If you wish to use these tools you can comment this flag out in cassandra-env.{sh,ps1}
+ - New transaction log files have been introduced to replace the compactions_in_progress
+ system table, temporary file markers (tmp and tmplink) and sstable ancerstors.
+ Therefore, compaction metadata no longer contains ancestors. Transaction log files
+ list sstable descriptors involved in compactions and other operations such as flushing
+ and streaming. Use the sstableutil tool to list any sstable files currently involved
+ in operations not yet completed, which previously would have been marked as temporary.
+ A transaction log file contains one sstable per line, with the prefix "add:" or "remove:".
+ They also contain a special line "commit", only inserted at the end when the transaction
+ is committed. On startup we use these files to cleanup any partial transactions that were
+ in progress when the process exited. If the commit line is found, we keep new sstables
+ (those with the "add" prefix) and delete the old sstables (those with the "remove" prefix),
+ vice-versa if the commit line is missing. Should you lose or delete these log files,
+ both old and new sstable files will be kept as live files, which will result in duplicated
+ sstables. These files are protected by incremental checksums so you should not manually
+ edit them. When restoring a full backup or moving sstable files, you should clean-up
+ any left over transactions and their temporary files first. You can use this command:
+ ===> sstableutil -c ks table
+ See CASSANDRA-7066 for full details.
+ - New write stages have been added for batchlog and materialized view mutations
+ you can set their size in cassandra.yaml
+ - User defined functions are now executed in a sandbox.
+ To use UDFs and UDAs, you have to enable them in cassandra.yaml.
+ - New SSTable version 'la' with improved bloom-filter false-positive handling
+ compared to previous version 'ka' used in 2.2 and 2.1. Running sstableupgrade
+ is not necessary but recommended.
+ - Before upgrading to 3.0, make sure that your cluster is in complete agreement
+ (schema versions outputted by `nodetool describecluster` are all the same).
+ - Schema metadata is now stored in the new `system_schema` keyspace, and
+ legacy `system.schema_*` tables are now gone; see CASSANDRA-6717 for details.
+ - Pig's CassandraStorage has been removed. Use CqlNativeStorage instead.
+ - Hadoop BulkOutputFormat and BulkRecordWriter have been removed; use
+ CqlBulkOutputFormat and CqlBulkRecordWriter instead.
+ - Hadoop ColumnFamilyInputFormat and ColumnFamilyOutputFormat have been removed;
+ use CqlInputFormat and CqlOutputFormat instead.
+ - Hadoop ColumnFamilyRecordReader and ColumnFamilyRecordWriter have been removed;
+ use CqlRecordReader and CqlRecordWriter instead.
+ - hinted_handoff_enabled in cassandra.yaml no longer supports a list of data centers.
+ To specify a list of excluded data centers when hinted_handoff_enabled is set to true,
+ use hinted_handoff_disabled_datacenters, see CASSANDRA-9035 for details.
+ - The `sstable_compression` and `chunk_length_kb` compression options have been deprecated.
+ The new options are `class` and `chunk_length_in_kb`. Disabling compression should now
+ be done by setting the new option `enabled` to `false`.
+ - The compression option `crc_check_chance` became a top-level table option, but is currently
+ enforced only against tables with enabled compression.
+ - Only map syntax is now allowed for caching options. ALL/NONE/KEYS_ONLY/ROWS_ONLY syntax
+ has been deprecated since 2.1.0 and is being removed in 3.0.0.
+ - The 'index_interval' option for 'CREATE TABLE' statements, which has been deprecated
+ since 2.1 and replaced with the 'min_index_interval' and 'max_index_interval' options,
+ has now been removed.
+ - Batchlog entries are now stored in a new table - system.batches.
+ The old one has been deprecated.
+ - JMX methods set/getCompactionStrategyClass have been removed, use
+ set/getCompactionParameters or set/getCompactionParametersJson instead.
+ - SizeTieredCompactionStrategy parameter cold_reads_to_omit has been removed.
+ - The secondary index API has been comprehensively reworked. This will be a breaking
+ change for any custom index implementations, which should now look to implement
+ the new org.apache.cassandra.index.Index interface. New syntax has been added to create
+ and query row-based indexes, which are not explicitly linked to a single column in the
+ base table.
+
2.2.2
=====
http://git-wip-us.apache.org/repos/asf/cassandra/blob/fce444f6/test/unit/org/apache/cassandra/cql3/validation/operations/AggregationTest.java
----------------------------------------------------------------------