cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jbel...@apache.org
Subject svn commit: r1035660 - in /cassandra/trunk: ./ conf/ interface/thrift/gen-java/org/apache/cassandra/thrift/ src/java/org/apache/cassandra/cli/ src/java/org/apache/cassandra/db/ src/java/org/apache/cassandra/db/marshal/ src/java/org/apache/cassandra/db/...
Date Tue, 16 Nov 2010 15:40:29 GMT
Author: jbellis
Date: Tue Nov 16 15:40:28 2010
New Revision: 1035660

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

Modified:
    cassandra/trunk/   (props changed)
    cassandra/trunk/CHANGES.txt
    cassandra/trunk/conf/cassandra.yaml
    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/db/DefinitionsUpdateResponseVerbHandler.java
    cassandra/trunk/src/java/org/apache/cassandra/db/marshal/LexicalUUIDType.java
    cassandra/trunk/src/java/org/apache/cassandra/db/marshal/TimeUUIDType.java
    cassandra/trunk/src/java/org/apache/cassandra/db/migration/Migration.java
    cassandra/trunk/src/java/org/apache/cassandra/service/StorageService.java
    cassandra/trunk/src/java/org/apache/cassandra/tools/SchemaTool.java
    cassandra/trunk/src/java/org/apache/cassandra/utils/UUIDGen.java
    cassandra/trunk/test/unit/org/apache/cassandra/cli/CliTest.java
    cassandra/trunk/test/unit/org/apache/cassandra/db/DefsTest.java
    cassandra/trunk/test/unit/org/apache/cassandra/db/marshal/TimeUUIDTypeTest.java
    cassandra/trunk/test/unit/org/apache/cassandra/utils/UUIDTests.java

Propchange: cassandra/trunk/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Nov 16 15:40:28 2010
@@ -1,5 +1,5 @@
-/cassandra/branches/cassandra-0.6:922689-1035020
-/cassandra/branches/cassandra-0.7:1026517-1035296
+/cassandra/branches/cassandra-0.6:922689-1035020,1035656
+/cassandra/branches/cassandra-0.7:1026517-1035659
 /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=1035660&r1=1035659&r2=1035660&view=diff
==============================================================================
--- cassandra/trunk/CHANGES.txt (original)
+++ cassandra/trunk/CHANGES.txt Tue Nov 16 15:40:28 2010
@@ -31,6 +31,7 @@ dev
  * fix index scan routing (CASSANDRA-1722)
  * fix tombstoning of supercolumns in range queries (CASSANDRA-1734)
  * clear endpoint cache after updating keyspace metadata (CASSANDRA-1741)
+ * fix wrapping-range queries on non-minimum token (CASSANDRA-1700)
 
 
 0.7.0-beta3

Modified: cassandra/trunk/conf/cassandra.yaml
URL: http://svn.apache.org/viewvc/cassandra/trunk/conf/cassandra.yaml?rev=1035660&r1=1035659&r2=1035660&view=diff
==============================================================================
--- cassandra/trunk/conf/cassandra.yaml (original)
+++ cassandra/trunk/conf/cassandra.yaml Tue Nov 16 15:40:28 2010
@@ -363,55 +363,101 @@ index_interval: 128
 #        before the memtable is flushed. If undefined, throughput / 64 * 0.3
 #        will be used.
 #
-# NOTE: this keyspace definition is for demonstration purposes only.
-#       Cassandra will not load these definitions during startup. See
-#       http://wiki.apache.org/cassandra/FAQ#no_keyspaces for an explanation.
 keyspaces:
-    - name: Keyspace1
-      replica_placement_strategy: org.apache.cassandra.locator.SimpleStrategy
-      replication_factor: 1
-      column_families:
-        - name: Standard1
-          compare_with: BytesType
-          keys_cached: 10000
-          rows_cached: 1000
-          row_cache_save_period_in_seconds: 0
-          key_cache_save_period_in_seconds: 3600
-          memtable_flush_after_mins: 59
-          memtable_throughput_in_mb: 255
-          memtable_operations_in_millions: 0.29
-
-        - name: Standard2
-          compare_with: UTF8Type
-          read_repair_chance: 0.1
-          keys_cached: 100
-          gc_grace_seconds: 0
-          min_compaction_threshold: 5
-          max_compaction_threshold: 31
-
-        - name: StandardByUUID1
-          compare_with: TimeUUIDType
-
-        - name: Super1
-          column_type: Super
-          compare_with: BytesType
-          compare_subcolumns_with: BytesType
-
-        - name: Super2
-          column_type: Super
-          compare_subcolumns_with: UTF8Type
-          rows_cached: 10000
-          keys_cached: 50
-          comment: 'A column family with supercolumns, whose column and subcolumn names are
UTF8 strings'
-
-        - name: Super3
-          column_type: Super
-          compare_with: LongType
-          comment: 'A column family with supercolumns, whose column names are Longs (8 bytes)'
-
-        - name: Indexed1
-          default_validation_class: LongType
-          column_metadata:
-            - name: birthdate
-              validator_class: LongType
-              index_type: KEYS
+- column_families:
+  - column_metadata:
+    - !!org.apache.cassandra.config.RawColumnDefinition
+      name: password
+      validator_class: org.apache.cassandra.db.marshal.UTF8Type
+    column_type: Standard
+    comment: ''
+    compare_with: org.apache.cassandra.db.marshal.UTF8Type
+    gc_grace_seconds: 864000
+    key_cache_save_period_in_seconds: 3600
+    keys_cached: 200000.0
+    max_compaction_threshold: 32
+    memtable_flush_after_mins: 60
+    min_compaction_threshold: 4
+    name: User
+    read_repair_chance: 1.0
+    row_cache_save_period_in_seconds: 0
+    rows_cached: 0.0
+  - column_type: Standard
+    comment: ''
+    compare_with: org.apache.cassandra.db.marshal.LongType
+    default_validation_class: org.apache.cassandra.db.marshal.LexicalUUIDType
+    gc_grace_seconds: 864000
+    key_cache_save_period_in_seconds: 3600
+    keys_cached: 200000.0
+    max_compaction_threshold: 32
+    memtable_flush_after_mins: 60
+    min_compaction_threshold: 4
+    name: Userline
+    read_repair_chance: 1.0
+    row_cache_save_period_in_seconds: 0
+    rows_cached: 0.0
+  - column_type: Standard
+    comment: ''
+    compare_with: org.apache.cassandra.db.marshal.UTF8Type
+    default_validation_class: org.apache.cassandra.db.marshal.UTF8Type
+    gc_grace_seconds: 864000
+    key_cache_save_period_in_seconds: 3600
+    keys_cached: 200000.0
+    max_compaction_threshold: 32
+    memtable_flush_after_mins: 60
+    min_compaction_threshold: 4
+    name: Followers
+    read_repair_chance: 1.0
+    row_cache_save_period_in_seconds: 0
+    rows_cached: 0.0
+  - column_metadata:
+    - !!org.apache.cassandra.config.RawColumnDefinition
+      name: body
+      validator_class: org.apache.cassandra.db.marshal.UTF8Type
+    - !!org.apache.cassandra.config.RawColumnDefinition
+      name: username
+      validator_class: org.apache.cassandra.db.marshal.UTF8Type
+    column_type: Standard
+    comment: ''
+    compare_with: org.apache.cassandra.db.marshal.UTF8Type
+    gc_grace_seconds: 864000
+    key_cache_save_period_in_seconds: 3600
+    keys_cached: 200000.0
+    max_compaction_threshold: 32
+    memtable_flush_after_mins: 60
+    min_compaction_threshold: 4
+    name: Tweet
+    read_repair_chance: 1.0
+    row_cache_save_period_in_seconds: 0
+    rows_cached: 0.0
+  - column_type: Standard
+    comment: ''
+    compare_with: org.apache.cassandra.db.marshal.UTF8Type
+    default_validation_class: org.apache.cassandra.db.marshal.UTF8Type
+    gc_grace_seconds: 864000
+    key_cache_save_period_in_seconds: 3600
+    keys_cached: 200000.0
+    max_compaction_threshold: 32
+    memtable_flush_after_mins: 60
+    min_compaction_threshold: 4
+    name: Friends
+    read_repair_chance: 1.0
+    row_cache_save_period_in_seconds: 0
+    rows_cached: 0.0
+  - column_type: Standard
+    comment: ''
+    compare_with: org.apache.cassandra.db.marshal.LongType
+    default_validation_class: org.apache.cassandra.db.marshal.LexicalUUIDType
+    gc_grace_seconds: 864000
+    key_cache_save_period_in_seconds: 3600
+    keys_cached: 200000.0
+    max_compaction_threshold: 32
+    memtable_flush_after_mins: 60
+    min_compaction_threshold: 4
+    name: Timeline
+    read_repair_chance: 1.0
+    row_cache_save_period_in_seconds: 0
+    rows_cached: 0.0
+  name: Twissjava
+  replica_placement_strategy: org.apache.cassandra.locator.SimpleStrategy
+  replication_factor: 1

Propchange: cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/Cassandra.java
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Nov 16 15:40:28 2010
@@ -1,5 +1,5 @@
-/cassandra/branches/cassandra-0.6/interface/thrift/gen-java/org/apache/cassandra/thrift/Cassandra.java:922689-1035020
-/cassandra/branches/cassandra-0.7/interface/thrift/gen-java/org/apache/cassandra/thrift/Cassandra.java:1026517-1035296
+/cassandra/branches/cassandra-0.6/interface/thrift/gen-java/org/apache/cassandra/thrift/Cassandra.java:922689-1035020,1035656
+/cassandra/branches/cassandra-0.7/interface/thrift/gen-java/org/apache/cassandra/thrift/Cassandra.java:1026517-1035659
 /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 Tue Nov 16 15:40:28 2010
@@ -1,5 +1,5 @@
-/cassandra/branches/cassandra-0.6/interface/thrift/gen-java/org/apache/cassandra/thrift/Column.java:922689-1035020
-/cassandra/branches/cassandra-0.7/interface/thrift/gen-java/org/apache/cassandra/thrift/Column.java:1026517-1035296
+/cassandra/branches/cassandra-0.6/interface/thrift/gen-java/org/apache/cassandra/thrift/Column.java:922689-1035020,1035656
+/cassandra/branches/cassandra-0.7/interface/thrift/gen-java/org/apache/cassandra/thrift/Column.java:1026517-1035659
 /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 Tue Nov 16 15:40:28 2010
@@ -1,5 +1,5 @@
-/cassandra/branches/cassandra-0.6/interface/thrift/gen-java/org/apache/cassandra/thrift/InvalidRequestException.java:922689-1035020
-/cassandra/branches/cassandra-0.7/interface/thrift/gen-java/org/apache/cassandra/thrift/InvalidRequestException.java:1026517-1035296
+/cassandra/branches/cassandra-0.6/interface/thrift/gen-java/org/apache/cassandra/thrift/InvalidRequestException.java:922689-1035020,1035656
+/cassandra/branches/cassandra-0.7/interface/thrift/gen-java/org/apache/cassandra/thrift/InvalidRequestException.java:1026517-1035659
 /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 Tue Nov 16 15:40:28 2010
@@ -1,5 +1,5 @@
-/cassandra/branches/cassandra-0.6/interface/thrift/gen-java/org/apache/cassandra/thrift/NotFoundException.java:922689-1035020
-/cassandra/branches/cassandra-0.7/interface/thrift/gen-java/org/apache/cassandra/thrift/NotFoundException.java:1026517-1035296
+/cassandra/branches/cassandra-0.6/interface/thrift/gen-java/org/apache/cassandra/thrift/NotFoundException.java:922689-1035020,1035656
+/cassandra/branches/cassandra-0.7/interface/thrift/gen-java/org/apache/cassandra/thrift/NotFoundException.java:1026517-1035659
 /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 Tue Nov 16 15:40:28 2010
@@ -1,5 +1,5 @@
-/cassandra/branches/cassandra-0.6/interface/thrift/gen-java/org/apache/cassandra/thrift/SuperColumn.java:922689-1035020
-/cassandra/branches/cassandra-0.7/interface/thrift/gen-java/org/apache/cassandra/thrift/SuperColumn.java:1026517-1035296
+/cassandra/branches/cassandra-0.6/interface/thrift/gen-java/org/apache/cassandra/thrift/SuperColumn.java:922689-1035020,1035656
+/cassandra/branches/cassandra-0.7/interface/thrift/gen-java/org/apache/cassandra/thrift/SuperColumn.java:1026517-1035659
 /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/cli/CliClient.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/src/java/org/apache/cassandra/cli/CliClient.java?rev=1035660&r1=1035659&r2=1035660&view=diff
==============================================================================
--- cassandra/trunk/src/java/org/apache/cassandra/cli/CliClient.java (original)
+++ cassandra/trunk/src/java/org/apache/cassandra/cli/CliClient.java Tue Nov 16 15:40:28 2010
@@ -904,8 +904,8 @@ public class CliClient extends CliUserHe
         // extract column family
         String columnFamily = statement.getChild(0).getText();
 
-        String startKey = "";
-        String endKey = "";
+        String rawStartKey = "";
+        String rawEndKey = "";
         int limitCount = Integer.MAX_VALUE; // will reset to default later if it's not specified
 
         // optional arguments: key range and limit
@@ -916,9 +916,9 @@ public class CliClient extends CliUserHe
             {
                 if (child.getChildCount() > 0)
                 {
-                    startKey = CliUtils.unescapeSQLString(child.getChild(0).getText());
+                    rawStartKey = CliUtils.unescapeSQLString(child.getChild(0).getText());
                     if (child.getChildCount() > 1)
-                        endKey = CliUtils.unescapeSQLString(child.getChild(1).getText());
+                        rawEndKey = CliUtils.unescapeSQLString(child.getChild(1).getText());
                 }
             }
             else
@@ -955,8 +955,9 @@ public class CliClient extends CliUserHe
         // set the key range
         KeyRange range = new KeyRange(limitCount);
         AbstractType keyComparator = this.cfKeysComparators.get(columnFamily);
-        range.setStart_key(getBytesAccordingToType(startKey, keyComparator))
-             .setEnd_key(getBytesAccordingToType(endKey, keyComparator));
+        ByteBuffer startKey = rawStartKey.isEmpty() ? FBUtilities.EMPTY_BYTE_BUFFER : getBytesAccordingToType(rawStartKey,
keyComparator);
+        ByteBuffer endKey = rawEndKey.isEmpty() ? FBUtilities.EMPTY_BYTE_BUFFER : getBytesAccordingToType(rawEndKey,
keyComparator);
+        range.setStart_key(startKey).setEnd_key(endKey);
 
         ColumnParent columnParent = new ColumnParent(columnFamily);
         List<KeySlice> keySlices = thriftClient.get_range_slices(columnParent, predicate,
range, ConsistencyLevel.ONE);
@@ -1424,6 +1425,12 @@ public class CliClient extends CliUserHe
      */
     private ByteBuffer getBytesAccordingToType(String object, AbstractType comparator)
     {
+        // TODO there is tension here between using this function to generate default values,
+        // and using it to parse input.  For instance, normally we want to convert empty
string
+        // to empty byte array for any type -- all types special case empty byte[] to mean
+        // "minimum value" -- but we also want timeuuid() to create a valid uuid for us.
+        // For now, this function takes the create-valid-values approach, and we leave
+        // other use cases to special case "" -> byte[0] before calling this.
         if (comparator instanceof LongType)
         {
             long longType;

Modified: cassandra/trunk/src/java/org/apache/cassandra/db/DefinitionsUpdateResponseVerbHandler.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/src/java/org/apache/cassandra/db/DefinitionsUpdateResponseVerbHandler.java?rev=1035660&r1=1035659&r2=1035660&view=diff
==============================================================================
--- cassandra/trunk/src/java/org/apache/cassandra/db/DefinitionsUpdateResponseVerbHandler.java
(original)
+++ cassandra/trunk/src/java/org/apache/cassandra/db/DefinitionsUpdateResponseVerbHandler.java
Tue Nov 16 15:40:28 2010
@@ -31,7 +31,6 @@ import org.apache.cassandra.utils.Wrappe
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import java.io.ByteArrayInputStream;
 import java.io.IOError;
 import java.io.IOException;
 import java.util.Collection;
@@ -51,7 +50,7 @@ public class DefinitionsUpdateResponseVe
             Collection<Column> cols = MigrationManager.makeColumns(message);
             for (Column col : cols)
             {
-                final UUID version = UUIDGen.makeType1UUID(col.name());
+                final UUID version = UUIDGen.getUUID(col.name());
                 if (version.timestamp() > DatabaseDescriptor.getDefsVersion().timestamp())
                 {
                     final Migration m = Migration.deserialize(col.value());

Modified: cassandra/trunk/src/java/org/apache/cassandra/db/marshal/LexicalUUIDType.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/src/java/org/apache/cassandra/db/marshal/LexicalUUIDType.java?rev=1035660&r1=1035659&r2=1035660&view=diff
==============================================================================
--- cassandra/trunk/src/java/org/apache/cassandra/db/marshal/LexicalUUIDType.java (original)
+++ cassandra/trunk/src/java/org/apache/cassandra/db/marshal/LexicalUUIDType.java Tue Nov
16 15:40:28 2010
@@ -21,10 +21,9 @@ package org.apache.cassandra.db.marshal;
  */
 
 
-import java.util.UUID;
 import java.nio.ByteBuffer;
 
-import org.apache.cassandra.utils.ByteBufferUtil;
+import org.apache.cassandra.utils.UUIDGen;
 
 public class LexicalUUIDType extends AbstractType
 {
@@ -32,11 +31,6 @@ public class LexicalUUIDType extends Abs
 
     LexicalUUIDType() {} // singleton
 
-    static UUID getUUID(ByteBuffer bytes)
-    {
-        return new UUID(bytes.getLong(bytes.position()+bytes.arrayOffset()), bytes.getLong(bytes.position()+bytes.arrayOffset()));
-    }
-
     public int compare(ByteBuffer o1, ByteBuffer o2)
     {
         if (o1.remaining() == 0)
@@ -48,7 +42,7 @@ public class LexicalUUIDType extends Abs
             return 1;
         }
 
-        return getUUID(o1).compareTo(getUUID(o2));
+        return UUIDGen.getUUID(o1).compareTo(UUIDGen.getUUID(o2));
     }
 
     public String getString(ByteBuffer bytes)
@@ -61,6 +55,6 @@ public class LexicalUUIDType extends Abs
         {
             throw new MarshalException("UUIDs must be exactly 16 bytes");
         }
-        return getUUID(bytes).toString();
+        return UUIDGen.getUUID(bytes).toString();
     }
 }

Modified: cassandra/trunk/src/java/org/apache/cassandra/db/marshal/TimeUUIDType.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/src/java/org/apache/cassandra/db/marshal/TimeUUIDType.java?rev=1035660&r1=1035659&r2=1035660&view=diff
==============================================================================
--- cassandra/trunk/src/java/org/apache/cassandra/db/marshal/TimeUUIDType.java (original)
+++ cassandra/trunk/src/java/org/apache/cassandra/db/marshal/TimeUUIDType.java Tue Nov 16
15:40:28 2010
@@ -24,7 +24,7 @@ package org.apache.cassandra.db.marshal;
 import java.nio.ByteBuffer;
 import java.util.UUID;
 
-import org.apache.cassandra.utils.FBUtilities;
+import org.apache.cassandra.utils.UUIDGen;
 
 public class TimeUUIDType extends AbstractType
 {
@@ -80,7 +80,7 @@ public class TimeUUIDType extends Abstra
         {
             throw new MarshalException("UUIDs must be exactly 16 bytes");
         }
-        UUID uuid = LexicalUUIDType.getUUID(bytes);
+        UUID uuid = UUIDGen.getUUID(bytes);
         if (uuid.version() != 1)
         {
             throw new MarshalException("TimeUUID only makes sense with version 1 UUIDs");

Modified: cassandra/trunk/src/java/org/apache/cassandra/db/migration/Migration.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/src/java/org/apache/cassandra/db/migration/Migration.java?rev=1035660&r1=1035659&r2=1035660&view=diff
==============================================================================
--- cassandra/trunk/src/java/org/apache/cassandra/db/migration/Migration.java (original)
+++ cassandra/trunk/src/java/org/apache/cassandra/db/migration/Migration.java Tue Nov 16 15:40:28
2010
@@ -179,7 +179,7 @@ public abstract class Migration
         if (cf == null || cf.getColumnNames().size() == 0)
             return null;
         else
-            return UUIDGen.makeType1UUID(cf.getColumn(LAST_MIGRATION_KEY).value());
+            return UUIDGen.getUUID(cf.getColumn(LAST_MIGRATION_KEY).value());
     }
     
     /** keep in mind that applyLive might happen on another machine */
@@ -277,8 +277,8 @@ public abstract class Migration
         }
         
         // super inflate
-        migration.lastVersion = UUIDGen.makeType1UUID(ByteBuffer.wrap(mi.old_version.bytes()));
-        migration.newVersion = UUIDGen.makeType1UUID(ByteBuffer.wrap(mi.new_version.bytes()));
+        migration.lastVersion = UUIDGen.getUUID(ByteBuffer.wrap(mi.old_version.bytes()));
+        migration.newVersion = UUIDGen.getUUID(ByteBuffer.wrap(mi.new_version.bytes()));
         try
         {
             migration.rm = RowMutation.serializer().deserialize(SerDeUtils.createDataInputStream(mi.row_mutation));

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=1035660&r1=1035659&r2=1035660&view=diff
==============================================================================
--- cassandra/trunk/src/java/org/apache/cassandra/service/StorageService.java (original)
+++ cassandra/trunk/src/java/org/apache/cassandra/service/StorageService.java Tue Nov 16 15:40:28
2010
@@ -1907,7 +1907,7 @@ public class StorageService implements I
             {
                 // blow up if there is a schema saved.
                 if (DatabaseDescriptor.getDefsVersion().timestamp() > 0 || Migration.getLastMigrationId()
!= null)
-                    throw new ConfigurationException("Cannot load from XML on top of pre-existing
schemas.");
+                    throw new ConfigurationException("Cannot import schema when one already
exists");
              
                 Migration migration = null;
                 for (KSMetaData table : tables)
@@ -1982,6 +1982,7 @@ public class StorageService implements I
                 RawColumnFamily rcf = new RawColumnFamily();
                 rcf.name = cfm.cfName;
                 rcf.compare_with = cfm.comparator.getClass().getName();
+                rcf.default_validation_class = cfm.defaultValidator.getClass().getName();
                 rcf.compare_subcolumns_with = cfm.subcolumnComparator == null ? null : cfm.subcolumnComparator.getClass().getName();
                 rcf.column_type = cfm.cfType;
                 rcf.comment = cfm.comment;

Modified: cassandra/trunk/src/java/org/apache/cassandra/tools/SchemaTool.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/src/java/org/apache/cassandra/tools/SchemaTool.java?rev=1035660&r1=1035659&r2=1035660&view=diff
==============================================================================
--- cassandra/trunk/src/java/org/apache/cassandra/tools/SchemaTool.java (original)
+++ cassandra/trunk/src/java/org/apache/cassandra/tools/SchemaTool.java Tue Nov 16 15:40:28
2010
@@ -28,14 +28,8 @@ public class SchemaTool
     public static void main(String[] args)
     throws NumberFormatException, IOException, InterruptedException, ConfigurationException
     {
-        if (args.length < 3)
+        if (args.length < 3 || args.length > 3)
             usage();
-        if (args.length != 3 && "import".equals(args[2]))
-            usage();
-        if (args.length != 4 && "export".equals(args[2]))
-            usage();
-        
-        System.out.println("# Note: This tool is deprecated and will be removed in future
releases.");
         
         String host = args[0];
         int port = 0;

Modified: cassandra/trunk/src/java/org/apache/cassandra/utils/UUIDGen.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/src/java/org/apache/cassandra/utils/UUIDGen.java?rev=1035660&r1=1035659&r2=1035660&view=diff
==============================================================================
--- cassandra/trunk/src/java/org/apache/cassandra/utils/UUIDGen.java (original)
+++ cassandra/trunk/src/java/org/apache/cassandra/utils/UUIDGen.java Tue Nov 16 15:40:28 2010
@@ -21,8 +21,6 @@ package org.apache.cassandra.utils;
  */
 
 
-import java.io.DataInputStream;
-import java.io.IOException;
 import java.net.InetAddress;
 import java.nio.ByteBuffer;
 import java.security.MessageDigest;
@@ -47,7 +45,7 @@ public class UUIDGen
             byte[] md5 = digest.digest();
             byte[] fauxMac = new byte[6];
             System.arraycopy(md5, 0, fauxMac, 0, Math.min(md5.length, fauxMac.length));
-            return makeType1UUID(ByteBuffer.wrap(UUIDGenerator.getInstance().generateTimeBasedUUID(new
EthernetAddress(fauxMac)).toByteArray()));
+            return getUUID(ByteBuffer.wrap(UUIDGenerator.getInstance().generateTimeBasedUUID(new
EthernetAddress(fauxMac)).toByteArray()));
         }
         catch (NoSuchAlgorithmException ex)
         {
@@ -55,24 +53,10 @@ public class UUIDGen
         }
     }
     
-    public static UUID makeType1UUID(DataInputStream in) throws IOException
-    {
-        byte[] b = new byte[16];
-        in.readFully(b);
-        return makeType1UUID(ByteBuffer.wrap(b));
-    }
-
     /** creates a type 1 uuid from raw bytes. */
-    public static UUID makeType1UUID(ByteBuffer raw)
+    public static UUID getUUID(ByteBuffer raw)
     {
-        long most = 0;
-        long least = 0;
-        assert raw.remaining() == 16;
-        for (int i = 0; i < 8; i++)
-            most = (most << 8) | (raw.array()[raw.position()+raw.arrayOffset() + i]
& 0xff);
-        for (int i =8 ; i < 16; i++)
-            least = (least << 8) | (raw.array()[raw.position()+raw.arrayOffset() +
i] & 0xff);
-        return new UUID(most, least);
+        return new UUID(raw.getLong(raw.position() + raw.arrayOffset()), raw.getLong(raw.position()
+ raw.arrayOffset() + 8));
     }
 
     /** decomposes a uuid into raw bytes. */

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=1035660&r1=1035659&r2=1035660&view=diff
==============================================================================
--- cassandra/trunk/test/unit/org/apache/cassandra/cli/CliTest.java (original)
+++ cassandra/trunk/test/unit/org/apache/cassandra/cli/CliTest.java Tue Nov 16 15:40:28 2010
@@ -125,7 +125,7 @@ public class CliTest extends CleanupHelp
             CliMain.processStatement(statement);
             String result = outStream.toString();
             // System.out.println("Result:\n" + result);
-            assertEquals("", errStream.toString());
+            assertEquals(errStream.toString() + " processing " + statement, "", errStream.toString());
             if (statement.startsWith("drop ") || statement.startsWith("create ") || statement.startsWith("update
"))
             {
                 assertTrue(result.matches("(.{8})-(.{4})-(.{4})-(.{4})-(.{12})\n"));

Modified: cassandra/trunk/test/unit/org/apache/cassandra/db/DefsTest.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/test/unit/org/apache/cassandra/db/DefsTest.java?rev=1035660&r1=1035659&r2=1035660&view=diff
==============================================================================
--- cassandra/trunk/test/unit/org/apache/cassandra/db/DefsTest.java (original)
+++ cassandra/trunk/test/unit/org/apache/cassandra/db/DefsTest.java Tue Nov 16 15:40:28 2010
@@ -24,7 +24,6 @@ import java.io.File;
 import java.io.IOException;
 import java.nio.ByteBuffer;
 import java.util.ArrayList;
-import java.util.Arrays;
 import java.util.Collection;
 import java.util.Collections;
 import java.util.List;
@@ -159,7 +158,7 @@ public class DefsTest extends CleanupHel
         int i = 0;
         for (IColumn col : serializedMigrations)
         {
-            UUID version = UUIDGen.makeType1UUID(col.name());
+            UUID version = UUIDGen.getUUID(col.name());
             reconstituded[i] = Migration.deserialize(col.value());
             assert version.equals(reconstituded[i].getVersion());
             i++;

Modified: cassandra/trunk/test/unit/org/apache/cassandra/db/marshal/TimeUUIDTypeTest.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/test/unit/org/apache/cassandra/db/marshal/TimeUUIDTypeTest.java?rev=1035660&r1=1035659&r2=1035660&view=diff
==============================================================================
--- cassandra/trunk/test/unit/org/apache/cassandra/db/marshal/TimeUUIDTypeTest.java (original)
+++ cassandra/trunk/test/unit/org/apache/cassandra/db/marshal/TimeUUIDTypeTest.java Tue Nov
16 15:40:28 2010
@@ -25,9 +25,7 @@ import java.util.Random;
 import org.junit.Test;
 import static org.junit.Assert.assertEquals;
 
-import org.apache.cassandra.CleanupHelper;
-import org.apache.cassandra.db.marshal.TimeUUIDType;
-
+import org.apache.cassandra.utils.UUIDGen;
 import org.safehaus.uuid.UUID;
 import org.safehaus.uuid.UUIDGenerator;
 
@@ -85,8 +83,8 @@ public class TimeUUIDTypeTest
         Arrays.sort(uuids, timeUUIDType);
         for (int i = 1; i < uuids.length; i++)
         {
-            long i0 = LexicalUUIDType.getUUID(uuids[i - 1]).timestamp();
-            long i1 = LexicalUUIDType.getUUID(uuids[i]).timestamp();
+            long i0 = UUIDGen.getUUID(uuids[i - 1]).timestamp();
+            long i1 = UUIDGen.getUUID(uuids[i]).timestamp();
             assert i0 <= i1;
         }
     }

Modified: cassandra/trunk/test/unit/org/apache/cassandra/utils/UUIDTests.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/test/unit/org/apache/cassandra/utils/UUIDTests.java?rev=1035660&r1=1035659&r2=1035660&view=diff
==============================================================================
--- cassandra/trunk/test/unit/org/apache/cassandra/utils/UUIDTests.java (original)
+++ cassandra/trunk/test/unit/org/apache/cassandra/utils/UUIDTests.java Tue Nov 16 15:40:28
2010
@@ -55,7 +55,7 @@ public class UUIDTests
     {
         UUID a = UUIDGen.makeType1UUIDFromHost(InetAddress.getByName("127.0.0.1"));
         byte[] decomposed = UUIDGen.decompose(a);
-        UUID b = UUIDGen.makeType1UUID(ByteBuffer.wrap(decomposed));
+        UUID b = UUIDGen.getUUID(ByteBuffer.wrap(decomposed));
         assert a.equals(b);
     }
 
@@ -67,7 +67,7 @@ public class UUIDTests
         ByteBuffer second = ByteBuffer.wrap(UUIDGen.decompose(UUIDGen.makeType1UUIDFromHost(InetAddress.getByName("127.0.0.1"))));
         assert comp.compare(first, second) < 0;
         assert comp.compare(second, first) > 0;
-        ByteBuffer sameAsFirst = ByteBuffer.wrap(UUIDGen.decompose(UUIDGen.makeType1UUID(first)));
+        ByteBuffer sameAsFirst = ByteBuffer.wrap(UUIDGen.decompose(UUIDGen.getUUID(first)));
         assert comp.compare(first, sameAsFirst) == 0;
     }
 



Mime
View raw message