git commit: Fix 'Wrong class type' assertion error in CounterColumn

2012-11-23 Thread slebresne
Updated Branches:
  refs/heads/cassandra-1.1 e128ab002 - d0292ef45


Fix 'Wrong class type' assertion error in CounterColumn

patch by slebresne; reviewed by jbellis for CASSANDRA-4976


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

Branch: refs/heads/cassandra-1.1
Commit: d0292ef45ad215e3980fc92fe0ef1e9cf5604fa8
Parents: e128ab0
Author: Sylvain Lebresne sylv...@datastax.com
Authored: Fri Nov 23 10:01:39 2012 +0100
Committer: Sylvain Lebresne sylv...@datastax.com
Committed: Fri Nov 23 10:01:39 2012 +0100

--
 CHANGES.txt|1 +
 .../org/apache/cassandra/db/CounterColumn.java |   12 ++--
 2 files changed, 11 insertions(+), 2 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/cassandra/blob/d0292ef4/CHANGES.txt
--
diff --git a/CHANGES.txt b/CHANGES.txt
index b32b3b6..7c653d0 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -21,6 +21,7 @@
  * Fix duplicate SSTable reference when stream session failed (CASSANDRA-3306)
  * Allow static CF definition with compact storage (CASSANDRA-4910)
  * Fix endless loop/compaction of schema_* CFs due to broken timestamps 
(CASSANDRA-4880)
+ * Fix 'wrong class type' assertion in CounterColumn (CASSANDRA-4976)
 
 
 1.1.6

http://git-wip-us.apache.org/repos/asf/cassandra/blob/d0292ef4/src/java/org/apache/cassandra/db/CounterColumn.java
--
diff --git a/src/java/org/apache/cassandra/db/CounterColumn.java 
b/src/java/org/apache/cassandra/db/CounterColumn.java
index b6e3909..67771a4 100644
--- a/src/java/org/apache/cassandra/db/CounterColumn.java
+++ b/src/java/org/apache/cassandra/db/CounterColumn.java
@@ -107,10 +107,18 @@ public class CounterColumn extends Column
 @Override
 public IColumn diff(IColumn column)
 {
-assert column instanceof CounterColumn : Wrong class type.;
+assert (column instanceof CounterColumn) || (column instanceof 
DeletedColumn) : Wrong class type:  + column.getClass();
 
 if (timestamp()  column.timestamp())
 return column;
+
+// Note that if at that point, column can't be a tombstone. Indeed,
+// column is the result of merging us with other nodes results, and
+// merging a CounterColumn with a tombstone never return a tombstone
+// unless that tombstone timestamp is greater that the CounterColumn
+// one.
+assert !(column instanceof DeletedColumn) : Wrong class type:  + 
column.getClass();
+
 if (timestampOfLastDelete()  
((CounterColumn)column).timestampOfLastDelete())
 return column;
 ContextRelationship rel = contextManager.diff(column.value(), value());
@@ -148,7 +156,7 @@ public class CounterColumn extends Column
 @Override
 public IColumn reconcile(IColumn column, Allocator allocator)
 {
-assert (column instanceof CounterColumn) || (column instanceof 
DeletedColumn) : Wrong class type.;
+assert (column instanceof CounterColumn) || (column instanceof 
DeletedColumn) : Wrong class type:  + column.getClass();
 
 if (column.isMarkedForDelete()) // live + tombstone: track last 
tombstone
 {



[jira] [Created] (CASSANDRA-4986) Allow finer control of ALLOW FILTERING behavior

2012-11-23 Thread Sylvain Lebresne (JIRA)
Sylvain Lebresne created CASSANDRA-4986:
---

 Summary: Allow finer control of ALLOW FILTERING behavior
 Key: CASSANDRA-4986
 URL: https://issues.apache.org/jira/browse/CASSANDRA-4986
 Project: Cassandra
  Issue Type: Improvement
Reporter: Sylvain Lebresne
Priority: Minor
 Fix For: 1.3


CASSANDRA-4915 added {{ALLOW FILTERING}} to warn people when they do 
potentially inefficient queries. However, as discussed in the former issue it 
would be interesting to allow controlling that mode more precisely by allowing 
something like:
{noformat}
... ALLOW FILTERING MAX 500
{noformat}
whose behavior would be that the query would be short-circuited if it filters 
(i.e. read but discard from the ResultSet) more than 500 CQL3 rows.

There is however 2 details I'm not totally clear on:
# what to do exactly when we reach the max filtering allowed. Do we return what 
we have so far, but then we need to have a way to say in the result set that 
the query was short-circuited. Or do we just throw an exception TooManyFiltered 
(simpler but maybe a little bit less useful).
# what about deleted records? Should we count them as 'filtered'? Imho the 
logical thing is to not count them as filtered, since after all we filter them 
out in the normal path (i.e. even when ALLOW FILTERING is not used).

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira


[jira] [Created] (CASSANDRA-4987) Support more queries when ALLOW FILTERING is used.

2012-11-23 Thread Sylvain Lebresne (JIRA)
Sylvain Lebresne created CASSANDRA-4987:
---

 Summary: Support more queries when ALLOW FILTERING is used.
 Key: CASSANDRA-4987
 URL: https://issues.apache.org/jira/browse/CASSANDRA-4987
 Project: Cassandra
  Issue Type: Improvement
Reporter: Sylvain Lebresne
 Fix For: 1.3


Even after CASSANDRA-4915, there is still a bunch of queries that we don't 
support even if {{ALLOW FILTERING}} is used. Typically, pretty much any queries 
with restriction on a non-primary-key column unless we have one of those 
restriction that is an EQ on an indexed column.

If {{ALLOW FILTERING}} is used, we could allow those queries out of convenience.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira


[3/3] git commit: Fix 'Wrong class type' assertion error in CounterColumn

2012-11-23 Thread slebresne
Fix 'Wrong class type' assertion error in CounterColumn

patch by slebresne; reviewed by jbellis for CASSANDRA-4976


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

Branch: refs/heads/cassandra-1.2.0
Commit: d0292ef45ad215e3980fc92fe0ef1e9cf5604fa8
Parents: e128ab0
Author: Sylvain Lebresne sylv...@datastax.com
Authored: Fri Nov 23 10:01:39 2012 +0100
Committer: Sylvain Lebresne sylv...@datastax.com
Committed: Fri Nov 23 10:01:39 2012 +0100

--
 CHANGES.txt|1 +
 .../org/apache/cassandra/db/CounterColumn.java |   12 ++--
 2 files changed, 11 insertions(+), 2 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/cassandra/blob/d0292ef4/CHANGES.txt
--
diff --git a/CHANGES.txt b/CHANGES.txt
index b32b3b6..7c653d0 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -21,6 +21,7 @@
  * Fix duplicate SSTable reference when stream session failed (CASSANDRA-3306)
  * Allow static CF definition with compact storage (CASSANDRA-4910)
  * Fix endless loop/compaction of schema_* CFs due to broken timestamps 
(CASSANDRA-4880)
+ * Fix 'wrong class type' assertion in CounterColumn (CASSANDRA-4976)
 
 
 1.1.6

http://git-wip-us.apache.org/repos/asf/cassandra/blob/d0292ef4/src/java/org/apache/cassandra/db/CounterColumn.java
--
diff --git a/src/java/org/apache/cassandra/db/CounterColumn.java 
b/src/java/org/apache/cassandra/db/CounterColumn.java
index b6e3909..67771a4 100644
--- a/src/java/org/apache/cassandra/db/CounterColumn.java
+++ b/src/java/org/apache/cassandra/db/CounterColumn.java
@@ -107,10 +107,18 @@ public class CounterColumn extends Column
 @Override
 public IColumn diff(IColumn column)
 {
-assert column instanceof CounterColumn : Wrong class type.;
+assert (column instanceof CounterColumn) || (column instanceof 
DeletedColumn) : Wrong class type:  + column.getClass();
 
 if (timestamp()  column.timestamp())
 return column;
+
+// Note that if at that point, column can't be a tombstone. Indeed,
+// column is the result of merging us with other nodes results, and
+// merging a CounterColumn with a tombstone never return a tombstone
+// unless that tombstone timestamp is greater that the CounterColumn
+// one.
+assert !(column instanceof DeletedColumn) : Wrong class type:  + 
column.getClass();
+
 if (timestampOfLastDelete()  
((CounterColumn)column).timestampOfLastDelete())
 return column;
 ContextRelationship rel = contextManager.diff(column.value(), value());
@@ -148,7 +156,7 @@ public class CounterColumn extends Column
 @Override
 public IColumn reconcile(IColumn column, Allocator allocator)
 {
-assert (column instanceof CounterColumn) || (column instanceof 
DeletedColumn) : Wrong class type.;
+assert (column instanceof CounterColumn) || (column instanceof 
DeletedColumn) : Wrong class type:  + column.getClass();
 
 if (column.isMarkedForDelete()) // live + tombstone: track last 
tombstone
 {



[2/3] git commit: Merge branch 'cassandra-1.1' into cassandra-1.2.0

2012-11-23 Thread slebresne
Merge branch 'cassandra-1.1' into cassandra-1.2.0

Conflicts:
CHANGES.txt


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

Branch: refs/heads/cassandra-1.2.0
Commit: 9fb57798eeb58578cf28338ce235f91b855dfabe
Parents: e1ac6e9 d0292ef
Author: Sylvain Lebresne sylv...@datastax.com
Authored: Fri Nov 23 10:03:23 2012 +0100
Committer: Sylvain Lebresne sylv...@datastax.com
Committed: Fri Nov 23 10:03:23 2012 +0100

--
 CHANGES.txt|1 +
 .../org/apache/cassandra/db/CounterColumn.java |   12 ++--
 2 files changed, 11 insertions(+), 2 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/cassandra/blob/9fb57798/CHANGES.txt
--
diff --cc CHANGES.txt
index b7cc394,7c653d0..90b6537
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@@ -28,66 -6,6 +28,67 @@@ Merged from 1.1
 (CASSANDRA-4919)
   * expunge row cache post-truncate (CASSANDRA-4940)
   * remove IAuthority2 (CASSANDRA-4875)
 + * Allow static CF definition with compact storage (CASSANDRA-4910)
 + * Fix endless loop/compaction of schema_* CFs due to broken timestamps 
(CASSANDRA-4880)
++ * Fix 'wrong class type' assertion in CounterColumn (CASSANDRA-4976)
 +
 +
 +1.2-beta2
 + * fp rate of 1.0 disables BF entirely; LCS defaults to 1.0 (CASSANDRA-4876)
 + * off-heap bloom filters for row keys (CASSANDRA_4865)
 + * add extension point for sstable components (CASSANDRA-4049)
 + * improve tracing output (CASSANDRA-4852, 4862)
 + * make TRACE verb droppable (CASSANDRA-4672)
 + * fix BulkLoader recognition of CQL3 columnfamilies (CASSANDRA-4755)
 + * Sort commitlog segments for replay by id instead of mtime (CASSANDRA-4793)
 + * Make hint delivery asynchronous (CASSANDRA-4761)
 + * Pluggable Thrift transport factories for CLI and cqlsh (CASSANDRA-4609, 
4610)
 + * cassandra-cli: allow Double value type to be inserted to a column 
(CASSANDRA-4661)
 + * Add ability to use custom TServerFactory implementations (CASSANDRA-4608)
 + * optimize batchlog flushing to skip successful batches (CASSANDRA-4667)
 + * include metadata for system keyspace itself in schema tables 
(CASSANDRA-4416)
 + * add check to PropertyFileSnitch to verify presence of location for
 +   local node (CASSANDRA-4728)
 + * add PBSPredictor consistency modeler (CASSANDRA-4261)
 + * remove vestiges of Thrift unframed mode (CASSANDRA-4729)
 + * optimize single-row PK lookups (CASSANDRA-4710)
 + * adjust blockFor calculation to account for pending ranges due to node 
 +   movement (CASSANDRA-833)
 + * Change CQL version to 3.0.0 and stop accepting 3.0.0-beta1 (CASSANDRA-4649)
 + * (CQL3) Make prepared statement global instead of per connection 
 +   (CASSANDRA-4449)
 + * Fix scrubbing of CQL3 created tables (CASSANDRA-4685)
 + * (CQL3) Fix validation when using counter and regular columns in the same 
 +   table (CASSANDRA-4706)
 + * Fix bug starting Cassandra with simple authentication (CASSANDRA-4648)
 + * Add support for batchlog in CQL3 (CASSANDRA-4545, 4738)
 + * Add support for multiple column family outputs in CFOF (CASSANDRA-4208)
 + * Support repairing only the local DC nodes (CASSANDRA-4747)
 + * Use rpc_address for binary protocol and change default port (CASSANRA-4751)
 + * Fix use of collections in prepared statements (CASSANDRA-4739)
 + * Store more information into peers table (CASSANDRA-4351, 4814)
 + * Configurable bucket size for size tiered compaction (CASSANDRA-4704)
 + * Run leveled compaction in parallel (CASSANDRA-4310)
 + * Fix potential NPE during CFS reload (CASSANDRA-4786)
 + * Composite indexes may miss results (CASSANDRA-4796)
 + * Move consistency level to the protocol level (CASSANDRA-4734, 4824)
 + * Fix Subcolumn slice ends not respected (CASSANDRA-4826)
 + * Fix Assertion error in cql3 select (CASSANDRA-4783)
 + * Fix list prepend logic (CQL3) (CASSANDRA-4835)
 + * Add booleans as literals in CQL3 (CASSANDRA-4776)
 + * Allow renaming PK columns in CQL3 (CASSANDRA-4822)
 + * Fix binary protocol NEW_NODE event (CASSANDRA-4679)
 + * Fix potential infinite loop in tombstone compaction (CASSANDRA-4781)
 + * Remove system tables accounting from schema (CASSANDRA-4850)
 + * Force provided columns in clustering key order in 'CLUSTERING ORDER BY' 
(CASSANDRA-4881)
 + * Fix composite index bug (CASSANDRA-4884)
 + * Fix short read protection for CQL3 (CASSANDRA-4882)
 + * Add tracing support to the binary protocol (CASSANDRA-4699)
 + * Don't allow prepared marker inside collections (CASSANDRA-4890)
 + * Re-allow order by on non-selected columns (CASSANDRA-4645)
 + * Bug when composite index is created in a 

[1/3] git commit: Prevent inefficient queries (CQL3)

2012-11-23 Thread slebresne
Updated Branches:
  refs/heads/cassandra-1.2.0 e1ac6e9ff - 6fb751240


Prevent inefficient queries (CQL3)

patch by slebresne; reviewed by jbellis for CASSANDRA-4915


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

Branch: refs/heads/cassandra-1.2.0
Commit: 6fb751240013799a13890282e1af1f7dc85d9e8d
Parents: 9fb5779
Author: Sylvain Lebresne sylv...@datastax.com
Authored: Fri Nov 23 10:04:56 2012 +0100
Committer: Sylvain Lebresne sylv...@datastax.com
Committed: Fri Nov 23 10:04:56 2012 +0100

--
 CHANGES.txt|1 +
 src/java/org/apache/cassandra/cql3/Cql.g   |8 -
 .../cassandra/cql3/statements/SelectStatement.java |   24 ++-
 3 files changed, 31 insertions(+), 2 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/cassandra/blob/6fb75124/CHANGES.txt
--
diff --git a/CHANGES.txt b/CHANGES.txt
index 90b6537..4ea42c1 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -21,6 +21,7 @@
  * Fix CQL3 LIMIT (CASSANDRA-4877)
  * Fix Stress for CQL3 (CASSANDRA-4979)
  * Remove cassandra specific exceptions from JMX interface (CASSANDRA-4893)
+ * (CQL3) Force using ALLOW FILTERING on potentially inefficient queries 
(CASSANDRA-4915)
 Merged from 1.1:
  * add basic authentication support for Pig CassandraStorage (CASSANDRA-3042)
  * fix CQL2 ALTER TABLE compaction_strategy_class altering (CASSANDRA-4965)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/6fb75124/src/java/org/apache/cassandra/cql3/Cql.g
--
diff --git a/src/java/org/apache/cassandra/cql3/Cql.g 
b/src/java/org/apache/cassandra/cql3/Cql.g
index 9c3f77b..d814434 100644
--- a/src/java/org/apache/cassandra/cql3/Cql.g
+++ b/src/java/org/apache/cassandra/cql3/Cql.g
@@ -190,16 +190,19 @@ selectStatement returns [SelectStatement.RawStatement 
expr]
 boolean isCount = false;
 int limit = Integer.MAX_VALUE;
 MapColumnIdentifier, Boolean orderings = new 
LinkedHashMapColumnIdentifier, Boolean();
+boolean allowFiltering = false;
 }
 : K_SELECT ( sclause=selectClause | (K_COUNT '(' sclause=selectCountClause 
')' { isCount = true; }) )
   K_FROM cf=columnFamilyName
   ( K_WHERE wclause=whereClause )?
   ( K_ORDER K_BY orderByClause[orderings] ( ',' orderByClause[orderings] 
)* )?
   ( K_LIMIT rows=INTEGER { limit = Integer.parseInt($rows.text); } )?
+  ( K_ALLOW K_FILTERING  { allowFiltering = true; } )?
   {
   SelectStatement.Parameters params = new 
SelectStatement.Parameters(limit,
  
orderings,
- 
isCount);
+ 
isCount,
+ 
allowFiltering);
   $expr = new SelectStatement.RawStatement(cf, params, sclause, 
wclause);
   }
 ;
@@ -754,6 +757,7 @@ unreserved_keyword returns [String str]
 | K_WRITETIME
 | K_MAP
 | K_LIST
+| K_FILTERING
 ) { $str = $k.text; }
 | t=native_type { $str = t.toString(); }
 ;
@@ -822,6 +826,8 @@ K_DESCRIBE:D E S C R I B E;
 K_FOR: F O R;
 K_FULL_ACCESS: F U L L '_' A C C E S S;
 K_NO_ACCESS:   N O '_' A C C E S S;
+K_ALLOW:   A L L O W;
+K_FILTERING:   F I L T E R I N G;
 
 
 K_CLUSTERING:  C L U S T E R I N G;

http://git-wip-us.apache.org/repos/asf/cassandra/blob/6fb75124/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 4ae2b55..4e61a7b 100644
--- a/src/java/org/apache/cassandra/cql3/statements/SelectStatement.java
+++ b/src/java/org/apache/cassandra/cql3/statements/SelectStatement.java
@@ -957,6 +957,16 @@ public class SelectStatement implements CQLStatement
 return name.type instanceof ReversedType;
 }
 
+private boolean columnFilterIsIdentity()
+{
+for (Restriction r : columnRestrictions)
+{
+if (r != null)
+return false;
+}
+return true;
+}
+
 public static class RawStatement extends CFStatement
 {
 private final Parameters parameters;
@@ -1247,6 +1257,16 @@ public class SelectStatement 

[jira] [Commented] (CASSANDRA-4987) Support more queries when ALLOW FILTERING is used.

2012-11-23 Thread Sylvain Lebresne (JIRA)

[ 
https://issues.apache.org/jira/browse/CASSANDRA-4987?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=13503127#comment-13503127
 ] 

Sylvain Lebresne commented on CASSANDRA-4987:
-

CASSANDRA-4915 has a patch that does part of this. Said patch is not efficient 
in that it load full internal rows in memory, but is should at least 
demonstrate what's involved here.

 Support more queries when ALLOW FILTERING is used.
 --

 Key: CASSANDRA-4987
 URL: https://issues.apache.org/jira/browse/CASSANDRA-4987
 Project: Cassandra
  Issue Type: Improvement
Reporter: Sylvain Lebresne
 Fix For: 1.3


 Even after CASSANDRA-4915, there is still a bunch of queries that we don't 
 support even if {{ALLOW FILTERING}} is used. Typically, pretty much any 
 queries with restriction on a non-primary-key column unless we have one of 
 those restriction that is an EQ on an indexed column.
 If {{ALLOW FILTERING}} is used, we could allow those queries out of 
 convenience.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira


[1/4] git commit: Merge branch 'cassandra-1.2.0' into cassandra-1.2

2012-11-23 Thread slebresne
Updated Branches:
  refs/heads/cassandra-1.2 106977d24 - d97a5ca4d


Merge branch 'cassandra-1.2.0' into cassandra-1.2


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

Branch: refs/heads/cassandra-1.2
Commit: d97a5ca4d46a85be24560fcd7639df1e074b9cf3
Parents: 106977d 6fb7512
Author: Sylvain Lebresne sylv...@datastax.com
Authored: Fri Nov 23 10:43:06 2012 +0100
Committer: Sylvain Lebresne sylv...@datastax.com
Committed: Fri Nov 23 10:43:06 2012 +0100

--
 CHANGES.txt|2 +
 src/java/org/apache/cassandra/cql3/Cql.g   |8 -
 .../cassandra/cql3/statements/SelectStatement.java |   24 ++-
 .../org/apache/cassandra/db/CounterColumn.java |   12 ++-
 4 files changed, 42 insertions(+), 4 deletions(-)
--


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



[2/4] git commit: Prevent inefficient queries (CQL3)

2012-11-23 Thread slebresne
Prevent inefficient queries (CQL3)

patch by slebresne; reviewed by jbellis for CASSANDRA-4915


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

Branch: refs/heads/cassandra-1.2
Commit: 6fb751240013799a13890282e1af1f7dc85d9e8d
Parents: 9fb5779
Author: Sylvain Lebresne sylv...@datastax.com
Authored: Fri Nov 23 10:04:56 2012 +0100
Committer: Sylvain Lebresne sylv...@datastax.com
Committed: Fri Nov 23 10:04:56 2012 +0100

--
 CHANGES.txt|1 +
 src/java/org/apache/cassandra/cql3/Cql.g   |8 -
 .../cassandra/cql3/statements/SelectStatement.java |   24 ++-
 3 files changed, 31 insertions(+), 2 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/cassandra/blob/6fb75124/CHANGES.txt
--
diff --git a/CHANGES.txt b/CHANGES.txt
index 90b6537..4ea42c1 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -21,6 +21,7 @@
  * Fix CQL3 LIMIT (CASSANDRA-4877)
  * Fix Stress for CQL3 (CASSANDRA-4979)
  * Remove cassandra specific exceptions from JMX interface (CASSANDRA-4893)
+ * (CQL3) Force using ALLOW FILTERING on potentially inefficient queries 
(CASSANDRA-4915)
 Merged from 1.1:
  * add basic authentication support for Pig CassandraStorage (CASSANDRA-3042)
  * fix CQL2 ALTER TABLE compaction_strategy_class altering (CASSANDRA-4965)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/6fb75124/src/java/org/apache/cassandra/cql3/Cql.g
--
diff --git a/src/java/org/apache/cassandra/cql3/Cql.g 
b/src/java/org/apache/cassandra/cql3/Cql.g
index 9c3f77b..d814434 100644
--- a/src/java/org/apache/cassandra/cql3/Cql.g
+++ b/src/java/org/apache/cassandra/cql3/Cql.g
@@ -190,16 +190,19 @@ selectStatement returns [SelectStatement.RawStatement 
expr]
 boolean isCount = false;
 int limit = Integer.MAX_VALUE;
 MapColumnIdentifier, Boolean orderings = new 
LinkedHashMapColumnIdentifier, Boolean();
+boolean allowFiltering = false;
 }
 : K_SELECT ( sclause=selectClause | (K_COUNT '(' sclause=selectCountClause 
')' { isCount = true; }) )
   K_FROM cf=columnFamilyName
   ( K_WHERE wclause=whereClause )?
   ( K_ORDER K_BY orderByClause[orderings] ( ',' orderByClause[orderings] 
)* )?
   ( K_LIMIT rows=INTEGER { limit = Integer.parseInt($rows.text); } )?
+  ( K_ALLOW K_FILTERING  { allowFiltering = true; } )?
   {
   SelectStatement.Parameters params = new 
SelectStatement.Parameters(limit,
  
orderings,
- 
isCount);
+ 
isCount,
+ 
allowFiltering);
   $expr = new SelectStatement.RawStatement(cf, params, sclause, 
wclause);
   }
 ;
@@ -754,6 +757,7 @@ unreserved_keyword returns [String str]
 | K_WRITETIME
 | K_MAP
 | K_LIST
+| K_FILTERING
 ) { $str = $k.text; }
 | t=native_type { $str = t.toString(); }
 ;
@@ -822,6 +826,8 @@ K_DESCRIBE:D E S C R I B E;
 K_FOR: F O R;
 K_FULL_ACCESS: F U L L '_' A C C E S S;
 K_NO_ACCESS:   N O '_' A C C E S S;
+K_ALLOW:   A L L O W;
+K_FILTERING:   F I L T E R I N G;
 
 
 K_CLUSTERING:  C L U S T E R I N G;

http://git-wip-us.apache.org/repos/asf/cassandra/blob/6fb75124/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 4ae2b55..4e61a7b 100644
--- a/src/java/org/apache/cassandra/cql3/statements/SelectStatement.java
+++ b/src/java/org/apache/cassandra/cql3/statements/SelectStatement.java
@@ -957,6 +957,16 @@ public class SelectStatement implements CQLStatement
 return name.type instanceof ReversedType;
 }
 
+private boolean columnFilterIsIdentity()
+{
+for (Restriction r : columnRestrictions)
+{
+if (r != null)
+return false;
+}
+return true;
+}
+
 public static class RawStatement extends CFStatement
 {
 private final Parameters parameters;
@@ -1247,6 +1257,16 @@ public class SelectStatement implements CQLStatement
 stmt.isReversed = isReversed;

[4/4] git commit: Fix 'Wrong class type' assertion error in CounterColumn

2012-11-23 Thread slebresne
Fix 'Wrong class type' assertion error in CounterColumn

patch by slebresne; reviewed by jbellis for CASSANDRA-4976


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

Branch: refs/heads/cassandra-1.2
Commit: d0292ef45ad215e3980fc92fe0ef1e9cf5604fa8
Parents: e128ab0
Author: Sylvain Lebresne sylv...@datastax.com
Authored: Fri Nov 23 10:01:39 2012 +0100
Committer: Sylvain Lebresne sylv...@datastax.com
Committed: Fri Nov 23 10:01:39 2012 +0100

--
 CHANGES.txt|1 +
 .../org/apache/cassandra/db/CounterColumn.java |   12 ++--
 2 files changed, 11 insertions(+), 2 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/cassandra/blob/d0292ef4/CHANGES.txt
--
diff --git a/CHANGES.txt b/CHANGES.txt
index b32b3b6..7c653d0 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -21,6 +21,7 @@
  * Fix duplicate SSTable reference when stream session failed (CASSANDRA-3306)
  * Allow static CF definition with compact storage (CASSANDRA-4910)
  * Fix endless loop/compaction of schema_* CFs due to broken timestamps 
(CASSANDRA-4880)
+ * Fix 'wrong class type' assertion in CounterColumn (CASSANDRA-4976)
 
 
 1.1.6

http://git-wip-us.apache.org/repos/asf/cassandra/blob/d0292ef4/src/java/org/apache/cassandra/db/CounterColumn.java
--
diff --git a/src/java/org/apache/cassandra/db/CounterColumn.java 
b/src/java/org/apache/cassandra/db/CounterColumn.java
index b6e3909..67771a4 100644
--- a/src/java/org/apache/cassandra/db/CounterColumn.java
+++ b/src/java/org/apache/cassandra/db/CounterColumn.java
@@ -107,10 +107,18 @@ public class CounterColumn extends Column
 @Override
 public IColumn diff(IColumn column)
 {
-assert column instanceof CounterColumn : Wrong class type.;
+assert (column instanceof CounterColumn) || (column instanceof 
DeletedColumn) : Wrong class type:  + column.getClass();
 
 if (timestamp()  column.timestamp())
 return column;
+
+// Note that if at that point, column can't be a tombstone. Indeed,
+// column is the result of merging us with other nodes results, and
+// merging a CounterColumn with a tombstone never return a tombstone
+// unless that tombstone timestamp is greater that the CounterColumn
+// one.
+assert !(column instanceof DeletedColumn) : Wrong class type:  + 
column.getClass();
+
 if (timestampOfLastDelete()  
((CounterColumn)column).timestampOfLastDelete())
 return column;
 ContextRelationship rel = contextManager.diff(column.value(), value());
@@ -148,7 +156,7 @@ public class CounterColumn extends Column
 @Override
 public IColumn reconcile(IColumn column, Allocator allocator)
 {
-assert (column instanceof CounterColumn) || (column instanceof 
DeletedColumn) : Wrong class type.;
+assert (column instanceof CounterColumn) || (column instanceof 
DeletedColumn) : Wrong class type:  + column.getClass();
 
 if (column.isMarkedForDelete()) // live + tombstone: track last 
tombstone
 {



[3/4] git commit: Merge branch 'cassandra-1.1' into cassandra-1.2.0

2012-11-23 Thread slebresne
Merge branch 'cassandra-1.1' into cassandra-1.2.0

Conflicts:
CHANGES.txt


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

Branch: refs/heads/cassandra-1.2
Commit: 9fb57798eeb58578cf28338ce235f91b855dfabe
Parents: e1ac6e9 d0292ef
Author: Sylvain Lebresne sylv...@datastax.com
Authored: Fri Nov 23 10:03:23 2012 +0100
Committer: Sylvain Lebresne sylv...@datastax.com
Committed: Fri Nov 23 10:03:23 2012 +0100

--
 CHANGES.txt|1 +
 .../org/apache/cassandra/db/CounterColumn.java |   12 ++--
 2 files changed, 11 insertions(+), 2 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/cassandra/blob/9fb57798/CHANGES.txt
--
diff --cc CHANGES.txt
index b7cc394,7c653d0..90b6537
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@@ -28,66 -6,6 +28,67 @@@ Merged from 1.1
 (CASSANDRA-4919)
   * expunge row cache post-truncate (CASSANDRA-4940)
   * remove IAuthority2 (CASSANDRA-4875)
 + * Allow static CF definition with compact storage (CASSANDRA-4910)
 + * Fix endless loop/compaction of schema_* CFs due to broken timestamps 
(CASSANDRA-4880)
++ * Fix 'wrong class type' assertion in CounterColumn (CASSANDRA-4976)
 +
 +
 +1.2-beta2
 + * fp rate of 1.0 disables BF entirely; LCS defaults to 1.0 (CASSANDRA-4876)
 + * off-heap bloom filters for row keys (CASSANDRA_4865)
 + * add extension point for sstable components (CASSANDRA-4049)
 + * improve tracing output (CASSANDRA-4852, 4862)
 + * make TRACE verb droppable (CASSANDRA-4672)
 + * fix BulkLoader recognition of CQL3 columnfamilies (CASSANDRA-4755)
 + * Sort commitlog segments for replay by id instead of mtime (CASSANDRA-4793)
 + * Make hint delivery asynchronous (CASSANDRA-4761)
 + * Pluggable Thrift transport factories for CLI and cqlsh (CASSANDRA-4609, 
4610)
 + * cassandra-cli: allow Double value type to be inserted to a column 
(CASSANDRA-4661)
 + * Add ability to use custom TServerFactory implementations (CASSANDRA-4608)
 + * optimize batchlog flushing to skip successful batches (CASSANDRA-4667)
 + * include metadata for system keyspace itself in schema tables 
(CASSANDRA-4416)
 + * add check to PropertyFileSnitch to verify presence of location for
 +   local node (CASSANDRA-4728)
 + * add PBSPredictor consistency modeler (CASSANDRA-4261)
 + * remove vestiges of Thrift unframed mode (CASSANDRA-4729)
 + * optimize single-row PK lookups (CASSANDRA-4710)
 + * adjust blockFor calculation to account for pending ranges due to node 
 +   movement (CASSANDRA-833)
 + * Change CQL version to 3.0.0 and stop accepting 3.0.0-beta1 (CASSANDRA-4649)
 + * (CQL3) Make prepared statement global instead of per connection 
 +   (CASSANDRA-4449)
 + * Fix scrubbing of CQL3 created tables (CASSANDRA-4685)
 + * (CQL3) Fix validation when using counter and regular columns in the same 
 +   table (CASSANDRA-4706)
 + * Fix bug starting Cassandra with simple authentication (CASSANDRA-4648)
 + * Add support for batchlog in CQL3 (CASSANDRA-4545, 4738)
 + * Add support for multiple column family outputs in CFOF (CASSANDRA-4208)
 + * Support repairing only the local DC nodes (CASSANDRA-4747)
 + * Use rpc_address for binary protocol and change default port (CASSANRA-4751)
 + * Fix use of collections in prepared statements (CASSANDRA-4739)
 + * Store more information into peers table (CASSANDRA-4351, 4814)
 + * Configurable bucket size for size tiered compaction (CASSANDRA-4704)
 + * Run leveled compaction in parallel (CASSANDRA-4310)
 + * Fix potential NPE during CFS reload (CASSANDRA-4786)
 + * Composite indexes may miss results (CASSANDRA-4796)
 + * Move consistency level to the protocol level (CASSANDRA-4734, 4824)
 + * Fix Subcolumn slice ends not respected (CASSANDRA-4826)
 + * Fix Assertion error in cql3 select (CASSANDRA-4783)
 + * Fix list prepend logic (CQL3) (CASSANDRA-4835)
 + * Add booleans as literals in CQL3 (CASSANDRA-4776)
 + * Allow renaming PK columns in CQL3 (CASSANDRA-4822)
 + * Fix binary protocol NEW_NODE event (CASSANDRA-4679)
 + * Fix potential infinite loop in tombstone compaction (CASSANDRA-4781)
 + * Remove system tables accounting from schema (CASSANDRA-4850)
 + * Force provided columns in clustering key order in 'CLUSTERING ORDER BY' 
(CASSANDRA-4881)
 + * Fix composite index bug (CASSANDRA-4884)
 + * Fix short read protection for CQL3 (CASSANDRA-4882)
 + * Add tracing support to the binary protocol (CASSANDRA-4699)
 + * Don't allow prepared marker inside collections (CASSANDRA-4890)
 + * Re-allow order by on non-selected columns (CASSANDRA-4645)
 + * Bug when composite index is created in a 

[1/5] git commit: Merge branch 'cassandra-1.2' into trunk

2012-11-23 Thread slebresne
Updated Branches:
  refs/heads/trunk c12d7cf44 - be89a954b


Merge branch 'cassandra-1.2' into trunk

Conflicts:
src/java/org/apache/cassandra/db/CounterColumn.java


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

Branch: refs/heads/trunk
Commit: be89a954b369802896599a8bd2003499b95f1112
Parents: c12d7cf d97a5ca
Author: Sylvain Lebresne sylv...@datastax.com
Authored: Fri Nov 23 10:44:18 2012 +0100
Committer: Sylvain Lebresne sylv...@datastax.com
Committed: Fri Nov 23 10:44:18 2012 +0100

--
 CHANGES.txt|2 +
 src/java/org/apache/cassandra/cql3/Cql.g   |8 -
 .../cassandra/cql3/statements/SelectStatement.java |   24 ++-
 .../org/apache/cassandra/db/CounterColumn.java |   12 ++-
 4 files changed, 42 insertions(+), 4 deletions(-)
--


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



[2/5] git commit: Merge branch 'cassandra-1.2.0' into cassandra-1.2

2012-11-23 Thread slebresne
Merge branch 'cassandra-1.2.0' into cassandra-1.2


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

Branch: refs/heads/trunk
Commit: d97a5ca4d46a85be24560fcd7639df1e074b9cf3
Parents: 106977d 6fb7512
Author: Sylvain Lebresne sylv...@datastax.com
Authored: Fri Nov 23 10:43:06 2012 +0100
Committer: Sylvain Lebresne sylv...@datastax.com
Committed: Fri Nov 23 10:43:06 2012 +0100

--
 CHANGES.txt|2 +
 src/java/org/apache/cassandra/cql3/Cql.g   |8 -
 .../cassandra/cql3/statements/SelectStatement.java |   24 ++-
 .../org/apache/cassandra/db/CounterColumn.java |   12 ++-
 4 files changed, 42 insertions(+), 4 deletions(-)
--


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



[4/5] git commit: Merge branch 'cassandra-1.1' into cassandra-1.2.0

2012-11-23 Thread slebresne
Merge branch 'cassandra-1.1' into cassandra-1.2.0

Conflicts:
CHANGES.txt


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

Branch: refs/heads/trunk
Commit: 9fb57798eeb58578cf28338ce235f91b855dfabe
Parents: e1ac6e9 d0292ef
Author: Sylvain Lebresne sylv...@datastax.com
Authored: Fri Nov 23 10:03:23 2012 +0100
Committer: Sylvain Lebresne sylv...@datastax.com
Committed: Fri Nov 23 10:03:23 2012 +0100

--
 CHANGES.txt|1 +
 .../org/apache/cassandra/db/CounterColumn.java |   12 ++--
 2 files changed, 11 insertions(+), 2 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/cassandra/blob/9fb57798/CHANGES.txt
--
diff --cc CHANGES.txt
index b7cc394,7c653d0..90b6537
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@@ -28,66 -6,6 +28,67 @@@ Merged from 1.1
 (CASSANDRA-4919)
   * expunge row cache post-truncate (CASSANDRA-4940)
   * remove IAuthority2 (CASSANDRA-4875)
 + * Allow static CF definition with compact storage (CASSANDRA-4910)
 + * Fix endless loop/compaction of schema_* CFs due to broken timestamps 
(CASSANDRA-4880)
++ * Fix 'wrong class type' assertion in CounterColumn (CASSANDRA-4976)
 +
 +
 +1.2-beta2
 + * fp rate of 1.0 disables BF entirely; LCS defaults to 1.0 (CASSANDRA-4876)
 + * off-heap bloom filters for row keys (CASSANDRA_4865)
 + * add extension point for sstable components (CASSANDRA-4049)
 + * improve tracing output (CASSANDRA-4852, 4862)
 + * make TRACE verb droppable (CASSANDRA-4672)
 + * fix BulkLoader recognition of CQL3 columnfamilies (CASSANDRA-4755)
 + * Sort commitlog segments for replay by id instead of mtime (CASSANDRA-4793)
 + * Make hint delivery asynchronous (CASSANDRA-4761)
 + * Pluggable Thrift transport factories for CLI and cqlsh (CASSANDRA-4609, 
4610)
 + * cassandra-cli: allow Double value type to be inserted to a column 
(CASSANDRA-4661)
 + * Add ability to use custom TServerFactory implementations (CASSANDRA-4608)
 + * optimize batchlog flushing to skip successful batches (CASSANDRA-4667)
 + * include metadata for system keyspace itself in schema tables 
(CASSANDRA-4416)
 + * add check to PropertyFileSnitch to verify presence of location for
 +   local node (CASSANDRA-4728)
 + * add PBSPredictor consistency modeler (CASSANDRA-4261)
 + * remove vestiges of Thrift unframed mode (CASSANDRA-4729)
 + * optimize single-row PK lookups (CASSANDRA-4710)
 + * adjust blockFor calculation to account for pending ranges due to node 
 +   movement (CASSANDRA-833)
 + * Change CQL version to 3.0.0 and stop accepting 3.0.0-beta1 (CASSANDRA-4649)
 + * (CQL3) Make prepared statement global instead of per connection 
 +   (CASSANDRA-4449)
 + * Fix scrubbing of CQL3 created tables (CASSANDRA-4685)
 + * (CQL3) Fix validation when using counter and regular columns in the same 
 +   table (CASSANDRA-4706)
 + * Fix bug starting Cassandra with simple authentication (CASSANDRA-4648)
 + * Add support for batchlog in CQL3 (CASSANDRA-4545, 4738)
 + * Add support for multiple column family outputs in CFOF (CASSANDRA-4208)
 + * Support repairing only the local DC nodes (CASSANDRA-4747)
 + * Use rpc_address for binary protocol and change default port (CASSANRA-4751)
 + * Fix use of collections in prepared statements (CASSANDRA-4739)
 + * Store more information into peers table (CASSANDRA-4351, 4814)
 + * Configurable bucket size for size tiered compaction (CASSANDRA-4704)
 + * Run leveled compaction in parallel (CASSANDRA-4310)
 + * Fix potential NPE during CFS reload (CASSANDRA-4786)
 + * Composite indexes may miss results (CASSANDRA-4796)
 + * Move consistency level to the protocol level (CASSANDRA-4734, 4824)
 + * Fix Subcolumn slice ends not respected (CASSANDRA-4826)
 + * Fix Assertion error in cql3 select (CASSANDRA-4783)
 + * Fix list prepend logic (CQL3) (CASSANDRA-4835)
 + * Add booleans as literals in CQL3 (CASSANDRA-4776)
 + * Allow renaming PK columns in CQL3 (CASSANDRA-4822)
 + * Fix binary protocol NEW_NODE event (CASSANDRA-4679)
 + * Fix potential infinite loop in tombstone compaction (CASSANDRA-4781)
 + * Remove system tables accounting from schema (CASSANDRA-4850)
 + * Force provided columns in clustering key order in 'CLUSTERING ORDER BY' 
(CASSANDRA-4881)
 + * Fix composite index bug (CASSANDRA-4884)
 + * Fix short read protection for CQL3 (CASSANDRA-4882)
 + * Add tracing support to the binary protocol (CASSANDRA-4699)
 + * Don't allow prepared marker inside collections (CASSANDRA-4890)
 + * Re-allow order by on non-selected columns (CASSANDRA-4645)
 + * Bug when composite index is created in a table 

[5/5] git commit: Fix 'Wrong class type' assertion error in CounterColumn

2012-11-23 Thread slebresne
Fix 'Wrong class type' assertion error in CounterColumn

patch by slebresne; reviewed by jbellis for CASSANDRA-4976


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

Branch: refs/heads/trunk
Commit: d0292ef45ad215e3980fc92fe0ef1e9cf5604fa8
Parents: e128ab0
Author: Sylvain Lebresne sylv...@datastax.com
Authored: Fri Nov 23 10:01:39 2012 +0100
Committer: Sylvain Lebresne sylv...@datastax.com
Committed: Fri Nov 23 10:01:39 2012 +0100

--
 CHANGES.txt|1 +
 .../org/apache/cassandra/db/CounterColumn.java |   12 ++--
 2 files changed, 11 insertions(+), 2 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/cassandra/blob/d0292ef4/CHANGES.txt
--
diff --git a/CHANGES.txt b/CHANGES.txt
index b32b3b6..7c653d0 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -21,6 +21,7 @@
  * Fix duplicate SSTable reference when stream session failed (CASSANDRA-3306)
  * Allow static CF definition with compact storage (CASSANDRA-4910)
  * Fix endless loop/compaction of schema_* CFs due to broken timestamps 
(CASSANDRA-4880)
+ * Fix 'wrong class type' assertion in CounterColumn (CASSANDRA-4976)
 
 
 1.1.6

http://git-wip-us.apache.org/repos/asf/cassandra/blob/d0292ef4/src/java/org/apache/cassandra/db/CounterColumn.java
--
diff --git a/src/java/org/apache/cassandra/db/CounterColumn.java 
b/src/java/org/apache/cassandra/db/CounterColumn.java
index b6e3909..67771a4 100644
--- a/src/java/org/apache/cassandra/db/CounterColumn.java
+++ b/src/java/org/apache/cassandra/db/CounterColumn.java
@@ -107,10 +107,18 @@ public class CounterColumn extends Column
 @Override
 public IColumn diff(IColumn column)
 {
-assert column instanceof CounterColumn : Wrong class type.;
+assert (column instanceof CounterColumn) || (column instanceof 
DeletedColumn) : Wrong class type:  + column.getClass();
 
 if (timestamp()  column.timestamp())
 return column;
+
+// Note that if at that point, column can't be a tombstone. Indeed,
+// column is the result of merging us with other nodes results, and
+// merging a CounterColumn with a tombstone never return a tombstone
+// unless that tombstone timestamp is greater that the CounterColumn
+// one.
+assert !(column instanceof DeletedColumn) : Wrong class type:  + 
column.getClass();
+
 if (timestampOfLastDelete()  
((CounterColumn)column).timestampOfLastDelete())
 return column;
 ContextRelationship rel = contextManager.diff(column.value(), value());
@@ -148,7 +156,7 @@ public class CounterColumn extends Column
 @Override
 public IColumn reconcile(IColumn column, Allocator allocator)
 {
-assert (column instanceof CounterColumn) || (column instanceof 
DeletedColumn) : Wrong class type.;
+assert (column instanceof CounterColumn) || (column instanceof 
DeletedColumn) : Wrong class type:  + column.getClass();
 
 if (column.isMarkedForDelete()) // live + tombstone: track last 
tombstone
 {



[3/5] git commit: Prevent inefficient queries (CQL3)

2012-11-23 Thread slebresne
Prevent inefficient queries (CQL3)

patch by slebresne; reviewed by jbellis for CASSANDRA-4915


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

Branch: refs/heads/trunk
Commit: 6fb751240013799a13890282e1af1f7dc85d9e8d
Parents: 9fb5779
Author: Sylvain Lebresne sylv...@datastax.com
Authored: Fri Nov 23 10:04:56 2012 +0100
Committer: Sylvain Lebresne sylv...@datastax.com
Committed: Fri Nov 23 10:04:56 2012 +0100

--
 CHANGES.txt|1 +
 src/java/org/apache/cassandra/cql3/Cql.g   |8 -
 .../cassandra/cql3/statements/SelectStatement.java |   24 ++-
 3 files changed, 31 insertions(+), 2 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/cassandra/blob/6fb75124/CHANGES.txt
--
diff --git a/CHANGES.txt b/CHANGES.txt
index 90b6537..4ea42c1 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -21,6 +21,7 @@
  * Fix CQL3 LIMIT (CASSANDRA-4877)
  * Fix Stress for CQL3 (CASSANDRA-4979)
  * Remove cassandra specific exceptions from JMX interface (CASSANDRA-4893)
+ * (CQL3) Force using ALLOW FILTERING on potentially inefficient queries 
(CASSANDRA-4915)
 Merged from 1.1:
  * add basic authentication support for Pig CassandraStorage (CASSANDRA-3042)
  * fix CQL2 ALTER TABLE compaction_strategy_class altering (CASSANDRA-4965)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/6fb75124/src/java/org/apache/cassandra/cql3/Cql.g
--
diff --git a/src/java/org/apache/cassandra/cql3/Cql.g 
b/src/java/org/apache/cassandra/cql3/Cql.g
index 9c3f77b..d814434 100644
--- a/src/java/org/apache/cassandra/cql3/Cql.g
+++ b/src/java/org/apache/cassandra/cql3/Cql.g
@@ -190,16 +190,19 @@ selectStatement returns [SelectStatement.RawStatement 
expr]
 boolean isCount = false;
 int limit = Integer.MAX_VALUE;
 MapColumnIdentifier, Boolean orderings = new 
LinkedHashMapColumnIdentifier, Boolean();
+boolean allowFiltering = false;
 }
 : K_SELECT ( sclause=selectClause | (K_COUNT '(' sclause=selectCountClause 
')' { isCount = true; }) )
   K_FROM cf=columnFamilyName
   ( K_WHERE wclause=whereClause )?
   ( K_ORDER K_BY orderByClause[orderings] ( ',' orderByClause[orderings] 
)* )?
   ( K_LIMIT rows=INTEGER { limit = Integer.parseInt($rows.text); } )?
+  ( K_ALLOW K_FILTERING  { allowFiltering = true; } )?
   {
   SelectStatement.Parameters params = new 
SelectStatement.Parameters(limit,
  
orderings,
- 
isCount);
+ 
isCount,
+ 
allowFiltering);
   $expr = new SelectStatement.RawStatement(cf, params, sclause, 
wclause);
   }
 ;
@@ -754,6 +757,7 @@ unreserved_keyword returns [String str]
 | K_WRITETIME
 | K_MAP
 | K_LIST
+| K_FILTERING
 ) { $str = $k.text; }
 | t=native_type { $str = t.toString(); }
 ;
@@ -822,6 +826,8 @@ K_DESCRIBE:D E S C R I B E;
 K_FOR: F O R;
 K_FULL_ACCESS: F U L L '_' A C C E S S;
 K_NO_ACCESS:   N O '_' A C C E S S;
+K_ALLOW:   A L L O W;
+K_FILTERING:   F I L T E R I N G;
 
 
 K_CLUSTERING:  C L U S T E R I N G;

http://git-wip-us.apache.org/repos/asf/cassandra/blob/6fb75124/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 4ae2b55..4e61a7b 100644
--- a/src/java/org/apache/cassandra/cql3/statements/SelectStatement.java
+++ b/src/java/org/apache/cassandra/cql3/statements/SelectStatement.java
@@ -957,6 +957,16 @@ public class SelectStatement implements CQLStatement
 return name.type instanceof ReversedType;
 }
 
+private boolean columnFilterIsIdentity()
+{
+for (Restriction r : columnRestrictions)
+{
+if (r != null)
+return false;
+}
+return true;
+}
+
 public static class RawStatement extends CFStatement
 {
 private final Parameters parameters;
@@ -1247,6 +1257,16 @@ public class SelectStatement implements CQLStatement
 stmt.isReversed = isReversed;
 }
 
+  

[jira] [Updated] (CASSANDRA-4982) cqlsh: alter table add column with table that has collection fails

2012-11-23 Thread Sylvain Lebresne (JIRA)

 [ 
https://issues.apache.org/jira/browse/CASSANDRA-4982?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Sylvain Lebresne updated CASSANDRA-4982:


Attachment: 4982.txt

Trivial patch attached.

 cqlsh: alter table add column with table that has collection fails
 --

 Key: CASSANDRA-4982
 URL: https://issues.apache.org/jira/browse/CASSANDRA-4982
 Project: Cassandra
  Issue Type: Bug
  Components: Core
Affects Versions: 1.2.0 beta 2
Reporter: Dave Brosius
Assignee: Sylvain Lebresne
 Attachments: 4982.txt


 create keyspace collections with replication = {'class':'SimpleStrategy', 
 'replication_factor':1};
 use collections;
 create table collections (key int primary key, aset settext);
 insert into collections (key, aset) values (1, {'fee', 'fi'});
 alter table collections add aaa text;
  
  
 ERROR 16:52:33,792 Error occurred during processing of message.
 java.lang.UnsupportedOperationException: ColumnToCollectionType should only 
 be used in composite types, never alone
 at 
 org.apache.cassandra.db.marshal.ColumnToCollectionType.validate(ColumnToCollectionType.java:103)
 at 
 org.apache.cassandra.config.CFMetaData.validate(CFMetaData.java:1094)
 at 
 org.apache.cassandra.service.MigrationManager.announceColumnFamilyUpdate(MigrationManager.java:202)
 at 
 org.apache.cassandra.cql3.statements.AlterTableStatement.announceMigration(AlterTableStatement.java:217)
 at 
 org.apache.cassandra.cql3.statements.SchemaAlteringStatement.execute(SchemaAlteringStatement.java:73)
 at 
 org.apache.cassandra.cql3.QueryProcessor.processStatement(QueryProcessor.java:132)
 at 
 org.apache.cassandra.cql3.QueryProcessor.process(QueryProcessor.java:140)
 at 
 org.apache.cassandra.thrift.CassandraServer.execute_cql3_query(CassandraServer.java:1706)
 at 
 org.apache.cassandra.thrift.Cassandra$Processor$execute_cql3_query.getResult(Cassandra.java:4074)
 at 
 org.apache.cassandra.thrift.Cassandra$Processor$execute_cql3_query.getResult(Cassandra.java:4062)
 at org.apache.thrift.ProcessFunction.process(ProcessFunction.java:32)
 at org.apache.thrift.TBaseProcessor.process(TBaseProcessor.java:34)
 at 
 org.apache.cassandra.thrift.CustomTThreadPoolServer$WorkerProcess.run(CustomTThreadPoolServer.java:199)
 at 
 java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
 at 
 java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
 at java.lang.Thread.run(Thread.java:662)

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira


[jira] [Commented] (CASSANDRA-4984) error opening data file at startup

2012-11-23 Thread Zenek Kraweznik (JIRA)

[ 
https://issues.apache.org/jira/browse/CASSANDRA-4984?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=13503157#comment-13503157
 ] 

Zenek Kraweznik commented on CASSANDRA-4984:


It happens after offline scrub too.

 error opening data file at startup
 --

 Key: CASSANDRA-4984
 URL: https://issues.apache.org/jira/browse/CASSANDRA-4984
 Project: Cassandra
  Issue Type: Bug
  Components: Core
Affects Versions: 1.1.6
 Environment: Oracle Java 1.6u37
Reporter: Zenek Kraweznik

 I've found this in logfile, this happens at cassandra startup:
 INFO 10:06:13,670 Opening 
 /var/lib/cassandra/data/MYKSPC/MYCF/MYKSPC-MYCF-hf-5547 (1073761823 bytes)
 ERROR 10:06:13,670 Exception in thread Thread[SSTableBatchOpen:3,5,main]
 java.lang.AssertionError
 at 
 org.apache.cassandra.io.sstable.SSTableReader.open(SSTableReader.java:166)
 at 
 org.apache.cassandra.io.sstable.SSTableReader.open(SSTableReader.java:153)
 at 
 org.apache.cassandra.io.sstable.SSTableReader$1.run(SSTableReader.java:242)
 at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
 at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
 at java.util.concurrent.FutureTask.run(Unknown Source)
 at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown 
 Source)
 at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
 at java.lang.Thread.run(Unknown Source)
 Every CF in this Keyspace has cashing set to 'NONE'

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira


[jira] [Created] (CASSANDRA-4988) Fix concurrent addition of collection columns

2012-11-23 Thread Sylvain Lebresne (JIRA)
Sylvain Lebresne created CASSANDRA-4988:
---

 Summary: Fix concurrent addition of collection columns
 Key: CASSANDRA-4988
 URL: https://issues.apache.org/jira/browse/CASSANDRA-4988
 Project: Cassandra
  Issue Type: Bug
Reporter: Sylvain Lebresne
 Fix For: 1.2.1


It is currently not safe to update the schema by adding multiple collection 
columns to the same table. The reason is that with collections, the comparator 
embeds a map of names-comparator for each collection columns (since different 
maps can have different key type for example). And when serialized on disk in 
the schema table, the comparator is serialized as a string with that map as one 
column. So if new collection columns are added concurrently, the addition may 
not be merged correctly.

One option to fix this would be to stop serializing the names-comparator map 
of ColumnToCollectionType in toString(), and do one of:
# reconstruct that map from the information stores in the schema_columns. The 
downside I can see is that code-wise this may not be super clean to do.
# change ColumnToCollectionType so that instead of having it's own 
names-comparator map, to just store a point to the CFMetaData that contains it 
and when it needs to find the exact comparator for a collection column, it 
would use CFMetadata.column_metadata directly. The downside is that creating a 
dependency from a comparator to a CFMetadata feels a bit backward.

Note sure what's the best solution of the two honestly.

While probably more anecdotal, we also now allow to change the type of the 
comparator in some cases (for example updating to BytesType is always allowed), 
and doing so concurrently on multiple components of a composite comparator is 
also not safe for a similar reason. I'm not sure how to fix that one.



--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira


[jira] [Resolved] (CASSANDRA-4977) Expose new SliceQueryFilter features through Thrift interface

2012-11-23 Thread aaa (JIRA)

 [ 
https://issues.apache.org/jira/browse/CASSANDRA-4977?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

aaa resolved CASSANDRA-4977.


Resolution: Invalid

 Expose new SliceQueryFilter features through Thrift interface
 -

 Key: CASSANDRA-4977
 URL: https://issues.apache.org/jira/browse/CASSANDRA-4977
 Project: Cassandra
  Issue Type: Improvement
  Components: API
Affects Versions: 1.2.0 beta 2
Reporter: aaa

 SliceQueryFilter has some very useful new features like ability to specify a 
 composite column prefix to group by and specify a limit of groups to return.
 This is very useful if for example I have a wide row with columns prefixed by 
 timestamp and I want to retrieve the latest columns, but I don't know the 
 column names. Say I have a row
 {{row - (t1, c1), (t1, c2)... (t1, cn) ... (t0,c1) ... etc}}
 Query slice range (t1,) group by prefix (1) limit (1)
 As a more general question, is the Thrift interface going to be kept 
 up-to-date with the feature changes or will it be left behind (a mistake IMO) 
 ?

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira


[jira] [Created] (CASSANDRA-4989) Expose new SliceQueryFilter features through Thrift interface

2012-11-23 Thread Cristian Opris (JIRA)
Cristian Opris created CASSANDRA-4989:
-

 Summary: Expose new SliceQueryFilter features through Thrift 
interface
 Key: CASSANDRA-4989
 URL: https://issues.apache.org/jira/browse/CASSANDRA-4989
 Project: Cassandra
  Issue Type: Improvement
  Components: API
Affects Versions: 1.2.0, 1.2.1, 1.3
Reporter: Cristian Opris


SliceQueryFilter has some very useful new features like ability to specify a 
composite column prefix to group by and specify a limit of groups to return.

This is very useful if for example I have a wide row with columns prefixed by 
timestamp and I want to retrieve the latest columns, but I don't know the 
column names. Say I have a row
{{row - (t1, c1), (t1, c2)... (t1, cn) ... (t0,c1) ... etc}}

Query slice range (t1,) group by prefix (1) limit (1)

As a more general question, is the Thrift interface going to be kept up-to-date 
with the feature changes or will it be left behind (a mistake IMO) ?



--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira


git commit: Document that list append/prepend are not idempotent and should be used with care

2012-11-23 Thread slebresne
Updated Branches:
  refs/heads/cassandra-1.2.0 6fb751240 - 64bc3354d


Document that list append/prepend are not idempotent and should be used with 
care


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

Branch: refs/heads/cassandra-1.2.0
Commit: 64bc3354d34bef9cff5a511f0045266f2c44f962
Parents: 6fb7512
Author: Sylvain Lebresne sylv...@datastax.com
Authored: Fri Nov 23 15:36:34 2012 +0100
Committer: Sylvain Lebresne sylv...@datastax.com
Committed: Fri Nov 23 15:36:34 2012 +0100

--
 doc/cql3/CQL.textile |2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/cassandra/blob/64bc3354/doc/cql3/CQL.textile
--
diff --git a/doc/cql3/CQL.textile b/doc/cql3/CQL.textile
index 931aa18..452407b 100644
--- a/doc/cql3/CQL.textile
+++ b/doc/cql3/CQL.textile
@@ -829,6 +829,8 @@ bc(sample).
 UPDATE plays SET players = 5, scores = scores + [ 14, 21 ] WHERE id = 
'123-afde';
 UPDATE plays SET players = 5, scores = [ 12 ] + scores WHERE id = '123-afde';
 
+It should be noted that append and prepend are not idempotent operations. This 
means that if during an append or a prepend the operation timeout, it is not 
always safe to retry the operation (as this could result in the record appended 
or prepended twice).
+
 Lists also provides the following operation: setting an element by its 
position in the list, removing an element by its position in the list and 
remove all the occurrence of a given value in the list. _However, and 
contrarily to all the other collection operations, these three operations 
induce an internal read before the update, and will thus typically have slower 
performance characteristics_. Those operations have the following syntax:
 
 bc(sample). 



[jira] [Resolved] (CASSANDRA-4806) Consistency of Append/Prepend on Lists need to be improved or clarified

2012-11-23 Thread Sylvain Lebresne (JIRA)

 [ 
https://issues.apache.org/jira/browse/CASSANDRA-4806?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Sylvain Lebresne resolved CASSANDRA-4806.
-

Resolution: Fixed

Alright, I've added some precision to the CQL3 doc so closing this.

 Consistency of Append/Prepend on Lists need to be improved or clarified
 ---

 Key: CASSANDRA-4806
 URL: https://issues.apache.org/jira/browse/CASSANDRA-4806
 Project: Cassandra
  Issue Type: Improvement
Affects Versions: 1.2.0 beta 1
Reporter: Michaël Figuière
Assignee: Sylvain Lebresne
Priority: Minor
 Fix For: 1.2.0


 Updates are idempotent in Cassandra, this rule makes it simple for developers 
 or client libraries to deal with retries on error. So far the only exception 
 was counters, and we worked around it saying they were meant to be used for 
 analytics use cases.
 Now with List datatype to be added in Cassandra 1.2 we have a similar issue 
 as Append and Prepend operations that can be applied on them are not 
 idempotent. The state of the list will be unknown whenever a timeout is 
 received from the coordinator node saying that no acknowledge could be 
 received on time from replicas or when the connection with the coordinator 
 node is broken while a client wait for an update request to be acknowledged.
 Of course the client can issue a read request on this List in the rare cases 
 when such an unknown state appear, but this is not really elegant and such a 
 check doesn't come with any visibility or atomicity guarantees.
 I can see 3 options:
 * Remove Append and Prepend operations. But this is a pity as they're really 
 useful.
 * Make the behavior of these commands quasi-idempotent. I imagine that if we 
 attach the list of timestamps and/or hashes of recent update requests to each 
 List column stored in Cassandra we would be able to avoid applying duplicate 
 updates. 
 * Explicitly document these operations as potentially unconsistent under 
 these particular conditions.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira


[jira] [Commented] (CASSANDRA-4989) Expose new SliceQueryFilter features through Thrift interface

2012-11-23 Thread Sylvain Lebresne (JIRA)

[ 
https://issues.apache.org/jira/browse/CASSANDRA-4989?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=13503226#comment-13503226
 ] 

Sylvain Lebresne commented on CASSANDRA-4989:
-

I'm not sure I understand your example. The way I understand your {{Query slice 
range (t1,) group by prefix (1) limit (1)}} you are literally asking for every 
columns staring with t1. You can absolutely do that with the thrift API 
currently (using CompositeType has a end-of-component feature).

Besides, the group by prefix is a CQL3 implementation detail and does more than 
just grouping by prefix when counting (it also skip deleted records in some 
conditions that only make sense for CQL3 for instance). The exact semantic of 
that counting may change depending on the needs of CQL3 and is not something 
that has ever been meant to be exposed directly. 

 Expose new SliceQueryFilter features through Thrift interface
 -

 Key: CASSANDRA-4989
 URL: https://issues.apache.org/jira/browse/CASSANDRA-4989
 Project: Cassandra
  Issue Type: Improvement
  Components: API
Affects Versions: 1.2.0, 1.2.1, 1.3
Reporter: Cristian Opris

 SliceQueryFilter has some very useful new features like ability to specify a 
 composite column prefix to group by and specify a limit of groups to return.
 This is very useful if for example I have a wide row with columns prefixed by 
 timestamp and I want to retrieve the latest columns, but I don't know the 
 column names. Say I have a row
 {{row - (t1, c1), (t1, c2)... (t1, cn) ... (t0,c1) ... etc}}
 Query slice range (t1,) group by prefix (1) limit (1)
 As a more general question, is the Thrift interface going to be kept 
 up-to-date with the feature changes or will it be left behind (a mistake IMO) 
 ?

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira


[jira] [Commented] (CASSANDRA-4989) Expose new SliceQueryFilter features through Thrift interface

2012-11-23 Thread Cristian Opris (JIRA)

[ 
https://issues.apache.org/jira/browse/CASSANDRA-4989?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=13503241#comment-13503241
 ] 

Cristian Opris commented on CASSANDRA-4989:
---

Sorry if I haven't been more clear. What I'd like is to do that query 
efficiently when I don't know t1 precisely, I
just want to get the latest columns before a time T

That can be done currently with Thrift but will return all columns with time t 
 T, while this way I can efficiently
get just the latest

Note that as of type queries are very common in financial type applications 
for example, so it's worth considering this
use case.

I'm not sure about the handling of deleted keys but maybe we can find a way to 
generalize and expose this ? I would have asked for a feature like this anyway, 
it just so happens that looking at the code I see this has been done to support 
CQL limits

Since I have an object serialization client API on top of Thrift, CQL is not 
much use to me...

 Expose new SliceQueryFilter features through Thrift interface
 -

 Key: CASSANDRA-4989
 URL: https://issues.apache.org/jira/browse/CASSANDRA-4989
 Project: Cassandra
  Issue Type: Improvement
  Components: API
Affects Versions: 1.2.0, 1.2.1, 1.3
Reporter: Cristian Opris

 SliceQueryFilter has some very useful new features like ability to specify a 
 composite column prefix to group by and specify a limit of groups to return.
 This is very useful if for example I have a wide row with columns prefixed by 
 timestamp and I want to retrieve the latest columns, but I don't know the 
 column names. Say I have a row
 {{row - (t1, c1), (t1, c2)... (t1, cn) ... (t0,c1) ... etc}}
 Query slice range (t1,) group by prefix (1) limit (1)
 As a more general question, is the Thrift interface going to be kept 
 up-to-date with the feature changes or will it be left behind (a mistake IMO) 
 ?

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira


[jira] [Commented] (CASSANDRA-4705) Speculative execution for CL_ONE

2012-11-23 Thread Vijay (JIRA)

[ 
https://issues.apache.org/jira/browse/CASSANDRA-4705?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=13503260#comment-13503260
 ] 

Vijay commented on CASSANDRA-4705:
--

Hi Jonathan, Sorry for the delay.

{quote}
Would it make more sense to have getReadLatencyRate and UpdateSampleLatencies 
into SR? that way we could replace case statements with polymorphism.
{quote}
The problem is that we have to calculate the expensive percentile calculation 
Async using a scheduled TPE, We can avoid the switch by introducing additional 
SRFactory which will initialize the TPE as per CF changes in the settings? Let 
me know.

{quote}
Why does preprocess return a boolean now?
{quote}
The current patch uses the boolean to understand if the processing was done or 
not its used by RCB after the patch when there are more than 1 responses 
received by the co-ordinator from the same host (When SR is on and the actual 
read response gets back at the same time as the speculated response), we should 
not count that towards the consistency level.

{quote}
How does/should SR interact with RR? Using ALL + RRR
{quote}
Currently we are doing additional read to double check if we need to write, I 
thought the goal for ALL will eliminate that and do additional write instead... 
Most cases it will be a memtable update :)
I can think of 2 options:
1) Just document the ALL case and live with the additional writes, user might 
not be a big issue for most cases and for the rest they can switch to the 
default behavior.
2) We can queue the repair Mutations, in the Async thread we can check if there 
are duplicate mutations pending... if yes then we can just ignore the 
duplicates this can be done by doing sendRR and adding the CF to be repaired in 
a HashSet (it takes additional memory footprint).

Should we move this discussion to a different ticket?

Let me know, Thanks!

 Speculative execution for CL_ONE
 

 Key: CASSANDRA-4705
 URL: https://issues.apache.org/jira/browse/CASSANDRA-4705
 Project: Cassandra
  Issue Type: Improvement
Affects Versions: 1.2.0
Reporter: Vijay
Assignee: Vijay
Priority: Minor
 Attachments: 0001-CASSANDRA-4705.patch, 0001-CASSANDRA-4705-v2.patch


 When read_repair is not 1.0, we send the request to one node for some of the 
 requests. When a node goes down or when a node is too busy the client has to 
 wait for the timeout before it can retry. 
 It would be nice to watch for latency and execute an additional request to a 
 different node, if the response is not received within average/99% of the 
 response times recorded in the past.
 CASSANDRA-2540 might be able to solve the variance when read_repair is set to 
 1.0
 1) May be we need to use metrics-core to record various Percentiles
 2) Modify ReadCallback.get to execute additional request speculatively.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira


[jira] [Comment Edited] (CASSANDRA-4705) Speculative execution for CL_ONE

2012-11-23 Thread Vijay (JIRA)

[ 
https://issues.apache.org/jira/browse/CASSANDRA-4705?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=13503260#comment-13503260
 ] 

Vijay edited comment on CASSANDRA-4705 at 11/23/12 6:28 PM:


Hi Jonathan, Sorry for the delay.

{quote}
Would it make more sense to have getReadLatencyRate and UpdateSampleLatencies 
into SR? that way we could replace case statements with polymorphism.
{quote}
The problem is that we have to calculate the expensive percentile calculation 
Async using a scheduled TPE, We can avoid the switch by introducing additional 
SRFactory which will initialize the TPE as per CF changes in the settings? Let 
me know.

{quote}
Why does preprocess return a boolean now?
{quote}
The current patch uses the boolean to understand if the processing was done or 
not its used by RCB after the patch when there are more than 1 responses 
received by the co-ordinator from the same host (When SR is on and the actual 
read response gets back at the same time as the speculated response), we should 
not count that towards the consistency level.

{quote}
How does/should SR interact with RR? Using ALL + RRR
{quote}
Currently we are doing additional read to double check if we need to write, I 
thought the goal for ALL will eliminate that and do additional write instead... 
Most cases it will be a memtable update :)
I can think of 2 options:
1) Just document the ALL case and live with the additional writes, might not be 
a big issue for most cases and for the rest user can switch to the default 
behavior.
2) We can queue the repair Mutations, in the Async thread we can check if there 
are duplicate mutations pending... if yes then we can just ignore the 
duplicates this can be done by doing sendRR and adding the CF to be repaired in 
a HashSet (it takes additional memory footprint).

Should we move this discussion to a different ticket?

Let me know, Thanks!

  was (Author: vijay2...@yahoo.com):
Hi Jonathan, Sorry for the delay.

{quote}
Would it make more sense to have getReadLatencyRate and UpdateSampleLatencies 
into SR? that way we could replace case statements with polymorphism.
{quote}
The problem is that we have to calculate the expensive percentile calculation 
Async using a scheduled TPE, We can avoid the switch by introducing additional 
SRFactory which will initialize the TPE as per CF changes in the settings? Let 
me know.

{quote}
Why does preprocess return a boolean now?
{quote}
The current patch uses the boolean to understand if the processing was done or 
not its used by RCB after the patch when there are more than 1 responses 
received by the co-ordinator from the same host (When SR is on and the actual 
read response gets back at the same time as the speculated response), we should 
not count that towards the consistency level.

{quote}
How does/should SR interact with RR? Using ALL + RRR
{quote}
Currently we are doing additional read to double check if we need to write, I 
thought the goal for ALL will eliminate that and do additional write instead... 
Most cases it will be a memtable update :)
I can think of 2 options:
1) Just document the ALL case and live with the additional writes, user might 
not be a big issue for most cases and for the rest they can switch to the 
default behavior.
2) We can queue the repair Mutations, in the Async thread we can check if there 
are duplicate mutations pending... if yes then we can just ignore the 
duplicates this can be done by doing sendRR and adding the CF to be repaired in 
a HashSet (it takes additional memory footprint).

Should we move this discussion to a different ticket?

Let me know, Thanks!
  
 Speculative execution for CL_ONE
 

 Key: CASSANDRA-4705
 URL: https://issues.apache.org/jira/browse/CASSANDRA-4705
 Project: Cassandra
  Issue Type: Improvement
Affects Versions: 1.2.0
Reporter: Vijay
Assignee: Vijay
Priority: Minor
 Attachments: 0001-CASSANDRA-4705.patch, 0001-CASSANDRA-4705-v2.patch


 When read_repair is not 1.0, we send the request to one node for some of the 
 requests. When a node goes down or when a node is too busy the client has to 
 wait for the timeout before it can retry. 
 It would be nice to watch for latency and execute an additional request to a 
 different node, if the response is not received within average/99% of the 
 response times recorded in the past.
 CASSANDRA-2540 might be able to solve the variance when read_repair is set to 
 1.0
 1) May be we need to use metrics-core to record various Percentiles
 2) Modify ReadCallback.get to execute additional request speculatively.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on 

[4/8] git commit: typos

2012-11-23 Thread brandonwilliams
typos


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

Branch: refs/heads/cassandra-1.2.0
Commit: 27db966539f6912e38b100a1c7c62b2ab93df8b7
Parents: 64bc335
Author: Brandon Williams brandonwilli...@apache.org
Authored: Fri Nov 23 15:50:38 2012 -0600
Committer: Brandon Williams brandonwilli...@apache.org
Committed: Fri Nov 23 15:50:38 2012 -0600

--
 .../cassandra/cql3/statements/SelectStatement.java |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/cassandra/blob/27db9665/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 4e61a7b..0a0dcfd 100644
--- a/src/java/org/apache/cassandra/cql3/statements/SelectStatement.java
+++ b/src/java/org/apache/cassandra/cql3/statements/SelectStatement.java
@@ -1264,8 +1264,8 @@ public class SelectStatement implements CQLStatement
 //  - Have more than one IndexExpression
 //  - Have no index expression and the column filter is not 
the identity
 if (stmt.metadataRestrictions.size()  1 || 
(stmt.metadataRestrictions.isEmpty()  !stmt.columnFilterIsIdentity()))
-throw new InvalidRequestException(Cannot execute this 
query as it might involve data filtering and thus may have impredictible 
performance. 
-+ If you want to execute 
this query despite the performance impredictibility, use ALLOW FILTERING);
+throw new InvalidRequestException(Cannot execute this 
query as it might involve data filtering and thus may have unpredictable 
performance. 
++ If you want to execute 
this query despite the performance unpredictability, use ALLOW FILTERING);
 }
 
 return new ParsedStatement.Prepared(stmt, 
Arrays.ColumnSpecificationasList(names));



[6/8] git commit: typos

2012-11-23 Thread brandonwilliams
typos


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

Branch: refs/heads/cassandra-1.2
Commit: 27db966539f6912e38b100a1c7c62b2ab93df8b7
Parents: 64bc335
Author: Brandon Williams brandonwilli...@apache.org
Authored: Fri Nov 23 15:50:38 2012 -0600
Committer: Brandon Williams brandonwilli...@apache.org
Committed: Fri Nov 23 15:50:38 2012 -0600

--
 .../cassandra/cql3/statements/SelectStatement.java |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/cassandra/blob/27db9665/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 4e61a7b..0a0dcfd 100644
--- a/src/java/org/apache/cassandra/cql3/statements/SelectStatement.java
+++ b/src/java/org/apache/cassandra/cql3/statements/SelectStatement.java
@@ -1264,8 +1264,8 @@ public class SelectStatement implements CQLStatement
 //  - Have more than one IndexExpression
 //  - Have no index expression and the column filter is not 
the identity
 if (stmt.metadataRestrictions.size()  1 || 
(stmt.metadataRestrictions.isEmpty()  !stmt.columnFilterIsIdentity()))
-throw new InvalidRequestException(Cannot execute this 
query as it might involve data filtering and thus may have impredictible 
performance. 
-+ If you want to execute 
this query despite the performance impredictibility, use ALLOW FILTERING);
+throw new InvalidRequestException(Cannot execute this 
query as it might involve data filtering and thus may have unpredictable 
performance. 
++ If you want to execute 
this query despite the performance unpredictability, use ALLOW FILTERING);
 }
 
 return new ParsedStatement.Prepared(stmt, 
Arrays.ColumnSpecificationasList(names));



[1/8] git commit: Merge branch 'cassandra-1.2' into trunk

2012-11-23 Thread brandonwilliams
Updated Branches:
  refs/heads/cassandra-1.2 d97a5ca4d - 49a067671
  refs/heads/cassandra-1.2.0 64bc3354d - 27db96653
  refs/heads/trunk be89a954b - a19d5dbbc


Merge branch 'cassandra-1.2' into trunk


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

Branch: refs/heads/trunk
Commit: a19d5dbbcb324040a2a62b14ddde5fb38cf6f573
Parents: be89a95 49a0676
Author: Brandon Williams brandonwilli...@apache.org
Authored: Fri Nov 23 15:51:06 2012 -0600
Committer: Brandon Williams brandonwilli...@apache.org
Committed: Fri Nov 23 15:51:06 2012 -0600

--
 doc/cql3/CQL.textile   |2 ++
 .../cassandra/cql3/statements/SelectStatement.java |4 ++--
 2 files changed, 4 insertions(+), 2 deletions(-)
--




[7/8] git commit: Document that list append/prepend are not idempotent and should be used with care

2012-11-23 Thread brandonwilliams
Document that list append/prepend are not idempotent and should be used with 
care


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

Branch: refs/heads/trunk
Commit: 64bc3354d34bef9cff5a511f0045266f2c44f962
Parents: 6fb7512
Author: Sylvain Lebresne sylv...@datastax.com
Authored: Fri Nov 23 15:36:34 2012 +0100
Committer: Sylvain Lebresne sylv...@datastax.com
Committed: Fri Nov 23 15:36:34 2012 +0100

--
 doc/cql3/CQL.textile |2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/cassandra/blob/64bc3354/doc/cql3/CQL.textile
--
diff --git a/doc/cql3/CQL.textile b/doc/cql3/CQL.textile
index 931aa18..452407b 100644
--- a/doc/cql3/CQL.textile
+++ b/doc/cql3/CQL.textile
@@ -829,6 +829,8 @@ bc(sample).
 UPDATE plays SET players = 5, scores = scores + [ 14, 21 ] WHERE id = 
'123-afde';
 UPDATE plays SET players = 5, scores = [ 12 ] + scores WHERE id = '123-afde';
 
+It should be noted that append and prepend are not idempotent operations. This 
means that if during an append or a prepend the operation timeout, it is not 
always safe to retry the operation (as this could result in the record appended 
or prepended twice).
+
 Lists also provides the following operation: setting an element by its 
position in the list, removing an element by its position in the list and 
remove all the occurrence of a given value in the list. _However, and 
contrarily to all the other collection operations, these three operations 
induce an internal read before the update, and will thus typically have slower 
performance characteristics_. Those operations have the following syntax:
 
 bc(sample). 



[8/8] git commit: Document that list append/prepend are not idempotent and should be used with care

2012-11-23 Thread brandonwilliams
Document that list append/prepend are not idempotent and should be used with 
care


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

Branch: refs/heads/cassandra-1.2
Commit: 64bc3354d34bef9cff5a511f0045266f2c44f962
Parents: 6fb7512
Author: Sylvain Lebresne sylv...@datastax.com
Authored: Fri Nov 23 15:36:34 2012 +0100
Committer: Sylvain Lebresne sylv...@datastax.com
Committed: Fri Nov 23 15:36:34 2012 +0100

--
 doc/cql3/CQL.textile |2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/cassandra/blob/64bc3354/doc/cql3/CQL.textile
--
diff --git a/doc/cql3/CQL.textile b/doc/cql3/CQL.textile
index 931aa18..452407b 100644
--- a/doc/cql3/CQL.textile
+++ b/doc/cql3/CQL.textile
@@ -829,6 +829,8 @@ bc(sample).
 UPDATE plays SET players = 5, scores = scores + [ 14, 21 ] WHERE id = 
'123-afde';
 UPDATE plays SET players = 5, scores = [ 12 ] + scores WHERE id = '123-afde';
 
+It should be noted that append and prepend are not idempotent operations. This 
means that if during an append or a prepend the operation timeout, it is not 
always safe to retry the operation (as this could result in the record appended 
or prepended twice).
+
 Lists also provides the following operation: setting an element by its 
position in the list, removing an element by its position in the list and 
remove all the occurrence of a given value in the list. _However, and 
contrarily to all the other collection operations, these three operations 
induce an internal read before the update, and will thus typically have slower 
performance characteristics_. Those operations have the following syntax:
 
 bc(sample). 



[5/8] git commit: typos

2012-11-23 Thread brandonwilliams
typos


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

Branch: refs/heads/trunk
Commit: 27db966539f6912e38b100a1c7c62b2ab93df8b7
Parents: 64bc335
Author: Brandon Williams brandonwilli...@apache.org
Authored: Fri Nov 23 15:50:38 2012 -0600
Committer: Brandon Williams brandonwilli...@apache.org
Committed: Fri Nov 23 15:50:38 2012 -0600

--
 .../cassandra/cql3/statements/SelectStatement.java |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/cassandra/blob/27db9665/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 4e61a7b..0a0dcfd 100644
--- a/src/java/org/apache/cassandra/cql3/statements/SelectStatement.java
+++ b/src/java/org/apache/cassandra/cql3/statements/SelectStatement.java
@@ -1264,8 +1264,8 @@ public class SelectStatement implements CQLStatement
 //  - Have more than one IndexExpression
 //  - Have no index expression and the column filter is not 
the identity
 if (stmt.metadataRestrictions.size()  1 || 
(stmt.metadataRestrictions.isEmpty()  !stmt.columnFilterIsIdentity()))
-throw new InvalidRequestException(Cannot execute this 
query as it might involve data filtering and thus may have impredictible 
performance. 
-+ If you want to execute 
this query despite the performance impredictibility, use ALLOW FILTERING);
+throw new InvalidRequestException(Cannot execute this 
query as it might involve data filtering and thus may have unpredictable 
performance. 
++ If you want to execute 
this query despite the performance unpredictability, use ALLOW FILTERING);
 }
 
 return new ParsedStatement.Prepared(stmt, 
Arrays.ColumnSpecificationasList(names));



[Cassandra Wiki] Update of Committers by AlekseyYeschenko

2012-11-23 Thread Apache Wiki
Dear Wiki user,

You have subscribed to a wiki page or wiki category on Cassandra Wiki for 
change notification.

The Committers page has been changed by AlekseyYeschenko:
http://wiki.apache.org/cassandra/Committers?action=diffrev1=27rev2=28

  ||Peter Schuller||Feb 2012||Twitter|| ||
  ||Dave Brosius||May 2012||Independent||Also a 
[[http://commons.apache.org|Commons]] committer||
  ||Yuki Morishita||May 2012||Datastax
+ ||Aleksey Yeschenko||Nov 2012||Datastax|| ||
  


[jira] [Commented] (CASSANDRA-4982) cqlsh: alter table add column with table that has collection fails

2012-11-23 Thread Dave Brosius (JIRA)

[ 
https://issues.apache.org/jira/browse/CASSANDRA-4982?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=13503339#comment-13503339
 ] 

Dave Brosius commented on CASSANDRA-4982:
-

fixed... LGTM.

 cqlsh: alter table add column with table that has collection fails
 --

 Key: CASSANDRA-4982
 URL: https://issues.apache.org/jira/browse/CASSANDRA-4982
 Project: Cassandra
  Issue Type: Bug
  Components: Core
Affects Versions: 1.2.0 beta 2
Reporter: Dave Brosius
Assignee: Sylvain Lebresne
 Fix For: 1.2.0 rc1

 Attachments: 4982.txt


 create keyspace collections with replication = {'class':'SimpleStrategy', 
 'replication_factor':1};
 use collections;
 create table collections (key int primary key, aset settext);
 insert into collections (key, aset) values (1, {'fee', 'fi'});
 alter table collections add aaa text;
  
  
 ERROR 16:52:33,792 Error occurred during processing of message.
 java.lang.UnsupportedOperationException: ColumnToCollectionType should only 
 be used in composite types, never alone
 at 
 org.apache.cassandra.db.marshal.ColumnToCollectionType.validate(ColumnToCollectionType.java:103)
 at 
 org.apache.cassandra.config.CFMetaData.validate(CFMetaData.java:1094)
 at 
 org.apache.cassandra.service.MigrationManager.announceColumnFamilyUpdate(MigrationManager.java:202)
 at 
 org.apache.cassandra.cql3.statements.AlterTableStatement.announceMigration(AlterTableStatement.java:217)
 at 
 org.apache.cassandra.cql3.statements.SchemaAlteringStatement.execute(SchemaAlteringStatement.java:73)
 at 
 org.apache.cassandra.cql3.QueryProcessor.processStatement(QueryProcessor.java:132)
 at 
 org.apache.cassandra.cql3.QueryProcessor.process(QueryProcessor.java:140)
 at 
 org.apache.cassandra.thrift.CassandraServer.execute_cql3_query(CassandraServer.java:1706)
 at 
 org.apache.cassandra.thrift.Cassandra$Processor$execute_cql3_query.getResult(Cassandra.java:4074)
 at 
 org.apache.cassandra.thrift.Cassandra$Processor$execute_cql3_query.getResult(Cassandra.java:4062)
 at org.apache.thrift.ProcessFunction.process(ProcessFunction.java:32)
 at org.apache.thrift.TBaseProcessor.process(TBaseProcessor.java:34)
 at 
 org.apache.cassandra.thrift.CustomTThreadPoolServer$WorkerProcess.run(CustomTThreadPoolServer.java:199)
 at 
 java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
 at 
 java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
 at java.lang.Thread.run(Thread.java:662)

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira