cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jbel...@apache.org
Subject svn commit: r1210747 [1/2] - in /cassandra/trunk: ./ bin/ contrib/ interface/thrift/gen-java/org/apache/cassandra/thrift/ src/java/org/apache/cassandra/cli/ src/java/org/apache/cassandra/config/ src/java/org/apache/cassandra/cql/ src/java/org/apache/ca...
Date Tue, 06 Dec 2011 02:10:00 GMT
Author: jbellis
Date: Tue Dec  6 02:09:58 2011
New Revision: 1210747

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

Modified:
    cassandra/trunk/   (props changed)
    cassandra/trunk/CHANGES.txt
    cassandra/trunk/bin/cqlsh
    cassandra/trunk/contrib/   (props changed)
    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/cli/CliClient.java
    cassandra/trunk/src/java/org/apache/cassandra/cli/CliMain.java
    cassandra/trunk/src/java/org/apache/cassandra/config/CFMetaData.java
    cassandra/trunk/src/java/org/apache/cassandra/cql/AbstractModification.java
    cassandra/trunk/src/java/org/apache/cassandra/cql/Cql.g
    cassandra/trunk/src/java/org/apache/cassandra/cql/DeleteStatement.java
    cassandra/trunk/src/java/org/apache/cassandra/cql/QueryProcessor.java
    cassandra/trunk/src/java/org/apache/cassandra/cql/UpdateStatement.java
    cassandra/trunk/src/java/org/apache/cassandra/db/ColumnFamilyStore.java
    cassandra/trunk/src/java/org/apache/cassandra/db/DataTracker.java
    cassandra/trunk/src/java/org/apache/cassandra/db/Memtable.java
    cassandra/trunk/src/java/org/apache/cassandra/db/compaction/CompactionManager.java
    cassandra/trunk/src/java/org/apache/cassandra/db/compaction/CompactionTask.java
    cassandra/trunk/src/java/org/apache/cassandra/db/compaction/LeveledManifest.java
    cassandra/trunk/src/java/org/apache/cassandra/hadoop/ColumnFamilyInputFormat.java
    cassandra/trunk/src/java/org/apache/cassandra/hadoop/ColumnFamilyRecordReader.java
    cassandra/trunk/src/java/org/apache/cassandra/hadoop/ColumnFamilySplit.java
    cassandra/trunk/src/java/org/apache/cassandra/io/compress/CompressionParameters.java
    cassandra/trunk/src/java/org/apache/cassandra/io/compress/SnappyCompressor.java
    cassandra/trunk/src/java/org/apache/cassandra/io/sstable/Component.java
    cassandra/trunk/src/java/org/apache/cassandra/io/sstable/Descriptor.java
    cassandra/trunk/src/java/org/apache/cassandra/io/sstable/SSTable.java
    cassandra/trunk/src/java/org/apache/cassandra/io/sstable/SSTableReader.java
    cassandra/trunk/src/java/org/apache/cassandra/io/sstable/SSTableWriter.java
    cassandra/trunk/src/java/org/apache/cassandra/net/MessagingService.java
    cassandra/trunk/src/java/org/apache/cassandra/service/StorageProxy.java
    cassandra/trunk/src/java/org/apache/cassandra/service/StorageService.java
    cassandra/trunk/src/java/org/apache/cassandra/streaming/IncomingStreamReader.java
    cassandra/trunk/src/java/org/apache/cassandra/thrift/ThriftValidation.java
    cassandra/trunk/src/java/org/apache/cassandra/tools/NodeCmd.java
    cassandra/trunk/src/java/org/apache/cassandra/tools/NodeProbe.java
    cassandra/trunk/src/java/org/apache/cassandra/utils/FBUtilities.java
    cassandra/trunk/src/java/org/apache/cassandra/utils/WrappedRunnable.java
    cassandra/trunk/test/unit/org/apache/cassandra/cli/CliTest.java
    cassandra/trunk/test/unit/org/apache/cassandra/io/sstable/SSTableTest.java
    cassandra/trunk/tools/stress/src/org/apache/cassandra/stress/Session.java
    cassandra/trunk/tools/stress/src/org/apache/cassandra/stress/operations/Inserter.java
    cassandra/trunk/tools/stress/src/org/apache/cassandra/stress/util/Operation.java

Propchange: cassandra/trunk/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Dec  6 02:09:58 2011
@@ -1,10 +1,10 @@
 /cassandra/branches/cassandra-0.6:922689-1052356,1052358-1053452,1053454,1053456-1131291
 /cassandra/branches/cassandra-0.7:1026516-1183000
 /cassandra/branches/cassandra-0.7.0:1053690-1055654
-/cassandra/branches/cassandra-0.8:1090934-1125013,1125019-1198724,1198726-1205453,1206184,1206235,1206257,1207262
+/cassandra/branches/cassandra-0.8:1090934-1125013,1125019-1198724,1198726-1206097,1206099-1209609
 /cassandra/branches/cassandra-0.8.0:1125021-1130369
 /cassandra/branches/cassandra-0.8.1:1101014-1125018
-/cassandra/branches/cassandra-1.0:1167085-1207969,1208000,1209390,1209397,1209399
+/cassandra/branches/cassandra-1.0:1167085-1210745
 /cassandra/branches/cassandra-1.0.0:1167104-1167229,1167232-1181093,1181741,1181816,1181820,1182951,1183243
 /cassandra/tags/cassandra-0.7.0-rc3:1051699-1053689
 /cassandra/tags/cassandra-0.8.0-rc1:1102511-1125020

Modified: cassandra/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/cassandra/trunk/CHANGES.txt?rev=1210747&r1=1210746&r2=1210747&view=diff
==============================================================================
--- cassandra/trunk/CHANGES.txt (original)
+++ cassandra/trunk/CHANGES.txt Tue Dec  6 02:09:58 2011
@@ -36,13 +36,14 @@
  * Optimize componentsFor method for compaction and startup time
    (CASSANDRA-3532)
  * (CQL) Proper ColumnFamily metadata validation on CREATE COLUMNFAMILY (CASSANDRA-3565)
-Merged from 0.8: 
+ * validate compression parameters on add/update of the ColumnFamily (CASSANDRA-3573)
+Merged from 0.8:
  * use cannonical host for local node in nodetool info (CASSANDRA-3556)
 
 
 1.0.5
- * add command to stop compactions (CASSANDRA-1740)
- * fix assertion error when forwarding to local nodes (CASSANDRA-3539)
+ * revert CASSANDRA-3407 (see CASSANDRA-3540)
+ * fix assertion error while forwarding writes to local nodes (CASSANDRA-3539)
 
 1.0.4
  * fix self-hinting of timed out read repair updates and make hinted handoff

Modified: cassandra/trunk/bin/cqlsh
URL: http://svn.apache.org/viewvc/cassandra/trunk/bin/cqlsh?rev=1210747&r1=1210746&r2=1210747&view=diff
==============================================================================
--- cassandra/trunk/bin/cqlsh (original)
+++ cassandra/trunk/bin/cqlsh Tue Dec  6 02:09:58 2011
@@ -1,4 +1,5 @@
-#!/usr/bin/env python
+#!/bin/sh
+# -*- mode: Python -*-
 
 # Licensed to the Apache Software Foundation (ASF) under one
 # or more contributor license agreements.  See the NOTICE file
@@ -16,6 +17,18 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
+""":"
+# bash code here; finds a suitable python interpreter and execs this file.
+# prefer unqualified "python" if suitable:
+python -c 'import sys; sys.exit(sys.hexversion < 0x020500b0)' 2>/dev/null \
+    && exec python "$0" "$@"
+for pyver in 2.6 2.7 2.5; do
+    which python$pyver > /dev/null 2>&1 && exec python$pyver "$0" "$@"
+done
+echo "No appropriate python interpreter found." >&2
+exit 1
+":"""
+
 description = "CQL Shell for Apache Cassandra"
 version = "2.0.0"
 
@@ -50,9 +63,11 @@ except ImportError:
 try:
     import cql
 except ImportError, e:
-    sys.stderr.write("\nPython CQL driver not installed, or not on PYTHONPATH.\n")
-    sys.stderr.write('You might try "easy_install cql".\n\n')
-    sys.exit(str(e))
+    sys.exit("\nPython CQL driver not installed, or not on PYTHONPATH.\n"
+             'You might try "easy_install cql".\n\n'
+             'Python: %s\n'
+             'Module load path: %r\n\n'
+             'Error: %s\n' % (sys.executable, sys.path, e))
 
 import cql.decoders
 from cql.cursor import _COUNT_DESCRIPTION, _VOID_DESCRIPTION
@@ -1520,3 +1535,5 @@ def main(options, hostname, port):
 
 if __name__ == '__main__':
     main(*read_options(sys.argv[1:], os.environ))
+
+# vim: set ft=python et ts=4 sw=4 :

Propchange: cassandra/trunk/contrib/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Dec  6 02:09:58 2011
@@ -1,10 +1,10 @@
 /cassandra/branches/cassandra-0.6/contrib:922689-1052356,1052358-1053452,1053454,1053456-1068009
 /cassandra/branches/cassandra-0.7/contrib:1026516-1183000
 /cassandra/branches/cassandra-0.7.0/contrib:1053690-1055654
-/cassandra/branches/cassandra-0.8/contrib:1090934-1125013,1125019-1198724,1198726-1205453,1206184,1206235,1206257,1207262
+/cassandra/branches/cassandra-0.8/contrib:1090934-1125013,1125019-1198724,1198726-1206097,1206099-1209609
 /cassandra/branches/cassandra-0.8.0/contrib:1125021-1130369
 /cassandra/branches/cassandra-0.8.1/contrib:1101014-1125018
-/cassandra/branches/cassandra-1.0/contrib:1167085-1207969,1208000,1209390,1209397,1209399
+/cassandra/branches/cassandra-1.0/contrib:1167085-1210745
 /cassandra/branches/cassandra-1.0.0/contrib:1167104-1167229,1167232-1181093,1181741,1181816,1181820,1182951,1183243
 /cassandra/tags/cassandra-0.7.0-rc3/contrib:1051699-1053689
 /cassandra/tags/cassandra-0.8.0-rc1/contrib:1102511-1125020

Propchange: cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/Cassandra.java
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Dec  6 02:09:58 2011
@@ -1,10 +1,10 @@
 /cassandra/branches/cassandra-0.6/interface/thrift/gen-java/org/apache/cassandra/thrift/Cassandra.java:922689-1052356,1052358-1053452,1053454,1053456-1131291
 /cassandra/branches/cassandra-0.7/interface/thrift/gen-java/org/apache/cassandra/thrift/Cassandra.java:1026516-1183000
 /cassandra/branches/cassandra-0.7.0/interface/thrift/gen-java/org/apache/cassandra/thrift/Cassandra.java:1053690-1055654
-/cassandra/branches/cassandra-0.8/interface/thrift/gen-java/org/apache/cassandra/thrift/Cassandra.java:1090934-1125013,1125019-1198724,1198726-1205453,1206184,1206235,1206257,1207262
+/cassandra/branches/cassandra-0.8/interface/thrift/gen-java/org/apache/cassandra/thrift/Cassandra.java:1090934-1125013,1125019-1198724,1198726-1206097,1206099-1209609
 /cassandra/branches/cassandra-0.8.0/interface/thrift/gen-java/org/apache/cassandra/thrift/Cassandra.java:1125021-1130369
 /cassandra/branches/cassandra-0.8.1/interface/thrift/gen-java/org/apache/cassandra/thrift/Cassandra.java:1101014-1125018
-/cassandra/branches/cassandra-1.0/interface/thrift/gen-java/org/apache/cassandra/thrift/Cassandra.java:1167085-1207969,1208000,1209390,1209397,1209399
+/cassandra/branches/cassandra-1.0/interface/thrift/gen-java/org/apache/cassandra/thrift/Cassandra.java:1167085-1210745
 /cassandra/branches/cassandra-1.0.0/interface/thrift/gen-java/org/apache/cassandra/thrift/Cassandra.java:1167104-1167229,1167232-1181093,1181741,1181816,1181820,1182951,1183243
 /cassandra/tags/cassandra-0.7.0-rc3/interface/thrift/gen-java/org/apache/cassandra/thrift/Cassandra.java:1051699-1053689
 /cassandra/tags/cassandra-0.8.0-rc1/interface/thrift/gen-java/org/apache/cassandra/thrift/Cassandra.java:1102511-1125020

Propchange: cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/Column.java
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Dec  6 02:09:58 2011
@@ -1,10 +1,10 @@
 /cassandra/branches/cassandra-0.6/interface/thrift/gen-java/org/apache/cassandra/thrift/Column.java:922689-1052356,1052358-1053452,1053454,1053456-1131291
 /cassandra/branches/cassandra-0.7/interface/thrift/gen-java/org/apache/cassandra/thrift/Column.java:1026516-1183000
 /cassandra/branches/cassandra-0.7.0/interface/thrift/gen-java/org/apache/cassandra/thrift/Column.java:1053690-1055654
-/cassandra/branches/cassandra-0.8/interface/thrift/gen-java/org/apache/cassandra/thrift/Column.java:1090934-1125013,1125019-1198724,1198726-1205453,1206184,1206235,1206257,1207262
+/cassandra/branches/cassandra-0.8/interface/thrift/gen-java/org/apache/cassandra/thrift/Column.java:1090934-1125013,1125019-1198724,1198726-1206097,1206099-1209609
 /cassandra/branches/cassandra-0.8.0/interface/thrift/gen-java/org/apache/cassandra/thrift/Column.java:1125021-1130369
 /cassandra/branches/cassandra-0.8.1/interface/thrift/gen-java/org/apache/cassandra/thrift/Column.java:1101014-1125018
-/cassandra/branches/cassandra-1.0/interface/thrift/gen-java/org/apache/cassandra/thrift/Column.java:1167085-1207969,1208000,1209390,1209397,1209399
+/cassandra/branches/cassandra-1.0/interface/thrift/gen-java/org/apache/cassandra/thrift/Column.java:1167085-1210745
 /cassandra/branches/cassandra-1.0.0/interface/thrift/gen-java/org/apache/cassandra/thrift/Column.java:1167104-1167229,1167232-1181093,1181741,1181816,1181820,1182951,1183243
 /cassandra/tags/cassandra-0.7.0-rc3/interface/thrift/gen-java/org/apache/cassandra/thrift/Column.java:1051699-1053689
 /cassandra/tags/cassandra-0.8.0-rc1/interface/thrift/gen-java/org/apache/cassandra/thrift/Column.java:1102511-1125020

Propchange: cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/InvalidRequestException.java
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Dec  6 02:09:58 2011
@@ -1,10 +1,10 @@
 /cassandra/branches/cassandra-0.6/interface/thrift/gen-java/org/apache/cassandra/thrift/InvalidRequestException.java:922689-1052356,1052358-1053452,1053454,1053456-1131291
 /cassandra/branches/cassandra-0.7/interface/thrift/gen-java/org/apache/cassandra/thrift/InvalidRequestException.java:1026516-1183000
 /cassandra/branches/cassandra-0.7.0/interface/thrift/gen-java/org/apache/cassandra/thrift/InvalidRequestException.java:1053690-1055654
-/cassandra/branches/cassandra-0.8/interface/thrift/gen-java/org/apache/cassandra/thrift/InvalidRequestException.java:1090934-1125013,1125019-1198724,1198726-1205453,1206184,1206235,1206257,1207262
+/cassandra/branches/cassandra-0.8/interface/thrift/gen-java/org/apache/cassandra/thrift/InvalidRequestException.java:1090934-1125013,1125019-1198724,1198726-1206097,1206099-1209609
 /cassandra/branches/cassandra-0.8.0/interface/thrift/gen-java/org/apache/cassandra/thrift/InvalidRequestException.java:1125021-1130369
 /cassandra/branches/cassandra-0.8.1/interface/thrift/gen-java/org/apache/cassandra/thrift/InvalidRequestException.java:1101014-1125018
-/cassandra/branches/cassandra-1.0/interface/thrift/gen-java/org/apache/cassandra/thrift/InvalidRequestException.java:1167085-1207969,1208000,1209390,1209397,1209399
+/cassandra/branches/cassandra-1.0/interface/thrift/gen-java/org/apache/cassandra/thrift/InvalidRequestException.java:1167085-1210745
 /cassandra/branches/cassandra-1.0.0/interface/thrift/gen-java/org/apache/cassandra/thrift/InvalidRequestException.java:1167104-1167229,1167232-1181093,1181741,1181816,1181820,1182951,1183243
 /cassandra/tags/cassandra-0.7.0-rc3/interface/thrift/gen-java/org/apache/cassandra/thrift/InvalidRequestException.java:1051699-1053689
 /cassandra/tags/cassandra-0.8.0-rc1/interface/thrift/gen-java/org/apache/cassandra/thrift/InvalidRequestException.java:1102511-1125020

Propchange: cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/NotFoundException.java
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Dec  6 02:09:58 2011
@@ -1,10 +1,10 @@
 /cassandra/branches/cassandra-0.6/interface/thrift/gen-java/org/apache/cassandra/thrift/NotFoundException.java:922689-1052356,1052358-1053452,1053454,1053456-1131291
 /cassandra/branches/cassandra-0.7/interface/thrift/gen-java/org/apache/cassandra/thrift/NotFoundException.java:1026516-1183000
 /cassandra/branches/cassandra-0.7.0/interface/thrift/gen-java/org/apache/cassandra/thrift/NotFoundException.java:1053690-1055654
-/cassandra/branches/cassandra-0.8/interface/thrift/gen-java/org/apache/cassandra/thrift/NotFoundException.java:1090934-1125013,1125019-1198724,1198726-1205453,1206184,1206235,1206257,1207262
+/cassandra/branches/cassandra-0.8/interface/thrift/gen-java/org/apache/cassandra/thrift/NotFoundException.java:1090934-1125013,1125019-1198724,1198726-1206097,1206099-1209609
 /cassandra/branches/cassandra-0.8.0/interface/thrift/gen-java/org/apache/cassandra/thrift/NotFoundException.java:1125021-1130369
 /cassandra/branches/cassandra-0.8.1/interface/thrift/gen-java/org/apache/cassandra/thrift/NotFoundException.java:1101014-1125018
-/cassandra/branches/cassandra-1.0/interface/thrift/gen-java/org/apache/cassandra/thrift/NotFoundException.java:1167085-1207969,1208000,1209390,1209397,1209399
+/cassandra/branches/cassandra-1.0/interface/thrift/gen-java/org/apache/cassandra/thrift/NotFoundException.java:1167085-1210745
 /cassandra/branches/cassandra-1.0.0/interface/thrift/gen-java/org/apache/cassandra/thrift/NotFoundException.java:1167104-1167229,1167232-1181093,1181741,1181816,1181820,1182951,1183243
 /cassandra/tags/cassandra-0.7.0-rc3/interface/thrift/gen-java/org/apache/cassandra/thrift/NotFoundException.java:1051699-1053689
 /cassandra/tags/cassandra-0.8.0-rc1/interface/thrift/gen-java/org/apache/cassandra/thrift/NotFoundException.java:1102511-1125020

Propchange: cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/SuperColumn.java
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Dec  6 02:09:58 2011
@@ -1,10 +1,10 @@
 /cassandra/branches/cassandra-0.6/interface/thrift/gen-java/org/apache/cassandra/thrift/SuperColumn.java:922689-1052356,1052358-1053452,1053454,1053456-1131291
 /cassandra/branches/cassandra-0.7/interface/thrift/gen-java/org/apache/cassandra/thrift/SuperColumn.java:1026516-1183000
 /cassandra/branches/cassandra-0.7.0/interface/thrift/gen-java/org/apache/cassandra/thrift/SuperColumn.java:1053690-1055654
-/cassandra/branches/cassandra-0.8/interface/thrift/gen-java/org/apache/cassandra/thrift/SuperColumn.java:1090934-1125013,1125019-1198724,1198726-1205453,1206184,1206235,1206257,1207262
+/cassandra/branches/cassandra-0.8/interface/thrift/gen-java/org/apache/cassandra/thrift/SuperColumn.java:1090934-1125013,1125019-1198724,1198726-1206097,1206099-1209609
 /cassandra/branches/cassandra-0.8.0/interface/thrift/gen-java/org/apache/cassandra/thrift/SuperColumn.java:1125021-1130369
 /cassandra/branches/cassandra-0.8.1/interface/thrift/gen-java/org/apache/cassandra/thrift/SuperColumn.java:1101014-1125018
-/cassandra/branches/cassandra-1.0/interface/thrift/gen-java/org/apache/cassandra/thrift/SuperColumn.java:1167085-1207969,1208000,1209390,1209397,1209399
+/cassandra/branches/cassandra-1.0/interface/thrift/gen-java/org/apache/cassandra/thrift/SuperColumn.java:1167085-1210745
 /cassandra/branches/cassandra-1.0.0/interface/thrift/gen-java/org/apache/cassandra/thrift/SuperColumn.java:1167104-1167229,1167232-1181093,1181741,1181816,1181820,1182951,1183243
 /cassandra/tags/cassandra-0.7.0-rc3/interface/thrift/gen-java/org/apache/cassandra/thrift/SuperColumn.java:1051699-1053689
 /cassandra/tags/cassandra-0.8.0-rc1/interface/thrift/gen-java/org/apache/cassandra/thrift/SuperColumn.java:1102511-1125020

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=1210747&r1=1210746&r2=1210747&view=diff
==============================================================================
--- cassandra/trunk/src/java/org/apache/cassandra/cli/CliClient.java (original)
+++ cassandra/trunk/src/java/org/apache/cassandra/cli/CliClient.java Tue Dec  6 02:09:58 2011
@@ -2497,7 +2497,8 @@ public class CliClient
     private ByteBuffer columnValueAsBytes(ByteBuffer columnName, String columnFamilyName, String columnValue)
     {
         CfDef columnFamilyDef = getCfDef(columnFamilyName);
-        
+        AbstractType defaultValidator = getFormatType(columnFamilyDef.default_validation_class);
+
         for (ColumnDef columnDefinition : columnFamilyDef.getColumn_metadata())
         {
             byte[] currentColumnName = columnDefinition.getName();
@@ -2516,8 +2517,7 @@ public class CliClient
             }
         }
 
-        // if no validation were set returning simple .getBytes()
-        return ByteBufferUtil.bytes(columnValue);
+        return defaultValidator.fromString(columnValue);
     }
 
     /**

Modified: cassandra/trunk/src/java/org/apache/cassandra/cli/CliMain.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/src/java/org/apache/cassandra/cli/CliMain.java?rev=1210747&r1=1210746&r2=1210747&view=diff
==============================================================================
--- cassandra/trunk/src/java/org/apache/cassandra/cli/CliMain.java (original)
+++ cassandra/trunk/src/java/org/apache/cassandra/cli/CliMain.java Tue Dec  6 02:09:58 2011
@@ -223,7 +223,9 @@ public class CliMain
         {
             String errorTemplate = sessionState.inFileMode() ? "Line " + lineNumber + " => " : "";
 
-            String message = (e.getCause() == null) ? e.getMessage() : e.getCause().getMessage();
+            Throwable exception = (e.getCause() == null) ? e : e.getCause();
+            String message = (exception instanceof InvalidRequestException) ? ((InvalidRequestException) exception).getWhy() : e.getMessage();
+
             sessionState.err.println(errorTemplate + message);
 
             if (!(e instanceof RuntimeException))

Modified: cassandra/trunk/src/java/org/apache/cassandra/config/CFMetaData.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/src/java/org/apache/cassandra/config/CFMetaData.java?rev=1210747&r1=1210746&r2=1210747&view=diff
==============================================================================
--- cassandra/trunk/src/java/org/apache/cassandra/config/CFMetaData.java (original)
+++ cassandra/trunk/src/java/org/apache/cassandra/config/CFMetaData.java Tue Dec  6 02:09:58 2011
@@ -39,7 +39,6 @@ import org.apache.cassandra.io.compress.
 import org.apache.cassandra.thrift.InvalidRequestException;
 import org.apache.cassandra.cache.ConcurrentLinkedHashCacheProvider;
 import org.apache.cassandra.cache.SerializingCacheProvider;
-import org.apache.cassandra.utils.CLibrary;
 import org.apache.cassandra.utils.ByteBufferUtil;
 import org.apache.cassandra.utils.FBUtilities;
 
@@ -206,7 +205,7 @@ public final class CFMetaData
 
         try
         {
-            compactionStrategyClass = createCompactionSrategy(DEFAULT_COMPACTION_STRATEGY_CLASS);
+            compactionStrategyClass = createCompactionStrategy(DEFAULT_COMPACTION_STRATEGY_CLASS);
         }
         catch (ConfigurationException e)
         {
@@ -397,7 +396,7 @@ public final class CFMetaData
         {
             try
             {
-                newCFMD.compactionStrategyClass = createCompactionSrategy(cf.compaction_strategy.toString());
+                newCFMD.compactionStrategyClass = createCompactionStrategy(cf.compaction_strategy.toString());
             }
             catch (ConfigurationException e)
             {
@@ -664,7 +663,7 @@ public final class CFMetaData
         if (cf_def.isSetKey_alias()) { newCFMD.keyAlias(cf_def.key_alias); }
         if (cf_def.isSetKey_validation_class()) { newCFMD.keyValidator(TypeParser.parse(cf_def.key_validation_class)); }
         if (cf_def.isSetCompaction_strategy())
-            newCFMD.compactionStrategyClass = createCompactionSrategy(cf_def.compaction_strategy);
+            newCFMD.compactionStrategyClass = createCompactionStrategy(cf_def.compaction_strategy);
         if (cf_def.isSetCompaction_strategy_options())
             newCFMD.compactionStrategyOptions(new HashMap<String, String>(cf_def.compaction_strategy_options));
 
@@ -772,7 +771,7 @@ public final class CFMetaData
         }
 
         if (cf_def.compaction_strategy != null)
-            compactionStrategyClass = createCompactionSrategy(cf_def.compaction_strategy.toString());
+            compactionStrategyClass = createCompactionStrategy(cf_def.compaction_strategy.toString());
 
         if (null != cf_def.compaction_strategy_options)
         {
@@ -786,7 +785,7 @@ public final class CFMetaData
         logger.debug("application result is {}", this);
     }
 
-    public static Class<? extends AbstractCompactionStrategy> createCompactionSrategy(String className) throws ConfigurationException
+    public static Class<? extends AbstractCompactionStrategy> createCompactionStrategy(String className) throws ConfigurationException
     {
         className = className.contains(".") ? className : "org.apache.cassandra.db.compaction." + className;
         try

Modified: cassandra/trunk/src/java/org/apache/cassandra/cql/AbstractModification.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/src/java/org/apache/cassandra/cql/AbstractModification.java?rev=1210747&r1=1210746&r2=1210747&view=diff
==============================================================================
--- cassandra/trunk/src/java/org/apache/cassandra/cql/AbstractModification.java (original)
+++ cassandra/trunk/src/java/org/apache/cassandra/cql/AbstractModification.java Tue Dec  6 02:09:58 2011
@@ -31,19 +31,21 @@ public abstract class AbstractModificati
 {
     public static final ConsistencyLevel defaultConsistency = ConsistencyLevel.ONE;
 
+    protected final String keyspace;
     protected final String columnFamily;
     protected final ConsistencyLevel cLevel;
     protected final Long timestamp;
     protected final int timeToLive;
     protected final String keyName;
 
-    public AbstractModification(String columnFamily, String keyAlias, Attributes attrs)
+    public AbstractModification(String keyspace, String columnFamily, String keyAlias, Attributes attrs)
     {
-        this(columnFamily, keyAlias, attrs.getConsistencyLevel(), attrs.getTimestamp(), attrs.getTimeToLive());
+        this(keyspace, columnFamily, keyAlias, attrs.getConsistencyLevel(), attrs.getTimestamp(), attrs.getTimeToLive());
     }
 
-    public AbstractModification(String columnFamily, String keyAlias, ConsistencyLevel cLevel, Long timestamp, int timeToLive)
+    public AbstractModification(String keyspace, String columnFamily, String keyAlias, ConsistencyLevel cLevel, Long timestamp, int timeToLive)
     {
+        this.keyspace = keyspace;
         this.columnFamily = columnFamily;
         this.cLevel = cLevel;
         this.timestamp = timestamp;
@@ -51,6 +53,11 @@ public abstract class AbstractModificati
         this.keyName = keyAlias.toUpperCase();
     }
 
+    public String getKeyspace()
+    {
+        return keyspace;
+    }
+
     public String getColumnFamily()
     {
         return columnFamily;

Modified: cassandra/trunk/src/java/org/apache/cassandra/cql/Cql.g
URL: http://svn.apache.org/viewvc/cassandra/trunk/src/java/org/apache/cassandra/cql/Cql.g?rev=1210747&r1=1210746&r2=1210747&view=diff
==============================================================================
--- cassandra/trunk/src/java/org/apache/cassandra/cql/Cql.g (original)
+++ cassandra/trunk/src/java/org/apache/cassandra/cql/Cql.g Tue Dec  6 02:09:58 2011
@@ -33,6 +33,7 @@ options {
     import java.util.Collections;
     import java.util.List;
     import java.util.ArrayList;
+    import org.apache.cassandra.utils.Pair;
     import org.apache.cassandra.thrift.ConsistencyLevel;
     import org.apache.cassandra.thrift.InvalidRequestException;
 
@@ -115,7 +116,7 @@ query returns [CQLStatement stmnt]
     | updateStatement endStmnt { $stmnt = new CQLStatement(StatementType.UPDATE, $updateStatement.expr); }
     | batchStatement { $stmnt = new CQLStatement(StatementType.BATCH, $batchStatement.expr); }
     | useStatement      { $stmnt = new CQLStatement(StatementType.USE, $useStatement.keyspace); }
-    | truncateStatement { $stmnt = new CQLStatement(StatementType.TRUNCATE, $truncateStatement.cfam); }
+    | truncateStatement { $stmnt = new CQLStatement(StatementType.TRUNCATE, $truncateStatement.cf); }
     | deleteStatement endStmnt { $stmnt = new CQLStatement(StatementType.DELETE, $deleteStatement.expr); }
     | createKeyspaceStatement { $stmnt = new CQLStatement(StatementType.CREATE_KEYSPACE, $createKeyspaceStatement.expr); }
     | createColumnFamilyStatement { $stmnt = new CQLStatement(StatementType.CREATE_COLUMNFAMILY, $createColumnFamilyStatement.expr); }
@@ -220,13 +221,13 @@ insertStatement returns [UpdateStatement
           List<Term> columnNames  = new ArrayList<Term>();
           List<Term> columnValues = new ArrayList<Term>();
       }
-      K_INSERT K_INTO columnFamily=( IDENT | STRING_LITERAL | INTEGER )
+      K_INSERT K_INTO (keyspace=(IDENT | STRING_LITERAL | INTEGER) '.')? columnFamily=( IDENT | STRING_LITERAL | INTEGER )
           '(' key_alias=term ( ',' column_name=term  { columnNames.add($column_name.item); } )+ ')'
         K_VALUES
           '(' key=term ( ',' column_value=term { columnValues.add($column_value.item); })+ ')'
         ( usingClause[attrs] )?
       {
-          return new UpdateStatement($columnFamily.text, key_alias.getText(), columnNames, columnValues, Collections.singletonList(key), attrs);
+          return new UpdateStatement($keyspace.text, $columnFamily.text, key_alias.getText(), columnNames, columnValues, Collections.singletonList(key), attrs);
       }
     ;
 
@@ -312,14 +313,14 @@ updateStatement returns [UpdateStatement
           Map<Term, Operation> columns = new HashMap<Term, Operation>();
           List<Term> keyList = null;
       }
-      K_UPDATE columnFamily=( IDENT | STRING_LITERAL | INTEGER )
+      K_UPDATE (keyspace=(IDENT | STRING_LITERAL | INTEGER) '.')? columnFamily=( IDENT | STRING_LITERAL | INTEGER )
           ( usingClause[attrs] )?
           K_SET termPairWithOperation[columns] (',' termPairWithOperation[columns])*
           K_WHERE ( key_alias=term ('=' key=term { keyList = Collections.singletonList(key); }
                                     |
                                     K_IN '(' keys=termList { keyList = $keys.items; } ')' ))
       {
-          return new UpdateStatement($columnFamily.text, key_alias.getText(), columns, keyList, attrs);
+          return new UpdateStatement($keyspace.text, $columnFamily.text, key_alias.getText(), columns, keyList, attrs);
       }
     ;
 
@@ -341,13 +342,13 @@ deleteStatement returns [DeleteStatement
       }
       K_DELETE
           ( cols=termList { columnsList = $cols.items; })?
-          K_FROM columnFamily=( IDENT | STRING_LITERAL | INTEGER )
+          K_FROM (keyspace=(IDENT | STRING_LITERAL | INTEGER) '.')? columnFamily=( IDENT | STRING_LITERAL | INTEGER )
           ( usingClauseDelete[attrs] )?
           ( K_WHERE key_alias=term ('=' key=term           { keyList = Collections.singletonList(key); }
                                    | K_IN '(' keys=termList { keyList = $keys.items; } ')')
                   )?
       {
-          return new DeleteStatement(columnsList, $columnFamily.text, key_alias.getText(), keyList, attrs);
+          return new DeleteStatement(columnsList, $keyspace.text, $columnFamily.text, key_alias.getText(), keyList, attrs);
       }
     ;
 
@@ -482,8 +483,8 @@ relation returns [Relation rel]
     ;
 
 // TRUNCATE <CF>;
-truncateStatement returns [String cfam]
-    : K_TRUNCATE columnFamily=( IDENT | STRING_LITERAL | INTEGER ) { $cfam = $columnFamily.text; } endStmnt
+truncateStatement returns [Pair<String,String> cf]
+    : K_TRUNCATE (keyspace=( IDENT | STRING_LITERAL | INTEGER ) '.')? columnFamily=( IDENT | STRING_LITERAL | INTEGER ) { $cf = new Pair<String, String>($keyspace.text, $columnFamily.text); } endStmnt
     ;
 
 endStmnt

Modified: cassandra/trunk/src/java/org/apache/cassandra/cql/DeleteStatement.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/src/java/org/apache/cassandra/cql/DeleteStatement.java?rev=1210747&r1=1210746&r2=1210747&view=diff
==============================================================================
--- cassandra/trunk/src/java/org/apache/cassandra/cql/DeleteStatement.java (original)
+++ cassandra/trunk/src/java/org/apache/cassandra/cql/DeleteStatement.java Tue Dec  6 02:09:58 2011
@@ -46,9 +46,9 @@ public class DeleteStatement extends Abs
     private List<Term> columns;
     private List<Term> keys;
     
-    public DeleteStatement(List<Term> columns, String columnFamily, String keyName, List<Term> keys, Attributes attrs)
+    public DeleteStatement(List<Term> columns, String keyspace, String columnFamily, String keyName, List<Term> keys, Attributes attrs)
     {
-        super(columnFamily, keyName, attrs);
+        super(keyspace, columnFamily, keyName, attrs);
 
         this.columns = columns;
         this.keys = keys;
@@ -118,8 +118,9 @@ public class DeleteStatement extends Abs
 
     public String toString()
     {
-        return String.format("DeleteStatement(columns=%s, columnFamily=%s, consistency=%s keys=%s)",
+        return String.format("DeleteStatement(columns=%s, keyspace=%s, columnFamily=%s, consistency=%s keys=%s)",
                              columns,
+                             keyspace,
                              columnFamily,
                              cLevel,
                              keys);

Modified: cassandra/trunk/src/java/org/apache/cassandra/cql/QueryProcessor.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/src/java/org/apache/cassandra/cql/QueryProcessor.java?rev=1210747&r1=1210746&r2=1210747&view=diff
==============================================================================
--- cassandra/trunk/src/java/org/apache/cassandra/cql/QueryProcessor.java (original)
+++ cassandra/trunk/src/java/org/apache/cassandra/cql/QueryProcessor.java Tue Dec  6 02:09:58 2011
@@ -52,6 +52,7 @@ import org.apache.cassandra.thrift.*;
 import org.apache.cassandra.thrift.Column;
 import org.apache.cassandra.utils.ByteBufferUtil;
 import org.apache.cassandra.utils.FBUtilities;
+import org.apache.cassandra.utils.Pair;
 
 import com.google.common.base.Predicates;
 import com.google.common.collect.Maps;
@@ -264,16 +265,18 @@ public class QueryProcessor
     private static void batchUpdate(ClientState clientState, List<UpdateStatement> updateStatements, ConsistencyLevel consistency)
     throws InvalidRequestException, UnavailableException, TimedOutException
     {
-        String keyspace = clientState.getKeyspace();
+        String globalKeyspace = clientState.getKeyspace();
         List<IMutation> rowMutations = new ArrayList<IMutation>();
         List<String> cfamsSeen = new ArrayList<String>();
 
         for (UpdateStatement update : updateStatements)
         {
+            String keyspace = update.keyspace == null ? globalKeyspace : update.keyspace;
+
             // Avoid unnecessary authorizations.
             if (!(cfamsSeen.contains(update.getColumnFamily())))
             {
-                clientState.hasColumnFamilyAccess(update.getColumnFamily(), Permission.WRITE);
+                clientState.hasColumnFamilyAccess(keyspace, update.getColumnFamily(), Permission.WRITE);
                 cfamsSeen.add(update.getColumnFamily());
             }
 
@@ -708,13 +711,15 @@ public class QueryProcessor
                 return result;
             
             case TRUNCATE:
-                String columnFamily = (String)statement.statement;
-                validateColumnFamily(keyspace, columnFamily);
-                clientState.hasColumnFamilyAccess(columnFamily, Permission.WRITE);
+                Pair<String, String> columnFamily = (Pair<String, String>)statement.statement;
+                keyspace = columnFamily.left == null ? clientState.getKeyspace() : columnFamily.left;
+
+                validateColumnFamily(keyspace, columnFamily.right);
+                clientState.hasColumnFamilyAccess(keyspace, columnFamily.right, Permission.WRITE);
                 
                 try
                 {
-                    StorageProxy.truncateBlocking(keyspace, columnFamily);
+                    StorageProxy.truncateBlocking(keyspace, columnFamily.right);
                 }
                 catch (TimeoutException e)
                 {
@@ -730,6 +735,9 @@ public class QueryProcessor
             
             case DELETE:
                 DeleteStatement delete = (DeleteStatement)statement.statement;
+
+                keyspace = delete.keyspace == null ? clientState.getKeyspace() : delete.keyspace;
+
                 try
                 {
                     StorageProxy.mutate(delete.prepareRowMutations(keyspace, clientState), delete.getConsistencyLevel());
@@ -778,10 +786,12 @@ public class QueryProcessor
                 CreateColumnFamilyStatement createCf = (CreateColumnFamilyStatement)statement.statement;
                 clientState.hasColumnFamilySchemaAccess(Permission.WRITE);
                 validateSchemaAgreement();
-                
+                CFMetaData cfmd = createCf.getCFMetaData(keyspace);
+                ThriftValidation.validateCfDef(cfmd.toThrift(), null);
+
                 try
                 {
-                    applyMigrationOnStage(new AddColumnFamily(createCf.getCFMetaData(keyspace)));
+                    applyMigrationOnStage(new AddColumnFamily(cfmd));
                 }
                 catch (ConfigurationException e)
                 {

Modified: cassandra/trunk/src/java/org/apache/cassandra/cql/UpdateStatement.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/src/java/org/apache/cassandra/cql/UpdateStatement.java?rev=1210747&r1=1210746&r2=1210747&view=diff
==============================================================================
--- cassandra/trunk/src/java/org/apache/cassandra/cql/UpdateStatement.java (original)
+++ cassandra/trunk/src/java/org/apache/cassandra/cql/UpdateStatement.java Tue Dec  6 02:09:58 2011
@@ -37,7 +37,6 @@ import org.apache.cassandra.thrift.Inval
 
 import static org.apache.cassandra.cql.QueryProcessor.validateColumn;
 
-import static org.apache.cassandra.cql.Operation.OperationType;
 import static org.apache.cassandra.thrift.ThriftValidation.validateColumnFamily;
 import static org.apache.cassandra.thrift.ThriftValidation.validateCommutativeForWrite;
 
@@ -54,20 +53,22 @@ public class UpdateStatement extends Abs
     /**
      * Creates a new UpdateStatement from a column family name, columns map, consistency
      * level, and key term.
-     * 
+     *
+     * @param keyspace Keyspace (optional)
      * @param columnFamily column family name
      * @param keyName alias key name
      * @param columns a map of column name/values pairs
      * @param keys the keys to update
      * @param attrs additional attributes for statement (CL, timestamp, timeToLive)
      */
-    public UpdateStatement(String columnFamily,
+    public UpdateStatement(String keyspace,
+                           String columnFamily,
                            String keyName,
                            Map<Term, Operation> columns,
                            List<Term> keys,
                            Attributes attrs)
     {
-        super(columnFamily, keyName, attrs);
+        super(keyspace, columnFamily, keyName, attrs);
 
         this.columns = columns;
         this.keys = keys;
@@ -77,7 +78,8 @@ public class UpdateStatement extends Abs
      * Creates a new UpdateStatement from a column family name, a consistency level,
      * key, and lists of column names and values.  It is intended for use with the
      * alternate update format, <code>INSERT</code>.
-     * 
+     *
+     * @param keyspace Keyspace (optional)
      * @param columnFamily column family name
      * @param keyName alias key name
      * @param columnNames list of column names
@@ -85,14 +87,15 @@ public class UpdateStatement extends Abs
      * @param keys the keys to update
      * @param attrs additional attributes for statement (CL, timestamp, timeToLive)
      */
-    public UpdateStatement(String columnFamily,
+    public UpdateStatement(String keyspace,
+                           String columnFamily,
                            String keyName,
                            List<Term> columnNames,
                            List<Term> columnValues,
                            List<Term> keys,
                            Attributes attrs)
     {
-        super(columnFamily, keyName, attrs);
+        super(keyspace, columnFamily, keyName, attrs);
 
         this.columnNames = columnNames;
         this.columnValues = columnValues;
@@ -266,7 +269,8 @@ public class UpdateStatement extends Abs
     
     public String toString()
     {
-        return String.format("UpdateStatement(columnFamily=%s, keys=%s, columns=%s, consistency=%s, timestamp=%s, timeToLive=%s)",
+        return String.format("UpdateStatement(keyspace=%s, columnFamily=%s, keys=%s, columns=%s, consistency=%s, timestamp=%s, timeToLive=%s)",
+                             keyspace,
                              columnFamily,
                              keys,
                              columns,

Modified: cassandra/trunk/src/java/org/apache/cassandra/db/ColumnFamilyStore.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/src/java/org/apache/cassandra/db/ColumnFamilyStore.java?rev=1210747&r1=1210746&r2=1210747&view=diff
==============================================================================
--- cassandra/trunk/src/java/org/apache/cassandra/db/ColumnFamilyStore.java (original)
+++ cassandra/trunk/src/java/org/apache/cassandra/db/ColumnFamilyStore.java Tue Dec  6 02:09:58 2011
@@ -226,7 +226,7 @@ public class ColumnFamilyStore implement
         data = new DataTracker(this);
         Set<DecoratedKey> savedKeys = keyCache.readSaved();
         Set<Map.Entry<Descriptor, Set<Component>>> entries = files(table.name, columnFamilyName, false, false).entrySet();
-        data.addSSTables(SSTableReader.batchOpen(entries, savedKeys, data, metadata, this.partitioner));
+        data.addInitialSSTables(SSTableReader.batchOpen(entries, savedKeys, data, metadata, this.partitioner));
 
         // compaction strategy should be created after the CFS has been prepared
         this.compactionStrategy = metadata.createCompactionStrategyInstance(this);
@@ -906,7 +906,7 @@ public class ColumnFamilyStore implement
     public void addSSTable(SSTableReader sstable)
     {
         assert sstable.getColumnFamilyName().equals(columnFamily);
-        data.addStreamedSSTable(sstable);
+        data.addSSTables(Arrays.asList(sstable));
         CompactionManager.instance.submitBackground(this);
     }
 
@@ -961,6 +961,7 @@ public class ColumnFamilyStore implement
 
     public void markCompacted(Collection<SSTableReader> sstables)
     {
+        assert !sstables.isEmpty();
         data.markCompacted(sstables);
     }
 

Modified: cassandra/trunk/src/java/org/apache/cassandra/db/DataTracker.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/src/java/org/apache/cassandra/db/DataTracker.java?rev=1210747&r1=1210746&r2=1210747&view=diff
==============================================================================
--- cassandra/trunk/src/java/org/apache/cassandra/db/DataTracker.java (original)
+++ cassandra/trunk/src/java/org/apache/cassandra/db/DataTracker.java Tue Dec  6 02:09:58 2011
@@ -251,23 +251,29 @@ public class DataTracker
     public void markCompacted(Collection<SSTableReader> sstables)
     {
         replace(sstables, Collections.<SSTableReader>emptyList());
+        notifySSTablesChanged(sstables, Collections.<SSTableReader>emptyList());
     }
 
     public void replaceCompactedSSTables(Collection<SSTableReader> sstables, Iterable<SSTableReader> replacements)
     {
         replace(sstables, replacements);
+        notifySSTablesChanged(sstables, replacements);
     }
 
-    public void addSSTables(Collection<SSTableReader> sstables)
+    public void addInitialSSTables(Collection<SSTableReader> sstables)
     {
         replace(Collections.<SSTableReader>emptyList(), sstables);
+        // no notifications or backup necessary
     }
 
-    public void addStreamedSSTable(SSTableReader sstable)
+    public void addSSTables(Collection<SSTableReader> sstables)
     {
-        addSSTables(Arrays.asList(sstable));
-        incrementallyBackup(sstable);
-        notifyAdded(sstable);
+        replace(Collections.<SSTableReader>emptyList(), sstables);
+        for (SSTableReader sstable : sstables)
+        {
+            incrementallyBackup(sstable);
+            notifyAdded(sstable);
+        }
     }
 
     /**
@@ -286,6 +292,7 @@ public class DataTracker
         }
         while (!view.compareAndSet(currentView, newView));
 
+        notifySSTablesChanged(notCompacting, Collections.<SSTableReader>emptySet());
         postReplace(notCompacting, Collections.<SSTableReader>emptySet());
     }
 
@@ -323,7 +330,6 @@ public class DataTracker
         addNewSSTablesSize(replacements);
         removeOldSSTablesSize(oldSSTables);
 
-        notifySSTablesChanged(replacements, oldSSTables);
         cfstore.updateCacheSizes();
     }
 
@@ -525,7 +531,7 @@ public class DataTracker
         return (double) falseCount / (trueCount + falseCount);
     }
 
-    public void notifySSTablesChanged(Iterable<SSTableReader> added, Iterable<SSTableReader> removed)
+    public void notifySSTablesChanged(Iterable<SSTableReader> removed, Iterable<SSTableReader> added)
     {
         for (INotificationConsumer subscriber : subscribers)
         {

Modified: cassandra/trunk/src/java/org/apache/cassandra/db/Memtable.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/src/java/org/apache/cassandra/db/Memtable.java?rev=1210747&r1=1210746&r2=1210747&view=diff
==============================================================================
--- cassandra/trunk/src/java/org/apache/cassandra/db/Memtable.java (original)
+++ cassandra/trunk/src/java/org/apache/cassandra/db/Memtable.java Tue Dec  6 02:09:58 2011
@@ -40,6 +40,7 @@ import org.apache.cassandra.db.filter.Sl
 import org.apache.cassandra.db.marshal.AbstractType;
 import org.apache.cassandra.io.sstable.SSTableReader;
 import org.apache.cassandra.io.sstable.SSTableWriter;
+import org.apache.cassandra.utils.FBUtilities;
 import org.apache.cassandra.utils.SlabAllocator;
 import org.apache.cassandra.utils.WrappedRunnable;
 import org.github.jamm.MemoryMeter;
@@ -275,9 +276,10 @@ public class Memtable
 
             ssTable = writer.closeAndOpenReader();
         }
-        finally
+        catch (Exception e)
         {
-            writer.cleanupIfNecessary();
+            writer.abort();
+            throw FBUtilities.unchecked(e);
         }
         logger.info(String.format("Completed flushing %s (%d bytes)",
                                   ssTable.getFilename(), new File(ssTable.getFilename()).length()));

Modified: cassandra/trunk/src/java/org/apache/cassandra/db/compaction/CompactionManager.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/src/java/org/apache/cassandra/db/compaction/CompactionManager.java?rev=1210747&r1=1210746&r2=1210747&view=diff
==============================================================================
--- cassandra/trunk/src/java/org/apache/cassandra/db/compaction/CompactionManager.java (original)
+++ cassandra/trunk/src/java/org/apache/cassandra/db/compaction/CompactionManager.java Tue Dec  6 02:09:58 2011
@@ -608,10 +608,14 @@ public class CompactionManager implement
             if (writer.getFilePointer() > 0)
                 newSstable = writer.closeAndOpenReader(sstable.maxDataAge);
         }
-        finally
+        catch (Exception e)
         {
             if (writer != null)
-                writer.cleanupIfNecessary();
+                writer.abort();
+            throw FBUtilities.unchecked(e);
+        }
+        finally
+        {
             FileUtils.closeQuietly(dataFile);
             FileUtils.closeQuietly(indexFile);
 
@@ -735,12 +739,16 @@ public class CompactionManager implement
                 if (writer != null)
                     newSstable = writer.closeAndOpenReader(sstable.maxDataAge);
             }
+            catch (Exception e)
+            {
+                if (writer != null)
+                    writer.abort();
+                throw FBUtilities.unchecked(e);
+            }
             finally
             {
                 scanner.close();
                 executor.finishCompaction(ci);
-                if (writer != null)
-                    writer.cleanupIfNecessary();
                 executor.finishCompaction(ci);
             }
 
@@ -921,7 +929,8 @@ public class CompactionManager implement
                             if (!sstable.newSince(truncatedAt))
                                 truncatedSSTables.add(sstable);
                         }
-                        cfs.markCompacted(truncatedSSTables);
+                        if (!truncatedSSTables.isEmpty())
+                            cfs.markCompacted(truncatedSSTables);
                     }
                 }
                 finally

Modified: cassandra/trunk/src/java/org/apache/cassandra/db/compaction/CompactionTask.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/src/java/org/apache/cassandra/db/compaction/CompactionTask.java?rev=1210747&r1=1210746&r2=1210747&view=diff
==============================================================================
--- cassandra/trunk/src/java/org/apache/cassandra/db/compaction/CompactionTask.java (original)
+++ cassandra/trunk/src/java/org/apache/cassandra/db/compaction/CompactionTask.java Tue Dec  6 02:09:58 2011
@@ -36,6 +36,7 @@ import org.apache.cassandra.io.sstable.S
 import org.apache.cassandra.io.sstable.SSTableReader;
 import org.apache.cassandra.io.sstable.SSTableWriter;
 import org.apache.cassandra.utils.CloseableIterator;
+import org.apache.cassandra.utils.FBUtilities;
 
 public class CompactionTask extends AbstractCompactionTask
 {
@@ -183,13 +184,17 @@ public class CompactionTask extends Abst
                 }
             }
         }
+        catch (Exception e)
+        {
+            for (SSTableWriter writer : writers)
+                writer.abort();
+            throw FBUtilities.unchecked(e);
+        }
         finally
         {
             iter.close();
             if (collector != null)
                 collector.finishCompaction(ci);
-            for (SSTableWriter writer : writers)
-                writer.cleanupIfNecessary();
         }
 
         cfs.replaceCompactedSSTables(toCompact, sstables);

Modified: cassandra/trunk/src/java/org/apache/cassandra/db/compaction/LeveledManifest.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/src/java/org/apache/cassandra/db/compaction/LeveledManifest.java?rev=1210747&r1=1210746&r2=1210747&view=diff
==============================================================================
--- cassandra/trunk/src/java/org/apache/cassandra/db/compaction/LeveledManifest.java (original)
+++ cassandra/trunk/src/java/org/apache/cassandra/db/compaction/LeveledManifest.java Tue Dec  6 02:09:58 2011
@@ -154,9 +154,10 @@ public class LeveledManifest
 
     public synchronized void promote(Iterable<SSTableReader> removed, Iterable<SSTableReader> added)
     {
+        assert !Iterables.isEmpty(removed); // use add() instead of promote when adding new sstables
         logDistribution();
         if (logger.isDebugEnabled())
-            logger.debug((Iterables.isEmpty(added) ? "Removing [" : "Replacing [") + toString(removed) + "]");
+            logger.debug("Replacing [" + toString(removed) + "]");
 
         // the level for the added sstables is the max of the removed ones,
         // plus one if the removed were all on the same level

Modified: cassandra/trunk/src/java/org/apache/cassandra/hadoop/ColumnFamilyInputFormat.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/src/java/org/apache/cassandra/hadoop/ColumnFamilyInputFormat.java?rev=1210747&r1=1210746&r2=1210747&view=diff
==============================================================================
--- cassandra/trunk/src/java/org/apache/cassandra/hadoop/ColumnFamilyInputFormat.java (original)
+++ cassandra/trunk/src/java/org/apache/cassandra/hadoop/ColumnFamilyInputFormat.java Tue Dec  6 02:09:58 2011
@@ -45,11 +45,14 @@ import org.apache.cassandra.thrift.KeyRa
 import org.apache.cassandra.thrift.TokenRange;
 import org.apache.commons.lang.StringUtils;
 import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.mapred.*;
+import org.apache.hadoop.mapreduce.*;
 import org.apache.hadoop.mapreduce.InputFormat;
 import org.apache.hadoop.mapreduce.InputSplit;
 import org.apache.hadoop.mapreduce.JobContext;
 import org.apache.hadoop.mapreduce.RecordReader;
 import org.apache.hadoop.mapreduce.TaskAttemptContext;
+import org.apache.hadoop.mapreduce.TaskAttemptID;
 import org.apache.thrift.TException;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -72,9 +75,18 @@ import org.slf4j.LoggerFactory;
  * The default split size is 64k rows.
  */
 public class ColumnFamilyInputFormat extends InputFormat<ByteBuffer, SortedMap<ByteBuffer, IColumn>>
+    implements org.apache.hadoop.mapred.InputFormat<ByteBuffer, SortedMap<ByteBuffer, IColumn>>
 {
     private static final Logger logger = LoggerFactory.getLogger(ColumnFamilyInputFormat.class);
 
+    public static final String MAPRED_TASK_ID = "mapred.task.id";
+    // The simple fact that we need this is because the old Hadoop API wants us to "write"
+    // to the key and value whereas the new asks for it.
+    // I choose 8kb as the default max key size (instanciated only once), but you can
+    // override it in your jobConf with this setting.
+    public static final String CASSANDRA_HADOOP_MAX_KEY_SIZE = "cassandra.hadoop.max_key_size";
+    public static final int    CASSANDRA_HADOOP_MAX_KEY_SIZE_DEFAULT = 8192;
+
     private String keyspace;
     private String cfName;
 
@@ -263,10 +275,39 @@ public class ColumnFamilyInputFormat ext
         return map;
     }
 
-
-
     public RecordReader<ByteBuffer, SortedMap<ByteBuffer, IColumn>> createRecordReader(InputSplit inputSplit, TaskAttemptContext taskAttemptContext) throws IOException, InterruptedException
     {
         return new ColumnFamilyRecordReader();
     }
+
+
+    //
+    // Old Hadoop API
+    //
+    public org.apache.hadoop.mapred.InputSplit[] getSplits(JobConf jobConf, int numSplits) throws IOException
+    {
+        TaskAttemptContext tac = new TaskAttemptContext(jobConf, new TaskAttemptID());
+        List<org.apache.hadoop.mapreduce.InputSplit> newInputSplits = this.getSplits(tac);
+        org.apache.hadoop.mapred.InputSplit[] oldInputSplits = new org.apache.hadoop.mapred.InputSplit[newInputSplits.size()];
+        for (int i = 0; i < newInputSplits.size(); i++)
+            oldInputSplits[i] = (ColumnFamilySplit)newInputSplits.get(i);
+        return oldInputSplits;
+    }
+
+    public org.apache.hadoop.mapred.RecordReader<ByteBuffer, SortedMap<ByteBuffer, IColumn>> getRecordReader(org.apache.hadoop.mapred.InputSplit split, JobConf jobConf, final Reporter reporter) throws IOException
+    {
+        TaskAttemptContext tac = new TaskAttemptContext(jobConf, TaskAttemptID.forName(jobConf.get(MAPRED_TASK_ID)))
+        {
+            @Override
+            public void progress()
+            {
+                reporter.progress();
+            }
+        };
+
+        ColumnFamilyRecordReader recordReader = new ColumnFamilyRecordReader(jobConf.getInt(CASSANDRA_HADOOP_MAX_KEY_SIZE, CASSANDRA_HADOOP_MAX_KEY_SIZE_DEFAULT));
+        recordReader.initialize((org.apache.hadoop.mapreduce.InputSplit)split, tac);
+        return recordReader;
+    }
+
 }

Modified: cassandra/trunk/src/java/org/apache/cassandra/hadoop/ColumnFamilyRecordReader.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/src/java/org/apache/cassandra/hadoop/ColumnFamilyRecordReader.java?rev=1210747&r1=1210746&r2=1210747&view=diff
==============================================================================
--- cassandra/trunk/src/java/org/apache/cassandra/hadoop/ColumnFamilyRecordReader.java (original)
+++ cassandra/trunk/src/java/org/apache/cassandra/hadoop/ColumnFamilyRecordReader.java Tue Dec  6 02:09:58 2011
@@ -51,7 +51,10 @@ import org.apache.thrift.transport.TFram
 import org.apache.thrift.transport.TSocket;
 
 public class ColumnFamilyRecordReader extends RecordReader<ByteBuffer, SortedMap<ByteBuffer, IColumn>>
+    implements org.apache.hadoop.mapred.RecordReader<ByteBuffer, SortedMap<ByteBuffer, IColumn>>
 {
+    public static final int CASSANDRA_HADOOP_MAX_KEY_SIZE_DEFAULT = 8192;
+
     private ColumnFamilySplit split;
     private RowIterator iter;
     private Pair<ByteBuffer, SortedMap<ByteBuffer, IColumn>> currentRow;
@@ -64,6 +67,18 @@ public class ColumnFamilyRecordReader ex
     private TSocket socket;
     private Cassandra.Client client;
     private ConsistencyLevel consistencyLevel;
+    private int keyBufferSize = 8192;
+
+    public ColumnFamilyRecordReader()
+    {
+        this(ColumnFamilyRecordReader.CASSANDRA_HADOOP_MAX_KEY_SIZE_DEFAULT);
+    }
+
+    public ColumnFamilyRecordReader(int keyBufferSize)
+    {
+        super();
+        this.keyBufferSize = keyBufferSize;
+    }
 
     public void close() 
     {
@@ -387,4 +402,41 @@ public class ColumnFamilyRecordReader ex
             return sc;
         }
     }
+
+
+    // Because the old Hadoop API wants us to write to the key and value
+    // and the new asks for them, we need to copy the output of the new API
+    // to the old. Thus, expect a small performance hit.
+    // And obviously this wouldn't work for wide rows. But since ColumnFamilyInputFormat
+    // and ColumnFamilyRecordReader don't support them, it should be fine for now.
+    public boolean next(ByteBuffer key, SortedMap<ByteBuffer, IColumn> value) throws IOException
+    {
+        if (this.nextKeyValue())
+        {
+            key.clear();
+            key.put(this.getCurrentKey());
+            key.rewind();
+
+            value.clear();
+            value.putAll(this.getCurrentValue());
+
+            return true;
+        }
+        return false;
+    }
+
+    public ByteBuffer createKey()
+    {
+        return ByteBuffer.wrap(new byte[this.keyBufferSize]);
+    }
+
+    public SortedMap<ByteBuffer, IColumn> createValue()
+    {
+        return new TreeMap<ByteBuffer, IColumn>();
+    }
+
+    public long getPos() throws IOException
+    {
+        return (long)iter.rowsRead();
+    }
 }

Modified: cassandra/trunk/src/java/org/apache/cassandra/hadoop/ColumnFamilySplit.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/src/java/org/apache/cassandra/hadoop/ColumnFamilySplit.java?rev=1210747&r1=1210746&r2=1210747&view=diff
==============================================================================
--- cassandra/trunk/src/java/org/apache/cassandra/hadoop/ColumnFamilySplit.java (original)
+++ cassandra/trunk/src/java/org/apache/cassandra/hadoop/ColumnFamilySplit.java Tue Dec  6 02:09:58 2011
@@ -21,15 +21,15 @@ package org.apache.cassandra.hadoop;
  */
 
 
+import org.apache.hadoop.io.Writable;
+import org.apache.hadoop.mapreduce.InputSplit;
+
 import java.io.DataInput;
 import java.io.DataOutput;
 import java.io.IOException;
 import java.util.Arrays;
 
-import org.apache.hadoop.io.Writable;
-import org.apache.hadoop.mapreduce.InputSplit;
-
-public class ColumnFamilySplit extends InputSplit implements Writable
+public class ColumnFamilySplit extends InputSplit implements Writable, org.apache.hadoop.mapred.InputSplit
 {
     private String startToken;
     private String endToken;

Modified: cassandra/trunk/src/java/org/apache/cassandra/io/compress/CompressionParameters.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/src/java/org/apache/cassandra/io/compress/CompressionParameters.java?rev=1210747&r1=1210746&r2=1210747&view=diff
==============================================================================
--- cassandra/trunk/src/java/org/apache/cassandra/io/compress/CompressionParameters.java (original)
+++ cassandra/trunk/src/java/org/apache/cassandra/io/compress/CompressionParameters.java Tue Dec  6 02:09:58 2011
@@ -116,7 +116,11 @@ public class CompressionParameters
         }
         catch (InvocationTargetException e)
         {
-            throw new ConfigurationException(compressorClass.getSimpleName() + ".create() throwed an error", e);
+            Throwable cause = e.getCause();
+            throw new ConfigurationException(String.format("%s.create() threw an error: %s",
+                                             compressorClass.getSimpleName(),
+                                             cause == null ? e.getClass().getName() + " " + e.getMessage() : cause.getClass().getName() + " " + cause.getMessage()),
+                                             e);
         }
         catch (ExceptionInInitializerError e)
         {

Modified: cassandra/trunk/src/java/org/apache/cassandra/io/compress/SnappyCompressor.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/src/java/org/apache/cassandra/io/compress/SnappyCompressor.java?rev=1210747&r1=1210746&r2=1210747&view=diff
==============================================================================
--- cassandra/trunk/src/java/org/apache/cassandra/io/compress/SnappyCompressor.java (original)
+++ cassandra/trunk/src/java/org/apache/cassandra/io/compress/SnappyCompressor.java Tue Dec  6 02:09:58 2011
@@ -19,7 +19,6 @@
 package org.apache.cassandra.io.compress;
 
 import java.io.IOException;
-import java.util.HashMap;
 import java.util.Map;
 
 import org.xerial.snappy.Snappy;
@@ -30,6 +29,10 @@ public class SnappyCompressor implements
 
     public static SnappyCompressor create(Map<String, String> compressionOptions)
     {
+        // this would throw java.lang.NoClassDefFoundError if Snappy class
+        // wasn't found at runtime which should be processed by calling method
+        Snappy.getNativeLibraryVersion();
+
         // no specific options supported so far
         return instance;
     }

Modified: cassandra/trunk/src/java/org/apache/cassandra/io/sstable/Component.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/src/java/org/apache/cassandra/io/sstable/Component.java?rev=1210747&r1=1210746&r2=1210747&view=diff
==============================================================================
--- cassandra/trunk/src/java/org/apache/cassandra/io/sstable/Component.java (original)
+++ cassandra/trunk/src/java/org/apache/cassandra/io/sstable/Component.java Tue Dec  6 02:09:58 2011
@@ -53,8 +53,6 @@ public class Component
         COMPRESSION_INFO("CompressionInfo.db"),
         // statistical metadata about the content of the sstable
         STATS("Statistics.db"),
-        // a bitmap secondary index: many of these may exist per sstable
-        BITMAP_INDEX("Bitidx.db"),
         // holds sha1 sum of the data file (to be checked by sha1sum)
         DIGEST("Digest.sha1");
 
@@ -103,25 +101,11 @@ public class Component
      */
     public String name()
     {
-        switch(type)
-        {
-            case DATA:
-            case PRIMARY_INDEX:
-            case FILTER:
-            case COMPACTED_MARKER:
-            case COMPRESSION_INFO:
-            case STATS:
-            case DIGEST:
-                return type.repr;
-            case BITMAP_INDEX:
-                return String.format("%d%c%s", id, separator, type.repr);
-        }
-        throw new IllegalStateException();
+        return type.repr;
     }
 
     /**
      * Filename of the form "<ksname>/<cfname>-[tmp-][<version>-]<gen>-<component>",
-     * where <component> is of the form "[<id>-]<component>".
      * @return A Descriptor for the SSTable, and a Component for this particular file.
      * TODO move descriptor into Component field
      */
@@ -130,15 +114,7 @@ public class Component
         Pair<Descriptor,String> path = Descriptor.fromFilename(directory, name);
 
         // parse the component suffix
-        String repr = path.right;
-        int id = -1;
-        int separatorPos = repr.indexOf(separator);
-        if (separatorPos != -1)
-        {
-            id = Integer.parseInt(repr.substring(0, separatorPos));
-            repr = repr.substring(separatorPos+1, repr.length());
-        }
-        Type type = Type.fromRepresentation(repr);
+        Type type = Type.fromRepresentation(path.right);
         // build (or retrieve singleton for) the component object
         Component component;
         switch(type)
@@ -150,9 +126,6 @@ public class Component
             case COMPRESSION_INFO:  component = Component.COMPRESSION_INFO; break;
             case STATS:             component = Component.STATS;            break;
             case DIGEST:            component = Component.DIGEST;           break;
-            case BITMAP_INDEX:
-                 component = new Component(type, id);
-                 break;
             default:
                  throw new IllegalStateException();
         }

Modified: cassandra/trunk/src/java/org/apache/cassandra/io/sstable/Descriptor.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/src/java/org/apache/cassandra/io/sstable/Descriptor.java?rev=1210747&r1=1210746&r2=1210747&view=diff
==============================================================================
--- cassandra/trunk/src/java/org/apache/cassandra/io/sstable/Descriptor.java (original)
+++ cassandra/trunk/src/java/org/apache/cassandra/io/sstable/Descriptor.java Tue Dec  6 02:09:58 2011
@@ -79,21 +79,6 @@ public class Descriptor
     public final boolean hasCompressionRatio;
     public final boolean hasPartitioner;
 
-    public enum TempState
-    {
-        LIVE,
-        TEMP,
-        ANY;
-
-        boolean isMatch(Descriptor descriptor)
-        {
-            assert descriptor != null;
-            if (TempState.ANY == this)
-                return true;
-            return (TempState.TEMP == this) ? descriptor.temporary : !descriptor.temporary;
-        }
-    }
-
     /**
      * A descriptor that assumes CURRENT_VERSION.
      */

Modified: cassandra/trunk/src/java/org/apache/cassandra/io/sstable/SSTable.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/src/java/org/apache/cassandra/io/sstable/SSTable.java?rev=1210747&r1=1210746&r2=1210747&view=diff
==============================================================================
--- cassandra/trunk/src/java/org/apache/cassandra/io/sstable/SSTable.java (original)
+++ cassandra/trunk/src/java/org/apache/cassandra/io/sstable/SSTable.java Tue Dec  6 02:09:58 2011
@@ -25,6 +25,8 @@ import java.io.IOException;
 import java.util.*;
 
 import com.google.common.collect.Ordering;
+import com.google.common.collect.Sets;
+
 import org.apache.cassandra.db.DecoratedKey;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -192,26 +194,15 @@ public abstract class SSTable
     /**
      * Discovers existing components for the descriptor. Slow: only intended for use outside the critical path.
      */
-    static Set<Component> componentsFor(final Descriptor desc, final Descriptor.TempState matchState)
+    static Set<Component> componentsFor(final Descriptor desc)
     {
-        final Set<Component> components = new HashSet<Component>();
-        final String sstableFilePrefix = desc.cfname + Component.separator;
-
-        desc.directory.listFiles(new FileFilter()
+        Set<Component> components = Sets.newHashSetWithExpectedSize(Component.TYPES.size());
+        for (Component.Type componentType : Component.TYPES)
         {
-            public boolean accept(File file)
-            {
-                if (file.isDirectory() || !file.getName().startsWith(sstableFilePrefix))
-                    return false;
-
-                Pair<Descriptor, Component> component = tryComponentFromFilename(file.getParentFile(), file.getName());
-
-                if (component != null && component.left.equals(desc) && (matchState.isMatch(component.left)))
-                    components.add(component.right);
-
-                return false;
-            }
-        });
+            Component component = new Component(componentType);
+            if (new File(desc.filenameFor(component)).exists())
+                components.add(component);
+        }
 
         return components;
     }

Modified: cassandra/trunk/src/java/org/apache/cassandra/io/sstable/SSTableReader.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/src/java/org/apache/cassandra/io/sstable/SSTableReader.java?rev=1210747&r1=1210746&r2=1210747&view=diff
==============================================================================
--- cassandra/trunk/src/java/org/apache/cassandra/io/sstable/SSTableReader.java (original)
+++ cassandra/trunk/src/java/org/apache/cassandra/io/sstable/SSTableReader.java Tue Dec  6 02:09:58 2011
@@ -116,7 +116,7 @@ public class SSTableReader extends SSTab
 
     public static SSTableReader open(Descriptor desc, CFMetaData metadata) throws IOException
     {
-        return open(desc, componentsFor(desc, Descriptor.TempState.LIVE), metadata, StorageService.getPartitioner());
+        return open(desc, componentsFor(desc), metadata, StorageService.getPartitioner());
     }
 
     public static SSTableReader open(Descriptor descriptor, Set<Component> components, CFMetaData metadata, IPartitioner partitioner) throws IOException

Modified: cassandra/trunk/src/java/org/apache/cassandra/io/sstable/SSTableWriter.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/src/java/org/apache/cassandra/io/sstable/SSTableWriter.java?rev=1210747&r1=1210746&r2=1210747&view=diff
==============================================================================
--- cassandra/trunk/src/java/org/apache/cassandra/io/sstable/SSTableWriter.java (original)
+++ cassandra/trunk/src/java/org/apache/cassandra/io/sstable/SSTableWriter.java Tue Dec  6 02:09:58 2011
@@ -277,16 +277,17 @@ public class SSTableWriter extends SSTab
     }
 
     /**
-     * Attempt to close the index writer and data file before deleting all temp components for the sstable
+     * After failure, attempt to close the index writer and data file before deleting all temp components for the sstable
      */
-    public void cleanupIfNecessary()
+    public void abort()
     {
+        assert descriptor.temporary;
         FileUtils.closeQuietly(iwriter);
         FileUtils.closeQuietly(dataFile);
 
         try
         {
-            Set<Component> components = SSTable.componentsFor(descriptor, Descriptor.TempState.TEMP);
+            Set<Component> components = SSTable.componentsFor(descriptor);
             if (!components.isEmpty())
                 SSTable.delete(descriptor, components);
         }
@@ -452,6 +453,7 @@ public class SSTableWriter extends SSTab
             indexFile.resetAndTruncate(mark);
         }
 
+        @Override
         public String toString()
         {
             return "IndexWriter(" + desc + ")";

Modified: cassandra/trunk/src/java/org/apache/cassandra/net/MessagingService.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/src/java/org/apache/cassandra/net/MessagingService.java?rev=1210747&r1=1210746&r2=1210747&view=diff
==============================================================================
--- cassandra/trunk/src/java/org/apache/cassandra/net/MessagingService.java (original)
+++ cassandra/trunk/src/java/org/apache/cassandra/net/MessagingService.java Tue Dec  6 02:09:58 2011
@@ -241,7 +241,7 @@ public final class MessagingService impl
     private List<ServerSocket> getServerSocket(InetAddress localEp) throws IOException, ConfigurationException
     {
        final List<ServerSocket> ss = new ArrayList<ServerSocket>();
-        if (DatabaseDescriptor.getEncryptionOptions() != null && DatabaseDescriptor.getEncryptionOptions().internode_encryption != EncryptionOptions.InternodeEncryption.none)
+        if (DatabaseDescriptor.getEncryptionOptions().internode_encryption != EncryptionOptions.InternodeEncryption.none)
         {
             ss.add(SSLFactory.getServerSocket(DatabaseDescriptor.getEncryptionOptions(), localEp, DatabaseDescriptor.getSSLStoragePort()));
             // setReuseAddress happens in the factory.

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=1210747&r1=1210746&r2=1210747&view=diff
==============================================================================
--- cassandra/trunk/src/java/org/apache/cassandra/service/StorageProxy.java (original)
+++ cassandra/trunk/src/java/org/apache/cassandra/service/StorageProxy.java Tue Dec  6 02:09:58 2011
@@ -812,7 +812,7 @@ public class StorageProxy implements Sto
     throws IOException, UnavailableException, TimeoutException
     {
         if (logger.isDebugEnabled())
-            logger.debug(command.toString());
+            logger.debug("Command/ConsistencyLevel is {}/{}", command.toString(), consistency_level);
         long startTime = System.nanoTime();
         List<Row> rows;
         // now scan until we have enough results

Modified: cassandra/trunk/src/java/org/apache/cassandra/service/StorageService.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/src/java/org/apache/cassandra/service/StorageService.java?rev=1210747&r1=1210746&r2=1210747&view=diff
==============================================================================
--- cassandra/trunk/src/java/org/apache/cassandra/service/StorageService.java (original)
+++ cassandra/trunk/src/java/org/apache/cassandra/service/StorageService.java Tue Dec  6 02:09:58 2011
@@ -453,7 +453,7 @@ public class StorageService implements I
                 if (!tasks.awaitTermination(1, TimeUnit.MINUTES))
                     logger_.warn("Miscellaneous task executor still busy after one minute; proceeding with shutdown");
             }
-        });
+        }, "StorageServiceShutdownHook");
         Runtime.getRuntime().addShutdownHook(drainOnShutdown);
 
         if (Boolean.parseBoolean(System.getProperty("cassandra.join_ring", "true")))

Modified: cassandra/trunk/src/java/org/apache/cassandra/streaming/IncomingStreamReader.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/src/java/org/apache/cassandra/streaming/IncomingStreamReader.java?rev=1210747&r1=1210746&r2=1210747&view=diff
==============================================================================
--- cassandra/trunk/src/java/org/apache/cassandra/streaming/IncomingStreamReader.java (original)
+++ cassandra/trunk/src/java/org/apache/cassandra/streaming/IncomingStreamReader.java Tue Dec  6 02:09:58 2011
@@ -29,7 +29,6 @@ import org.apache.cassandra.db.ColumnFam
 import org.apache.cassandra.db.ColumnFamilyStore;
 import org.apache.cassandra.db.DecoratedKey;
 import org.apache.cassandra.db.Table;
-import org.apache.cassandra.db.compaction.AbstractCompactedRow;
 import org.apache.cassandra.db.compaction.CompactionController;
 import org.apache.cassandra.db.compaction.PrecompactedRow;
 import org.apache.cassandra.io.IColumnSerializer;
@@ -38,6 +37,7 @@ import org.apache.cassandra.io.util.File
 import org.apache.cassandra.service.StorageService;
 import org.apache.cassandra.utils.ByteBufferUtil;
 import org.apache.cassandra.utils.BytesReadTracker;
+import org.apache.cassandra.utils.FBUtilities;
 import org.apache.cassandra.utils.Pair;
 
 import com.ning.compress.lzf.LZFInputStream;
@@ -154,9 +154,10 @@ public class IncomingStreamReader
             }
             return writer.closeAndOpenReader();
         }
-        finally
+        catch (Exception e)
         {
-            writer.cleanupIfNecessary();
+            writer.abort();
+            throw FBUtilities.unchecked(e);
         }
     }
 

Modified: cassandra/trunk/src/java/org/apache/cassandra/thrift/ThriftValidation.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/src/java/org/apache/cassandra/thrift/ThriftValidation.java?rev=1210747&r1=1210746&r2=1210747&view=diff
==============================================================================
--- cassandra/trunk/src/java/org/apache/cassandra/thrift/ThriftValidation.java (original)
+++ cassandra/trunk/src/java/org/apache/cassandra/thrift/ThriftValidation.java Tue Dec  6 02:09:58 2011
@@ -39,6 +39,7 @@ import org.apache.cassandra.dht.RandomPa
 import org.apache.cassandra.dht.Token;
 import org.apache.cassandra.locator.*;
 import org.apache.cassandra.service.StorageService;
+import org.apache.cassandra.io.compress.CompressionParameters;
 import org.apache.cassandra.utils.ByteBufferUtil;
 import org.apache.cassandra.utils.FBUtilities;
 
@@ -602,7 +603,7 @@ public class ThriftValidation
                     if (cf_def.key_alias.equals(columnDef.name))
                         throw new InvalidRequestException("Invalid column name: "
                                                           + AsciiType.instance.compose(cf_def.key_alias)
-                                                          + ", because it equals to the key_alias.");
+                                                          + ", because it equals the key_alias");
                 }
             }
 
@@ -668,6 +669,9 @@ public class ThriftValidation
                 }
             }
             validateMinMaxCompactionThresholds(cf_def);
+
+            // validates compression parameters
+            CompressionParameters.create(cf_def.compression_options);
         }
         catch (ConfigurationException e)
         {

Modified: cassandra/trunk/src/java/org/apache/cassandra/tools/NodeCmd.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/src/java/org/apache/cassandra/tools/NodeCmd.java?rev=1210747&r1=1210746&r2=1210747&view=diff
==============================================================================
--- cassandra/trunk/src/java/org/apache/cassandra/tools/NodeCmd.java (original)
+++ cassandra/trunk/src/java/org/apache/cassandra/tools/NodeCmd.java Tue Dec  6 02:09:58 2011
@@ -75,14 +75,44 @@ public class NodeCmd
         this.probe = probe;
     }
 
-    public enum NodeCommand
+    private enum NodeCommand
     {
-        RING, INFO, CFSTATS, SNAPSHOT, CLEARSNAPSHOT, VERSION, TPSTATS, FLUSH, DRAIN,
-        DECOMMISSION, MOVE, REMOVETOKEN, REPAIR, CLEANUP, COMPACT, SCRUB,
-        SETCACHECAPACITY, GETCOMPACTIONTHRESHOLD, SETCOMPACTIONTHRESHOLD, NETSTATS, CFHISTOGRAMS,
-        COMPACTIONSTATS, DISABLEGOSSIP, ENABLEGOSSIP, INVALIDATEKEYCACHE, INVALIDATEROWCACHE,
-        DISABLETHRIFT, ENABLETHRIFT, STATUSTHRIFT, JOIN, SETCOMPACTIONTHROUGHPUT, GETENDPOINTS,
-        REFRESH, GOSSIPINFO, UPGRADESSTABLES, STOP
+        CFHISTOGRAMS,
+        CFSTATS,
+        CLEANUP,
+        CLEARSNAPSHOT,
+        COMPACT,
+        COMPACTIONSTATS,
+        DECOMMISSION,
+        DISABLEGOSSIP,
+        DISABLETHRIFT,
+        DRAIN,
+        ENABLEGOSSIP,
+        ENABLETHRIFT,
+        FLUSH,
+        GETCOMPACTIONTHRESHOLD,
+        GETENDPOINTS,
+        GOSSIPINFO,
+        INFO,
+        INVALIDATEKEYCACHE,
+        INVALIDATEROWCACHE,
+        JOIN,
+        MOVE,
+        NETSTATS,
+        REFRESH,
+        REMOVETOKEN,
+        REPAIR,
+        RING,
+        SCRUB,
+        SETCACHECAPACITY,
+        SETCOMPACTIONTHRESHOLD,
+        SETCOMPACTIONTHROUGHPUT,
+        SNAPSHOT,
+        STATUSTHRIFT,
+        STOP,
+        TPSTATS,
+        UPGRADESSTABLES,
+        VERSION,
     }
 
     

Modified: cassandra/trunk/src/java/org/apache/cassandra/tools/NodeProbe.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/src/java/org/apache/cassandra/tools/NodeProbe.java?rev=1210747&r1=1210746&r2=1210747&view=diff
==============================================================================
--- cassandra/trunk/src/java/org/apache/cassandra/tools/NodeProbe.java (original)
+++ cassandra/trunk/src/java/org/apache/cassandra/tools/NodeProbe.java Tue Dec  6 02:09:58 2011
@@ -56,6 +56,7 @@ import org.apache.cassandra.service.Stor
 import org.apache.cassandra.streaming.StreamingService;
 import org.apache.cassandra.streaming.StreamingServiceMBean;
 import org.apache.cassandra.thrift.UnavailableException;
+import org.apache.cassandra.utils.Pair;
 
 /**
  * JMX client operations for Cassandra.
@@ -533,11 +534,29 @@ public class NodeProbe
         return cfsProxy;
     }
 
+    public String getEndpoint()
+    {
+        // Try to find the endpoint using the local token, doing so in a crazy manner
+        // to maintain backwards compatibility with the MBean interface
+        String stringToken = ssProxy.getToken();
+        Map<Token, String> tokenToEndpoint = ssProxy.getTokenToEndpointMap();
+
+        for (Map.Entry<Token, String> pair : tokenToEndpoint.entrySet())
+        {
+            if (pair.getKey().toString().equals(stringToken))
+            {
+                return pair.getValue();
+            }
+        }
+
+        throw new AssertionError("Could not find myself in the endpoint list, something is very wrong!");
+    }
+
     public String getDataCenter()
     {
         try
         {
-            return getEndpointSnitchInfoProxy().getDatacenter(host);
+            return getEndpointSnitchInfoProxy().getDatacenter(getEndpoint());
         }
         catch (UnknownHostException e)
         {
@@ -549,7 +568,7 @@ public class NodeProbe
     {
         try
         {
-            return getEndpointSnitchInfoProxy().getRack(host);
+            return getEndpointSnitchInfoProxy().getRack(getEndpoint());
         }
         catch (UnknownHostException e)
         {

Modified: cassandra/trunk/src/java/org/apache/cassandra/utils/FBUtilities.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/src/java/org/apache/cassandra/utils/FBUtilities.java?rev=1210747&r1=1210746&r2=1210747&view=diff
==============================================================================
--- cassandra/trunk/src/java/org/apache/cassandra/utils/FBUtilities.java (original)
+++ cassandra/trunk/src/java/org/apache/cassandra/utils/FBUtilities.java Tue Dec  6 02:09:58 2011
@@ -668,4 +668,9 @@ public class FBUtilities
                                buffer.getData().length, buffer.getLength(), size, object);
         return buffer.getData();
     }
+
+    public static RuntimeException unchecked(Exception e)
+    {
+        return e instanceof RuntimeException ? (RuntimeException) e : new RuntimeException(e);
+    }
 }

Modified: cassandra/trunk/src/java/org/apache/cassandra/utils/WrappedRunnable.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/src/java/org/apache/cassandra/utils/WrappedRunnable.java?rev=1210747&r1=1210746&r2=1210747&view=diff
==============================================================================
--- cassandra/trunk/src/java/org/apache/cassandra/utils/WrappedRunnable.java (original)
+++ cassandra/trunk/src/java/org/apache/cassandra/utils/WrappedRunnable.java Tue Dec  6 02:09:58 2011
@@ -31,10 +31,7 @@ public abstract class WrappedRunnable im
         }
         catch (Exception e)
         {
-            if (e instanceof RuntimeException)
-                throw (RuntimeException) e;
-            else
-                throw new RuntimeException(e);
+            throw FBUtilities.unchecked(e);
         }
     }
 

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=1210747&r1=1210746&r2=1210747&view=diff
==============================================================================
--- cassandra/trunk/test/unit/org/apache/cassandra/cli/CliTest.java (original)
+++ cassandra/trunk/test/unit/org/apache/cassandra/cli/CliTest.java Tue Dec  6 02:09:58 2011
@@ -43,7 +43,8 @@ public class CliTest extends CleanupHelp
                                                                                "{ column_name:world2, validation_class:LongType, index_type:KEYS, index_name:LongIdxName}, " +
                                                                                "{ column_name:617070, validation_class:UTF8Type, index_type:KEYS }, " +
                                                                                "{ column_name:28292, validation_class:UTF8Type, index_type:CUSTOM, index_options:{class_name:'org.apache.cassandra.db.index.keys.KeysIndex', foo:bar}}," +
-                                                                               "{ column_name:'-617071', validation_class:UTF8Type, index_type:KEYS }];",
+                                                                               "{ column_name:'-617071', validation_class:UTF8Type, index_type:KEYS }," +
+                                                                               "{ column_name:time_spent_uuid, validation_class:TimeUUIDType}] and default_validation_class=UTF8Type;",
         "assume 123 keys as utf8;",
         "set 123[hello][world] = 123848374878933948398384;",
         "set 123[hello][test_quote] = 'value\\'';",
@@ -60,7 +61,6 @@ public class CliTest extends CleanupHelp
         "get 123[hello][test_quote];",
         "get 123['k\\'ey'][VALUE]",
         "set 123[hello][-31337] = -23876;",
-        "set 123[hello][-31337] = long(-23876);",
         "set 123[hello][world2] = 15;",
         "get 123 where world2 = long(15);",
         "get 123 where world2 = long(15);",
@@ -68,7 +68,7 @@ public class CliTest extends CleanupHelp
         "del 123[utf8('hello')][utf8('world')];",
         "del 123[hello][world2];",
         "set 123['hello'][time_spent_uuid] = timeuuid(a8098c1a-f86e-11da-bd1a-00112444be1e);",
-        "create column family CF2 with comparator=IntegerType;",
+        "create column family CF2 with comparator=IntegerType and default_validation_class=AsciiType;",
         "assume CF2 keys as utf8;",
         "set CF2['key'][98349387493847748398334] = 'some text';",
         "get CF2['key'][98349387493847748398334];",
@@ -160,7 +160,7 @@ public class CliTest extends CleanupHelp
         "drop keyspace tesTIN;",
         "update column family 123 with comparator=UTF8Type and column_metadata=[];",
         "drop column family 123;",
-        "create column family myCF with column_type='Super' and comparator='UTF8Type' AND subcomparator='UTF8Type';",
+        "create column family myCF with column_type='Super' and comparator='UTF8Type' AND subcomparator='UTF8Type' AND default_validation_class=AsciiType;",
         "assume myCF keys as utf8;",
         "create column family Countries with comparator=UTF8Type and column_metadata=[ {column_name: name, validation_class: UTF8Type} ];",
         "set Countries[1][name] = USA;",

Modified: cassandra/trunk/test/unit/org/apache/cassandra/io/sstable/SSTableTest.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/test/unit/org/apache/cassandra/io/sstable/SSTableTest.java?rev=1210747&r1=1210746&r2=1210747&view=diff
==============================================================================
--- cassandra/trunk/test/unit/org/apache/cassandra/io/sstable/SSTableTest.java (original)
+++ cassandra/trunk/test/unit/org/apache/cassandra/io/sstable/SSTableTest.java Tue Dec  6 02:09:58 2011
@@ -23,6 +23,7 @@ import java.io.IOException;
 import java.nio.ByteBuffer;
 import java.util.*;
 
+import com.google.common.collect.Sets;
 import org.junit.Test;
 
 import org.apache.cassandra.CleanupHelper;
@@ -75,12 +76,10 @@ public class SSTableTest extends Cleanup
         ssTable = SSTableReader.open(ssTable.descriptor); // read the index from disk
         verifyMany(ssTable, map);
 
-        Set<Component> live = SSTable.componentsFor(ssTable.descriptor, Descriptor.TempState.LIVE);
-        assert !live.isEmpty() : "SSTable has live components";
-        Set<Component> all = SSTable.componentsFor(ssTable.descriptor, Descriptor.TempState.ANY);
-        assert live.equals(all) : "live components same as all components";
-        all.removeAll(live);
-        assert all.isEmpty() : "SSTable has no temp components";
+        Set<Component> live = SSTable.componentsFor(ssTable.descriptor);
+        assert !live.isEmpty() : "SSTable has no live components";
+        Set<Component> temp = SSTable.componentsFor(ssTable.descriptor.asTemporary(true));
+        assert temp.isEmpty() : "SSTable has unexpected temp components";
     }
 
     private void verifyMany(SSTableReader sstable, Map<ByteBuffer, ByteBuffer> map) throws IOException



Mime
View raw message