cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gdusba...@apache.org
Subject svn commit: r934154 [2/3] - in /cassandra/trunk: src/java/org/apache/cassandra/avro/ src/java/org/apache/cassandra/client/ src/java/org/apache/cassandra/db/ src/java/org/apache/cassandra/db/filter/ src/java/org/apache/cassandra/db/migration/ src/java/o...
Date Wed, 14 Apr 2010 19:53:07 GMT
Modified: cassandra/trunk/src/java/org/apache/cassandra/service/StorageServiceMBean.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/src/java/org/apache/cassandra/service/StorageServiceMBean.java?rev=934154&r1=934153&r2=934154&view=diff
==============================================================================
--- cassandra/trunk/src/java/org/apache/cassandra/service/StorageServiceMBean.java (original)
+++ cassandra/trunk/src/java/org/apache/cassandra/service/StorageServiceMBean.java Wed Apr 14 19:53:06 2010
@@ -89,7 +89,7 @@ public interface StorageServiceMBean
      * @param key - key for which we need to find the endpoint return value -
      * the endpoint responsible for this key
      */
-    public List<InetAddress> getNaturalEndpoints(String key, String table);
+    public List<InetAddress> getNaturalEndpoints(String table, byte[] key);
 
     /**
      * Forces major compaction (all sstable files compacted)

Modified: cassandra/trunk/src/java/org/apache/cassandra/thrift/CassandraServer.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/src/java/org/apache/cassandra/thrift/CassandraServer.java?rev=934154&r1=934153&r2=934154&view=diff
==============================================================================
--- cassandra/trunk/src/java/org/apache/cassandra/thrift/CassandraServer.java (original)
+++ cassandra/trunk/src/java/org/apache/cassandra/thrift/CassandraServer.java Wed Apr 14 19:53:06 2010
@@ -52,6 +52,7 @@ import org.apache.cassandra.dht.Range;
 import org.apache.cassandra.dht.Token;
 import org.apache.cassandra.service.StorageProxy;
 import org.apache.cassandra.service.StorageService;
+import static org.apache.cassandra.utils.FBUtilities.UTF8;
 import org.apache.thrift.TException;
 
 public class CassandraServer implements Cassandra.Iface
@@ -83,11 +84,11 @@ public class CassandraServer implements 
         storageService = StorageService.instance;
     }
     
-    protected Map<String, ColumnFamily> readColumnFamily(List<ReadCommand> commands, ConsistencyLevel consistency_level)
+    protected Map<byte[], ColumnFamily> readColumnFamily(List<ReadCommand> commands, ConsistencyLevel consistency_level)
     throws InvalidRequestException, UnavailableException, TimedOutException
     {
         // TODO - Support multiple column families per row, right now row only contains 1 column family
-        Map<String, ColumnFamily> columnFamilyKeyMap = new HashMap<String,ColumnFamily>();
+        Map<byte[], ColumnFamily> columnFamilyKeyMap = new HashMap<byte[],ColumnFamily>();
 
         if (consistency_level == ConsistencyLevel.ZERO)
         {
@@ -118,7 +119,7 @@ public class CassandraServer implements 
 
         for (Row row: rows)
         {
-            columnFamilyKeyMap.put(row.key, row.cf);
+            columnFamilyKeyMap.put(row.key.key, row.cf);
         }
         return columnFamilyKeyMap;
     }
@@ -188,14 +189,15 @@ public class CassandraServer implements 
     private Map<String, List<ColumnOrSuperColumn>> getSlice(List<ReadCommand> commands, ConsistencyLevel consistency_level)
     throws InvalidRequestException, UnavailableException, TimedOutException
     {
-        Map<String, ColumnFamily> columnFamilies = readColumnFamily(commands, consistency_level);
+        Map<byte[], ColumnFamily> columnFamilies = readColumnFamily(commands, consistency_level);
         Map<String, List<ColumnOrSuperColumn>> columnFamiliesMap = new HashMap<String, List<ColumnOrSuperColumn>>();
         for (ReadCommand command: commands)
         {
             ColumnFamily cf = columnFamilies.get(command.key);
             boolean reverseOrder = command instanceof SliceFromReadCommand && ((SliceFromReadCommand)command).reversed;
             List<ColumnOrSuperColumn> thriftifiedColumns = thriftifyColumnFamily(cf, command.queryPath.superColumnName != null, reverseOrder);
-            columnFamiliesMap.put(command.key, thriftifiedColumns);
+            // FIXME: string keys
+            columnFamiliesMap.put(new String(command.key, UTF8), thriftifiedColumns);
         }
 
         return columnFamiliesMap;
@@ -253,7 +255,8 @@ public class CassandraServer implements 
             for (String key: keys)
             {
                 ThriftValidation.validateKey(key);
-                commands.add(new SliceByNamesReadCommand(keyspace, key, column_parent, predicate.column_names));
+                // FIXME: string keys
+                commands.add(new SliceByNamesReadCommand(keyspace, key.getBytes(UTF8), column_parent, predicate.column_names));
             }
         }
         else
@@ -262,7 +265,8 @@ public class CassandraServer implements 
             for (String key: keys)
             {
                 ThriftValidation.validateKey(key);
-                commands.add(new SliceFromReadCommand(keyspace, key, column_parent, range.start, range.finish, range.reversed, range.count));
+                // FIXME: string keys
+                commands.add(new SliceFromReadCommand(keyspace, key.getBytes(UTF8), column_parent, range.start, range.finish, range.reversed, range.count));
             }
         }
 
@@ -308,23 +312,27 @@ public class CassandraServer implements 
         for (String key: keys)
         {
             ThriftValidation.validateKey(key);
-            commands.add(new SliceByNamesReadCommand(table, key, path, nameAsList));
+            // FIXME: string keys
+            commands.add(new SliceByNamesReadCommand(table, key.getBytes(UTF8), path, nameAsList));
         }
 
         Map<String, ColumnOrSuperColumn> columnFamiliesMap = new HashMap<String, ColumnOrSuperColumn>();
-        Map<String, ColumnFamily> cfamilies = readColumnFamily(commands, consistency_level);
+        Map<byte[], ColumnFamily> cfamilies = readColumnFamily(commands, consistency_level);
+
 
         for (ReadCommand command: commands)
         {
             ColumnFamily cf = cfamilies.get(command.key);
+            // FIXME: string keys
+            String skey = new String(command.key, UTF8);
             if (cf == null)
             {
-                columnFamiliesMap.put(command.key, new ColumnOrSuperColumn());
+                columnFamiliesMap.put(skey, new ColumnOrSuperColumn());
             }
             else
             {
                 List<ColumnOrSuperColumn> tcolumns = thriftifyColumnFamily(cf, command.queryPath.superColumnName != null, false);
-                columnFamiliesMap.put(command.key, tcolumns.size() > 0 ? tcolumns.iterator().next() : new ColumnOrSuperColumn());
+                columnFamiliesMap.put(skey, tcolumns.size() > 0 ? tcolumns.iterator().next() : new ColumnOrSuperColumn());
             }
         }
 
@@ -355,7 +363,8 @@ public class CassandraServer implements 
         ThriftValidation.validateKey(key);
         ThriftValidation.validateColumnPath(table, column_path);
 
-        RowMutation rm = new RowMutation(table, key);
+        // FIXME: string keys
+        RowMutation rm = new RowMutation(table, key.getBytes(UTF8));
         try
         {
             rm.add(new QueryPath(column_path), value, timestamp);
@@ -385,7 +394,8 @@ public class CassandraServer implements 
             }
         }
 
-        doInsert(consistency_level, RowMutation.getRowMutation(keyspace, key, cfmap));
+        // FIXME: string keys
+        doInsert(consistency_level, RowMutation.getRowMutation(keyspace, key.getBytes(UTF8), cfmap));
     }
 
     public void batch_mutate(String keyspace, Map<String,Map<String,List<Mutation>>> mutation_map, ConsistencyLevel consistency_level)
@@ -430,7 +440,8 @@ public class CassandraServer implements 
                     ThriftValidation.validateMutation(keyspace, cfName, mutation);
                 }
             }
-            rowMutations.add(RowMutation.getRowMutationFromMutations(keyspace, key, columnFamilyToMutations));
+            // FIXME: string keys
+            rowMutations.add(RowMutation.getRowMutationFromMutations(keyspace, key.getBytes(UTF8), columnFamilyToMutations));
         }
         if (consistency_level == ConsistencyLevel.ZERO)
         {
@@ -460,7 +471,8 @@ public class CassandraServer implements 
         ThriftValidation.validateKey(key);
         ThriftValidation.validateColumnPathOrParent(table, column_path);
         
-        RowMutation rm = new RowMutation(table, key);
+        // FIXME: string keys
+        RowMutation rm = new RowMutation(table, key.getBytes(UTF8));
         rm.delete(new QueryPath(column_path), timestamp);
 
         doInsert(consistency_level, rm);
@@ -553,7 +565,8 @@ public class CassandraServer implements 
             }
             else
             {
-                bounds = new Bounds(p.getToken(range.start_key), p.getToken(range.end_key));
+                // FIXME: string keys
+                bounds = new Bounds(p.getToken(range.start_key.getBytes(UTF8)), p.getToken(range.end_key.getBytes(UTF8)));
             }
             rows = StorageProxy.getRangeSlice(new RangeSliceCommand(keyspace, column_parent, predicate, bounds, range.count), consistency_level);
             assert rows != null;
@@ -572,7 +585,8 @@ public class CassandraServer implements 
         for (Row row : rows)
         {
             List<ColumnOrSuperColumn> thriftifiedColumns = thriftifyColumnFamily(row.cf, column_parent.super_column != null, reversed);
-            keySlices.add(new KeySlice(row.key, thriftifiedColumns));
+            // FIXME: string keys
+            keySlices.add(new KeySlice(new String(row.key.key, UTF8), thriftifiedColumns));
         }
 
         return keySlices;

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=934154&r1=934153&r2=934154&view=diff
==============================================================================
--- cassandra/trunk/src/java/org/apache/cassandra/thrift/ThriftValidation.java (original)
+++ cassandra/trunk/src/java/org/apache/cassandra/thrift/ThriftValidation.java Wed Apr 14 19:53:06 2010
@@ -303,8 +303,9 @@ public class ThriftValidation
         if (range.start_key != null)
         {
             IPartitioner p = StorageService.getPartitioner();
-            Token startToken = p.decorateKey(range.start_key).token;
-            Token endToken = p.decorateKey(range.end_key).token;
+            // FIXME: string keys
+            Token startToken = p.getToken(range.start_key.getBytes(FBUtilities.UTF8));
+            Token endToken = p.getToken(range.end_key.getBytes(FBUtilities.UTF8));
             if (startToken.compareTo(endToken) > 0 && !endToken.equals(p.getMinimumToken()))
             {
                 if (p instanceof RandomPartitioner)

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=934154&r1=934153&r2=934154&view=diff
==============================================================================
--- cassandra/trunk/src/java/org/apache/cassandra/tools/NodeProbe.java (original)
+++ cassandra/trunk/src/java/org/apache/cassandra/tools/NodeProbe.java Wed Apr 14 19:53:06 2010
@@ -48,6 +48,7 @@ import org.apache.cassandra.dht.Range;
 import org.apache.cassandra.service.StorageServiceMBean;
 import org.apache.cassandra.streaming.StreamingService;
 import org.apache.cassandra.streaming.StreamingServiceMBean;
+import static org.apache.cassandra.utils.FBUtilities.UTF8;
 
 /**
  * JMX client operations for Cassandra.
@@ -402,7 +403,8 @@ public class NodeProbe
 
     public List<InetAddress> getEndPoints(String keyspace, String key)
     {
-        return ssProxy.getNaturalEndpoints(keyspace, key);
+        // FIXME: string key
+        return ssProxy.getNaturalEndpoints(keyspace, key.getBytes(UTF8));
     }
 
     public Set<InetAddress> getStreamDestinations()

Modified: cassandra/trunk/src/java/org/apache/cassandra/tools/SSTableExport.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/src/java/org/apache/cassandra/tools/SSTableExport.java?rev=934154&r1=934153&r2=934154&view=diff
==============================================================================
--- cassandra/trunk/src/java/org/apache/cassandra/tools/SSTableExport.java (original)
+++ cassandra/trunk/src/java/org/apache/cassandra/tools/SSTableExport.java Wed Apr 14 19:53:06 2010
@@ -38,6 +38,7 @@ import org.apache.cassandra.service.Stor
 import org.apache.cassandra.utils.FBUtilities;
 
 import static org.apache.cassandra.utils.FBUtilities.bytesToHex;
+import static org.apache.cassandra.utils.FBUtilities.UTF8;
 import org.apache.commons.cli.*;
 
 /**
@@ -212,7 +213,8 @@ public class SSTableExport
         {
             if (excludeSet.contains(key))
                 continue;
-            DecoratedKey<?> dk = partitioner.decorateKey(key);
+            // FIXME: assuming string keys
+            DecoratedKey<?> dk = partitioner.decorateKey(key.getBytes(UTF8));
             scanner.seekTo(dk);
             
             i++;

Modified: cassandra/trunk/src/java/org/apache/cassandra/tools/SSTableImport.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/src/java/org/apache/cassandra/tools/SSTableImport.java?rev=934154&r1=934153&r2=934154&view=diff
==============================================================================
--- cassandra/trunk/src/java/org/apache/cassandra/tools/SSTableImport.java (original)
+++ cassandra/trunk/src/java/org/apache/cassandra/tools/SSTableImport.java Wed Apr 14 19:53:06 2010
@@ -31,6 +31,7 @@ import org.apache.cassandra.io.util.Data
 import org.apache.cassandra.io.sstable.SSTableWriter;
 import org.apache.cassandra.utils.FBUtilities;
 import static org.apache.cassandra.utils.FBUtilities.hexToBytes;
+import static org.apache.cassandra.utils.FBUtilities.UTF8;
 import org.apache.commons.cli.*;
 import org.json.simple.JSONArray;
 import org.json.simple.JSONObject;
@@ -153,7 +154,8 @@ public class SSTableImport
             List<DecoratedKey<?>> decoratedKeys = new ArrayList<DecoratedKey<?>>();
             
             for (String key : (Set<String>)json.keySet())
-                decoratedKeys.add(partitioner.decorateKey(key));
+                // FIXME: assuming string keys
+                decoratedKeys.add(partitioner.decorateKey(key.getBytes(UTF8)));
             Collections.sort(decoratedKeys);
 
             for (DecoratedKey<?> rowKey : decoratedKeys)

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=934154&r1=934153&r2=934154&view=diff
==============================================================================
--- cassandra/trunk/src/java/org/apache/cassandra/utils/FBUtilities.java (original)
+++ cassandra/trunk/src/java/org/apache/cassandra/utils/FBUtilities.java Wed Apr 14 19:53:06 2010
@@ -236,9 +236,9 @@ public class FBUtilities
         return out;
     }
 
-    public static BigInteger hash(String data)
+    public static BigInteger md5hash(byte[] data)
     {
-        byte[] result = hash("MD5", data.getBytes());
+        byte[] result = hash("MD5", data);
         BigInteger hash = new BigInteger(result);
         return hash.abs();        
     }

Modified: cassandra/trunk/test/unit/org/apache/cassandra/Util.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/test/unit/org/apache/cassandra/Util.java?rev=934154&r1=934153&r2=934154&view=diff
==============================================================================
--- cassandra/trunk/test/unit/org/apache/cassandra/Util.java (original)
+++ cassandra/trunk/test/unit/org/apache/cassandra/Util.java Wed Apr 14 19:53:06 2010
@@ -32,19 +32,28 @@ import org.apache.commons.lang.ArrayUtil
 
 import org.apache.cassandra.db.*;
 import org.apache.cassandra.db.filter.QueryPath;
-import org.apache.cassandra.dht.Bounds;
-import org.apache.cassandra.dht.Range;
-import org.apache.cassandra.dht.Token;
+import org.apache.cassandra.dht.*;
 import org.apache.cassandra.service.StorageService;
 import org.apache.cassandra.thrift.SliceRange;
+import static org.apache.cassandra.utils.FBUtilities.UTF8;
 
 public class Util
 {
+    public static DecoratedKey dk(String key)
+    {
+        return StorageService.getPartitioner().decorateKey(key.getBytes(UTF8));
+    }
+
     public static Column column(String name, String value, long timestamp)
     {
         return new Column(name.getBytes(), value.getBytes(), timestamp);
     }
 
+    public static Range range(IPartitioner p, String left, String right)
+    {
+        return new Range(p.getToken(left.getBytes()), p.getToken(right.getBytes()));
+    }
+
     public static void addMutation(RowMutation rm, String columnFamilyName, String superColumnName, long columnName, String value, long timestamp)
     {
         rm.add(new QueryPath(columnFamilyName, superColumnName.getBytes(), getBytes(columnName)), value.getBytes(), timestamp);
@@ -92,6 +101,11 @@ public class Util
     
     public static ColumnFamily getColumnFamily(Table table, String key, String cfName) throws IOException
     {
+        return getColumnFamily(table, dk(key), cfName);
+    }
+
+    public static ColumnFamily getColumnFamily(Table table, DecoratedKey key, String cfName) throws IOException
+    {
         ColumnFamilyStore cfStore = table.getColumnFamilyStore(cfName);
         assert cfStore != null : "Column family " + cfName + " has not been defined";
         return cfStore.getColumnFamily(QueryFilter.getIdentityFilter(key, new QueryPath(cfName)));

Modified: cassandra/trunk/test/unit/org/apache/cassandra/client/TestRingCache.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/test/unit/org/apache/cassandra/client/TestRingCache.java?rev=934154&r1=934153&r2=934154&view=diff
==============================================================================
--- cassandra/trunk/test/unit/org/apache/cassandra/client/TestRingCache.java (original)
+++ cassandra/trunk/test/unit/org/apache/cassandra/client/TestRingCache.java Wed Apr 14 19:53:06 2010
@@ -90,7 +90,7 @@ public class TestRingCache
             String row = rowPrefix + nRows;
             ColumnPath col = new ColumnPath("Standard1").setSuper_column(null).setColumn("col1".getBytes());
 
-            List<InetAddress> endPoints = tester.ringCache.getEndPoint(row);
+            List<InetAddress> endPoints = tester.ringCache.getEndPoint(row.getBytes());
             String hosts="";
             for (int i = 0; i < endPoints.size(); i++)
                 hosts = hosts + ((i > 0) ? "," : "") + endPoints.get(i);

Modified: cassandra/trunk/test/unit/org/apache/cassandra/db/ColumnFamilyStoreTest.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/test/unit/org/apache/cassandra/db/ColumnFamilyStoreTest.java?rev=934154&r1=934153&r2=934154&view=diff
==============================================================================
--- cassandra/trunk/test/unit/org/apache/cassandra/db/ColumnFamilyStoreTest.java (original)
+++ cassandra/trunk/test/unit/org/apache/cassandra/db/ColumnFamilyStoreTest.java Wed Apr 14 19:53:06 2010
@@ -57,7 +57,7 @@ public class ColumnFamilyStoreTest exten
     {
         List<RowMutation> rms = new LinkedList<RowMutation>();
         RowMutation rm;
-        rm = new RowMutation("Keyspace1", "key1");
+        rm = new RowMutation("Keyspace1", "key1".getBytes());
         rm.add(new QueryPath("Standard1", null, "Column1".getBytes()), "asdf".getBytes(), 0);
         rm.add(new QueryPath("Standard1", null, "Column2".getBytes()), "asdf".getBytes(), 0);
         rms.add(rm);
@@ -67,7 +67,7 @@ public class ColumnFamilyStoreTest exten
         List<SSTableReader> ssTables = table.getAllSSTablesOnDisk();
         assertEquals(1, ssTables.size());
         ssTables.get(0).forceFilterFailures();
-        ColumnFamily cf = store.getColumnFamily(QueryFilter.getIdentityFilter("key2", new QueryPath("Standard1", null, "Column1".getBytes())));
+        ColumnFamily cf = store.getColumnFamily(QueryFilter.getIdentityFilter(Util.dk("key2"), new QueryPath("Standard1", null, "Column1".getBytes())));
         assertNull(cf);
     }
 
@@ -78,7 +78,7 @@ public class ColumnFamilyStoreTest exten
         final ColumnFamilyStore store = table.getColumnFamilyStore("Standard2");
         RowMutation rm;
 
-        rm = new RowMutation("Keyspace1", "key1");
+        rm = new RowMutation("Keyspace1", "key1".getBytes());
         rm.delete(new QueryPath("Standard2", null, null), System.currentTimeMillis());
         rm.apply();
 
@@ -86,9 +86,9 @@ public class ColumnFamilyStoreTest exten
         {
             public void runMayThrow() throws IOException
             {
-                QueryFilter sliceFilter = QueryFilter.getSliceFilter("key1", new QueryPath("Standard2", null, null), ArrayUtils.EMPTY_BYTE_ARRAY, ArrayUtils.EMPTY_BYTE_ARRAY, null, false, 1);
+                QueryFilter sliceFilter = QueryFilter.getSliceFilter(Util.dk("key1"), new QueryPath("Standard2", null, null), ArrayUtils.EMPTY_BYTE_ARRAY, ArrayUtils.EMPTY_BYTE_ARRAY, null, false, 1);
                 assertNull(store.getColumnFamily(sliceFilter));
-                QueryFilter namesFilter = QueryFilter.getNamesFilter("key1", new QueryPath("Standard2", null, null), "a".getBytes());
+                QueryFilter namesFilter = QueryFilter.getNamesFilter(Util.dk("key1"), new QueryPath("Standard2", null, null), "a".getBytes());
                 assertNull(store.getColumnFamily(namesFilter));
             }
         };
@@ -106,7 +106,7 @@ public class ColumnFamilyStoreTest exten
         for (int j = 0; j < insertsPerTable; j++)
         {
             String key = String.valueOf(j);
-            RowMutation rm = new RowMutation("Keyspace1", key);
+            RowMutation rm = new RowMutation("Keyspace1", key.getBytes());
             rm.add(new QueryPath(columnFamilyName, null, "0".getBytes()), new byte[0], j);
             rms.add(rm);
         }
@@ -114,7 +114,7 @@ public class ColumnFamilyStoreTest exten
 
         List<Range> ranges  = new ArrayList<Range>();
         IPartitioner partitioner = new CollatingOrderPreservingPartitioner();
-        Range r = new Range(partitioner.getToken("0"), partitioner.getToken("zzzzzzz"));
+        Range r = Util.range(partitioner, "0", "zzzzzzz");
         ranges.add(r);
 
         List<SSTableReader> fileList = CompactionManager.instance.submitAnticompaction(store, ranges, InetAddress.getByName("127.0.0.1")).get();
@@ -134,7 +134,7 @@ public class ColumnFamilyStoreTest exten
 
         IPartitioner p = StorageService.getPartitioner();
         RangeSliceReply result = cfs.getRangeSlice(ArrayUtils.EMPTY_BYTE_ARRAY,
-                                                   new Range(p.getToken("key15"), p.getToken("key1")),
+                                                   Util.range(p, "key15", "key1"),
                                                    10,
                                                    null,
                                                    Arrays.asList("asdf".getBytes()));
@@ -148,24 +148,24 @@ public class ColumnFamilyStoreTest exten
 
         IPartitioner p = StorageService.getPartitioner();
         RangeSliceReply result = cfs.getRangeSlice(ArrayUtils.EMPTY_BYTE_ARRAY,
-                                                   new Range(p.getToken("key1"), p.getToken("key2")),
+                                                   Util.range(p, "key1", "key2"),
                                                    10,
                                                    null,
                                                    Arrays.asList("asdf".getBytes()));
         assertEquals(1, result.rows.size());
-        assert result.rows.get(0).key.equals("key2");
+        assert Arrays.equals(result.rows.get(0).key.key, "key2".getBytes());
     }
 
     private ColumnFamilyStore insertKey1Key2() throws IOException, ExecutionException, InterruptedException
     {
         List<RowMutation> rms = new LinkedList<RowMutation>();
         RowMutation rm;
-        rm = new RowMutation("Keyspace2", "key1");
+        rm = new RowMutation("Keyspace2", "key1".getBytes());
         rm.add(new QueryPath("Standard1", null, "Column1".getBytes()), "asdf".getBytes(), 0);
         rms.add(rm);
         Util.writeColumnFamily(rms);
 
-        rm = new RowMutation("Keyspace2", "key2");
+        rm = new RowMutation("Keyspace2", "key2".getBytes());
         rm.add(new QueryPath("Standard1", null, "Column1".getBytes()), "asdf".getBytes(), 0);
         rms.add(rm);
         return Util.writeColumnFamily(rms);

Modified: cassandra/trunk/test/unit/org/apache/cassandra/db/CommitLogTest.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/test/unit/org/apache/cassandra/db/CommitLogTest.java?rev=934154&r1=934153&r2=934154&view=diff
==============================================================================
--- cassandra/trunk/test/unit/org/apache/cassandra/db/CommitLogTest.java (original)
+++ cassandra/trunk/test/unit/org/apache/cassandra/db/CommitLogTest.java Wed Apr 14 19:53:06 2010
@@ -44,7 +44,7 @@ public class CommitLogTest extends Clean
         // add data.  use relatively large values to force quick segment creation since we have a low flush threshold in the test config.
         for (int i = 0; i < 10; i++)
         {
-            rm = new RowMutation("Keyspace1", "key1");
+            rm = new RowMutation("Keyspace1", "key1".getBytes());
             rm.add(new QueryPath("Standard1", null, "Column1".getBytes()), value, 0);
             rm.add(new QueryPath("Standard2", null, "Column1".getBytes()), value, 0);
             rm.apply();

Modified: cassandra/trunk/test/unit/org/apache/cassandra/db/CompactionsPurgeTest.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/test/unit/org/apache/cassandra/db/CompactionsPurgeTest.java?rev=934154&r1=934153&r2=934154&view=diff
==============================================================================
--- cassandra/trunk/test/unit/org/apache/cassandra/db/CompactionsPurgeTest.java (original)
+++ cassandra/trunk/test/unit/org/apache/cassandra/db/CompactionsPurgeTest.java Wed Apr 14 19:53:06 2010
@@ -34,6 +34,7 @@ import org.apache.cassandra.db.filter.Qu
 import org.apache.cassandra.db.filter.QueryPath;
 import org.apache.cassandra.io.sstable.SSTableReader;
 import org.apache.cassandra.utils.FBUtilities;
+import org.apache.cassandra.Util;
 
 import static junit.framework.Assert.assertEquals;
 import static org.apache.cassandra.db.TableTest.assertColumns;
@@ -51,11 +52,11 @@ public class CompactionsPurgeTest extend
         String cfName = "Standard1";
         ColumnFamilyStore cfs = table.getColumnFamilyStore(cfName);
 
-        String key = "key1";
+        DecoratedKey key = Util.dk("key1");
         RowMutation rm;
 
         // inserts
-        rm = new RowMutation(TABLE1, key);
+        rm = new RowMutation(TABLE1, key.key);
         for (int i = 0; i < 10; i++)
         {
             rm.add(new QueryPath(cfName, null, String.valueOf(i).getBytes()), new byte[0], 0);
@@ -66,21 +67,21 @@ public class CompactionsPurgeTest extend
         // deletes
         for (int i = 0; i < 10; i++)
         {
-            rm = new RowMutation(TABLE1, key);
+            rm = new RowMutation(TABLE1, key.key);
             rm.delete(new QueryPath(cfName, null, String.valueOf(i).getBytes()), 1);
             rm.apply();
         }
         cfs.forceBlockingFlush();
 
         // resurrect one column
-        rm = new RowMutation(TABLE1, key);
+        rm = new RowMutation(TABLE1, key.key);
         rm.add(new QueryPath(cfName, null, String.valueOf(5).getBytes()), new byte[0], 2);
         rm.apply();
         cfs.forceBlockingFlush();
 
         // verify that non-major compaction does no GC to ensure correctness (see CASSANDRA-604)
         Collection<SSTableReader> sstablesIncomplete = cfs.getSSTables();
-        rm = new RowMutation(TABLE1, key + "x");
+        rm = new RowMutation(TABLE1, Util.dk("blah").key);
         rm.add(new QueryPath(cfName, null, "0".getBytes()), new byte[0], 0);
         rm.apply();
         cfs.forceBlockingFlush();
@@ -105,11 +106,11 @@ public class CompactionsPurgeTest extend
         String cfName = "Standard2";
         ColumnFamilyStore store = table.getColumnFamilyStore(cfName);
 
-        String key = "key1";
+        DecoratedKey key = Util.dk("key1");
         RowMutation rm;
 
         // inserts
-        rm = new RowMutation(TABLE1, key);
+        rm = new RowMutation(TABLE1, key.key);
         for (int i = 0; i < 5; i++)
         {
             rm.add(new QueryPath(cfName, null, String.valueOf(i).getBytes()), new byte[0], 0);
@@ -119,7 +120,7 @@ public class CompactionsPurgeTest extend
         // deletes
         for (int i = 0; i < 5; i++)
         {
-            rm = new RowMutation(TABLE1, key);
+            rm = new RowMutation(TABLE1, key.key);
             rm.delete(new QueryPath(cfName, null, String.valueOf(i).getBytes()), 1);
             rm.apply();
         }

Modified: cassandra/trunk/test/unit/org/apache/cassandra/db/CompactionsTest.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/test/unit/org/apache/cassandra/db/CompactionsTest.java?rev=934154&r1=934153&r2=934154&view=diff
==============================================================================
--- cassandra/trunk/test/unit/org/apache/cassandra/db/CompactionsTest.java (original)
+++ cassandra/trunk/test/unit/org/apache/cassandra/db/CompactionsTest.java Wed Apr 14 19:53:06 2010
@@ -52,17 +52,17 @@ public class CompactionsTest extends Cle
         ColumnFamilyStore store = table.getColumnFamilyStore("Standard1");
 
         final int ROWS_PER_SSTABLE = 10;
-        Set<String> inserted = new HashSet<String>();
+        Set<DecoratedKey> inserted = new HashSet<DecoratedKey>();
         for (int j = 0; j < (SSTableReader.indexInterval() * 3) / ROWS_PER_SSTABLE; j++) {
             for (int i = 0; i < ROWS_PER_SSTABLE; i++) {
-                String key = String.valueOf(i % 2);
-                RowMutation rm = new RowMutation(TABLE1, key);
+                DecoratedKey key = Util.dk(String.valueOf(i % 2));
+                RowMutation rm = new RowMutation(TABLE1, key.key);
                 rm.add(new QueryPath("Standard1", null, String.valueOf(i / 2).getBytes()), new byte[0], j * ROWS_PER_SSTABLE + i);
                 rm.apply();
                 inserted.add(key);
             }
             store.forceBlockingFlush();
-            assertEquals(inserted.size(), Util.getRangeSlice(store).rows.size());
+            assertEquals(inserted.toString(), inserted.size(), Util.getRangeSlice(store).rows.size());
         }
         while (true)
         {
@@ -86,23 +86,19 @@ public class CompactionsTest extends Cle
         ColumnFamilyStore store = table.getColumnFamilyStore("Standard1");
 
         final int ROWS_PER_SSTABLE = 10;
-        Set<String> inserted = new HashSet<String>();
         for (int j = 0; j < (SSTableReader.indexInterval() * 3) / ROWS_PER_SSTABLE; j++) {
             for (int i = 0; i < ROWS_PER_SSTABLE; i++) {
-                String key = String.valueOf(i % 2);
+                byte[] key = String.valueOf(i % 2).getBytes();
                 RowMutation rm = new RowMutation(TABLE2, key);
                 rm.add(new QueryPath("Standard1", null, String.valueOf(i / 2).getBytes()), new byte[0], j * ROWS_PER_SSTABLE + i);
                 rm.apply();
-                inserted.add(key);
             }
             store.forceBlockingFlush();
-            assertEquals(inserted.size(), Util.getRangeSlice(store).rows.size());
         }
 
         // perform readonly compaction and confirm that no sstables changed
         ArrayList<SSTableReader> oldsstables = new ArrayList<SSTableReader>(store.getSSTables());
         CompactionManager.instance.submitReadonly(store, LOCAL).get();
         assertEquals(oldsstables, new ArrayList<SSTableReader>(store.getSSTables()));
-        assertEquals(inserted.size(), Util.getRangeSlice(store).rows.size());
     }
 }

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=934154&r1=934153&r2=934154&view=diff
==============================================================================
--- cassandra/trunk/test/unit/org/apache/cassandra/db/DefsTest.java (original)
+++ cassandra/trunk/test/unit/org/apache/cassandra/db/DefsTest.java Wed Apr 14 19:53:06 2010
@@ -19,6 +19,8 @@
 package org.apache.cassandra.db;
 
 import org.apache.cassandra.CleanupHelper;
+import org.apache.cassandra.Util;
+
 import org.apache.cassandra.config.CFMetaData;
 import org.apache.cassandra.config.ConfigurationException;
 import org.apache.cassandra.config.DatabaseDescriptor;
@@ -174,14 +176,15 @@ public class DefsTest extends CleanupHel
         assert DatabaseDescriptor.getTableDefinition(ks).cfMetaData().get(newCf.cfName).equals(newCf);
 
         // now read and write to it.
-        RowMutation rm = new RowMutation(ks, "key0");
+        DecoratedKey dk = Util.dk("key0");
+        RowMutation rm = new RowMutation(ks, dk.key);
         rm.add(new QueryPath(cf, null, "col0".getBytes()), "value0".getBytes(), 1L);
         rm.apply();
         ColumnFamilyStore store = Table.open(ks).getColumnFamilyStore(cf);
         assert store != null;
         store.forceBlockingFlush();
         
-        ColumnFamily cfam = store.getColumnFamily(QueryFilter.getNamesFilter("key0", new QueryPath(cf), "col0".getBytes()));
+        ColumnFamily cfam = store.getColumnFamily(QueryFilter.getNamesFilter(dk, new QueryPath(cf), "col0".getBytes()));
         assert cfam.getColumn("col0".getBytes()) != null;
         IColumn col = cfam.getColumn("col0".getBytes());
         assert Arrays.equals("value0".getBytes(), col.value());
@@ -190,6 +193,7 @@ public class DefsTest extends CleanupHel
     @Test
     public void dropCf() throws ConfigurationException, IOException, ExecutionException, InterruptedException
     {
+        DecoratedKey dk = Util.dk("dropCf");
         // sanity
         final KSMetaData ks = DatabaseDescriptor.getTableDefinition("Keyspace1");
         assert ks != null;
@@ -197,7 +201,7 @@ public class DefsTest extends CleanupHel
         assert cfm != null;
         
         // write some data, force a flush, then verify that files exist on disk.
-        RowMutation rm = new RowMutation(ks.name, "dropCf");
+        RowMutation rm = new RowMutation(ks.name, dk.key);
         for (int i = 0; i < 100; i++)
             rm.add(new QueryPath(cfm.cfName, null, ("col" + i).getBytes()), "anyvalue".getBytes(), 1L);
         rm.apply();
@@ -212,7 +216,7 @@ public class DefsTest extends CleanupHel
         assert !DatabaseDescriptor.getTableDefinition(ks.name).cfMetaData().containsKey(cfm.cfName);
         
         // any write should fail.
-        rm = new RowMutation(ks.name, "dropCf");
+        rm = new RowMutation(ks.name, dk.key);
         try
         {
             rm.add(new QueryPath("Standard1", null, "col0".getBytes()), "value0".getBytes(), 1L);
@@ -231,13 +235,14 @@ public class DefsTest extends CleanupHel
     @Test
     public void renameCf() throws ConfigurationException, IOException, ExecutionException, InterruptedException
     {
+        DecoratedKey dk = Util.dk("key0");
         final KSMetaData ks = DatabaseDescriptor.getTableDefinition("Keyspace2");
         assert ks != null;
         final CFMetaData oldCfm = ks.cfMetaData().get("Standard1");
         assert oldCfm != null;
         
         // write some data, force a flush, then verify that files exist on disk.
-        RowMutation rm = new RowMutation(ks.name, "key0");
+        RowMutation rm = new RowMutation(ks.name, dk.key);
         for (int i = 0; i < 100; i++)
             rm.add(new QueryPath(oldCfm.cfName, null, ("col" + i).getBytes()), "anyvalue".getBytes(), 1L);
         rm.apply();
@@ -259,16 +264,16 @@ public class DefsTest extends CleanupHel
         // do some reads.
         store = Table.open(oldCfm.tableName).getColumnFamilyStore(cfName);
         assert store != null;
-        ColumnFamily cfam = store.getColumnFamily(QueryFilter.getSliceFilter("key0", new QueryPath(cfName), "".getBytes(), "".getBytes(), null, false, 1000));
+        ColumnFamily cfam = store.getColumnFamily(QueryFilter.getSliceFilter(dk, new QueryPath(cfName), "".getBytes(), "".getBytes(), null, false, 1000));
         assert cfam.getSortedColumns().size() == 100; // should be good enough?
         
         // do some writes
-        rm = new RowMutation(ks.name, "key0");
+        rm = new RowMutation(ks.name, dk.key);
         rm.add(new QueryPath(cfName, null, "col5".getBytes()), "updated".getBytes(), 2L);
         rm.apply();
         store.forceBlockingFlush();
         
-        cfam = store.getColumnFamily(QueryFilter.getNamesFilter("key0", new QueryPath(cfName), "col5".getBytes()));
+        cfam = store.getColumnFamily(QueryFilter.getNamesFilter(dk, new QueryPath(cfName), "col5".getBytes()));
         assert cfam.getColumnCount() == 1;
         assert Arrays.equals(cfam.getColumn("col5".getBytes()).value(), "updated".getBytes());
     }
@@ -276,6 +281,7 @@ public class DefsTest extends CleanupHel
     @Test
     public void addNewKS() throws ConfigurationException, IOException, ExecutionException, InterruptedException
     {
+        DecoratedKey dk = Util.dk("key0");
         CFMetaData newCf = new CFMetaData("NewKeyspace1", "AddedStandard1", "Standard", new UTF8Type(), null, "A new cf for a new ks", 0, 0);
         KSMetaData newKs = new KSMetaData(newCf.tableName, RackAwareStrategy.class, 5, new EndPointSnitch(), newCf);
         
@@ -287,14 +293,14 @@ public class DefsTest extends CleanupHel
         assert DatabaseDescriptor.getTableDefinition(newCf.tableName) == newKs;
 
         // test reads and writes.
-        RowMutation rm = new RowMutation(newCf.tableName, "key0");
+        RowMutation rm = new RowMutation(newCf.tableName, dk.key);
         rm.add(new QueryPath(newCf.cfName, null, "col0".getBytes()), "value0".getBytes(), 1L);
         rm.apply();
         ColumnFamilyStore store = Table.open(newCf.tableName).getColumnFamilyStore(newCf.cfName);
         assert store != null;
         store.forceBlockingFlush();
         
-        ColumnFamily cfam = store.getColumnFamily(QueryFilter.getNamesFilter("key0", new QueryPath(newCf.cfName), "col0".getBytes()));
+        ColumnFamily cfam = store.getColumnFamily(QueryFilter.getNamesFilter(dk, new QueryPath(newCf.cfName), "col0".getBytes()));
         assert cfam.getColumn("col0".getBytes()) != null;
         IColumn col = cfam.getColumn("col0".getBytes());
         assert Arrays.equals("value0".getBytes(), col.value());
@@ -303,6 +309,7 @@ public class DefsTest extends CleanupHel
     @Test
     public void dropKS() throws ConfigurationException, IOException, ExecutionException, InterruptedException
     {
+        DecoratedKey dk = Util.dk("dropKs");
         // sanity
         final KSMetaData ks = DatabaseDescriptor.getTableDefinition("Keyspace1");
         assert ks != null;
@@ -310,7 +317,7 @@ public class DefsTest extends CleanupHel
         assert cfm != null;
         
         // write some data, force a flush, then verify that files exist on disk.
-        RowMutation rm = new RowMutation(ks.name, "dropKs");
+        RowMutation rm = new RowMutation(ks.name, dk.key);
         for (int i = 0; i < 100; i++)
             rm.add(new QueryPath(cfm.cfName, null, ("col" + i).getBytes()), "anyvalue".getBytes(), 1L);
         rm.apply();
@@ -324,7 +331,7 @@ public class DefsTest extends CleanupHel
         assert DatabaseDescriptor.getTableDefinition(ks.name) == null;
         
         // write should fail.
-        rm = new RowMutation(ks.name, "dropKs");
+        rm = new RowMutation(ks.name, dk.key);
         try
         {
             rm.add(new QueryPath("Standard1", null, "col0".getBytes()), "value0".getBytes(), 1L);
@@ -351,6 +358,7 @@ public class DefsTest extends CleanupHel
     @Test
     public void renameKs() throws ConfigurationException, IOException, ExecutionException, InterruptedException
     {
+        DecoratedKey dk = Util.dk("renameKs");
         final KSMetaData oldKs = DatabaseDescriptor.getTableDefinition("Keyspace2");
         assert oldKs != null;
         final String cfName = "Standard3";
@@ -358,7 +366,7 @@ public class DefsTest extends CleanupHel
         assert oldKs.cfMetaData().get(cfName).tableName.equals(oldKs.name);
         
         // write some data that we hope to read back later.
-        RowMutation rm = new RowMutation(oldKs.name, "renameKs");
+        RowMutation rm = new RowMutation(oldKs.name, dk.key);
         for (int i = 0; i < 10; i++)
             rm.add(new QueryPath(cfName, null, ("col" + i).getBytes()), "value".getBytes(), 1L);
         rm.apply();
@@ -390,7 +398,7 @@ public class DefsTest extends CleanupHel
         }
         
         // write on old should fail.
-        rm = new RowMutation(oldKs.name, "any key will do");
+        rm = new RowMutation(oldKs.name, "any key will do".getBytes());
         try
         {
             rm.add(new QueryPath(cfName, null, "col0".getBytes()), "value0".getBytes(), 1L);
@@ -403,7 +411,7 @@ public class DefsTest extends CleanupHel
         }
         
         // write on new should work.
-        rm = new RowMutation(newKsName, "renameKs");
+        rm = new RowMutation(newKsName, dk.key);
         rm.add(new QueryPath(cfName, null, "col0".getBytes()), "newvalue".getBytes(), 2L);
         rm.apply();
         store = Table.open(newKs.name).getColumnFamilyStore(cfName);
@@ -414,7 +422,7 @@ public class DefsTest extends CleanupHel
         SortedSet<byte[]> cols = new TreeSet<byte[]>(new BytesType());
         cols.add("col0".getBytes());
         cols.add("col1".getBytes());
-        ColumnFamily cfam = store.getColumnFamily(QueryFilter.getNamesFilter("renameKs", new QueryPath(cfName), cols));
+        ColumnFamily cfam = store.getColumnFamily(QueryFilter.getNamesFilter(dk, new QueryPath(cfName), cols));
         assert cfam.getColumnCount() == cols.size();
         // tests new write.
         assert Arrays.equals(cfam.getColumn("col0".getBytes()).value(), "newvalue".getBytes());

Modified: cassandra/trunk/test/unit/org/apache/cassandra/db/MultitableTest.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/test/unit/org/apache/cassandra/db/MultitableTest.java?rev=934154&r1=934153&r2=934154&view=diff
==============================================================================
--- cassandra/trunk/test/unit/org/apache/cassandra/db/MultitableTest.java (original)
+++ cassandra/trunk/test/unit/org/apache/cassandra/db/MultitableTest.java Wed Apr 14 19:53:06 2010
@@ -29,6 +29,7 @@ import org.junit.Test;
 
 import static org.apache.cassandra.db.TableTest.assertColumns;
 import org.apache.cassandra.CleanupHelper;
+import org.apache.cassandra.Util;
 import static org.apache.cassandra.Util.column;
 
 public class MultitableTest extends CleanupHelper
@@ -40,15 +41,16 @@ public class MultitableTest extends Clea
         Table table2 = Table.open("Keyspace2");
 
         RowMutation rm;
+        DecoratedKey dk = Util.dk("keymulti");
         ColumnFamily cf;
 
-        rm = new RowMutation("Keyspace1", "keymulti");
+        rm = new RowMutation("Keyspace1", dk.key);
         cf = ColumnFamily.create("Keyspace1", "Standard1");
         cf.addColumn(column("col1", "val1", 1L));
         rm.add(cf);
         rm.apply();
 
-        rm = new RowMutation("Keyspace2", "keymulti");
+        rm = new RowMutation("Keyspace2", dk.key);
         cf = ColumnFamily.create("Keyspace2", "Standard1");
         cf.addColumn(column("col2", "val2", 1L));
         rm.add(cf);
@@ -57,7 +59,7 @@ public class MultitableTest extends Clea
         table1.getColumnFamilyStore("Standard1").forceBlockingFlush();
         table2.getColumnFamilyStore("Standard1").forceBlockingFlush();
 
-        assertColumns(Util.getColumnFamily(table1, "keymulti", "Standard1"), "col1");
-        assertColumns(Util.getColumnFamily(table2, "keymulti", "Standard1"), "col2");
+        assertColumns(Util.getColumnFamily(table1, dk, "Standard1"), "col1");
+        assertColumns(Util.getColumnFamily(table2, dk, "Standard1"), "col2");
     }
 }

Modified: cassandra/trunk/test/unit/org/apache/cassandra/db/NameSortTest.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/test/unit/org/apache/cassandra/db/NameSortTest.java?rev=934154&r1=934153&r2=934154&view=diff
==============================================================================
--- cassandra/trunk/test/unit/org/apache/cassandra/db/NameSortTest.java (original)
+++ cassandra/trunk/test/unit/org/apache/cassandra/db/NameSortTest.java Wed Apr 14 19:53:06 2010
@@ -28,7 +28,9 @@ import org.apache.cassandra.Util;
 import org.junit.Test;
 
 import org.apache.cassandra.CleanupHelper;
+import org.apache.cassandra.Util;
 import static org.apache.cassandra.Util.addMutation;
+
 import org.apache.cassandra.db.filter.QueryPath;
 
 import static junit.framework.Assert.assertEquals;
@@ -63,7 +65,7 @@ public class NameSortTest extends Cleanu
 
         for (int i = 0; i < N; ++i)
         {
-            String key = Integer.toString(i);
+            byte[] key = Integer.toString(i).getBytes();
             RowMutation rm;
 
             // standard
@@ -99,7 +101,7 @@ public class NameSortTest extends Cleanu
     {
         for (int i = 0; i < N; ++i)
         {
-            String key = Integer.toString(i);
+            DecoratedKey key = Util.dk(Integer.toString(i));
             ColumnFamily cf;
 
             cf = Util.getColumnFamily(table, key, "Standard1");

Modified: cassandra/trunk/test/unit/org/apache/cassandra/db/OneCompactionTest.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/test/unit/org/apache/cassandra/db/OneCompactionTest.java?rev=934154&r1=934153&r2=934154&view=diff
==============================================================================
--- cassandra/trunk/test/unit/org/apache/cassandra/db/OneCompactionTest.java (original)
+++ cassandra/trunk/test/unit/org/apache/cassandra/db/OneCompactionTest.java Wed Apr 14 19:53:06 2010
@@ -40,10 +40,10 @@ public class OneCompactionTest extends C
         Table table = Table.open("Keyspace1");
         ColumnFamilyStore store = table.getColumnFamilyStore(columnFamilyName);
 
-        Set<String> inserted = new HashSet<String>();
+        Set<DecoratedKey> inserted = new HashSet<DecoratedKey>();
         for (int j = 0; j < insertsPerTable; j++) {
-            String key = String.valueOf(j);
-            RowMutation rm = new RowMutation("Keyspace1", key);
+            DecoratedKey key = Util.dk(String.valueOf(j));
+            RowMutation rm = new RowMutation("Keyspace1", key.key);
             rm.add(new QueryPath(columnFamilyName, null, "0".getBytes()), new byte[0], j);
             rm.apply();
             inserted.add(key);

Modified: cassandra/trunk/test/unit/org/apache/cassandra/db/ReadMessageTest.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/test/unit/org/apache/cassandra/db/ReadMessageTest.java?rev=934154&r1=934153&r2=934154&view=diff
==============================================================================
--- cassandra/trunk/test/unit/org/apache/cassandra/db/ReadMessageTest.java (original)
+++ cassandra/trunk/test/unit/org/apache/cassandra/db/ReadMessageTest.java Wed Apr 14 19:53:06 2010
@@ -33,6 +33,8 @@ import org.junit.Test;
 import org.apache.cassandra.db.filter.QueryPath;
 import org.apache.cassandra.io.util.DataOutputBuffer;
 
+import org.apache.cassandra.Util;
+
 public class ReadMessageTest extends SchemaLoader
 {
     @Test
@@ -43,24 +45,25 @@ public class ReadMessageTest extends Sch
         colList.add("col2".getBytes());
         
         ReadCommand rm, rm2;
+        DecoratedKey dk = Util.dk("row1");
         
-        rm = new SliceByNamesReadCommand("Keyspace1", "row1", new QueryPath("Standard1"), colList);
+        rm = new SliceByNamesReadCommand("Keyspace1", dk.key, new QueryPath("Standard1"), colList);
         rm2 = serializeAndDeserializeReadMessage(rm);
         assert rm2.toString().equals(rm.toString());
 
-        rm = new SliceFromReadCommand("Keyspace1", "row1", new QueryPath("Standard1"), ArrayUtils.EMPTY_BYTE_ARRAY, ArrayUtils.EMPTY_BYTE_ARRAY, new ArrayList<byte[]>(0), true, 2);
+        rm = new SliceFromReadCommand("Keyspace1", dk.key, new QueryPath("Standard1"), ArrayUtils.EMPTY_BYTE_ARRAY, ArrayUtils.EMPTY_BYTE_ARRAY, new ArrayList<byte[]>(0), true, 2);
         rm2 = serializeAndDeserializeReadMessage(rm);
         assert rm2.toString().equals(rm.toString());
         
-        rm = new SliceFromReadCommand("Keyspace1", "row1", new QueryPath("Standard1"), "a".getBytes(), "z".getBytes(), new ArrayList<byte[]>(0), true, 5);
+        rm = new SliceFromReadCommand("Keyspace1", dk.key, new QueryPath("Standard1"), "a".getBytes(), "z".getBytes(), new ArrayList<byte[]>(0), true, 5);
         rm2 = serializeAndDeserializeReadMessage(rm);
         assertEquals(rm2.toString(), rm.toString());
 
-        rm = new SliceFromReadCommand("Keyspace1", "row1", new QueryPath("Standard1"), ArrayUtils.EMPTY_BYTE_ARRAY, ArrayUtils.EMPTY_BYTE_ARRAY, null, true, 2);
+        rm = new SliceFromReadCommand("Keyspace1", dk.key, new QueryPath("Standard1"), ArrayUtils.EMPTY_BYTE_ARRAY, ArrayUtils.EMPTY_BYTE_ARRAY, null, true, 2);
         rm2 = serializeAndDeserializeReadMessage(rm);
         assert rm2.toString().equals(rm.toString());
 
-        rm = new SliceFromReadCommand("Keyspace1", "row1", new QueryPath("Standard1"), "a".getBytes(), "z".getBytes(), null, true, 5);
+        rm = new SliceFromReadCommand("Keyspace1", dk.key, new QueryPath("Standard1"), "a".getBytes(), "z".getBytes(), null, true, 5);
         rm2 = serializeAndDeserializeReadMessage(rm);
         assertEquals(rm2.toString(), rm.toString());
 
@@ -72,11 +75,11 @@ public class ReadMessageTest extends Sch
                 bitmasks.add(bitmaskTest.getBytes("UTF-8"));
             }
 
-            rm = new SliceFromReadCommand("Keyspace1", "row1", new QueryPath("Standard1"), ArrayUtils.EMPTY_BYTE_ARRAY, ArrayUtils.EMPTY_BYTE_ARRAY, bitmasks, true, 2);
+            rm = new SliceFromReadCommand("Keyspace1", dk.key, new QueryPath("Standard1"), ArrayUtils.EMPTY_BYTE_ARRAY, ArrayUtils.EMPTY_BYTE_ARRAY, bitmasks, true, 2);
             rm2 = serializeAndDeserializeReadMessage(rm);
             assert rm2.toString().equals(rm.toString());
 
-            rm = new SliceFromReadCommand("Keyspace1", "row1", new QueryPath("Standard1"), "a".getBytes(), "z".getBytes(), bitmasks, true, 5);
+            rm = new SliceFromReadCommand("Keyspace1", dk.key, new QueryPath("Standard1"), "a".getBytes(), "z".getBytes(), bitmasks, true, 5);
             rm2 = serializeAndDeserializeReadMessage(rm);
             assertEquals(rm2.toString(), rm.toString());
         }
@@ -98,13 +101,14 @@ public class ReadMessageTest extends Sch
     {
         Table table = Table.open("Keyspace1");
         RowMutation rm;
+        DecoratedKey dk = Util.dk("key1");
 
         // add data
-        rm = new RowMutation("Keyspace1", "key1");
+        rm = new RowMutation("Keyspace1", dk.key);
         rm.add(new QueryPath("Standard1", null, "Column1".getBytes()), "abcd".getBytes(), 0);
         rm.apply();
 
-        ReadCommand command = new SliceByNamesReadCommand("Keyspace1", "key1", new QueryPath("Standard1"), Arrays.asList("Column1".getBytes()));
+        ReadCommand command = new SliceByNamesReadCommand("Keyspace1", dk.key, new QueryPath("Standard1"), Arrays.asList("Column1".getBytes()));
         Row row = command.getRow(table);
         IColumn col = row.cf.getColumn("Column1".getBytes());
         assert Arrays.equals(col.value(), "abcd".getBytes());  

Modified: cassandra/trunk/test/unit/org/apache/cassandra/db/RecoveryManager2Test.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/test/unit/org/apache/cassandra/db/RecoveryManager2Test.java?rev=934154&r1=934153&r2=934154&view=diff
==============================================================================
--- cassandra/trunk/test/unit/org/apache/cassandra/db/RecoveryManager2Test.java (original)
+++ cassandra/trunk/test/unit/org/apache/cassandra/db/RecoveryManager2Test.java Wed Apr 14 19:53:06 2010
@@ -58,7 +58,7 @@ public class RecoveryManager2Test extend
 
     private void insertRow(String key) throws IOException
     {
-        RowMutation rm = new RowMutation("Keyspace1", key);
+        RowMutation rm = new RowMutation("Keyspace1", key.getBytes());
         ColumnFamily cf = ColumnFamily.create("Keyspace1", "Standard1");
         cf.addColumn(column("col1", "val1", 1L));
         rm.add(cf);

Modified: cassandra/trunk/test/unit/org/apache/cassandra/db/RecoveryManagerTest.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/test/unit/org/apache/cassandra/db/RecoveryManagerTest.java?rev=934154&r1=934153&r2=934154&view=diff
==============================================================================
--- cassandra/trunk/test/unit/org/apache/cassandra/db/RecoveryManagerTest.java (original)
+++ cassandra/trunk/test/unit/org/apache/cassandra/db/RecoveryManagerTest.java Wed Apr 14 19:53:06 2010
@@ -27,6 +27,7 @@ import org.junit.Test;
 import org.apache.cassandra.CleanupHelper;
 import org.apache.cassandra.db.commitlog.CommitLog;
 
+import org.apache.cassandra.Util;
 import static org.apache.cassandra.Util.column;
 import static org.apache.cassandra.db.TableTest.assertColumns;
 
@@ -45,15 +46,16 @@ public class RecoveryManagerTest extends
         Table table2 = Table.open("Keyspace2");
 
         RowMutation rm;
+        DecoratedKey dk = Util.dk("keymulti");
         ColumnFamily cf;
 
-        rm = new RowMutation("Keyspace1", "keymulti");
+        rm = new RowMutation("Keyspace1", dk.key);
         cf = ColumnFamily.create("Keyspace1", "Standard1");
         cf.addColumn(column("col1", "val1", 1L));
         rm.add(cf);
         rm.apply();
 
-        rm = new RowMutation("Keyspace2", "keymulti");
+        rm = new RowMutation("Keyspace2", dk.key);
         cf = ColumnFamily.create("Keyspace2", "Standard3");
         cf.addColumn(column("col2", "val2", 1L));
         rm.add(cf);
@@ -64,7 +66,7 @@ public class RecoveryManagerTest extends
 
         CommitLog.recover();
 
-        assertColumns(Util.getColumnFamily(table1, "keymulti", "Standard1"), "col1");
-        assertColumns(Util.getColumnFamily(table2, "keymulti", "Standard3"), "col2");
+        assertColumns(Util.getColumnFamily(table1, dk, "Standard1"), "col1");
+        assertColumns(Util.getColumnFamily(table2, dk, "Standard3"), "col2");
     }
 }

Modified: cassandra/trunk/test/unit/org/apache/cassandra/db/RemoveColumnFamilyTest.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/test/unit/org/apache/cassandra/db/RemoveColumnFamilyTest.java?rev=934154&r1=934153&r2=934154&view=diff
==============================================================================
--- cassandra/trunk/test/unit/org/apache/cassandra/db/RemoveColumnFamilyTest.java (original)
+++ cassandra/trunk/test/unit/org/apache/cassandra/db/RemoveColumnFamilyTest.java Wed Apr 14 19:53:06 2010
@@ -26,7 +26,9 @@ import org.junit.Test;
 import static junit.framework.Assert.assertNull;
 import org.apache.cassandra.db.filter.QueryFilter;
 import org.apache.cassandra.db.filter.QueryPath;
+
 import org.apache.cassandra.CleanupHelper;
+import org.apache.cassandra.Util;
 
 public class RemoveColumnFamilyTest extends CleanupHelper
 {
@@ -36,20 +38,21 @@ public class RemoveColumnFamilyTest exte
         Table table = Table.open("Keyspace1");
         ColumnFamilyStore store = table.getColumnFamilyStore("Standard1");
         RowMutation rm;
+        DecoratedKey dk = Util.dk("key1");
 
         // add data
-        rm = new RowMutation("Keyspace1", "key1");
+        rm = new RowMutation("Keyspace1", dk.key);
         rm.add(new QueryPath("Standard1", null, "Column1".getBytes()), "asdf".getBytes(), 0);
         rm.apply();
 
         // remove
-        rm = new RowMutation("Keyspace1", "key1");
+        rm = new RowMutation("Keyspace1", dk.key);
         rm.delete(new QueryPath("Standard1"), 1);
         rm.apply();
 
-        ColumnFamily retrieved = store.getColumnFamily(QueryFilter.getIdentityFilter("key1", new QueryPath("Standard1", null, "Column1".getBytes())));
+        ColumnFamily retrieved = store.getColumnFamily(QueryFilter.getIdentityFilter(dk, new QueryPath("Standard1", null, "Column1".getBytes())));
         assert retrieved.isMarkedForDelete();
         assertNull(retrieved.getColumn("Column1".getBytes()));
         assertNull(ColumnFamilyStore.removeDeleted(retrieved, Integer.MAX_VALUE));
     }
-}
\ No newline at end of file
+}

Modified: cassandra/trunk/test/unit/org/apache/cassandra/db/RemoveColumnFamilyWithFlush1Test.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/test/unit/org/apache/cassandra/db/RemoveColumnFamilyWithFlush1Test.java?rev=934154&r1=934153&r2=934154&view=diff
==============================================================================
--- cassandra/trunk/test/unit/org/apache/cassandra/db/RemoveColumnFamilyWithFlush1Test.java (original)
+++ cassandra/trunk/test/unit/org/apache/cassandra/db/RemoveColumnFamilyWithFlush1Test.java Wed Apr 14 19:53:06 2010
@@ -26,7 +26,9 @@ import org.junit.Test;
 import static junit.framework.Assert.assertNull;
 import org.apache.cassandra.db.filter.QueryFilter;
 import org.apache.cassandra.db.filter.QueryPath;
+
 import org.apache.cassandra.CleanupHelper;
+import org.apache.cassandra.Util;
 
 public class RemoveColumnFamilyWithFlush1Test extends CleanupHelper
 {
@@ -36,22 +38,23 @@ public class RemoveColumnFamilyWithFlush
         Table table = Table.open("Keyspace1");
         ColumnFamilyStore store = table.getColumnFamilyStore("Standard1");
         RowMutation rm;
+        DecoratedKey dk = Util.dk("key1");
 
         // add data
-        rm = new RowMutation("Keyspace1", "key1");
+        rm = new RowMutation("Keyspace1", dk.key);
         rm.add(new QueryPath("Standard1", null, "Column1".getBytes()), "asdf".getBytes(), 0);
         rm.add(new QueryPath("Standard1", null, "Column2".getBytes()), "asdf".getBytes(), 0);
         rm.apply();
         store.forceBlockingFlush();
 
         // remove
-        rm = new RowMutation("Keyspace1", "key1");
+        rm = new RowMutation("Keyspace1", dk.key);
         rm.delete(new QueryPath("Standard1"), 1);
         rm.apply();
 
-        ColumnFamily retrieved = store.getColumnFamily(QueryFilter.getIdentityFilter("key1", new QueryPath("Standard1")));
+        ColumnFamily retrieved = store.getColumnFamily(QueryFilter.getIdentityFilter(dk, new QueryPath("Standard1")));
         assert retrieved.isMarkedForDelete();
         assertNull(retrieved.getColumn("Column1".getBytes()));
         assertNull(ColumnFamilyStore.removeDeleted(retrieved, Integer.MAX_VALUE));
     }
-}
\ No newline at end of file
+}

Modified: cassandra/trunk/test/unit/org/apache/cassandra/db/RemoveColumnFamilyWithFlush2Test.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/test/unit/org/apache/cassandra/db/RemoveColumnFamilyWithFlush2Test.java?rev=934154&r1=934153&r2=934154&view=diff
==============================================================================
--- cassandra/trunk/test/unit/org/apache/cassandra/db/RemoveColumnFamilyWithFlush2Test.java (original)
+++ cassandra/trunk/test/unit/org/apache/cassandra/db/RemoveColumnFamilyWithFlush2Test.java Wed Apr 14 19:53:06 2010
@@ -26,7 +26,9 @@ import org.junit.Test;
 import static junit.framework.Assert.assertNull;
 import org.apache.cassandra.db.filter.QueryFilter;
 import org.apache.cassandra.db.filter.QueryPath;
+
 import org.apache.cassandra.CleanupHelper;
+import org.apache.cassandra.Util;
 
 public class RemoveColumnFamilyWithFlush2Test extends CleanupHelper
 {
@@ -36,20 +38,21 @@ public class RemoveColumnFamilyWithFlush
         Table table = Table.open("Keyspace1");
         ColumnFamilyStore store = table.getColumnFamilyStore("Standard1");
         RowMutation rm;
+        DecoratedKey dk = Util.dk("key1");
 
         // add data
-        rm = new RowMutation("Keyspace1", "key1");
+        rm = new RowMutation("Keyspace1", dk.key);
         rm.add(new QueryPath("Standard1", null, "Column1".getBytes()), "asdf".getBytes(), 0);
         rm.apply();
         // remove
-        rm = new RowMutation("Keyspace1", "key1");
+        rm = new RowMutation("Keyspace1", dk.key);
         rm.delete(new QueryPath("Standard1"), 1);
         rm.apply();
         store.forceBlockingFlush();
 
-        ColumnFamily retrieved = store.getColumnFamily(QueryFilter.getIdentityFilter("key1", new QueryPath("Standard1", null, "Column1".getBytes())));
+        ColumnFamily retrieved = store.getColumnFamily(QueryFilter.getIdentityFilter(dk, new QueryPath("Standard1", null, "Column1".getBytes())));
         assert retrieved.isMarkedForDelete();
         assertNull(retrieved.getColumn("Column1".getBytes()));
         assertNull(ColumnFamilyStore.removeDeleted(retrieved, Integer.MAX_VALUE));
     }
-}
\ No newline at end of file
+}

Modified: cassandra/trunk/test/unit/org/apache/cassandra/db/RemoveColumnTest.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/test/unit/org/apache/cassandra/db/RemoveColumnTest.java?rev=934154&r1=934153&r2=934154&view=diff
==============================================================================
--- cassandra/trunk/test/unit/org/apache/cassandra/db/RemoveColumnTest.java (original)
+++ cassandra/trunk/test/unit/org/apache/cassandra/db/RemoveColumnTest.java Wed Apr 14 19:53:06 2010
@@ -27,7 +27,9 @@ import static junit.framework.Assert.ass
 import org.apache.cassandra.db.filter.NamesQueryFilter;
 import org.apache.cassandra.db.filter.QueryFilter;
 import org.apache.cassandra.db.filter.QueryPath;
+
 import org.apache.cassandra.CleanupHelper;
+import org.apache.cassandra.Util;
 
 public class RemoveColumnTest extends CleanupHelper
 {
@@ -37,21 +39,22 @@ public class RemoveColumnTest extends Cl
         Table table = Table.open("Keyspace1");
         ColumnFamilyStore store = table.getColumnFamilyStore("Standard1");
         RowMutation rm;
+        DecoratedKey dk = Util.dk("key1");
 
         // add data
-        rm = new RowMutation("Keyspace1", "key1");
+        rm = new RowMutation("Keyspace1", dk.key);
         rm.add(new QueryPath("Standard1", null, "Column1".getBytes()), "asdf".getBytes(), 0);
         rm.apply();
         store.forceBlockingFlush();
 
         // remove
-        rm = new RowMutation("Keyspace1", "key1");
+        rm = new RowMutation("Keyspace1", dk.key);
         rm.delete(new QueryPath("Standard1", null, "Column1".getBytes()), 1);
         rm.apply();
 
-        ColumnFamily retrieved = store.getColumnFamily(QueryFilter.getNamesFilter("key1", new QueryPath("Standard1"), "Column1".getBytes()));
+        ColumnFamily retrieved = store.getColumnFamily(QueryFilter.getNamesFilter(dk, new QueryPath("Standard1"), "Column1".getBytes()));
         assert retrieved.getColumn("Column1".getBytes()).isMarkedForDelete();
         assertNull(ColumnFamilyStore.removeDeleted(retrieved, Integer.MAX_VALUE));
-        assertNull(ColumnFamilyStore.removeDeleted(store.getColumnFamily(QueryFilter.getIdentityFilter("key1", new QueryPath("Standard1"))), Integer.MAX_VALUE));
+        assertNull(ColumnFamilyStore.removeDeleted(store.getColumnFamily(QueryFilter.getIdentityFilter(dk, new QueryPath("Standard1"))), Integer.MAX_VALUE));
     }
-}
\ No newline at end of file
+}

Modified: cassandra/trunk/test/unit/org/apache/cassandra/db/RemoveSubColumnTest.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/test/unit/org/apache/cassandra/db/RemoveSubColumnTest.java?rev=934154&r1=934153&r2=934154&view=diff
==============================================================================
--- cassandra/trunk/test/unit/org/apache/cassandra/db/RemoveSubColumnTest.java (original)
+++ cassandra/trunk/test/unit/org/apache/cassandra/db/RemoveSubColumnTest.java Wed Apr 14 19:53:06 2010
@@ -26,8 +26,8 @@ import org.junit.Test;
 import static junit.framework.Assert.assertNull;
 import org.apache.cassandra.db.filter.QueryFilter;
 import org.apache.cassandra.db.filter.QueryPath;
-import static org.apache.cassandra.Util.addMutation;
 import static org.apache.cassandra.Util.getBytes;
+import org.apache.cassandra.Util;
 import org.apache.cassandra.CleanupHelper;
 
 public class RemoveSubColumnTest extends CleanupHelper
@@ -38,20 +38,21 @@ public class RemoveSubColumnTest extends
         Table table = Table.open("Keyspace1");
         ColumnFamilyStore store = table.getColumnFamilyStore("Super1");
         RowMutation rm;
+        DecoratedKey dk = Util.dk("key1");
 
         // add data
-        rm = new RowMutation("Keyspace1", "key1");
-        addMutation(rm, "Super1", "SC1", 1, "asdf", 0);
+        rm = new RowMutation("Keyspace1", dk.key);
+        Util.addMutation(rm, "Super1", "SC1", 1, "asdf", 0);
         rm.apply();
         store.forceBlockingFlush();
 
         // remove
-        rm = new RowMutation("Keyspace1", "key1");
+        rm = new RowMutation("Keyspace1", dk.key);
         rm.delete(new QueryPath("Super1", "SC1".getBytes(), getBytes(1)), 1);
         rm.apply();
 
-        ColumnFamily retrieved = store.getColumnFamily(QueryFilter.getIdentityFilter("key1", new QueryPath("Super1", "SC1".getBytes())));
+        ColumnFamily retrieved = store.getColumnFamily(QueryFilter.getIdentityFilter(dk, new QueryPath("Super1", "SC1".getBytes())));
         assert retrieved.getColumn("SC1".getBytes()).getSubColumn(getBytes(1)).isMarkedForDelete();
         assertNull(ColumnFamilyStore.removeDeleted(retrieved, Integer.MAX_VALUE));
     }
-}
\ No newline at end of file
+}

Modified: cassandra/trunk/test/unit/org/apache/cassandra/db/RemoveSuperColumnTest.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/test/unit/org/apache/cassandra/db/RemoveSuperColumnTest.java?rev=934154&r1=934153&r2=934154&view=diff
==============================================================================
--- cassandra/trunk/test/unit/org/apache/cassandra/db/RemoveSuperColumnTest.java (original)
+++ cassandra/trunk/test/unit/org/apache/cassandra/db/RemoveSuperColumnTest.java Wed Apr 14 19:53:06 2010
@@ -42,26 +42,27 @@ public class RemoveSuperColumnTest exten
     {
         ColumnFamilyStore store = Table.open("Keyspace1").getColumnFamilyStore("Super1");
         RowMutation rm;
+        DecoratedKey dk = Util.dk("key1");
 
         // add data
-        rm = new RowMutation("Keyspace1", "key1");
+        rm = new RowMutation("Keyspace1", dk.key);
         addMutation(rm, "Super1", "SC1", 1, "val1", 0);
         rm.apply();
         store.forceBlockingFlush();
 
         // remove
-        rm = new RowMutation("Keyspace1", "key1");
+        rm = new RowMutation("Keyspace1", dk.key);
         rm.delete(new QueryPath("Super1", "SC1".getBytes()), 1);
         rm.apply();
 
-        validateRemoveTwoSources();
+        validateRemoveTwoSources(dk);
 
         store.forceBlockingFlush();
-        validateRemoveTwoSources();
+        validateRemoveTwoSources(dk);
 
         CompactionManager.instance.submitMajor(store).get();
         assertEquals(1, store.getSSTables().size());
-        validateRemoveCompacted();
+        validateRemoveCompacted(dk);
     }
 
     @Test
@@ -69,48 +70,49 @@ public class RemoveSuperColumnTest exten
     {
         ColumnFamilyStore store = Table.open("Keyspace1").getColumnFamilyStore("Super3");
         RowMutation rm;
+        DecoratedKey dk = Util.dk("key1");
 
         // add data
-        rm = new RowMutation("Keyspace1", "key1");
+        rm = new RowMutation("Keyspace1", dk.key);
         addMutation(rm, "Super3", "SC1", 1, "val1", 0);
         addMutation(rm, "Super3", "SC1", 2, "val1", 0);
         rm.apply();
         store.forceBlockingFlush();
 
         // remove
-        rm = new RowMutation("Keyspace1", "key1");
+        rm = new RowMutation("Keyspace1", dk.key);
         rm.delete(new QueryPath("Super3", "SC1".getBytes(), Util.getBytes(1)), 1);
         rm.apply();
 
-        validateRemoveSubColumn();
+        validateRemoveSubColumn(dk);
 
         store.forceBlockingFlush();
-        validateRemoveSubColumn();
+        validateRemoveSubColumn(dk);
     }
 
-    private void validateRemoveSubColumn() throws IOException
+    private void validateRemoveSubColumn(DecoratedKey dk) throws IOException
     {
         ColumnFamilyStore store = Table.open("Keyspace1").getColumnFamilyStore("Super3");
-        assertNull(store.getColumnFamily(QueryFilter.getNamesFilter("key1", new QueryPath("Super3", "SC1".getBytes()), Util.getBytes(1)), Integer.MAX_VALUE));
-        assertNotNull(store.getColumnFamily(QueryFilter.getNamesFilter("key1", new QueryPath("Super3", "SC1".getBytes()), Util.getBytes(2)), Integer.MAX_VALUE));
+        assertNull(store.getColumnFamily(QueryFilter.getNamesFilter(dk, new QueryPath("Super3", "SC1".getBytes()), Util.getBytes(1)), Integer.MAX_VALUE));
+        assertNotNull(store.getColumnFamily(QueryFilter.getNamesFilter(dk, new QueryPath("Super3", "SC1".getBytes()), Util.getBytes(2)), Integer.MAX_VALUE));
     }
 
-    private void validateRemoveTwoSources() throws IOException
+    private void validateRemoveTwoSources(DecoratedKey dk) throws IOException
     {
         ColumnFamilyStore store = Table.open("Keyspace1").getColumnFamilyStore("Super1");
-        ColumnFamily resolved = store.getColumnFamily(QueryFilter.getNamesFilter("key1", new QueryPath("Super1"), "SC1".getBytes()));
+        ColumnFamily resolved = store.getColumnFamily(QueryFilter.getNamesFilter(dk, new QueryPath("Super1"), "SC1".getBytes()));
         assert resolved.getSortedColumns().iterator().next().getMarkedForDeleteAt() == 1 : resolved;
         assert resolved.getSortedColumns().iterator().next().getSubColumns().size() == 0 : resolved;
         assertNull(ColumnFamilyStore.removeDeleted(resolved, Integer.MAX_VALUE));
-        assertNull(store.getColumnFamily(QueryFilter.getNamesFilter("key1", new QueryPath("Super1"), "SC1".getBytes()), Integer.MAX_VALUE));
-        assertNull(store.getColumnFamily(QueryFilter.getIdentityFilter("key1", new QueryPath("Super1")), Integer.MAX_VALUE));
-        assertNull(ColumnFamilyStore.removeDeleted(store.getColumnFamily(QueryFilter.getIdentityFilter("key1", new QueryPath("Super1"))), Integer.MAX_VALUE));
+        assertNull(store.getColumnFamily(QueryFilter.getNamesFilter(dk, new QueryPath("Super1"), "SC1".getBytes()), Integer.MAX_VALUE));
+        assertNull(store.getColumnFamily(QueryFilter.getIdentityFilter(dk, new QueryPath("Super1")), Integer.MAX_VALUE));
+        assertNull(ColumnFamilyStore.removeDeleted(store.getColumnFamily(QueryFilter.getIdentityFilter(dk, new QueryPath("Super1"))), Integer.MAX_VALUE));
     }
 
-    private void validateRemoveCompacted() throws IOException
+    private void validateRemoveCompacted(DecoratedKey dk) throws IOException
     {
         ColumnFamilyStore store = Table.open("Keyspace1").getColumnFamilyStore("Super1");
-        ColumnFamily resolved = store.getColumnFamily(QueryFilter.getNamesFilter("key1", new QueryPath("Super1"), "SC1".getBytes()));
+        ColumnFamily resolved = store.getColumnFamily(QueryFilter.getNamesFilter(dk, new QueryPath("Super1"), "SC1".getBytes()));
         assert resolved.getSortedColumns().iterator().next().getMarkedForDeleteAt() == 1;
         Collection<IColumn> subColumns = resolved.getSortedColumns().iterator().next().getSubColumns();
         assert subColumns.size() == 0;
@@ -121,37 +123,38 @@ public class RemoveSuperColumnTest exten
     {
         ColumnFamilyStore store = Table.open("Keyspace1").getColumnFamilyStore("Super2");
         RowMutation rm;
+        DecoratedKey dk = Util.dk("key1");
 
         // add data
-        rm = new RowMutation("Keyspace1", "key1");
+        rm = new RowMutation("Keyspace1", dk.key);
         addMutation(rm, "Super2", "SC1", 1, "val1", 0);
         rm.apply();
         store.forceBlockingFlush();
 
         // remove
-        rm = new RowMutation("Keyspace1", "key1");
+        rm = new RowMutation("Keyspace1", dk.key);
         rm.delete(new QueryPath("Super2", "SC1".getBytes()), 1);
         rm.apply();
 
         // new data
-        rm = new RowMutation("Keyspace1", "key1");
+        rm = new RowMutation("Keyspace1", dk.key);
         addMutation(rm, "Super2", "SC1", 2, "val2", 2);
         rm.apply();
 
-        validateRemoveWithNewData();
+        validateRemoveWithNewData(dk);
 
         store.forceBlockingFlush();
-        validateRemoveWithNewData();
+        validateRemoveWithNewData(dk);
 
         CompactionManager.instance.submitMajor(store).get();
         assertEquals(1, store.getSSTables().size());
-        validateRemoveWithNewData();
+        validateRemoveWithNewData(dk);
     }
 
-    private void validateRemoveWithNewData() throws IOException
+    private void validateRemoveWithNewData(DecoratedKey dk) throws IOException
     {
         ColumnFamilyStore store = Table.open("Keyspace1").getColumnFamilyStore("Super2");
-        ColumnFamily resolved = store.getColumnFamily(QueryFilter.getNamesFilter("key1", new QueryPath("Super2", "SC1".getBytes()), getBytes(2)), Integer.MAX_VALUE);
+        ColumnFamily resolved = store.getColumnFamily(QueryFilter.getNamesFilter(dk, new QueryPath("Super2", "SC1".getBytes()), getBytes(2)), Integer.MAX_VALUE);
         Collection<IColumn> subColumns = resolved.getSortedColumns().iterator().next().getSubColumns();
         assert subColumns.size() == 1;
         assert subColumns.iterator().next().timestamp() == 2;
@@ -162,21 +165,21 @@ public class RemoveSuperColumnTest exten
     {
         ColumnFamilyStore store = Table.open("Keyspace1").getColumnFamilyStore("Super2");
         RowMutation rm;
-        String key = "keyC";
+        DecoratedKey key = Util.dk("keyC");
 
         // add data
-        rm = new RowMutation("Keyspace1", key);
+        rm = new RowMutation("Keyspace1", key.key);
         addMutation(rm, "Super2", "SC1", 1, "val1", 0);
         rm.apply();
 
         // remove
-        rm = new RowMutation("Keyspace1", key);
+        rm = new RowMutation("Keyspace1", key.key);
         rm.delete(new QueryPath("Super2", "SC1".getBytes()), 1);
         rm.apply();
         assertNull(store.getColumnFamily(QueryFilter.getNamesFilter(key, new QueryPath("Super2"), "SC1".getBytes()), Integer.MAX_VALUE));
 
         // resurrect
-        rm = new RowMutation("Keyspace1", key);
+        rm = new RowMutation("Keyspace1", key.key);
         addMutation(rm, "Super2", "SC1", 1, "val2", 2);
         rm.apply();
 

Modified: cassandra/trunk/test/unit/org/apache/cassandra/db/SystemTableTest.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/test/unit/org/apache/cassandra/db/SystemTableTest.java?rev=934154&r1=934153&r2=934154&view=diff
==============================================================================
--- cassandra/trunk/test/unit/org/apache/cassandra/db/SystemTableTest.java (original)
+++ cassandra/trunk/test/unit/org/apache/cassandra/db/SystemTableTest.java Wed Apr 14 19:53:06 2010
@@ -41,7 +41,7 @@ public class SystemTableTest extends Cle
     public void testTokenGetsUpdated() throws IOException
     {
         SystemTable.StorageMetadata storageMetadata1 = SystemTable.initMetadata();
-        SystemTable.updateToken(StorageService.getPartitioner().getToken("503545744:0"));
+        SystemTable.updateToken(StorageService.getPartitioner().getToken("503545744:0".getBytes()));
         SystemTable.StorageMetadata storageMetadata2 = SystemTable.initMetadata();
         Assert.assertTrue("smd should still be a singleton after updateToken", storageMetadata1 == storageMetadata2);
     }

Modified: cassandra/trunk/test/unit/org/apache/cassandra/db/TableTest.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/test/unit/org/apache/cassandra/db/TableTest.java?rev=934154&r1=934153&r2=934154&view=diff
==============================================================================
--- cassandra/trunk/test/unit/org/apache/cassandra/db/TableTest.java (original)
+++ cassandra/trunk/test/unit/org/apache/cassandra/db/TableTest.java Wed Apr 14 19:53:06 2010
@@ -38,6 +38,7 @@ import org.apache.cassandra.db.filter.Qu
 import org.apache.cassandra.utils.WrappedRunnable;
 import static org.apache.cassandra.Util.column;
 import static org.apache.cassandra.Util.getBytes;
+import org.apache.cassandra.Util;
 import org.apache.cassandra.db.filter.NamesQueryFilter;
 import org.apache.cassandra.db.filter.QueryPath;
 import org.apache.cassandra.db.filter.SliceQueryFilter;
@@ -46,11 +47,13 @@ import org.apache.cassandra.io.sstable.I
 import org.apache.cassandra.io.sstable.SSTable;
 import org.apache.cassandra.io.sstable.SSTableReader;
 import org.apache.cassandra.io.util.BufferedRandomAccessFile;
+import org.apache.cassandra.utils.FBUtilities;
 
 public class TableTest extends CleanupHelper
 {
-    private static final String KEY2 = "key2";
-    private static final String TEST_KEY = "key1";
+    private static final DecoratedKey KEY2 = Util.dk("key2");
+    private static final DecoratedKey TEST_KEY = Util.dk("key1");
+    private static final DecoratedKey TEST_SLICE_KEY = Util.dk("key1-slicerange");
 
     public static void reTest(ColumnFamilyStore cfs, Runnable verify) throws Exception
     {
@@ -65,7 +68,7 @@ public class TableTest extends CleanupHe
         final Table table = Table.open("Keyspace2");
         final ColumnFamilyStore cfStore = table.getColumnFamilyStore("Standard3");
 
-        RowMutation rm = new RowMutation("Keyspace2", TEST_KEY);
+        RowMutation rm = new RowMutation("Keyspace2", TEST_KEY.key);
         ColumnFamily cf = ColumnFamily.create("Keyspace2", "Standard3");
         cf.addColumn(column("col1","val1", 1L));
         rm.add(cf);
@@ -96,7 +99,7 @@ public class TableTest extends CleanupHe
         final Table table = Table.open("Keyspace1");
         final ColumnFamilyStore cfStore = table.getColumnFamilyStore("Standard1");
 
-        RowMutation rm = new RowMutation("Keyspace1", TEST_KEY);
+        RowMutation rm = new RowMutation("Keyspace1", TEST_KEY.key);
         ColumnFamily cf = ColumnFamily.create("Keyspace1", "Standard1");
         cf.addColumn(column("col1","val1", 1L));
         cf.addColumn(column("col2","val2", 1L));
@@ -123,10 +126,10 @@ public class TableTest extends CleanupHe
     @Test
     public void testGetRowSliceByRange() throws Throwable
     {
-    	String key = TEST_KEY+"slicerow";
+    	DecoratedKey key = TEST_SLICE_KEY;
     	Table table = Table.open("Keyspace1");
         ColumnFamilyStore cfStore = table.getColumnFamilyStore("Standard1");
-    	RowMutation rm = new RowMutation("Keyspace1", key);
+    	RowMutation rm = new RowMutation("Keyspace1", key.key);
         ColumnFamily cf = ColumnFamily.create("Keyspace1", "Standard1");
         // First write "a", "b", "c"
         cf.addColumn(column("a", "val1", 1L));
@@ -152,7 +155,7 @@ public class TableTest extends CleanupHe
     public void testGetSliceNoMatch() throws Throwable
     {
         Table table = Table.open("Keyspace1");
-        RowMutation rm = new RowMutation("Keyspace1", "row1000");
+        RowMutation rm = new RowMutation("Keyspace1", "row1000".getBytes());
         ColumnFamily cf = ColumnFamily.create("Keyspace1", "Standard2");
         cf.addColumn(column("col1", "val1", 1));
         rm.add(cf);
@@ -174,10 +177,10 @@ public class TableTest extends CleanupHe
         // tests slicing against data from one row in a memtable and then flushed to an sstable
         final Table table = Table.open("Keyspace1");
         final ColumnFamilyStore cfStore = table.getColumnFamilyStore("Standard1");
-        final String ROW = "row4";
+        final DecoratedKey ROW = Util.dk("row4");
         final NumberFormat fmt = new DecimalFormat("000");
 
-        RowMutation rm = new RowMutation("Keyspace1", ROW);
+        RowMutation rm = new RowMutation("Keyspace1", ROW.key);
         ColumnFamily cf = ColumnFamily.create("Keyspace1", "Standard1");
         // at this rate, we're getting 78-79 cos/block, assuming the blocks are set to be about 4k.
         // so if we go to 300, we'll get at least 4 blocks, which is plenty for testing.
@@ -233,10 +236,10 @@ public class TableTest extends CleanupHe
         // tests slicing against data from one row in a memtable and then flushed to an sstable
         final Table table = Table.open("Keyspace1");
         final ColumnFamilyStore cfStore = table.getColumnFamilyStore("Standard1");
-        final String ROW = "row-bitmasktest";
+        final DecoratedKey ROW = Util.dk("row-bitmasktest");
         final NumberFormat fmt = new DecimalFormat("000");
 
-        RowMutation rm = new RowMutation("Keyspace1", ROW);
+        RowMutation rm = new RowMutation("Keyspace1", ROW.key);
         ColumnFamily cf = ColumnFamily.create("Keyspace1", "Standard1");
         // at this rate, we're getting 78-79 cos/block, assuming the blocks are set to be about 4k.
         // so if we go to 300, we'll get at least 4 blocks, which is plenty for testing.
@@ -297,11 +300,11 @@ public class TableTest extends CleanupHe
         ColumnFamily cf;
 
         // key before the rows that exists
-        cf = cfStore.getColumnFamily("a", new QueryPath("Standard2"), ArrayUtils.EMPTY_BYTE_ARRAY, ArrayUtils.EMPTY_BYTE_ARRAY, false, 1);
+        cf = cfStore.getColumnFamily(Util.dk("a"), new QueryPath("Standard2"), ArrayUtils.EMPTY_BYTE_ARRAY, ArrayUtils.EMPTY_BYTE_ARRAY, false, 1);
         assertColumns(cf);
 
         // key after the rows that exist
-        cf = cfStore.getColumnFamily("z", new QueryPath("Standard2"), ArrayUtils.EMPTY_BYTE_ARRAY, ArrayUtils.EMPTY_BYTE_ARRAY, false, 1);
+        cf = cfStore.getColumnFamily(Util.dk("z"), new QueryPath("Standard2"), ArrayUtils.EMPTY_BYTE_ARRAY, ArrayUtils.EMPTY_BYTE_ARRAY, false, 1);
         assertColumns(cf);
     }
 
@@ -311,9 +314,9 @@ public class TableTest extends CleanupHe
         // tests slicing against data from one row in a memtable and then flushed to an sstable
         final Table table = Table.open("Keyspace1");
         final ColumnFamilyStore cfStore = table.getColumnFamilyStore("Standard1");
-        final String ROW = "row1";
+        final DecoratedKey ROW = Util.dk("row1");
 
-        RowMutation rm = new RowMutation("Keyspace1", ROW);
+        RowMutation rm = new RowMutation("Keyspace1", ROW.key);
         ColumnFamily cf = ColumnFamily.create("Keyspace1", "Standard1");
         cf.addColumn(column("col1", "val1", 1L));
         cf.addColumn(column("col3", "val3", 1L));
@@ -324,7 +327,7 @@ public class TableTest extends CleanupHe
         rm.add(cf);
         rm.apply();
 
-        rm = new RowMutation("Keyspace1", ROW);
+        rm = new RowMutation("Keyspace1", ROW.key);
         rm.delete(new QueryPath("Standard1", null, "col4".getBytes()), 2L);
         rm.apply();
 
@@ -367,9 +370,9 @@ public class TableTest extends CleanupHe
         // tests slicing against data from one row spread across two sstables
         final Table table = Table.open("Keyspace1");
         final ColumnFamilyStore cfStore = table.getColumnFamilyStore("Standard1");
-        final String ROW = "row2";
+        final DecoratedKey ROW = Util.dk("row2");
 
-        RowMutation rm = new RowMutation("Keyspace1", ROW);
+        RowMutation rm = new RowMutation("Keyspace1", ROW.key);
         ColumnFamily cf = ColumnFamily.create("Keyspace1", "Standard1");
         cf.addColumn(column("col1", "val1", 1L));
         cf.addColumn(column("col2", "val2", 1L));
@@ -381,7 +384,7 @@ public class TableTest extends CleanupHe
         rm.apply();
         cfStore.forceBlockingFlush();
 
-        rm = new RowMutation("Keyspace1", ROW);
+        rm = new RowMutation("Keyspace1", ROW.key);
         cf = ColumnFamily.create("Keyspace1", "Standard1");
         cf.addColumn(column("col1", "valx", 2L));
         cf.addColumn(column("col2", "valx", 2L));
@@ -412,8 +415,8 @@ public class TableTest extends CleanupHe
         // tests slicing against 1000 columns in an sstable
         Table table = Table.open("Keyspace1");
         ColumnFamilyStore cfStore = table.getColumnFamilyStore("Standard1");
-        String key = "row3";
-        RowMutation rm = new RowMutation("Keyspace1", key);
+        DecoratedKey key = Util.dk("row3");
+        RowMutation rm = new RowMutation("Keyspace1", key.key);
         ColumnFamily cf = ColumnFamily.create("Keyspace1", "Standard1");
         for (int i = 1000; i < 2000; i++)
             cf.addColumn(column("col" + i, ("v" + i), 1L));
@@ -428,11 +431,10 @@ public class TableTest extends CleanupHe
             CompactionManager.instance.submitMajor(cfStore).get();
         }
         SSTableReader sstable = cfStore.getSSTables().iterator().next();
-        DecoratedKey decKey = sstable.getPartitioner().decorateKey(key);
-        SSTable.PositionSize info = sstable.getPosition(decKey);
+        SSTable.PositionSize info = sstable.getPosition(key);
         BufferedRandomAccessFile file = new BufferedRandomAccessFile(sstable.getFilename(), "r");
         file.seek(info.position);
-        assert file.readUTF().equals(key);
+        assert Arrays.equals(FBUtilities.readShortByteArray(file), key.key);
         file.readInt();
         IndexHelper.skipBloomFilter(file);
         ArrayList<IndexHelper.IndexInfo> indexes = IndexHelper.deserializeIndex(file);
@@ -442,7 +444,7 @@ public class TableTest extends CleanupHe
 
     private void validateSliceLarge(ColumnFamilyStore cfStore) throws IOException
     {
-        String key = "row3";
+        DecoratedKey key = Util.dk("row3");
         ColumnFamily cf;
         cf = cfStore.getColumnFamily(key, new QueryPath("Standard1"), "col1000".getBytes(), ArrayUtils.EMPTY_BYTE_ARRAY, false, 3);
         assertColumns(cf, "col1000", "col1001", "col1002");
@@ -491,9 +493,9 @@ public class TableTest extends CleanupHe
         // tests slicing against data from one row spread across two sstables
         final Table table = Table.open("Keyspace1");
         final ColumnFamilyStore cfStore = table.getColumnFamilyStore("Super1");
-        final String ROW = "row2";
+        final DecoratedKey ROW = Util.dk("row2");
 
-        RowMutation rm = new RowMutation("Keyspace1", ROW);
+        RowMutation rm = new RowMutation("Keyspace1", ROW.key);
         ColumnFamily cf = ColumnFamily.create("Keyspace1", "Super1");
         SuperColumn sc = new SuperColumn("sc1".getBytes(), new LongType());
         sc.addColumn(new Column(getBytes(1), "val1".getBytes(), 1L));



Mime
View raw message