cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jbel...@apache.org
Subject svn commit: r1034096 - in /cassandra/trunk: ./ bin/ contrib/pig/src/java/org/apache/cassandra/hadoop/pig/ contrib/word_count/src/ interface/thrift/gen-java/org/apache/cassandra/thrift/ lib/ lib/licenses/ src/java/org/apache/cassandra/cache/ src/java/or...
Date Thu, 11 Nov 2010 20:06:15 GMT
Author: jbellis
Date: Thu Nov 11 20:06:14 2010
New Revision: 1034096

URL: http://svn.apache.org/viewvc?rev=1034096&view=rev
Log:
merge from 0.7

Added:
    cassandra/trunk/lib/concurrentlinkedhashmap-lru-1.1.jar
      - copied unchanged from r1034095, cassandra/branches/cassandra-0.7/lib/concurrentlinkedhashmap-lru-1.1.jar
    cassandra/trunk/lib/licenses/concurrentlinkedhashmap-lru-1.1.txt
      - copied unchanged from r1034095, cassandra/branches/cassandra-0.7/lib/licenses/concurrentlinkedhashmap-lru-1.1.txt
Removed:
    cassandra/trunk/lib/clhm-production.jar
    cassandra/trunk/lib/licenses/clhm-production.txt
Modified:
    cassandra/trunk/   (props changed)
    cassandra/trunk/CHANGES.txt
    cassandra/trunk/bin/cassandra-cli.bat
    cassandra/trunk/bin/cassandra.bat
    cassandra/trunk/bin/json2sstable
    cassandra/trunk/bin/json2sstable.bat
    cassandra/trunk/bin/nodetool.bat
    cassandra/trunk/bin/sstable2json.bat
    cassandra/trunk/contrib/pig/src/java/org/apache/cassandra/hadoop/pig/CassandraStorage.java
    cassandra/trunk/contrib/word_count/src/WordCount.java
    cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/Cassandra.java   (props changed)
    cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/Column.java   (props changed)
    cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/InvalidRequestException.java   (props changed)
    cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/NotFoundException.java   (props changed)
    cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/SuperColumn.java   (props changed)
    cassandra/trunk/src/java/org/apache/cassandra/cache/InstrumentedCache.java
    cassandra/trunk/src/java/org/apache/cassandra/cli/Cli.g
    cassandra/trunk/src/java/org/apache/cassandra/cli/CliClient.java
    cassandra/trunk/src/java/org/apache/cassandra/cli/CliUserHelp.java
    cassandra/trunk/src/java/org/apache/cassandra/db/DecoratedKey.java
    cassandra/trunk/src/java/org/apache/cassandra/db/ReadVerbHandler.java
    cassandra/trunk/src/java/org/apache/cassandra/db/Table.java
    cassandra/trunk/src/java/org/apache/cassandra/service/ConsistencyChecker.java
    cassandra/trunk/src/java/org/apache/cassandra/service/ReadResponseResolver.java
    cassandra/trunk/src/java/org/apache/cassandra/service/StorageProxy.java
    cassandra/trunk/test/unit/org/apache/cassandra/cli/CliTest.java
    cassandra/trunk/test/unit/org/apache/cassandra/service/StorageProxyTest.java

Propchange: cassandra/trunk/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Thu Nov 11 20:06:14 2010
@@ -1,5 +1,5 @@
-/cassandra/branches/cassandra-0.6:922689-1030284
-/cassandra/branches/cassandra-0.7:1026517-1032807
+/cassandra/branches/cassandra-0.6:922689-1034086
+/cassandra/branches/cassandra-0.7:1026517-1034095
 /incubator/cassandra/branches/cassandra-0.3:774578-796573
 /incubator/cassandra/branches/cassandra-0.4:810145-834239,834349-834350
 /incubator/cassandra/branches/cassandra-0.5:888872-915439

Modified: cassandra/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/cassandra/trunk/CHANGES.txt?rev=1034096&r1=1034095&r2=1034096&view=diff
==============================================================================
--- cassandra/trunk/CHANGES.txt (original)
+++ cassandra/trunk/CHANGES.txt Thu Nov 11 20:06:14 2010
@@ -1,5 +1,10 @@
 dev
+ * Update windows .bat files to work outside of main Cassandra
+   directory (CASSANDRA-1713)
  * log threshold causing memtable flush (CASSANDRA-1675)
+ * fix read repair regression from 0.6.7 (CASSANDRA-1727)
+ * more-efficient read repair (CASSANDRA-1719)
+ * fix hinted handoff replay (CASSANDRA-1656)
  * log type of dropped messages (CASSANDRA-1677)
  * upgrade to SLF4J 1.6.1
  * fix ByteBuffer bug in ExpiringColumn.updateDigest (CASSANDRA-1679)
@@ -15,10 +20,13 @@ dev
  * add friendlier error for UnknownHostException on startup (CASSANDRA-1697)
  * include jna dependency in RPM package (CASSANDRA-1690)
  * add --skip-keys option to stress.py (CASSANDRA-1696)
- * improve cli handling of non-string column names (CASSANDRA-1701)
+ * improve cli handling of non-string keys and column names 
+   (CASSANDRA-1701, -1693)
  * enable skipping bad rows on LazilyCompacted path (CASSANDRA-1702)
  * r/m extra subcomparator line in cli keyspaces output (CASSANDRA-1712)
  * add read repair chance to cli "show keyspaces"
+ * upgrade to ConcurrentLinkedHashMap 1.1 (CASSANDRA-975)
+ * fix index scan routing (CASSANDRA-1722)
 
 
 0.7.0-beta3

Modified: cassandra/trunk/bin/cassandra-cli.bat
URL: http://svn.apache.org/viewvc/cassandra/trunk/bin/cassandra-cli.bat?rev=1034096&r1=1034095&r2=1034096&view=diff
==============================================================================
--- cassandra/trunk/bin/cassandra-cli.bat (original)
+++ cassandra/trunk/bin/cassandra-cli.bat Thu Nov 11 20:06:14 2010
@@ -18,7 +18,7 @@
 @echo off
 if "%OS%" == "Windows_NT" setlocal
 
-if NOT DEFINED CASSANDRA_HOME set CASSANDRA_HOME=%CD%
+if NOT DEFINED CASSANDRA_HOME set CASSANDRA_HOME=%~dp0..
 if NOT DEFINED JAVA_HOME goto err
 
 REM Ensure that any user defined CLASSPATH variables are not used on startup

Modified: cassandra/trunk/bin/cassandra.bat
URL: http://svn.apache.org/viewvc/cassandra/trunk/bin/cassandra.bat?rev=1034096&r1=1034095&r2=1034096&view=diff
==============================================================================
--- cassandra/trunk/bin/cassandra.bat (original)
+++ cassandra/trunk/bin/cassandra.bat Thu Nov 11 20:06:14 2010
@@ -18,7 +18,6 @@
 if "%OS%" == "Windows_NT" setlocal
 
 if NOT DEFINED CASSANDRA_HOME set CASSANDRA_HOME=%~dp0..
-if NOT DEFINED CASSANDRA_CONF set CASSANDRA_CONF=%CASSANDRA_HOME%\conf
 if NOT DEFINED CASSANDRA_MAIN set CASSANDRA_MAIN=org.apache.cassandra.thrift.CassandraDaemon
 if NOT DEFINED JAVA_HOME goto err
 

Modified: cassandra/trunk/bin/json2sstable
URL: http://svn.apache.org/viewvc/cassandra/trunk/bin/json2sstable?rev=1034096&r1=1034095&r2=1034096&view=diff
==============================================================================
--- cassandra/trunk/bin/json2sstable (original)
+++ cassandra/trunk/bin/json2sstable Thu Nov 11 20:06:14 2010
@@ -1,50 +1,50 @@
-#!/bin/sh
-
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-#
-#     http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-if [ "x$CASSANDRA_INCLUDE" = "x" ]; then
-    for include in /usr/share/cassandra/cassandra.in.sh \
-                   /usr/local/share/cassandra/cassandra.in.sh \
-                   /opt/cassandra/cassandra.in.sh \
-                   ~/.cassandra.in.sh \
-                   `dirname $0`/cassandra.in.sh; do
-        if [ -r $include ]; then
-            . $include
-            break
-        fi
-    done
-elif [ -r $CASSANDRA_INCLUDE ]; then
-    . $CASSANDRA_INCLUDE
-fi
-
-# Use JAVA_HOME if set, otherwise look for java in PATH
-if [ -x $JAVA_HOME/bin/java ]; then
-    JAVA=$JAVA_HOME/bin/java
-else
-    JAVA=`which java`
-fi
-
-if [ -z $CLASSPATH ]; then
-    echo "You must set the CLASSPATH var" >&2
-    exit 1
-fi
-
-$JAVA -cp $CLASSPATH  -Dstorage-config=$CASSANDRA_CONF \
-        -Dlog4j.configuration=log4j-tools.properties \
-        org.apache.cassandra.tools.SSTableImport "$@"
-
-# vi:ai sw=4 ts=4 tw=0 et
+#!/bin/sh
+
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+if [ "x$CASSANDRA_INCLUDE" = "x" ]; then
+    for include in /usr/share/cassandra/cassandra.in.sh \
+                   /usr/local/share/cassandra/cassandra.in.sh \
+                   /opt/cassandra/cassandra.in.sh \
+                   ~/.cassandra.in.sh \
+                   `dirname $0`/cassandra.in.sh; do
+        if [ -r $include ]; then
+            . $include
+            break
+        fi
+    done
+elif [ -r $CASSANDRA_INCLUDE ]; then
+    . $CASSANDRA_INCLUDE
+fi
+
+# Use JAVA_HOME if set, otherwise look for java in PATH
+if [ -x $JAVA_HOME/bin/java ]; then
+    JAVA=$JAVA_HOME/bin/java
+else
+    JAVA=`which java`
+fi
+
+if [ -z $CLASSPATH ]; then
+    echo "You must set the CLASSPATH var" >&2
+    exit 1
+fi
+
+$JAVA -cp $CLASSPATH  -Dstorage-config=$CASSANDRA_CONF \
+        -Dlog4j.configuration=log4j-tools.properties \
+        org.apache.cassandra.tools.SSTableImport "$@"
+
+# vi:ai sw=4 ts=4 tw=0 et

Modified: cassandra/trunk/bin/json2sstable.bat
URL: http://svn.apache.org/viewvc/cassandra/trunk/bin/json2sstable.bat?rev=1034096&r1=1034095&r2=1034096&view=diff
==============================================================================
--- cassandra/trunk/bin/json2sstable.bat (original)
+++ cassandra/trunk/bin/json2sstable.bat Thu Nov 11 20:06:14 2010
@@ -1,67 +1,67 @@
-@REM
-@REM  Licensed to the Apache Software Foundation (ASF) under one or more
-@REM  contributor license agreements.  See the NOTICE file distributed with
-@REM  this work for additional information regarding copyright ownership.
-@REM  The ASF licenses this file to You under the Apache License, Version 2.0
-@REM  (the "License"); you may not use this file except in compliance with
-@REM  the License.  You may obtain a copy of the License at
-@REM
-@REM      http://www.apache.org/licenses/LICENSE-2.0
-@REM
-@REM  Unless required by applicable law or agreed to in writing, software
-@REM  distributed under the License is distributed on an "AS IS" BASIS,
-@REM  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-@REM  See the License for the specific language governing permissions and
-@REM  limitations under the License.
-
-@echo off
-if "%OS%" == "Windows_NT" setlocal
-
-if NOT DEFINED CASSANDRA_HOME set CASSANDRA_HOME=%CD%
-if NOT DEFINED CASSANDRA_CONF set CASSANDRA_CONF=%CASSANDRA_HOME%\conf
-if NOT DEFINED CASSANDRA_MAIN set CASSANDRA_MAIN=org.apache.cassandra.tools.SSTableImport
-if NOT DEFINED JAVA_HOME goto err
-
-REM ***** JAVA options *****
-set JAVA_OPTS=^
- -Dlog4j.configuration=log4j-tools.properties
-
-REM ***** CLASSPATH library setting *****
-
-REM Ensure that any user defined CLASSPATH variables are not used on startup
-set CLASSPATH=%CASSANDRA_HOME%\conf
-
-REM For each jar in the CASSANDRA_HOME lib directory call append to build the CLASSPATH variable.
-for %%i in (%CASSANDRA_HOME%\lib\*.jar) do call :append %%~fi
-goto okClasspath
-
-:append
-set CLASSPATH=%CLASSPATH%;%1%2
-goto :eof
-
-:okClasspath
-REM Include the build\classes directory so it works in development
-set CASSANDRA_CLASSPATH=%CLASSPATH%;%CASSANDRA_HOME%\build\classes;%CASSANDRA_CONF%
-
-set CASSANDRA_PARAMS=
-set TOOLS_PARAMS=
-
-FOR %%A IN (%*) DO call :appendToolsParams %%A
-
-goto runTool
-
-:appendToolsParams
-set TOOLS_PARAMS=%TOOLS_PARAMS% %1
-goto :eof
-
-:runTool
-"%JAVA_HOME%\bin\java" %JAVA_OPTS% %CASSANDRA_PARAMS% -cp "%CASSANDRA_CLASSPATH%" "%CASSANDRA_MAIN%" %TOOLS_PARAMS%
-goto finally
-
-:err
-echo JAVA_HOME environment variable must be set!
-pause
-
-:finally
-
-ENDLOCAL
+@REM
+@REM  Licensed to the Apache Software Foundation (ASF) under one or more
+@REM  contributor license agreements.  See the NOTICE file distributed with
+@REM  this work for additional information regarding copyright ownership.
+@REM  The ASF licenses this file to You under the Apache License, Version 2.0
+@REM  (the "License"); you may not use this file except in compliance with
+@REM  the License.  You may obtain a copy of the License at
+@REM
+@REM      http://www.apache.org/licenses/LICENSE-2.0
+@REM
+@REM  Unless required by applicable law or agreed to in writing, software
+@REM  distributed under the License is distributed on an "AS IS" BASIS,
+@REM  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+@REM  See the License for the specific language governing permissions and
+@REM  limitations under the License.
+
+@echo off
+if "%OS%" == "Windows_NT" setlocal
+
+if NOT DEFINED CASSANDRA_HOME set CASSANDRA_HOME=%~dp0..
+if NOT DEFINED CASSANDRA_CONF set CASSANDRA_CONF=%CASSANDRA_HOME%\conf
+if NOT DEFINED CASSANDRA_MAIN set CASSANDRA_MAIN=org.apache.cassandra.tools.SSTableImport
+if NOT DEFINED JAVA_HOME goto err
+
+REM ***** JAVA options *****
+set JAVA_OPTS=^
+ -Dlog4j.configuration=log4j-tools.properties
+
+REM ***** CLASSPATH library setting *****
+
+REM Ensure that any user defined CLASSPATH variables are not used on startup
+set CLASSPATH=%CASSANDRA_HOME%\conf
+
+REM For each jar in the CASSANDRA_HOME lib directory call append to build the CLASSPATH variable.
+for %%i in (%CASSANDRA_HOME%\lib\*.jar) do call :append %%~fi
+goto okClasspath
+
+:append
+set CLASSPATH=%CLASSPATH%;%1%2
+goto :eof
+
+:okClasspath
+REM Include the build\classes directory so it works in development
+set CASSANDRA_CLASSPATH=%CLASSPATH%;%CASSANDRA_HOME%\build\classes;%CASSANDRA_CONF%
+
+set CASSANDRA_PARAMS=
+set TOOLS_PARAMS=
+
+FOR %%A IN (%*) DO call :appendToolsParams %%A
+
+goto runTool
+
+:appendToolsParams
+set TOOLS_PARAMS=%TOOLS_PARAMS% %1
+goto :eof
+
+:runTool
+"%JAVA_HOME%\bin\java" %JAVA_OPTS% %CASSANDRA_PARAMS% -cp "%CASSANDRA_CLASSPATH%" "%CASSANDRA_MAIN%" %TOOLS_PARAMS%
+goto finally
+
+:err
+echo JAVA_HOME environment variable must be set!
+pause
+
+:finally
+
+ENDLOCAL

Modified: cassandra/trunk/bin/nodetool.bat
URL: http://svn.apache.org/viewvc/cassandra/trunk/bin/nodetool.bat?rev=1034096&r1=1034095&r2=1034096&view=diff
==============================================================================
--- cassandra/trunk/bin/nodetool.bat (original)
+++ cassandra/trunk/bin/nodetool.bat Thu Nov 11 20:06:14 2010
@@ -17,7 +17,7 @@
 @echo off
 if "%OS%" == "Windows_NT" setlocal
 
-if NOT DEFINED CASSANDRA_HOME set CASSANDRA_HOME=%CD%
+if NOT DEFINED CASSANDRA_HOME set CASSANDRA_HOME=%~dp0..
 if NOT DEFINED JAVA_HOME goto err
 
 REM Ensure that any user defined CLASSPATH variables are not used on startup

Modified: cassandra/trunk/bin/sstable2json.bat
URL: http://svn.apache.org/viewvc/cassandra/trunk/bin/sstable2json.bat?rev=1034096&r1=1034095&r2=1034096&view=diff
==============================================================================
--- cassandra/trunk/bin/sstable2json.bat (original)
+++ cassandra/trunk/bin/sstable2json.bat Thu Nov 11 20:06:14 2010
@@ -17,7 +17,7 @@
 @echo off
 if "%OS%" == "Windows_NT" setlocal
 
-if NOT DEFINED CASSANDRA_HOME set CASSANDRA_HOME=%CD%
+if NOT DEFINED CASSANDRA_HOME set CASSANDRA_HOME=%~dp0..
 if NOT DEFINED CASSANDRA_CONF set CASSANDRA_CONF=%CASSANDRA_HOME%\conf
 if NOT DEFINED CASSANDRA_MAIN set CASSANDRA_MAIN=org.apache.cassandra.tools.SSTableExport
 if NOT DEFINED JAVA_HOME goto err
@@ -55,7 +55,6 @@ set TOOLS_PARAMS=%TOOLS_PARAMS% %1
 goto :eof
 
 :runTool
-echo "%JAVA_HOME%\bin\java" %JAVA_OPTS% %CASSANDRA_PARAMS% -cp "%CASSANDRA_CLASSPATH%" "%CASSANDRA_MAIN%" %TOOLS_PARAMS%
 "%JAVA_HOME%\bin\java" %JAVA_OPTS% %CASSANDRA_PARAMS% -cp "%CASSANDRA_CLASSPATH%" "%CASSANDRA_MAIN%" %TOOLS_PARAMS%
 goto finally
 

Modified: cassandra/trunk/contrib/pig/src/java/org/apache/cassandra/hadoop/pig/CassandraStorage.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/contrib/pig/src/java/org/apache/cassandra/hadoop/pig/CassandraStorage.java?rev=1034096&r1=1034095&r2=1034096&view=diff
==============================================================================
--- cassandra/trunk/contrib/pig/src/java/org/apache/cassandra/hadoop/pig/CassandraStorage.java (original)
+++ cassandra/trunk/contrib/pig/src/java/org/apache/cassandra/hadoop/pig/CassandraStorage.java Thu Nov 11 20:06:14 2010
@@ -68,18 +68,18 @@ public class CassandraStorage extends Lo
             // load the next pair
             if (!reader.nextKeyValue())
                 return null;
-            byte[] key = (byte[])reader.getCurrentKey();
-            SortedMap<byte[],IColumn> cf = (SortedMap<byte[],IColumn>)reader.getCurrentValue();
+
+            ByteBuffer key = (ByteBuffer)reader.getCurrentKey();
+            SortedMap<ByteBuffer,IColumn> cf = (SortedMap<ByteBuffer,IColumn>)reader.getCurrentValue();
             assert key != null && cf != null;
             
             // and wrap it in a tuple
-		    Tuple tuple = TupleFactory.getInstance().newTuple(2);
+	    Tuple tuple = TupleFactory.getInstance().newTuple(2);
             ArrayList<Tuple> columns = new ArrayList<Tuple>();
-            tuple.set(0, new DataByteArray(key));
-            for (Map.Entry<byte[], IColumn> entry : cf.entrySet())
+            tuple.set(0, new DataByteArray(key.array(), key.position()+key.arrayOffset(), key.limit()+key.arrayOffset()));
+            for (Map.Entry<ByteBuffer, IColumn> entry : cf.entrySet())
             {                    
-                byte[] name = entry.getKey();
-                columns.add(columnToTuple(name, 0, name.length, entry.getValue()));
+                columns.add(columnToTuple(entry.getKey(), entry.getValue()));
             }
          
             tuple.set(1, new DefaultDataBag(columns));
@@ -91,25 +91,23 @@ public class CassandraStorage extends Lo
         }
     }
 
-    private Tuple columnToTuple(byte[] name, int nameOffset, int nameLength, IColumn col) throws IOException
+    private Tuple columnToTuple(ByteBuffer name, IColumn col) throws IOException
     {
         Tuple pair = TupleFactory.getInstance().newTuple(2);
-        pair.set(0, new DataByteArray(name, nameOffset, nameLength));
+        pair.set(0, new DataByteArray(name.array(), name.position()+name.arrayOffset(), name.limit()+name.arrayOffset()));
         if (col instanceof Column)
         {
             // standard
             pair.set(1, new DataByteArray(col.value().array(), 
                                           col.value().position()+col.value().arrayOffset(),
-                                          col.value().remaining()));
+                                          col.value().limit()+col.value().arrayOffset()));
             return pair;
         }
 
         // super
         ArrayList<Tuple> subcols = new ArrayList<Tuple>();
         for (IColumn subcol : ((SuperColumn)col).getSubColumns())
-            subcols.add(columnToTuple(subcol.name().array(), 
-                                      subcol.name().position()+subcol.name().arrayOffset(),
-                                      subcol.name().remaining(), subcol));
+            subcols.add(columnToTuple(subcol.name(), subcol));
         
         pair.set(1, new DefaultDataBag(subcols));
         return pair;

Modified: cassandra/trunk/contrib/word_count/src/WordCount.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/contrib/word_count/src/WordCount.java?rev=1034096&r1=1034095&r2=1034096&view=diff
==============================================================================
--- cassandra/trunk/contrib/word_count/src/WordCount.java (original)
+++ cassandra/trunk/contrib/word_count/src/WordCount.java Thu Nov 11 20:06:14 2010
@@ -70,15 +70,15 @@ public class WordCount extends Configure
         System.exit(0);
     }
 
-    public static class TokenizerMapper extends Mapper<byte[], SortedMap<byte[], IColumn>, Text, IntWritable>
+    public static class TokenizerMapper extends Mapper<ByteBuffer, SortedMap<ByteBuffer, IColumn>, Text, IntWritable>
     {
         private final static IntWritable one = new IntWritable(1);
         private Text word = new Text();
-        private String columnName;
+        private ByteBuffer columnName;
 
-        public void map(byte[] key, SortedMap<byte[], IColumn> columns, Context context) throws IOException, InterruptedException
+        public void map(ByteBuffer key, SortedMap<ByteBuffer, IColumn> columns, Context context) throws IOException, InterruptedException
         {
-            IColumn column = columns.get(columnName.getBytes());
+            IColumn column = columns.get(columnName);
             if (column == null)
                 return;
             String value = ByteBufferUtil.string(column.value());
@@ -95,7 +95,7 @@ public class WordCount extends Configure
         protected void setup(org.apache.hadoop.mapreduce.Mapper.Context context)
             throws IOException, InterruptedException
         {
-            this.columnName = context.getConfiguration().get(CONF_COLUMN_NAME);
+            this.columnName = ByteBuffer.wrap(context.getConfiguration().get(CONF_COLUMN_NAME).getBytes());
         }
         
     }

Propchange: cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/Cassandra.java
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Thu Nov 11 20:06:14 2010
@@ -1,5 +1,5 @@
-/cassandra/branches/cassandra-0.6/interface/thrift/gen-java/org/apache/cassandra/thrift/Cassandra.java:922689-1030284
-/cassandra/branches/cassandra-0.7/interface/thrift/gen-java/org/apache/cassandra/thrift/Cassandra.java:1026517-1032807
+/cassandra/branches/cassandra-0.6/interface/thrift/gen-java/org/apache/cassandra/thrift/Cassandra.java:922689-1034086
+/cassandra/branches/cassandra-0.7/interface/thrift/gen-java/org/apache/cassandra/thrift/Cassandra.java:1026517-1034095
 /incubator/cassandra/branches/cassandra-0.3/interface/gen-java/org/apache/cassandra/service/Cassandra.java:774578-796573
 /incubator/cassandra/branches/cassandra-0.4/interface/gen-java/org/apache/cassandra/service/Cassandra.java:810145-834239,834349-834350
 /incubator/cassandra/branches/cassandra-0.5/interface/gen-java/org/apache/cassandra/service/Cassandra.java:888872-903502

Propchange: cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/Column.java
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Thu Nov 11 20:06:14 2010
@@ -1,5 +1,5 @@
-/cassandra/branches/cassandra-0.6/interface/thrift/gen-java/org/apache/cassandra/thrift/Column.java:922689-1030284
-/cassandra/branches/cassandra-0.7/interface/thrift/gen-java/org/apache/cassandra/thrift/Column.java:1026517-1032807
+/cassandra/branches/cassandra-0.6/interface/thrift/gen-java/org/apache/cassandra/thrift/Column.java:922689-1034086
+/cassandra/branches/cassandra-0.7/interface/thrift/gen-java/org/apache/cassandra/thrift/Column.java:1026517-1034095
 /incubator/cassandra/branches/cassandra-0.3/interface/gen-java/org/apache/cassandra/service/column_t.java:774578-792198
 /incubator/cassandra/branches/cassandra-0.4/interface/gen-java/org/apache/cassandra/service/Column.java:810145-834239,834349-834350
 /incubator/cassandra/branches/cassandra-0.5/interface/gen-java/org/apache/cassandra/service/Column.java:888872-903502

Propchange: cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/InvalidRequestException.java
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Thu Nov 11 20:06:14 2010
@@ -1,5 +1,5 @@
-/cassandra/branches/cassandra-0.6/interface/thrift/gen-java/org/apache/cassandra/thrift/InvalidRequestException.java:922689-1030284
-/cassandra/branches/cassandra-0.7/interface/thrift/gen-java/org/apache/cassandra/thrift/InvalidRequestException.java:1026517-1032807
+/cassandra/branches/cassandra-0.6/interface/thrift/gen-java/org/apache/cassandra/thrift/InvalidRequestException.java:922689-1034086
+/cassandra/branches/cassandra-0.7/interface/thrift/gen-java/org/apache/cassandra/thrift/InvalidRequestException.java:1026517-1034095
 /incubator/cassandra/branches/cassandra-0.3/interface/gen-java/org/apache/cassandra/service/InvalidRequestException.java:774578-796573
 /incubator/cassandra/branches/cassandra-0.4/interface/gen-java/org/apache/cassandra/service/InvalidRequestException.java:810145-834239,834349-834350
 /incubator/cassandra/branches/cassandra-0.5/interface/gen-java/org/apache/cassandra/service/InvalidRequestException.java:888872-903502

Propchange: cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/NotFoundException.java
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Thu Nov 11 20:06:14 2010
@@ -1,5 +1,5 @@
-/cassandra/branches/cassandra-0.6/interface/thrift/gen-java/org/apache/cassandra/thrift/NotFoundException.java:922689-1030284
-/cassandra/branches/cassandra-0.7/interface/thrift/gen-java/org/apache/cassandra/thrift/NotFoundException.java:1026517-1032807
+/cassandra/branches/cassandra-0.6/interface/thrift/gen-java/org/apache/cassandra/thrift/NotFoundException.java:922689-1034086
+/cassandra/branches/cassandra-0.7/interface/thrift/gen-java/org/apache/cassandra/thrift/NotFoundException.java:1026517-1034095
 /incubator/cassandra/branches/cassandra-0.3/interface/gen-java/org/apache/cassandra/service/NotFoundException.java:774578-796573
 /incubator/cassandra/branches/cassandra-0.4/interface/gen-java/org/apache/cassandra/service/NotFoundException.java:810145-834239,834349-834350
 /incubator/cassandra/branches/cassandra-0.5/interface/gen-java/org/apache/cassandra/service/NotFoundException.java:888872-903502

Propchange: cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/SuperColumn.java
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Thu Nov 11 20:06:14 2010
@@ -1,5 +1,5 @@
-/cassandra/branches/cassandra-0.6/interface/thrift/gen-java/org/apache/cassandra/thrift/SuperColumn.java:922689-1030284
-/cassandra/branches/cassandra-0.7/interface/thrift/gen-java/org/apache/cassandra/thrift/SuperColumn.java:1026517-1032807
+/cassandra/branches/cassandra-0.6/interface/thrift/gen-java/org/apache/cassandra/thrift/SuperColumn.java:922689-1034086
+/cassandra/branches/cassandra-0.7/interface/thrift/gen-java/org/apache/cassandra/thrift/SuperColumn.java:1026517-1034095
 /incubator/cassandra/branches/cassandra-0.3/interface/gen-java/org/apache/cassandra/service/superColumn_t.java:774578-792198
 /incubator/cassandra/branches/cassandra-0.4/interface/gen-java/org/apache/cassandra/service/SuperColumn.java:810145-834239,834349-834350
 /incubator/cassandra/branches/cassandra-0.5/interface/gen-java/org/apache/cassandra/service/SuperColumn.java:888872-903502

Modified: cassandra/trunk/src/java/org/apache/cassandra/cache/InstrumentedCache.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/src/java/org/apache/cassandra/cache/InstrumentedCache.java?rev=1034096&r1=1034095&r2=1034096&view=diff
==============================================================================
--- cassandra/trunk/src/java/org/apache/cassandra/cache/InstrumentedCache.java (original)
+++ cassandra/trunk/src/java/org/apache/cassandra/cache/InstrumentedCache.java Thu Nov 11 20:06:14 2010
@@ -24,11 +24,13 @@ package org.apache.cassandra.cache;
 import java.util.Set;
 import java.util.concurrent.atomic.AtomicLong;
 
-import com.reardencommerce.kernel.collections.shared.evictable.ConcurrentLinkedHashMap;
+import com.googlecode.concurrentlinkedhashmap.Weighers;
+import com.googlecode.concurrentlinkedhashmap.ConcurrentLinkedHashMap;
 
 public class InstrumentedCache<K, V>
 {
-    private int capacity;
+    public static final int DEFAULT_CONCURENCY_LEVEL = 64;
+
     private final ConcurrentLinkedHashMap<K, V> map;
     private final AtomicLong requests = new AtomicLong(0);
     private final AtomicLong hits = new AtomicLong(0);
@@ -38,8 +40,17 @@ public class InstrumentedCache<K, V>
 
     public InstrumentedCache(int capacity)
     {
-        this.capacity = capacity;
-        map = ConcurrentLinkedHashMap.create(ConcurrentLinkedHashMap.EvictionPolicy.SECOND_CHANCE, capacity);
+        this(capacity, DEFAULT_CONCURENCY_LEVEL);
+    }
+
+    public InstrumentedCache(int capacity, int concurency)
+    {
+        map = new ConcurrentLinkedHashMap.Builder<K, V>()
+                .weigher(Weighers.<V>singleton())
+                .initialCapacity(capacity)
+                .maximumWeightedCapacity(capacity)
+                .concurrencyLevel(concurency)
+                .build();
     }
 
     public void put(K key, V value)
@@ -68,7 +79,7 @@ public class InstrumentedCache<K, V>
 
     public int getCapacity()
     {
-        return capacity;
+        return map.capacity();
     }
 
     public boolean isCapacitySetManually()
@@ -79,7 +90,6 @@ public class InstrumentedCache<K, V>
     public void updateCapacity(int capacity)
     {
         map.setCapacity(capacity);
-        this.capacity = capacity;
     }
 
     public void setCapacity(int capacity)

Modified: cassandra/trunk/src/java/org/apache/cassandra/cli/Cli.g
URL: http://svn.apache.org/viewvc/cassandra/trunk/src/java/org/apache/cassandra/cli/Cli.g?rev=1034096&r1=1034095&r2=1034096&view=diff
==============================================================================
--- cassandra/trunk/src/java/org/apache/cassandra/cli/Cli.g (original)
+++ cassandra/trunk/src/java/org/apache/cassandra/cli/Cli.g Thu Nov 11 20:06:14 2010
@@ -56,6 +56,7 @@ tokens {
     NODE_UPDATE_COLUMN_FAMILY;
     NODE_LIST;
     NODE_TRUNCATE;
+    NODE_ASSUME;
 
     // Internal Nodes.
     NODE_COLUMN_ACCESS;
@@ -151,6 +152,7 @@ statement
     | showStatement
     | listStatement
     | truncateStatement
+    | assumeStatement
     | -> ^(NODE_NO_OP)
     ;
 
@@ -204,6 +206,8 @@ helpStatement
         -> ^(NODE_HELP NODE_LIST)
     | HELP TRUNCATE
         -> ^(NODE_HELP NODE_TRUNCATE)
+    | HELP ASSUME
+        -> ^(NODE_HELP NODE_ASSUME)
     | HELP 
         -> ^(NODE_HELP)
     | '?'    
@@ -266,6 +270,11 @@ truncateStatement
         -> ^(NODE_TRUNCATE columnFamily)
     ;
 
+assumeStatement
+    : ASSUME columnFamily assumptionElement=Identifier 'AS' defaultType=Identifier
+        -> ^(NODE_ASSUME columnFamily $assumptionElement $defaultType)
+    ;
+
 showClusterName
     : SHOW CLUSTER NAME 
         -> ^(NODE_SHOW_CLUSTER_NAME)
@@ -430,7 +439,7 @@ columnFamily
 	;
 
 rowKey	
-    :   (Identifier | StringLiteral)
+    :  (Identifier | StringLiteral | IntegerLiteral | functionCall)
 	;
 
 value	
@@ -438,8 +447,8 @@ value	
 	;
 
 functionCall 
-    : functionName=Identifier '(' functionArgument ')'
-        -> ^(FUNCTION_CALL $functionName functionArgument)
+    : functionName=Identifier '(' functionArgument? ')'
+        -> ^(FUNCTION_CALL $functionName functionArgument?)
     ;
 
 functionArgument 
@@ -455,7 +464,7 @@ endKey	
 	;
 
 columnOrSuperColumn
-	: (Identifier | IntegerLiteral | StringLiteral)
+	: (Identifier | IntegerLiteral | StringLiteral | functionCall)
 	;
 
 host	
@@ -515,6 +524,7 @@ UPDATE:     'UPDATE';
 LIST:       'LIST';
 LIMIT:      'LIMIT';
 TRUNCATE:   'TRUNCATE';
+ASSUME:     'ASSUME';
 
 IP_ADDRESS 
     : IntegerLiteral '.' IntegerLiteral '.' IntegerLiteral '.' IntegerLiteral

Modified: cassandra/trunk/src/java/org/apache/cassandra/cli/CliClient.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/src/java/org/apache/cassandra/cli/CliClient.java?rev=1034096&r1=1034095&r2=1034096&view=diff
==============================================================================
--- cassandra/trunk/src/java/org/apache/cassandra/cli/CliClient.java (original)
+++ cassandra/trunk/src/java/org/apache/cassandra/cli/CliClient.java Thu Nov 11 20:06:14 2010
@@ -29,13 +29,14 @@ import org.apache.cassandra.utils.FBUtil
 import org.apache.cassandra.utils.UUIDGen;
 import org.apache.thrift.TBaseHelper;
 import org.apache.thrift.TException;
+import org.safehaus.uuid.UUIDGenerator;
 
 import java.math.BigInteger;
 import java.nio.ByteBuffer;
 import java.util.*;
 
 // Cli Client Side Library
-public class CliClient extends CliUserHelp 
+public class CliClient extends CliUserHelp
 {
 
     /**
@@ -94,13 +95,15 @@ public class CliClient extends CliUserHe
     private String keySpace = null;
     private String username = null;
     private Map<String, KsDef> keyspacesMap = new HashMap<String, KsDef>();
-
+    private Map<String, AbstractType> cfKeysComparators;
+    
     private final String DEFAULT_PLACEMENT_STRATEGY = "org.apache.cassandra.locator.SimpleStrategy";
     
     public CliClient(CliSessionState cliSessionState, Cassandra.Client thriftClient)
     {
         this.sessionState = cliSessionState;
         this.thriftClient = thriftClient;
+        this.cfKeysComparators = new HashMap<String, AbstractType>();
     }
 
     // Execute a CLI Statement 
@@ -175,6 +178,9 @@ public class CliClient extends CliUserHe
                 case CliParser.NODE_TRUNCATE:
                     executeTruncate(tree.getChild(0).getText());
                     break;
+                case CliParser.NODE_ASSUME:
+                    executeAssumeStatement(tree);
+                    break;
                 case CliParser.NODE_NO_OP:
                     // comment lines come here; they are treated as no ops.
                     break;
@@ -214,28 +220,28 @@ public class CliClient extends CliUserHe
     private void executeCount(Tree statement)
             throws TException, InvalidRequestException, UnavailableException, TimedOutException
     {
-       if (!CliMain.isConnected() || !hasKeySpace())
-           return;
+        if (!CliMain.isConnected() || !hasKeySpace())
+            return;
 
-       Tree columnFamilySpec = statement.getChild(0);
+        Tree columnFamilySpec = statement.getChild(0);
 
-       String key = CliCompiler.getKey(columnFamilySpec);
-       String columnFamily = CliCompiler.getColumnFamily(columnFamilySpec);
-       int columnSpecCnt = CliCompiler.numColumnSpecifiers(columnFamilySpec);
+        String key = CliCompiler.getKey(columnFamilySpec);
+        String columnFamily = CliCompiler.getColumnFamily(columnFamilySpec);
+        int columnSpecCnt = CliCompiler.numColumnSpecifiers(columnFamilySpec);
        
-       ColumnParent colParent = new ColumnParent(columnFamily).setSuper_column((ByteBuffer) null);
+        ColumnParent colParent = new ColumnParent(columnFamily).setSuper_column((ByteBuffer) null);
        
-       if (columnSpecCnt != 0)
-       {
-           byte[] superColumn = columnNameAsByteArray(CliCompiler.getColumn(columnFamilySpec, 0), columnFamily);
-           colParent = new ColumnParent(columnFamily).setSuper_column(superColumn);
-       }
+        if (columnSpecCnt != 0)
+        {
+            byte[] superColumn = columnNameAsByteArray(CliCompiler.getColumn(columnFamilySpec, 0), columnFamily);
+            colParent = new ColumnParent(columnFamily).setSuper_column(superColumn);
+        }
 
-       SliceRange range = new SliceRange(FBUtilities.EMPTY_BYTE_BUFFER, FBUtilities.EMPTY_BYTE_BUFFER, false, Integer.MAX_VALUE);
-       SlicePredicate predicate = new SlicePredicate().setColumn_names(null).setSlice_range(range);
-       
-       int count = thriftClient.get_count(ByteBuffer.wrap(key.getBytes(Charsets.UTF_8)), colParent, predicate, ConsistencyLevel.ONE);
-       sessionState.out.printf("%d columns\n", count);
+        SliceRange range = new SliceRange(FBUtilities.EMPTY_BYTE_BUFFER, FBUtilities.EMPTY_BYTE_BUFFER, false, Integer.MAX_VALUE);
+        SlicePredicate predicate = new SlicePredicate().setColumn_names(null).setSlice_range(range);
+
+        int count = thriftClient.get_count(ByteBuffer.wrap(key.getBytes(Charsets.UTF_8)), colParent, predicate, ConsistencyLevel.ONE);
+        sessionState.out.printf("%d columns\n", count);
     }
     
     private void executeDelete(Tree statement) 
@@ -288,17 +294,16 @@ public class CliClient extends CliUserHe
         sessionState.out.println(String.format("%s removed.", (columnSpecCnt == 0) ? "row" : "column"));
     }
 
-    private void doSlice(String keyspace, String key, String columnFamily, byte[] superColumnName)
+    private void doSlice(String keyspace, ByteBuffer key, String columnFamily, byte[] superColumnName)
             throws InvalidRequestException, UnavailableException, TimedOutException, TException, IllegalAccessException, NotFoundException, InstantiationException, NoSuchFieldException
     {
         
         ColumnParent parent = new ColumnParent(columnFamily);
         if(superColumnName != null)
             parent.setSuper_column(superColumnName);
-                
+
         SliceRange range = new SliceRange(FBUtilities.EMPTY_BYTE_BUFFER, FBUtilities.EMPTY_BYTE_BUFFER, true, 1000000);
-        List<ColumnOrSuperColumn> columns = thriftClient.get_slice(ByteBuffer.wrap(key.getBytes(Charsets.UTF_8)),parent,
-                                                                    new SlicePredicate().setColumn_names(null).setSlice_range(range), ConsistencyLevel.ONE);
+        List<ColumnOrSuperColumn> columns = thriftClient.get_slice(key, parent, new SlicePredicate().setColumn_names(null).setSlice_range(range), ConsistencyLevel.ONE);
 
         AbstractType validator;
         CfDef cfDef = getCfDef(columnFamily);
@@ -365,9 +370,8 @@ public class CliClient extends CliUserHe
             return;
 
         Tree columnFamilySpec = statement.getChild(0);
-        
-        String key = CliCompiler.getKey(columnFamilySpec);
         String columnFamily = CliCompiler.getColumnFamily(columnFamilySpec);
+        ByteBuffer key = getKeyAsBytes(columnFamily, columnFamilySpec.getChild(1));
         int columnSpecCnt = CliCompiler.numColumnSpecifiers(columnFamilySpec);
         CfDef cfDef = getCfDef(columnFamily);
         boolean isSuper = cfDef.comparator_type.equals("Super");
@@ -384,22 +388,20 @@ public class CliClient extends CliUserHe
         // table.cf['key']['column'] -- slice of a super, or get of a standard
         else if (columnSpecCnt == 1)
         {
+            columnName = getColumnName(columnFamily, columnFamilySpec.getChild(2));
+
             if (isSuper)
             {
-                superColumnName = columnNameAsByteArray(CliCompiler.getColumn(columnFamilySpec, 0), cfDef);
+                superColumnName = columnName.array();
                 doSlice(keySpace, key, columnFamily, superColumnName);
                 return;
             }
-            else 
-            {
-                 columnName = columnNameAsBytes(CliCompiler.getColumn(columnFamilySpec, 0), cfDef);
-            }
         }
         // table.cf['key']['column']['column'] -- get of a sub-column
         else if (columnSpecCnt == 2)
         {
-            superColumnName = columnNameAsByteArray(CliCompiler.getColumn(columnFamilySpec, 0), cfDef);
-            columnName = subColumnNameAsBytes(CliCompiler.getColumn(columnFamilySpec, 1), cfDef);
+            superColumnName = getColumnName(columnFamily, columnFamilySpec.getChild(2)).array();
+            columnName = getSubColumnName(columnFamily, columnFamilySpec.getChild(3));
         }
         // The parser groks an arbitrary number of these so it is possible to get here.
         else
@@ -417,7 +419,7 @@ public class CliClient extends CliUserHe
         Column column;
         try
         {
-            column = thriftClient.get(ByteBuffer.wrap(key.getBytes(Charsets.UTF_8)), path, ConsistencyLevel.ONE).column;
+            column = thriftClient.get(key, path, ConsistencyLevel.ONE).column;
         }
         catch (NotFoundException e)
         {
@@ -558,8 +560,8 @@ public class CliClient extends CliUserHe
         
         // ^(NODE_COLUMN_ACCESS <cf> <key> <column>)
         Tree columnFamilySpec = statement.getChild(0);
-        
-        String key = CliCompiler.getKey(columnFamilySpec);
+        Tree keyTree = columnFamilySpec.getChild(1); // could be a function or regular text
+
         String columnFamily = CliCompiler.getColumnFamily(columnFamilySpec);
         int columnSpecCnt = CliCompiler.numColumnSpecifiers(columnFamilySpec);
         String value = CliUtils.unescapeSQLString(statement.getChild(1).getText());
@@ -578,18 +580,16 @@ public class CliClient extends CliUserHe
         else if (columnSpecCnt == 1)
         {
             // get the column name
-            columnName = columnNameAsBytes(CliCompiler.getColumn(columnFamilySpec, 0), columnFamily);
+            columnName = getColumnName(columnFamily, columnFamilySpec.getChild(2));
         }
         // table.cf['key']['super_column']['column'] = 'value'
         else
         {
             assert (columnSpecCnt == 2) : "serious parsing error (this is a bug).";
-            
-            // get the super column and column names
-            superColumnName = columnNameAsByteArray(CliCompiler.getColumn(columnFamilySpec, 0), columnFamily);
-            columnName = subColumnNameAsBytes(CliCompiler.getColumn(columnFamilySpec, 1), columnFamily);
-        }
 
+            superColumnName = getColumnName(columnFamily, columnFamilySpec.getChild(2)).array();
+            columnName = getSubColumnName(columnFamily, columnFamilySpec.getChild(3));
+        }
 
         ByteBuffer columnValueInBytes;
 
@@ -605,14 +605,14 @@ public class CliClient extends CliUserHe
         ColumnParent parent = new ColumnParent(columnFamily);
         if(superColumnName != null)
             parent.setSuper_column(superColumnName);
-        
+
         // do the insert
-        thriftClient.insert(ByteBuffer.wrap(key.getBytes(Charsets.UTF_8)), parent,
-                             new Column(columnName, columnValueInBytes, FBUtilities.timestampMicros()), ConsistencyLevel.ONE);
+        thriftClient.insert(getKeyAsBytes(columnFamily, keyTree), parent, new Column(columnName, columnValueInBytes,
+                FBUtilities.timestampMicros()), ConsistencyLevel.ONE);
         
         sessionState.out.println("Value inserted.");
     }
-    
+
     private void executeShowClusterName() throws TException
     {
         if (!CliMain.isConnected())
@@ -979,6 +979,63 @@ public class CliClient extends CliUserHe
         }
     }
 
+    /**
+     * Command: ASSUME <columnFamily> (VALIDATOR | COMPARATOR | KEYS | SUB_COMPARATOR) AS <type>
+     * Tree: ^(NODE_ASSUME <columnFamily> (VALIDATOR | COMPARATOR | KEYS | SUB_COMPARATOR) <type>))
+     * @param statement - tree representing current statement
+     */
+    private void executeAssumeStatement(Tree statement)
+    {
+        if (!CliMain.isConnected() || !hasKeySpace())
+            return;
+
+        CfDef columnFamily = getCfDef(statement.getChild(0).getText());
+
+        // VALIDATOR | COMPARATOR | KEYS | SUB_COMPARATOR
+        String assumptionElement = statement.getChild(1).getText().toUpperCase();
+        // used to store in this.cfKeysComparator
+        AbstractType comparator;
+
+        // Could be UTF8Type, IntegerType, LexicalUUIDType etc.
+        String defaultType = statement.getChild(2).getText();
+
+        try
+        {
+            comparator = Function.valueOf(defaultType.toUpperCase()).getValidator();
+        }
+        catch (Exception e)
+        {
+            String functions = Function.getFunctionNames();
+            sessionState.out.println("Type '" + defaultType + "' was not found. Available: " + functions);
+            return;
+        }
+
+        if (assumptionElement.equals("COMPARATOR"))
+        {
+            columnFamily.setComparator_type(defaultType);
+        }
+        else if (assumptionElement.equals("SUB_COMPARATOR"))
+        {
+            columnFamily.setSubcomparator_type(defaultType);
+        }
+        else if (assumptionElement.equals("VALIDATOR"))
+        {
+            columnFamily.setDefault_validation_class(defaultType);
+        }
+        else if (assumptionElement.equals("KEYS"))
+        {
+            this.cfKeysComparators.put(columnFamily.getName(), comparator);
+        }
+        else
+        {
+            String elements = "VALIDATOR, COMPARATOR, KEYS, SUB_COMPARATOR.";
+            sessionState.out.println(String.format("'%s' is invalid. Available: %s", assumptionElement, elements));
+            return;
+        }
+
+        sessionState.out.println(String.format("Assumption for column family '%s' added successfully.", columnFamily.getName()));
+    }
+
     // SHOW API VERSION
     private void executeShowVersion() throws TException
     {
@@ -1260,7 +1317,7 @@ public class CliClient extends CliUserHe
     
     /**
      * Used to parse meta tree and compile meta attributes into List<ColumnDef>
-     * @param cfDef 
+     * @param cfDef - column family definition 
      * @param meta (Tree representing Array of the hashes with metadata attributes)
      * @return List<ColumnDef> List of the ColumnDef's
      * 
@@ -1375,7 +1432,12 @@ public class CliClient extends CliUserHe
         }
         else if (comparator instanceof LexicalUUIDType || comparator instanceof TimeUUIDType)
         {
-            UUID uuid = UUID.fromString(object);
+            // generate new time based UUID if object is empty
+            // this means that we have timeuuid() call
+            if (comparator instanceof TimeUUIDType && object.isEmpty())
+                return ByteBuffer.wrap(UUIDGenerator.getInstance().generateTimeBasedUUID().asByteArray());
+
+            UUID uuid = (object.isEmpty()) ? UUID.randomUUID() : UUID.fromString(object);
 
             if (comparator instanceof TimeUUIDType && uuid.version() != 1)
                 throw new IllegalArgumentException("TimeUUID supports only version 1 UUIDs");    
@@ -1444,7 +1506,7 @@ public class CliClient extends CliUserHe
     /**
      * Converts column name into byte[] according to comparator type
      * @param column - column name from parser
-     * @param columnFamilyDef - column family from parser
+     * @param cfDef  - column family from parser
      * @return bytes[] - into which column name was converted according to comparator type
      */
     private byte[] columnNameAsByteArray(String column, CfDef cfDef)
@@ -1615,23 +1677,12 @@ public class CliClient extends CliUserHe
     private ByteBuffer convertValueByFunction(Tree functionCall, CfDef columnFamily, ByteBuffer columnName, boolean withUpdate)
     {
         String functionName = functionCall.getChild(0).getText();
-        String functionArg  = CliUtils.unescapeSQLString(functionCall.getChild(1).getText());
-        Function function;
-
-        try
-        {
-            function = Function.valueOf(functionName.toUpperCase());
-        }
-        catch (IllegalArgumentException e)
-        {
-            StringBuilder errorMessage = new StringBuilder("Function '" + functionName + "' not found. ");
-            errorMessage.append("Available functions: ");
-            throw new RuntimeException(errorMessage.append(Function.getFunctionNames()).toString());  
-        }
+        Tree argumentTree = functionCall.getChild(1);
+        String functionArg  = (argumentTree == null) ? "" : CliUtils.unescapeSQLString(argumentTree.getText());
+        AbstractType validator = getTypeByFunction(functionName);
 
         try
         {
-            AbstractType validator = function.getValidator();
             ByteBuffer value = getBytesAccordingToType(functionArg, validator);
 
             // performing ColumnDef local validator update
@@ -1649,6 +1700,29 @@ public class CliClient extends CliUserHe
     }
 
     /**
+     * Get AbstractType by function name
+     * @param functionName - name of the function e.g. utf8, integer, long etc.
+     * @return AbstractType type corresponding to the function name
+     */
+    public static AbstractType getTypeByFunction(String functionName)
+    {
+        Function function;
+
+        try
+        {
+            function = Function.valueOf(functionName.toUpperCase());
+        }
+        catch (IllegalArgumentException e)
+        {
+            StringBuilder errorMessage = new StringBuilder("Function '" + functionName + "' not found. ");
+            errorMessage.append("Available functions: ");
+            throw new RuntimeException(errorMessage.append(Function.getFunctionNames()).toString());
+        }
+
+        return function.getValidator();
+    }
+
+    /**
      * Used to locally update column family definition with new column metadata
      * @param columnFamily    - CfDef record
      * @param columnName      - column name represented as byte[]
@@ -1710,12 +1784,14 @@ public class CliClient extends CliUserHe
     {
         AbstractType validator;
         String columnFamilyName = columnFamilyDef.getName();
+        AbstractType keyComparator = this.cfKeysComparators.get(columnFamilyName);
 
         for (KeySlice ks : slices)
         {
-            sessionState.out.printf("-------------------\n");
-            sessionState.out.printf("RowKey: %s\n", ByteBufferUtil.string(ks.key, Charsets.UTF_8));
+            String keyName = (keyComparator == null) ? ByteBufferUtil.string(ks.key, Charsets.UTF_8) : keyComparator.getString(ks.key);
 
+            sessionState.out.printf("-------------------\n");
+            sessionState.out.printf("RowKey: %s\n", keyName);
             Iterator<ColumnOrSuperColumn> iterator = ks.getColumnsIterator();
 
             while (iterator.hasNext())
@@ -1771,4 +1847,33 @@ public class CliClient extends CliUserHe
     {
         return getFormatTypeForColumn(getCfDef(keyspace, columnFamily).comparator_type).getString(ByteBuffer.wrap(column.getName()));
     }
+
+    private ByteBuffer getColumnName(String columnFamily, Tree columnTree)
+    {
+        return (columnTree.getType() == CliParser.FUNCTION_CALL)
+                    ? convertValueByFunction(columnTree, null, null)
+                    : columnNameAsBytes(CliUtils.unescapeSQLString(columnTree.getText()), columnFamily);
+    }
+
+    private ByteBuffer getSubColumnName(String columnFamily, Tree columnTree)
+    {
+        return (columnTree.getType() == CliParser.FUNCTION_CALL)
+                    ? convertValueByFunction(columnTree, null, null)
+                    : subColumnNameAsBytes(CliUtils.unescapeSQLString(columnTree.getText()), columnFamily);
+    }
+
+    public ByteBuffer getKeyAsBytes(String columnFamily, Tree keyTree)
+    {
+        if (keyTree.getType() == CliParser.FUNCTION_CALL)
+            return convertValueByFunction(keyTree, null, null);
+
+        String key = CliUtils.unescapeSQLString(keyTree.getText());
+
+        AbstractType keyComparator = this.cfKeysComparators.get(columnFamily);
+        return keyComparator == null
+                ? ByteBuffer.wrap(key.getBytes(Charsets.UTF_8))
+                : getBytesAccordingToType(key, keyComparator);
+
+    }
+
 }

Modified: cassandra/trunk/src/java/org/apache/cassandra/cli/CliUserHelp.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/src/java/org/apache/cassandra/cli/CliUserHelp.java?rev=1034096&r1=1034095&r2=1034096&view=diff
==============================================================================
--- cassandra/trunk/src/java/org/apache/cassandra/cli/CliUserHelp.java (original)
+++ cassandra/trunk/src/java/org/apache/cassandra/cli/CliUserHelp.java Thu Nov 11 20:06:14 2010
@@ -227,15 +227,19 @@ public class CliUserHelp {
                 state.out.println("get <cf>['<key>']");
                 state.out.println("get <cf>['<key>']['<col>'] (as <type>)*");
                 state.out.println("get <cf>['<key>']['<super>']");
+                state.out.println("get <cf>['<key>'][<function>]");
+                state.out.println("get <cf>['<key>'][<function>(<super>)][<function>(<col>)]");
                 state.out.println("get <cf> where <column> = <value> [and <column> > <value> and ...] [limit <integer>]");
                 state.out.println("Default LIMIT is 100. Available operations: =, >, >=, <, <=\n");
                 state.out.println("get <cf>['<key>']['<super>']['<col>'] (as <type>)*");
                 state.out.print("Note: `as <type>` is optional, it dynamically converts column value to the specified type");
                 state.out.println(", column value validator will be set to <type>.");
+                state.out.println("Available functions: " + CliClient.Function.getFunctionNames());
                 state.out.println("Available types: IntegerType, LongType, UTF8Type, ASCIIType, TimeUUIDType, LexicalUUIDType.\n");
                 state.out.println("examples:");
                 state.out.println("get bar[testkey]");
                 state.out.println("get bar[testkey][test_column] as IntegerType");
+                state.out.println("get bar[testkey][utf8(hello)]");
                 break;
 
             case CliParser.NODE_THRIFT_SET:
@@ -243,11 +247,13 @@ public class CliUserHelp {
                 state.out.println("set <cf>['<key>']['<super>']['<col>'] = <value>");
                 state.out.println("set <cf>['<key>']['<col>'] = <function>(<argument>)");
                 state.out.println("set <cf>['<key>']['<super>']['<col>'] = <function>(<argument>)");
+                state.out.println("set <cf>[<key>][<function>(<col>)] = <value> || <function>");
                 state.out.println("Available functions: " + CliClient.Function.getFunctionNames() + "\n");
                 state.out.println("examples:");
                 state.out.println("set bar['testkey']['my super']['test col']='this is a test'");
                 state.out.println("set baz['testkey']['test col']='this is also a test'");
                 state.out.println("set diz[testkey][testcol] = utf8('this is utf8 string.')");
+                state.out.println("set bar[testkey][timeuuid()] = utf('hello world')");
                 break;
 
             case CliParser.NODE_THRIFT_DEL:
@@ -287,7 +293,18 @@ public class CliUserHelp {
                 state.out.println("example:");
                 state.out.println("truncate Category");
                 break;
-            
+
+            case CliParser.NODE_ASSUME:
+                state.out.println("assume <column_family> comparator as <type>");
+                state.out.println("assume <column_family> sub_comparator as <type>");
+                state.out.println("assume <column_family> validator as <type>");
+                state.out.println("assume <column_family> keys as <type>\n");
+                state.out.println("Assume one of the attributes (comparator, sub_comparator, validator or keys)");
+                state.out.println("of the given column family to match specified type. Available types: " + CliClient.Function.getFunctionNames());
+                state.out.println("example:");
+                state.out.println("assume Users comparator as lexicaluuid");
+                break;
+
             default:
                 state.out.println("?");
                 break;
@@ -317,8 +334,6 @@ public class CliUserHelp {
             state.out.println("            Update a column family with the specified attribute(s) and value(s).");
             state.out.println("drop keyspace <keyspace>                                      Delete a keyspace.");
             state.out.println("drop column family <cf>                                  Delete a column family.");
-            state.out.println("rename keyspace <keyspace> <keyspace_new_name>                Rename a keyspace.");
-            state.out.println("rename column family <cf> <new_name>                     Rename a column family.");
             state.out.println("get <cf>['<key>']                                        Get a slice of columns.");
             state.out.println("get <cf>['<key>']['<super>']                         Get a slice of sub columns.");
             state.out.println("get <cf> where <column> = <value> [and <column> > <value> and ...] [limit int]. ");
@@ -331,7 +346,9 @@ public class CliUserHelp {
             state.out.println("del <cf>['<key>']['<super>']['<col>']                         Delete sub column.");
             state.out.println("count <cf>['<key>']                                     Count columns in record.");
             state.out.println("count <cf>['<key>']['<super>']                  Count columns in a super column.");
-            state.out.println("truncate <column_family>                       Truncate specified column family.");            
+            state.out.println("truncate <column_family>                       Truncate specified column family.");
+            state.out.println("assume <column_family> <attribute> as <type>");
+            state.out.println("Assume one of the attributes of the given column family to match specified type.");
             state.out.println("list <cf>                                    List all rows in the column family.");
             state.out.println("list <cf>[<startKey>:]");
             state.out.println("                       List rows in the column family beginning with <startKey>.");

Modified: cassandra/trunk/src/java/org/apache/cassandra/db/DecoratedKey.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/src/java/org/apache/cassandra/db/DecoratedKey.java?rev=1034096&r1=1034095&r2=1034096&view=diff
==============================================================================
--- cassandra/trunk/src/java/org/apache/cassandra/db/DecoratedKey.java (original)
+++ cassandra/trunk/src/java/org/apache/cassandra/db/DecoratedKey.java Thu Nov 11 20:06:14 2010
@@ -61,7 +61,7 @@ public class DecoratedKey<T extends Toke
     @Override
     public int hashCode()
     {
-        return token.hashCode();
+        return token.hashCode() + (key == null ? 0 : key.hashCode());
     }
 
     @Override
@@ -75,12 +75,40 @@ public class DecoratedKey<T extends Toke
             return false;
 
         DecoratedKey other = (DecoratedKey) obj;
-        return token.equals(other.token);
+
+        if (token.equals(other.token))
+        {
+            if (key == null && other.key == null)
+                return true;
+
+            if (key == null || other.key == null)
+                return false;
+
+            return key.equals(other.key);
+        }
+
+        return false;
     }
 
     public int compareTo(DecoratedKey other)
     {
-        return token.compareTo(other.token);
+        int cmp = token.compareTo(other.token);
+
+        if (cmp == 0)
+        {
+            if (key == null && other.key == null)
+                return 0;
+
+            if (key == null)
+                return 1;
+
+            if (other.key == null)
+                return -1;
+
+            return key.compareTo(other.key);
+        }
+
+        return cmp;
     }
 
     public boolean isEmpty()

Modified: cassandra/trunk/src/java/org/apache/cassandra/db/ReadVerbHandler.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/src/java/org/apache/cassandra/db/ReadVerbHandler.java?rev=1034096&r1=1034095&r2=1034096&view=diff
==============================================================================
--- cassandra/trunk/src/java/org/apache/cassandra/db/ReadVerbHandler.java (original)
+++ cassandra/trunk/src/java/org/apache/cassandra/db/ReadVerbHandler.java Thu Nov 11 20:06:14 2010
@@ -93,7 +93,8 @@ public class ReadVerbHandler implements 
 
             Message response = message.getReply(FBUtilities.getLocalAddress(), bytes);
             if (logger_.isDebugEnabled())
-              logger_.debug("Read key " + command.key + "; sending response to " + message.getMessageId() + "@" + message.getFrom());
+              logger_.debug(String.format("Read key %s; sending response to %s@%s",
+                                          FBUtilities.bytesToHex(command.key), message.getMessageId(), message.getFrom()));
             MessagingService.instance.sendOneWay(response, message.getFrom());
 
             /* Do read repair if header of the message says so */

Modified: cassandra/trunk/src/java/org/apache/cassandra/db/Table.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/src/java/org/apache/cassandra/db/Table.java?rev=1034096&r1=1034095&r2=1034096&view=diff
==============================================================================
--- cassandra/trunk/src/java/org/apache/cassandra/db/Table.java (original)
+++ cassandra/trunk/src/java/org/apache/cassandra/db/Table.java Thu Nov 11 20:06:14 2010
@@ -369,7 +369,7 @@ public class Table
     {
         List<Memtable> memtablesToFlush = Collections.emptyList();
         if (logger.isDebugEnabled())
-            logger.debug("applying mutation of {}", FBUtilities.bytesToHex(mutation.key()));
+            logger.debug("applying mutation of row {}", FBUtilities.bytesToHex(mutation.key()));
 
         // write the mutation to the commitlog and memtables
         flusherLock.readLock().lock();
@@ -397,7 +397,14 @@ public class Table
                             mutatedIndexedColumns = new TreeSet<ByteBuffer>();
                         mutatedIndexedColumns.add(column);
                         if (logger.isDebugEnabled())
-                            logger.debug("mutating indexed column " + cf.getComparator().getString(column));
+                        {
+                            // can't actually use validator to print value here, because we overload value
+                            // for deletion timestamp as well (which may not be a well-formed value for the column type)
+                            ByteBuffer value = cf.getColumn(column) == null ? null : cf.getColumn(column).value(); // may be null on row-level deletion
+                            logger.debug(String.format("mutating indexed column %s value %s",
+                                                       cf.getComparator().getString(column),
+                                                       value == null ? "null" : FBUtilities.bytesToHex(value)));
+                        }
                     }
                 }
 
@@ -411,6 +418,7 @@ public class Table
                         // but for indexed data we need to make sure that we're not creating index entries
                         // for obsolete writes.
                         oldIndexedColumns = readCurrentIndexedColumns(key, cfs, mutatedIndexedColumns);
+                        logger.debug("Pre-mutation index row is {}", oldIndexedColumns);
                         ignoreObsoleteMutations(cf, mutatedIndexedColumns, oldIndexedColumns);
                     }
 

Modified: cassandra/trunk/src/java/org/apache/cassandra/service/ConsistencyChecker.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/src/java/org/apache/cassandra/service/ConsistencyChecker.java?rev=1034096&r1=1034095&r2=1034096&view=diff
==============================================================================
--- cassandra/trunk/src/java/org/apache/cassandra/service/ConsistencyChecker.java (original)
+++ cassandra/trunk/src/java/org/apache/cassandra/service/ConsistencyChecker.java Thu Nov 11 20:06:14 2010
@@ -30,8 +30,12 @@ import java.util.concurrent.ScheduledExe
 import java.util.concurrent.ScheduledThreadPoolExecutor;
 import java.util.concurrent.TimeUnit;
 
+import org.apache.commons.lang.ArrayUtils;
 import org.apache.commons.lang.StringUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
+import org.apache.cassandra.concurrent.StageManager;
 import org.apache.cassandra.config.DatabaseDescriptor;
 import org.apache.cassandra.db.ColumnFamily;
 import org.apache.cassandra.db.ReadCommand;
@@ -42,12 +46,22 @@ import org.apache.cassandra.net.IAsyncCa
 import org.apache.cassandra.net.Message;
 import org.apache.cassandra.net.MessagingService;
 import org.apache.cassandra.utils.FBUtilities;
-
 import org.apache.cassandra.utils.WrappedRunnable;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
 
+/**
+ * ConsistencyChecker does the following:
+ *
+ * [ConsistencyChecker.run]
+ * (1) sends DIGEST read requests to each other replica of the given row.
+ *
+ * [DigestResponseHandler]
+ * (2) If any of the digests to not match the local one, it sends a second round of requests
+ * to each replica, this time for the full data
+ *
+ * [DataRepairHandler]
+ * (3) processes full-read responses and invokes resolve.  The actual sending of messages
+ * repairing out-of-date or missing data is handled by ReadResponseResolver.
+ */
 class ConsistencyChecker implements Runnable
 {
     private static Logger logger_ = LoggerFactory.getLogger(ConsistencyChecker.class);
@@ -65,6 +79,7 @@ class ConsistencyChecker implements Runn
         row_ = row;
         replicas_ = endpoints;
         readCommand_ = readCommand;
+        assert replicas_.contains(FBUtilities.getLocalAddress());
     }
 
     public void run()
@@ -99,8 +114,9 @@ class ConsistencyChecker implements Runn
     class DigestResponseHandler implements IAsyncCallback
 	{
         private boolean repairInvoked;
+        private final ByteBuffer localDigest = ColumnFamily.digest(row_.cf);
 
-		public synchronized void response(Message response)
+        public synchronized void response(Message response)
 		{
             if (repairInvoked)
                 return;
@@ -112,19 +128,15 @@ class ConsistencyChecker implements Runn
                 ReadResponse result = ReadResponse.serializer().deserialize(new DataInputStream(bufIn));
                 ByteBuffer digest = result.digest();
 
-                if (!ColumnFamily.digest(row_.cf).equals(digest))
+                if (!localDigest.equals(digest))
                 {
-                    IResponseResolver<Row> readResponseResolver = new ReadResponseResolver(table_);
-                    IAsyncCallback responseHandler;
-                    if (replicas_.contains(FBUtilities.getLocalAddress()))
-                        responseHandler = new DataRepairHandler(row_, replicas_.size(), readResponseResolver);
-                    else
-                        responseHandler = new DataRepairHandler(replicas_.size(), readResponseResolver);
+                    ReadResponseResolver readResponseResolver = new ReadResponseResolver(table_);
+                    IAsyncCallback responseHandler = new DataRepairHandler(row_, replicas_.size(), readResponseResolver);
 
                     ReadCommand readCommand = constructReadMessage(false);
                     Message message = readCommand.makeReadMessage();
                     if (logger_.isDebugEnabled())
-                      logger_.debug("Performing read repair for " + readCommand_.key + " to " + message.getMessageId() + "@[" + StringUtils.join(replicas_, ", ") + "]");
+                        logger_.debug("Digest mismatch; re-reading " + readCommand_.key + " from " + message.getMessageId() + "@[" + StringUtils.join(replicas_, ", ") + "]");                         
                     MessagingService.instance.addCallback(responseHandler, message.getMessageId());
                     for (InetAddress endpoint : replicas_)
                     {
@@ -145,33 +157,27 @@ class ConsistencyChecker implements Runn
 	static class DataRepairHandler implements IAsyncCallback
 	{
 		private final Collection<Message> responses_ = new LinkedBlockingQueue<Message>();
-		private final IResponseResolver<Row> readResponseResolver_;
+		private final ReadResponseResolver readResponseResolver_;
 		private final int majority_;
 		
-		DataRepairHandler(int responseCount, IResponseResolver<Row> readResponseResolver)
-		{
-			readResponseResolver_ = readResponseResolver;
-			majority_ = (responseCount / 2) + 1;  
-		}
-
-        public DataRepairHandler(Row localRow, int responseCount, IResponseResolver<Row> readResponseResolver) throws IOException
+        public DataRepairHandler(Row localRow, int responseCount, ReadResponseResolver readResponseResolver) throws IOException
         {
-            this(responseCount, readResponseResolver);
+            readResponseResolver_ = readResponseResolver;
+            majority_ = (responseCount / 2) + 1;
             // wrap localRow in a response Message so it doesn't need to be special-cased in the resolver
             ReadResponse readResponse = new ReadResponse(localRow);
-            DataOutputBuffer out = new DataOutputBuffer();
-            ReadResponse.serializer().serialize(readResponse, out);
-            byte[] bytes = new byte[out.getLength()];
-            System.arraycopy(out.getData(), 0, bytes, 0, bytes.length);
-            responses_.add(new Message(FBUtilities.getLocalAddress(), StorageService.Verb.INTERNAL_RESPONSE, bytes));
+            Message fakeMessage = new Message(FBUtilities.getLocalAddress(), StorageService.Verb.INTERNAL_RESPONSE, ArrayUtils.EMPTY_BYTE_ARRAY);
+            responses_.add(fakeMessage);
+            readResponseResolver_.injectPreProcessed(fakeMessage, readResponse);
         }
 
         // synchronized so the " == majority" is safe
 		public synchronized void response(Message message)
 		{
 			if (logger_.isDebugEnabled())
-			  logger_.debug("Received responses in DataRepairHandler : " + message.toString());
+			  logger_.debug("Received response in DataRepairHandler : " + message.toString());
 			responses_.add(message);
+            readResponseResolver_.preprocess(message);
             if (responses_.size() == majority_)
             {
                 Runnable runnable = new WrappedRunnable()

Modified: cassandra/trunk/src/java/org/apache/cassandra/service/ReadResponseResolver.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/src/java/org/apache/cassandra/service/ReadResponseResolver.java?rev=1034096&r1=1034095&r2=1034096&view=diff
==============================================================================
--- cassandra/trunk/src/java/org/apache/cassandra/service/ReadResponseResolver.java (original)
+++ cassandra/trunk/src/java/org/apache/cassandra/service/ReadResponseResolver.java Thu Nov 11 20:06:14 2010
@@ -195,6 +195,12 @@ public class ReadResponseResolver implem
         }
     }
 
+    /** hack so ConsistencyChecker doesn't have to serialize/deserialize an extra real Message */
+    public void injectPreProcessed(Message message, ReadResponse result)
+    {
+        results.put(message, result);
+    }
+
     public boolean isDataPresent(Collection<Message> responses)
 	{
         for (Message message : responses)

Modified: cassandra/trunk/src/java/org/apache/cassandra/service/StorageProxy.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/src/java/org/apache/cassandra/service/StorageProxy.java?rev=1034096&r1=1034095&r2=1034096&view=diff
==============================================================================
--- cassandra/trunk/src/java/org/apache/cassandra/service/StorageProxy.java (original)
+++ cassandra/trunk/src/java/org/apache/cassandra/service/StorageProxy.java Thu Nov 11 20:06:14 2010
@@ -561,8 +561,8 @@ public class StorageProxy implements Sto
      */
     static List<AbstractBounds> getRestrictedRanges(final AbstractBounds queryRange)
     {
-        // special case for bounds containing exactly 1 token
-        if (queryRange instanceof Bounds && queryRange.left.equals(queryRange.right))
+        // special case for bounds containing exactly 1 (non-minimum) token
+        if (queryRange instanceof Bounds && queryRange.left.equals(queryRange.right) && !queryRange.left.equals(StorageService.getPartitioner().getMinimumToken()))
         {
             if (logger.isDebugEnabled())
                 logger.debug("restricted single token match for query " + queryRange);

Modified: cassandra/trunk/test/unit/org/apache/cassandra/cli/CliTest.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/test/unit/org/apache/cassandra/cli/CliTest.java?rev=1034096&r1=1034095&r2=1034096&view=diff
==============================================================================
--- cassandra/trunk/test/unit/org/apache/cassandra/cli/CliTest.java (original)
+++ cassandra/trunk/test/unit/org/apache/cassandra/cli/CliTest.java Thu Nov 11 20:06:14 2010
@@ -80,7 +80,21 @@ public class CliTest extends CleanupHelp
         "get SCF1['hello'][1][9999]",
         "truncate CF1",
         "update keyspace TestKeySpace with placement_strategy='org.apache.cassandra.locator.LocalStrategy'",
-        "update keyspace TestKeySpace with replication_factor=1 and strategy_options=[{DC1:3, DC2:4, DC5:1}]"
+        "update keyspace TestKeySpace with replication_factor=1 and strategy_options=[{DC1:3, DC2:4, DC5:1}]",
+        "assume CF1 comparator as utf8",
+        "assume CF1 sub_comparator as integer",
+        "assume CF1 validator as lexicaluuid",
+        "assume CF1 keys as timeuuid",
+        "create column family CF7",
+        "set CF7[1][timeuuid()] = utf8(test1)",
+        "set CF7[2][lexicaluuid()] = utf8('hello world!')",
+        "set CF7[3][lexicaluuid(550e8400-e29b-41d4-a716-446655440000)] = utf8(test2)",
+        "set CF7[key2][timeuuid()] = utf8(test3)",
+        "assume CF7 comparator as lexicaluuid",
+        "assume CF7 keys as utf8",
+        "list CF7",
+        "get CF7[3]",
+        "get CF7[3][lexicaluuid(550e8400-e29b-41d4-a716-446655440000)]"
     };
     
     @Test
@@ -135,6 +149,10 @@ public class CliTest extends CleanupHelp
             {
                 assertTrue(result.contains(" truncated."));
             }
+            else if (statement.startsWith("assume "))
+            {
+                assertTrue(result.contains("successfully."));
+            }
 
             outStream.reset(); // reset stream so we have only output from next statement all the time
             errStream.reset(); // no errors to the end user.

Modified: cassandra/trunk/test/unit/org/apache/cassandra/service/StorageProxyTest.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/test/unit/org/apache/cassandra/service/StorageProxyTest.java?rev=1034096&r1=1034095&r2=1034096&view=diff
==============================================================================
--- cassandra/trunk/test/unit/org/apache/cassandra/service/StorageProxyTest.java (original)
+++ cassandra/trunk/test/unit/org/apache/cassandra/service/StorageProxyTest.java Thu Nov 11 20:06:14 2010
@@ -107,5 +107,7 @@ public class StorageProxyTest extends Cl
     {
         // equal tokens are special cased as non-wrapping for bounds
         testGRR(bounds("0", "0"), bounds("0", "0"));
+        // completely empty bounds match everything
+        testGRR(bounds("", ""), bounds("", "1"), range("1", "6"), range("6", ""));
     }
 }



Mime
View raw message