Author: jbellis
Date: Thu Oct  1 02:49:59 2009
New Revision: 820512

URL: http://svn.apache.org/viewvc?rev=820512&view=rev
Log:
don't use token in decoration except for RandomPartioner.  patch by jbellis for 
CASSANDRA-467; tested by dispalt

Modified:
    incubator/cassandra/trunk/src/java/org/apache/cassandra/db/DecoratedKey.java

Modified: 
incubator/cassandra/trunk/src/java/org/apache/cassandra/db/DecoratedKey.java
URL: 
http://svn.apache.org/viewvc/incubator/cassandra/trunk/src/java/org/apache/cassandra/db/DecoratedKey.java?rev=820512&r1=820511&r2=820512&view=diff
==============================================================================
--- 
incubator/cassandra/trunk/src/java/org/apache/cassandra/db/DecoratedKey.java 
(original)
+++ 
incubator/cassandra/trunk/src/java/org/apache/cassandra/db/DecoratedKey.java 
Thu Oct  1 02:49:59 2009
@@ -19,6 +19,9 @@
 package org.apache.cassandra.db;
 
 import org.apache.cassandra.dht.Token;
+import org.apache.cassandra.dht.IPartitioner;
+import org.apache.cassandra.dht.RandomPartitioner;
+import org.apache.cassandra.service.StorageService;
 
 /**
  * Represents a decorated key, handy for certain operations
@@ -78,7 +81,11 @@
      */
     public String toString()
     {
-        return token.toString() + DELIMITER + key;
+        // TODO when we can break the disk format, we should use
+        // token == null ? key : token.toString() + DELIMITER + key
+        // until then we special case like this, which keeps COPP using just 
the key string
+        return StorageService.getPartitioner() instanceof RandomPartitioner
+               ? token.toString() + DELIMITER + key
+               : key;
     }
-
 }


Reply via email to