Merge branch 'cassandra-2.0' into cassandra-2.1.0 Conflicts: build.xml src/java/org/apache/cassandra/cql3/statements/BatchStatement.java
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/8da13437 Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/8da13437 Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/8da13437 Branch: refs/heads/cassandra-2.1.0 Commit: 8da134377a04614a5343ccf3eb211e8c48dd90fa Parents: a0923db 200b802 Author: Sylvain Lebresne <sylv...@datastax.com> Authored: Fri Aug 22 16:15:50 2014 +0200 Committer: Sylvain Lebresne <sylv...@datastax.com> Committed: Fri Aug 22 16:15:50 2014 +0200 ---------------------------------------------------------------------- build.xml | 2 +- .../cassandra/cql3/statements/BatchStatement.java | 2 +- .../cql3/statements/ModificationStatement.java | 2 +- tools/lib/cassandra-driver-core-2.0.4.jar | Bin 544025 -> 0 bytes tools/lib/cassandra-driver-core-2.0.5.jar | Bin 0 -> 544552 bytes 5 files changed, 3 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cassandra/blob/8da13437/build.xml ---------------------------------------------------------------------- diff --cc build.xml index ae77274,dd59bd2..16ff03b --- a/build.xml +++ b/build.xml @@@ -395,12 -384,10 +395,12 @@@ <dependency groupId="org.apache.cassandra" artifactId="cassandra-thrift" version="${version}" /> <dependency groupId="com.yammer.metrics" artifactId="metrics-core" version="2.2.0" /> <dependency groupId="com.addthis.metrics" artifactId="reporter-config" version="2.1.0" /> - <dependency groupId="edu.stanford.ppl" artifactId="snaptree" version="0.1" /> <dependency groupId="org.mindrot" artifactId="jbcrypt" version="0.3m" /> - <dependency groupId="io.netty" artifactId="netty" version="3.6.6.Final" /> + <dependency groupId="io.airlift" artifactId="airline" version="0.6" /> + <dependency groupId="io.netty" artifactId="netty-all" version="4.0.20.Final" /> + <dependency groupId="com.google.code.findbugs" artifactId="jsr305" version="2.0.2" /> + <dependency groupId="com.clearspring.analytics" artifactId="stream" version="2.5.2" /> - <dependency groupId="com.datastax.cassandra" artifactId="cassandra-driver-core" version="2.0.4" /> + <dependency groupId="com.datastax.cassandra" artifactId="cassandra-driver-core" version="2.0.5" /> <dependency groupId="net.sf.supercsv" artifactId="super-csv" version="2.1.0" /> </dependencyManagement> <developer id="alakshman" name="Avinash Lakshman"/> http://git-wip-us.apache.org/repos/asf/cassandra/blob/8da13437/src/java/org/apache/cassandra/cql3/statements/BatchStatement.java ---------------------------------------------------------------------- diff --cc src/java/org/apache/cassandra/cql3/statements/BatchStatement.java index 90be914,8a9a8f0..49617ee --- a/src/java/org/apache/cassandra/cql3/statements/BatchStatement.java +++ b/src/java/org/apache/cassandra/cql3/statements/BatchStatement.java @@@ -124,35 -124,10 +124,35 @@@ public class BatchStatement implements if (timestampSet && statement.isTimestampSet()) throw new InvalidRequestException("Timestamp must be set either on BATCH or individual statements"); - statement.validate(state); + if (type == Type.COUNTER && !statement.isCounter()) + throw new InvalidRequestException("Cannot include non-counter statement in a counter batch"); + + if (type == Type.LOGGED && statement.isCounter()) + throw new InvalidRequestException("Cannot include a counter statement in a logged batch"); + + if (statement.isCounter()) + hasCounters = true; + else + hasNonCounters = true; + } + + if (hasCounters && hasNonCounters) + throw new InvalidRequestException("Counter and non-counter mutations cannot exist in the same batch"); - if (hasConditions && statement.requiresRead()) - throw new InvalidRequestException("Operations on lists requiring a read (setting by index and deletions by index or value) are not allowed with IF conditions"); + if (hasConditions) + { + String ksName = null; + String cfName = null; + for (ModificationStatement stmt : statements) + { + if (ksName != null && (!stmt.keyspace().equals(ksName) || !stmt.columnFamily().equals(cfName))) + throw new InvalidRequestException("Batch with conditions cannot span multiple tables"); + ksName = stmt.keyspace(); + cfName = stmt.columnFamily(); + + if (stmt.requiresRead()) - throw new InvalidRequestException("Operations using list indexes are not allowed with IF conditions"); ++ throw new InvalidRequestException("Operations on lists requiring a read (setting by index and deletions by index or value) are not allowed with IF conditions"); + } } } http://git-wip-us.apache.org/repos/asf/cassandra/blob/8da13437/src/java/org/apache/cassandra/cql3/statements/ModificationStatement.java ---------------------------------------------------------------------- diff --cc src/java/org/apache/cassandra/cql3/statements/ModificationStatement.java index fef0e94,165dbc1..95ba41a --- a/src/java/org/apache/cassandra/cql3/statements/ModificationStatement.java +++ b/src/java/org/apache/cassandra/cql3/statements/ModificationStatement.java @@@ -150,17 -154,30 +150,17 @@@ public abstract class ModificationState if (hasConditions()) { if (attrs.isTimestampSet()) - throw new InvalidRequestException("Cannot provide custom timestamp for conditional update"); + throw new InvalidRequestException("Cannot provide custom timestamp for conditional updates"); if (requiresRead()) - throw new InvalidRequestException("Operations using list indexes are not allowed with IF conditions"); + throw new InvalidRequestException("Operations on lists requiring a read (setting by index and deletions by index or value) are not allowed with IF conditions"); } - if (isCounter()) - { - if (attrs.isTimestampSet() && !loggedCounterTimestamp) - { - logger.warn("Detected use of 'USING TIMESTAMP' in a counter UPDATE. This is invalid " + - "because counters do not use timestamps, and the timestamp has been ignored. " + - "Such queries will be rejected in Cassandra 2.1+ - please fix your queries before then."); - loggedCounterTimestamp = true; - } + if (isCounter() && attrs.isTimestampSet()) + throw new InvalidRequestException("Cannot provide custom timestamp for counter updates"); - if (attrs.isTimeToLiveSet() && !loggedCounterTTL) - { - logger.warn("Detected use of 'USING TTL' in a counter UPDATE. This is invalid " + - "because counter tables do not support TTL, and the TTL value has been ignored. " + - "Such queries will be rejected in Cassandra 2.1+ - please fix your queries before then."); - loggedCounterTTL = true; - } - } + if (isCounter() && attrs.isTimeToLiveSet()) + throw new InvalidRequestException("Cannot provide custom TTL for counter updates"); } public void addOperation(Operation op) http://git-wip-us.apache.org/repos/asf/cassandra/blob/8da13437/tools/lib/cassandra-driver-core-2.0.5.jar ---------------------------------------------------------------------- diff --cc tools/lib/cassandra-driver-core-2.0.5.jar index 0000000,0000000..260183e new file mode 100644 Binary files differ