cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From slebre...@apache.org
Subject [2/2] git commit: Merge branch 'cassandra-2.0' into cassandra-2.1
Date Wed, 26 Mar 2014 15:00:21 GMT
Merge branch 'cassandra-2.0' into cassandra-2.1

Conflicts:
	src/java/org/apache/cassandra/cql3/QueryProcessor.java


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

Branch: refs/heads/cassandra-2.1
Commit: eefa14f6c61089a20e9b6fcb269874372716c6ec
Parents: 7b32dbd 485feef
Author: Sylvain Lebresne <sylvain@datastax.com>
Authored: Wed Mar 26 16:00:09 2014 +0100
Committer: Sylvain Lebresne <sylvain@datastax.com>
Committed: Wed Mar 26 16:00:09 2014 +0100

----------------------------------------------------------------------
 CHANGES.txt                                     |   1 +
 .../cassandra/cql3/BatchQueryOptions.java       |  55 +++++++++
 .../org/apache/cassandra/cql3/QueryHandler.java |  35 ++++++
 .../apache/cassandra/cql3/QueryProcessor.java   | 119 ++++---------------
 .../cql3/hooks/BatchExecutionContext.java       |  52 --------
 .../cassandra/cql3/hooks/ExecutionContext.java  |  47 --------
 .../cassandra/cql3/hooks/PostExecutionHook.java |  52 --------
 .../cql3/hooks/PostPreparationHook.java         |  38 ------
 .../cassandra/cql3/hooks/PreExecutionHook.java  |  62 ----------
 .../cql3/hooks/PreparationContext.java          |  41 -------
 .../cql3/statements/ListUsersStatement.java     |   2 +-
 .../apache/cassandra/service/ClientState.java   |  30 +++++
 .../cassandra/thrift/CassandraServer.java       |  12 +-
 .../transport/messages/BatchMessage.java        |   9 +-
 .../transport/messages/ExecuteMessage.java      |   7 +-
 .../transport/messages/PrepareMessage.java      |   2 +-
 .../transport/messages/QueryMessage.java        |   4 +-
 17 files changed, 163 insertions(+), 405 deletions(-)
----------------------------------------------------------------------


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

http://git-wip-us.apache.org/repos/asf/cassandra/blob/eefa14f6/src/java/org/apache/cassandra/cql3/QueryProcessor.java
----------------------------------------------------------------------
diff --cc src/java/org/apache/cassandra/cql3/QueryProcessor.java
index 5acb367,fe818fd..1a88843
--- a/src/java/org/apache/cassandra/cql3/QueryProcessor.java
+++ b/src/java/org/apache/cassandra/cql3/QueryProcessor.java
@@@ -47,8 -44,10 +45,10 @@@ public class QueryProcessor implements 
  {
      public static final SemanticVersion CQL_VERSION = new SemanticVersion("3.1.5");
  
+     public static final QueryProcessor instance = new QueryProcessor();
+ 
      private static final Logger logger = LoggerFactory.getLogger(QueryProcessor.class);
 -    private static final MemoryMeter meter = new MemoryMeter();
 +    private static final MemoryMeter meter = new MemoryMeter().withGuessing(MemoryMeter.Guess.FALLBACK_BEST);
      private static final long MAX_CACHE_PREPARED_MEMORY = Runtime.getRuntime().maxMemory()
/ 256;
      private static final int MAX_CACHE_PREPARED_COUNT = 10000;
  
@@@ -75,51 -74,35 +75,21 @@@
  
      static
      {
 -        if (MemoryMeter.isInitialized())
 -        {
 -            preparedStatements = new ConcurrentLinkedHashMap.Builder<MD5Digest, CQLStatement>()
 -                                 .maximumWeightedCapacity(MAX_CACHE_PREPARED_MEMORY)
 -                                 .weigher(cqlMemoryUsageWeigher)
 -                                 .build();
 -            thriftPreparedStatements = new ConcurrentLinkedHashMap.Builder<Integer, CQLStatement>()
 -                                       .maximumWeightedCapacity(MAX_CACHE_PREPARED_MEMORY)
 -                                       .weigher(thriftMemoryUsageWeigher)
 -                                       .build();
 -        }
 -        else
 -        {
 -            logger.error("Unable to initialize MemoryMeter (jamm not specified as javaagent).
 This means "
 -                         + "Cassandra will be unable to measure object sizes accurately
and may consequently OOM.");
 -            preparedStatements = new ConcurrentLinkedHashMap.Builder<MD5Digest, CQLStatement>()
 -                                 .maximumWeightedCapacity(MAX_CACHE_PREPARED_COUNT)
 -                                 .build();
 -            thriftPreparedStatements = new ConcurrentLinkedHashMap.Builder<Integer, CQLStatement>()
 -                                       .maximumWeightedCapacity(MAX_CACHE_PREPARED_COUNT)
 -                                       .build();
 -        }
 +        preparedStatements = new ConcurrentLinkedHashMap.Builder<MD5Digest, CQLStatement>()
 +                             .maximumWeightedCapacity(MAX_CACHE_PREPARED_MEMORY)
 +                             .weigher(cqlMemoryUsageWeigher)
 +                             .build();
 +        thriftPreparedStatements = new ConcurrentLinkedHashMap.Builder<Integer, CQLStatement>()
 +                                   .maximumWeightedCapacity(MAX_CACHE_PREPARED_MEMORY)
 +                                   .weigher(thriftMemoryUsageWeigher)
 +                                   .build();
      }
  
-     private static final List<PreExecutionHook> preExecutionHooks = new CopyOnWriteArrayList<>();
-     private static final List<PostExecutionHook> postExecutionHooks = new CopyOnWriteArrayList<>();
-     private static final List<PostPreparationHook> postPreparationHooks = new CopyOnWriteArrayList<>();
- 
-     public static void addPreExecutionHook(PreExecutionHook hook)
-     {
-         preExecutionHooks.add(hook);
-     }
- 
-     public static void removePreExecutionHook(PreExecutionHook hook)
-     {
-         preExecutionHooks.remove(hook);
-     }
- 
-     public static void addPostExecutionHook(PostExecutionHook hook)
-     {
-         postExecutionHooks.add(hook);
-     }
- 
-     public static void removePostExecutionHook(PostExecutionHook hook)
+     private QueryProcessor()
      {
-         postExecutionHooks.remove(hook);
      }
  
-     public static void addPostPreparationHook(PostPreparationHook hook)
-     {
-         postPreparationHooks.add(hook);
-     }
- 
-     public static void removePostPreparationHook(PostPreparationHook hook)
-     {
-         postPreparationHooks.remove(hook);
-     }
- 
-     public static CQLStatement getPrepared(MD5Digest id)
+     public CQLStatement getPrepared(MD5Digest id)
      {
          return preparedStatements.get(id);
      }
@@@ -157,19 -144,9 +127,18 @@@
              throw new InvalidRequestException("Invalid empty value for clustering column
of COMPACT TABLE");
      }
  
 +    public static void validateComposite(Composite name, CType type) throws InvalidRequestException
 +    {
 +        long serializedSize = type.serializer().serializedSize(name, TypeSizes.NATIVE);
 +        if (serializedSize > Cell.MAX_NAME_LENGTH)
 +            throw new InvalidRequestException(String.format("The sum of all clustering columns
is too long (%s > %s)",
 +                                                            serializedSize,
 +                                                            Cell.MAX_NAME_LENGTH));
 +    }
 +
-     private static ResultMessage processStatement(CQLStatement statement,
+     public static ResultMessage processStatement(CQLStatement statement,
                                                    QueryState queryState,
-                                                   QueryOptions options,
-                                                   String queryString)
+                                                   QueryOptions options)
      throws RequestExecutionException, RequestValidationException
      {
          logger.trace("Process {} @CL.{}", statement, options.getConsistency());
@@@ -223,9 -183,9 +175,9 @@@
      {
          try
          {
-             ResultMessage result = process(query, QueryState.forInternalCalls(), new QueryOptions(cl,
Collections.<ByteBuffer>emptyList()));
+             ResultMessage result = instance.process(query, QueryState.forInternalCalls(),
new QueryOptions(cl, Collections.<ByteBuffer>emptyList()));
              if (result instanceof ResultMessage.Rows)
 -                return new UntypedResultSet(((ResultMessage.Rows)result).result);
 +                return UntypedResultSet.create(((ResultMessage.Rows)result).result);
              else
                  return null;
          }

http://git-wip-us.apache.org/repos/asf/cassandra/blob/eefa14f6/src/java/org/apache/cassandra/thrift/CassandraServer.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/cassandra/blob/eefa14f6/src/java/org/apache/cassandra/transport/messages/BatchMessage.java
----------------------------------------------------------------------
diff --cc src/java/org/apache/cassandra/transport/messages/BatchMessage.java
index c34e35d,221dcd9..ef30a22
--- a/src/java/org/apache/cassandra/transport/messages/BatchMessage.java
+++ b/src/java/org/apache/cassandra/transport/messages/BatchMessage.java
@@@ -23,11 -23,9 +23,9 @@@ import java.util.Collections
  import java.util.List;
  import java.util.UUID;
  
 -import org.jboss.netty.buffer.ChannelBuffer;
 +import io.netty.buffer.ByteBuf;
  
- import org.apache.cassandra.cql3.Attributes;
- import org.apache.cassandra.cql3.CQLStatement;
- import org.apache.cassandra.cql3.QueryProcessor;
+ import org.apache.cassandra.cql3.*;
  import org.apache.cassandra.cql3.statements.BatchStatement;
  import org.apache.cassandra.cql3.statements.ModificationStatement;
  import org.apache.cassandra.db.ConsistencyLevel;

http://git-wip-us.apache.org/repos/asf/cassandra/blob/eefa14f6/src/java/org/apache/cassandra/transport/messages/ExecuteMessage.java
----------------------------------------------------------------------
diff --cc src/java/org/apache/cassandra/transport/messages/ExecuteMessage.java
index 4ee340c,0a2b26d..caec43f
--- a/src/java/org/apache/cassandra/transport/messages/ExecuteMessage.java
+++ b/src/java/org/apache/cassandra/transport/messages/ExecuteMessage.java
@@@ -22,10 -23,11 +22,10 @@@ import java.util.List
  import java.util.UUID;
  
  import com.google.common.collect.ImmutableMap;
 -import org.jboss.netty.buffer.ChannelBuffer;
 -import org.jboss.netty.buffer.ChannelBuffers;
 +import io.netty.buffer.ByteBuf;
  
  import org.apache.cassandra.cql3.CQLStatement;
- import org.apache.cassandra.cql3.QueryProcessor;
+ import org.apache.cassandra.cql3.QueryHandler;
  import org.apache.cassandra.cql3.QueryOptions;
  import org.apache.cassandra.db.ConsistencyLevel;
  import org.apache.cassandra.exceptions.PreparedQueryNotFoundException;

http://git-wip-us.apache.org/repos/asf/cassandra/blob/eefa14f6/src/java/org/apache/cassandra/transport/messages/PrepareMessage.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/cassandra/blob/eefa14f6/src/java/org/apache/cassandra/transport/messages/QueryMessage.java
----------------------------------------------------------------------
diff --cc src/java/org/apache/cassandra/transport/messages/QueryMessage.java
index 0a31dfe,b0a48e7..377cdaf
--- a/src/java/org/apache/cassandra/transport/messages/QueryMessage.java
+++ b/src/java/org/apache/cassandra/transport/messages/QueryMessage.java
@@@ -22,9 -22,10 +22,9 @@@ import java.util.Collections
  import java.util.UUID;
  
  import com.google.common.collect.ImmutableMap;
 -import org.jboss.netty.buffer.ChannelBuffer;
 -import org.jboss.netty.buffer.ChannelBuffers;
 +import io.netty.buffer.ByteBuf;
  
- import org.apache.cassandra.cql3.QueryProcessor;
+ import org.apache.cassandra.cql3.QueryHandler;
  import org.apache.cassandra.cql3.QueryOptions;
  import org.apache.cassandra.db.ConsistencyLevel;
  import org.apache.cassandra.exceptions.*;


Mime
View raw message