Just looked at the code and it indeed just compare the
timestamps. I also find it weird and I would be for changing it,
but maybe there was a good reason to do it the way it is (even
if I don't see one right now). I'll let people give their opinion on
that.

In the meantime, if you need a quick fix for testing, I join you
a two line patch that should fix it.

--
Sylvain

On Fri, Mar 19, 2010 at 1:25 AM, John Alessi <j...@socketlabs.com> wrote:
> But they are different names.  In my example they are:
> 1077e700-c7f2-11de-86d5-f5bcc793a028
> 1077e700-c7f2-11de-982e-6fad363d5f29
> But Cassandra sees them as the same.
> --
> John
>
>
>
> On Mar 18, 2010, at 7:17 PM, Brandon Williams wrote:
>
> On Thu, Mar 18, 2010 at 6:12 PM, John Alessi <j...@socketlabs.com> wrote:
>>
>> I am having an issue where Cassandra doesn't seem to be able to
>> distinguish between 2 different UUIDs if based on the same exact time, and
>> sorting by TimeUUID.
>
> *snip*
>>
>> Cassandra doesn't seem to be able to distinguish between 2 different UUIDs
>> if based on the same exact time, and sorting by TimeUUID.
>>
>> What am I missing???
>
> Column names must be distinct.  If you insert two columns with the same
> name, one overwrites the other.
> -Brandon
>
>
Index: a/src/java/org/apache/cassandra/db/marshal/TimeUUIDType.java
===================================================================
--- a/src/java/org/apache/cassandra/db/marshal/TimeUUIDType.java	(revision 924386)
+++ b/src/java/org/apache/cassandra/db/marshal/TimeUUIDType.java	(working copy)
@@ -22,6 +22,7 @@
 
 
 import java.util.UUID;
+import org.apache.cassandra.utils.FBUtilities;
 
 public class TimeUUIDType extends AbstractType
 {
@@ -38,7 +39,7 @@
         
         long t1 = LexicalUUIDType.getUUID(o1).timestamp();
         long t2 = LexicalUUIDType.getUUID(o2).timestamp();
-        return t1 < t2 ? -1 : (t1 > t2 ? 1 : 0);
+        return t1 < t2 ? -1 : (t1 > t2 ? 1 : FBUtilities.compareByteArrays(o1, o2));
     }
 
     public String getString(byte[] bytes)

Reply via email to