You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by jb...@apache.org on 2009/10/01 04:49:59 UTC

svn commit: r820512 - /incubator/cassandra/trunk/src/java/org/apache/cassandra/db/DecoratedKey.java

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;
     }
-
 }