Updated Branches:
  refs/heads/trunk 5e425cb15 -> 78783556b

Merge branch 'cassandra-1.1' into trunk


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

Branch: refs/heads/trunk
Commit: 78783556b5707ada88a552e36f4f3803a02e9db6
Parents: 5e425cb 46fc843
Author: Dave Brosius <dbros...@apache.org>
Authored: Tue Oct 9 22:07:08 2012 -0400
Committer: Dave Brosius <dbros...@apache.org>
Committed: Tue Oct 9 22:07:08 2012 -0400

----------------------------------------------------------------------
 CHANGES.txt                                        |    1 +
 .../cql3/statements/ModificationStatement.java     |    6 +++++
 .../org/apache/cassandra/db/ExpiringColumn.java    |    2 +
 .../apache/cassandra/thrift/ThriftValidation.java  |   17 ++++++++++----
 4 files changed, 21 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/78783556/CHANGES.txt
----------------------------------------------------------------------
diff --cc CHANGES.txt
index a321193,7863d56..7189012
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@@ -1,102 -1,5 +1,103 @@@
 +1.2-beta2
 + * 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)
 + * Configurable bucket size for size tiered compaction (CASSANDRA-4704)
 +
 +
 +1.2-beta1
 + * add atomic_batch_mutate (CASSANDRA-4542, -4635)
 + * increase default max_hint_window_in_ms to 3h (CASSANDRA-4632)
 + * include message initiation time to replicas so they can more
 +   accurately drop timed-out requests (CASSANDRA-2858)
 + * fix clientutil.jar dependencies (CASSANDRA-4566)
 + * optimize WriteResponse (CASSANDRA-4548)
 + * new metrics (CASSANDRA-4009)
 + * redesign KEYS indexes to avoid read-before-write (CASSANDRA-2897)
 + * debug tracing (CASSANDRA-1123)
 + * parallelize row cache loading (CASSANDRA-4282)
 + * Make compaction, flush JBOD-aware (CASSANDRA-4292)
 + * run local range scans on the read stage (CASSANDRA-3687)
 + * clean up ioexceptions (CASSANDRA-2116)
 + * add disk_failure_policy (CASSANDRA-2118)
 + * Introduce new json format with row level deletion (CASSANDRA-4054)
 + * remove redundant "name" column from schema_keyspaces (CASSANDRA-4433)
 + * improve "nodetool ring" handling of multi-dc clusters (CASSANDRA-3047)
 + * update NTS calculateNaturalEndpoints to be O(N log N) (CASSANDRA-3881)
 + * add UseCondCardMark XX jvm settings on jdk 1.7 (CASSANDRA-4366)
 + * split up rpc timeout by operation type (CASSANDRA-2819)
 + * rewrite key cache save/load to use only sequential i/o (CASSANDRA-3762)
 + * update MS protocol with a version handshake + broadcast address id
 +   (CASSANDRA-4311)
 + * multithreaded hint replay (CASSANDRA-4189)
 + * add inter-node message compression (CASSANDRA-3127)
 + * remove COPP (CASSANDRA-2479)
 + * Track tombstone expiration and compact when tombstone content is
 +   higher than a configurable threshold, default 20% (CASSANDRA-3442, 4234)
 + * update MurmurHash to version 3 (CASSANDRA-2975)
 + * (CLI) track elapsed time for `delete' operation (CASSANDRA-4060)
 + * (CLI) jline version is bumped to 1.0 to properly  support
 +   'delete' key function (CASSANDRA-4132)
 + * Save IndexSummary into new SSTable 'Summary' component (CASSANDRA-2392, 
4289)
 + * Add support for range tombstones (CASSANDRA-3708)
 + * Improve MessagingService efficiency (CASSANDRA-3617)
 + * Avoid ID conflicts from concurrent schema changes (CASSANDRA-3794)
 + * Set thrift HSHA server thread limit to unlimited by default 
(CASSANDRA-4277)
 + * Avoids double serialization of CF id in RowMutation messages
 +   (CASSANDRA-4293)
 + * stream compressed sstables directly with java nio (CASSANDRA-4297)
 + * Support multiple ranges in SliceQueryFilter (CASSANDRA-3885)
 + * Add column metadata to system column families (CASSANDRA-4018)
 + * (cql3) Always use composite types by default (CASSANDRA-4329)
 + * (cql3) Add support for set, map and list (CASSANDRA-3647)
 + * Validate date type correctly (CASSANDRA-4441)
 + * (cql3) Allow definitions with only a PK (CASSANDRA-4361)
 + * (cql3) Add support for row key composites (CASSANDRA-4179)
 + * improve DynamicEndpointSnitch by using reservoir sampling (CASSANDRA-4038)
 + * (cql3) Add support for 2ndary indexes (CASSANDRA-3680)
 + * (cql3) fix defining more than one PK to be invalid (CASSANDRA-4477)
 + * remove schema agreement checking from all external APIs (Thrift, CQL and 
CQL3) (CASSANDRA-4487)
 + * add Murmur3Partitioner and make it default for new installations 
(CASSANDRA-3772, 4621)
 + * (cql3) update pseudo-map syntax to use map syntax (CASSANDRA-4497)
 + * Finer grained exceptions hierarchy and provides error code with exceptions 
(CASSANDRA-3979)
 + * Adds events push to binary protocol (CASSANDRA-4480)
 + * Rewrite nodetool help (CASSANDRA-2293)
 + * Make CQL3 the default for CQL (CASSANDRA-4640)
 + * update stress tool to be able to use CQL3 (CASSANDRA-4406)
 + * Accept all thrift update on CQL3 cf but don't expose their metadata 
(CASSANDRA-4377)
 + * Replace Throttle with Guava's RateLimiter for HintedHandOff 
(CASSANDRA-4541)
 + * fix counter add/get using CQL2 and CQL3 in stress tool (CASSANDRA-4633)
 + * Add sstable count per level to cfstats (CASSANDRA-4537)
 + * (cql3) Add ALTER KEYSPACE statement (CASSANDRA-4611)
 + * (cql3) Allow defining default consistency levels (CASSANDRA-4448)
 + * (cql3) Fix queries using LIMIT missing results (CASSANDRA-4579)
 + * fix cross-version gossip messaging (CASSANDRA-4576)
 +
 +
  1.1.6
+  * preflight check ttl for maximum of 20 years (CASSANDRA-4771)
   * Fix HH to compact with correct gcBefore, which avoids wiping out
     undelivered hints (CASSANDRA-4772)
   * LCS will merge up to 32 L0 sstables as intended (CASSANDRA-4778)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/78783556/src/java/org/apache/cassandra/cql3/statements/ModificationStatement.java
----------------------------------------------------------------------
diff --cc 
src/java/org/apache/cassandra/cql3/statements/ModificationStatement.java
index df58ca9,23d96e0..9f335a7
--- a/src/java/org/apache/cassandra/cql3/statements/ModificationStatement.java
+++ b/src/java/org/apache/cassandra/cql3/statements/ModificationStatement.java
@@@ -17,22 -18,23 +17,25 @@@
   */
  package org.apache.cassandra.cql3.statements;
  
 +import java.io.IOError;
 +import java.io.IOException;
  import java.nio.ByteBuffer;
 -import java.util.List;
 -import java.util.concurrent.TimeoutException;
 +import java.util.*;
  
  import org.apache.cassandra.auth.Permission;
 +import org.apache.cassandra.config.CFMetaData;
 +import org.apache.cassandra.config.Schema;
  import org.apache.cassandra.cql3.*;
++
 +import org.apache.cassandra.transport.messages.ResultMessage;
 +import org.apache.cassandra.db.*;
 +import org.apache.cassandra.db.filter.QueryPath;
 +import org.apache.cassandra.db.marshal.CompositeType;
 +import org.apache.cassandra.exceptions.*;
+ import org.apache.cassandra.db.IMutation;
+ import org.apache.cassandra.db.ExpiringColumn;
  import org.apache.cassandra.service.ClientState;
  import org.apache.cassandra.service.StorageProxy;
 -import org.apache.cassandra.thrift.ConsistencyLevel;
 -import org.apache.cassandra.thrift.CqlResult;
 -import org.apache.cassandra.thrift.InvalidRequestException;
 -import org.apache.cassandra.thrift.RequestType;
 -import org.apache.cassandra.thrift.ThriftValidation;
 -import org.apache.cassandra.thrift.TimedOutException;
 -import org.apache.cassandra.thrift.UnavailableException;
  
  /**
   * Abstract class for statements that apply on a given column family.
@@@ -75,41 -70,22 +78,44 @@@ public abstract class ModificationState
          if (timeToLive < 0)
              throw new InvalidRequestException("A TTL must be greater or equal 
to 0");
  
+         if (timeToLive > ExpiringColumn.MAX_TTL)
+             throw new InvalidRequestException(String.format("ttl is too 
large. requested (%d) maximum (%d)", timeToLive, ExpiringColumn.MAX_TTL));
+ 
 -        ThriftValidation.validateConsistencyLevel(keyspace(), 
getConsistencyLevel(), RequestType.WRITE);
 +        getConsistencyLevel().validateForWrite(keyspace());
      }
  
 -    public CqlResult execute(ClientState state, List<ByteBuffer> variables) 
throws InvalidRequestException, UnavailableException, TimedOutException
 +    public ResultMessage execute(ClientState state, List<ByteBuffer> 
variables) throws RequestExecutionException, RequestValidationException
      {
 -        try
 -        {
 -            StorageProxy.mutate(getMutations(state, variables), 
getConsistencyLevel());
 -        }
 -        catch (TimeoutException e)
 +        Collection<? extends IMutation> mutations = getMutations(state, 
variables, false);
 +        ConsistencyLevel cl = getConsistencyLevel();
 +
 +        // The type should have been set by now or we have a bug
 +        assert type != null;
 +
 +        switch (type)
          {
 -            throw new TimedOutException();
 +            case LOGGED:
 +                if (mutations.size() > 1)
 +                    StorageProxy.mutateAtomically((Collection<RowMutation>) 
mutations, cl);
 +                else
 +                    StorageProxy.mutate(mutations, cl);
 +                break;
 +            case UNLOGGED:
 +            case COUNTER:
 +                StorageProxy.mutate(mutations, cl);
 +                break;
 +            default:
 +                throw new AssertionError();
          }
 +
 +        return null;
 +    }
 +
 +
 +    public ResultMessage executeInternal(ClientState state) throws 
RequestValidationException, RequestExecutionException
 +    {
 +        for (IMutation mutation : getMutations(state, 
Collections.<ByteBuffer>emptyList(), true))
 +            mutation.apply();
          return null;
      }
  

http://git-wip-us.apache.org/repos/asf/cassandra/blob/78783556/src/java/org/apache/cassandra/db/ExpiringColumn.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/cassandra/blob/78783556/src/java/org/apache/cassandra/thrift/ThriftValidation.java
----------------------------------------------------------------------
diff --cc src/java/org/apache/cassandra/thrift/ThriftValidation.java
index 0e9f494,c673a9c..4bb5387
--- a/src/java/org/apache/cassandra/thrift/ThriftValidation.java
+++ b/src/java/org/apache/cassandra/thrift/ThriftValidation.java
@@@ -308,14 -332,21 +308,21 @@@ public class ThriftValidatio
          }
      }
  
 -    private static void validateTtl(Column column) throws 
InvalidRequestException
 +    private static void validateTtl(Column column) throws 
org.apache.cassandra.exceptions.InvalidRequestException
      {
-         if (column.isSetTtl() && column.ttl <= 0)
+         if (column.isSetTtl())
          {
-             throw new 
org.apache.cassandra.exceptions.InvalidRequestException("ttl must be positive");
+             if (column.ttl <= 0)
 -                throw new InvalidRequestException("ttl must be positive");
++                throw new 
org.apache.cassandra.exceptions.InvalidRequestException("ttl must be positive");
+ 
+             if (column.ttl > ExpiringColumn.MAX_TTL)
 -                throw new InvalidRequestException(String.format("ttl is too 
large. requested (%d) maximum (%d)", column.ttl, ExpiringColumn.MAX_TTL));
++                throw new 
org.apache.cassandra.exceptions.InvalidRequestException(String.format("ttl is 
too large. requested (%d) maximum (%d)", column.ttl, ExpiringColumn.MAX_TTL));
+         }
+         else
+         {
+             // if it's not set, then it should be zero -- here we are just 
checking to make sure Thrift doesn't change that contract with us.
+             assert column.ttl == 0;
          }
-         // if it's not set, then it should be zero -- here we are just 
checking to make sure Thrift doesn't change that contract with us.
-         assert column.isSetTtl() || column.ttl == 0;
      }
  
      public static void validateMutation(CFMetaData metadata, Mutation mut)
@@@ -407,20 -438,20 +414,20 @@@
          {
              if (logger.isDebugEnabled())
                  logger.debug("rejecting invalid value " + 
ByteBufferUtil.bytesToHex(summarize(column.value)));
 -            throw new InvalidRequestException(String.format("(%s) 
[%s][%s][%s] failed validation",
 -                                                            me.getMessage(),
 -                                                            metadata.ksName,
 -                                                            metadata.cfName,
 -                                                            (isSubColumn ? 
metadata.subcolumnComparator : metadata.comparator).getString(column.name)));
 +            throw new 
org.apache.cassandra.exceptions.InvalidRequestException(String.format("(%s) 
[%s][%s][%s] failed validation",
 +                                                                      
me.getMessage(),
 +                                                                      
metadata.ksName,
 +                                                                      
metadata.cfName,
 +                                                                      
(isSubColumn ? metadata.subcolumnComparator : 
metadata.comparator).getString(column.name)));
          }
  
-         // Indexed column values cannot be larger than 64K.  See 
CASSANDRA-3057/4240 for more details       
+         // Indexed column values cannot be larger than 64K.  See 
CASSANDRA-3057/4240 for more details
          if 
(!Table.open(metadata.ksName).getColumnFamilyStore(metadata.cfName).indexManager.validate(column))
 -                    throw new InvalidRequestException(String.format("Can't 
index column value of size %d for index %s in CF %s of KS %s",
 -                                                                     
column.value.remaining(),
 -                                                                     
columnDef.getIndexName(),
 -                                                                     
metadata.cfName,
 -                                                                     
metadata.ksName));
 +                    throw new 
org.apache.cassandra.exceptions.InvalidRequestException(String.format("Can't 
index column value of size %d for index %s in CF %s of KS %s",
 +                                                                              
column.value.remaining(),
 +                                                                              
columnDef.getIndexName(),
 +                                                                              
metadata.cfName,
 +                                                                              
metadata.ksName));
      }
  
      /**

Reply via email to