cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From slebre...@apache.org
Subject svn commit: r1163695 - in /cassandra/branches/cassandra-0.8: CHANGES.txt src/java/org/apache/cassandra/db/marshal/ReversedType.java
Date Wed, 31 Aug 2011 16:55:20 GMT
Author: slebresne
Date: Wed Aug 31 16:55:19 2011
New Revision: 1163695

URL: http://svn.apache.org/viewvc?rev=1163695&view=rev
Log:
Fix handling of the empty byte buffer by ReversedType
patch by frousseau; reviewed by slebresne for CASSANDRA-3111

Modified:
    cassandra/branches/cassandra-0.8/CHANGES.txt
    cassandra/branches/cassandra-0.8/src/java/org/apache/cassandra/db/marshal/ReversedType.java

Modified: cassandra/branches/cassandra-0.8/CHANGES.txt
URL: http://svn.apache.org/viewvc/cassandra/branches/cassandra-0.8/CHANGES.txt?rev=1163695&r1=1163694&r2=1163695&view=diff
==============================================================================
--- cassandra/branches/cassandra-0.8/CHANGES.txt (original)
+++ cassandra/branches/cassandra-0.8/CHANGES.txt Wed Aug 31 16:55:19 2011
@@ -48,6 +48,7 @@
  * make Range and Bounds objects client-safe (CASSANDRA-3108)
  * make repair report failure when a node participating dies (instead of
    hanging forever) (CASSANDRA-2433)
+ * fix handling of the empty byte buffer by ReversedType (CASSANDRA-3111)
 
 
 0.8.4

Modified: cassandra/branches/cassandra-0.8/src/java/org/apache/cassandra/db/marshal/ReversedType.java
URL: http://svn.apache.org/viewvc/cassandra/branches/cassandra-0.8/src/java/org/apache/cassandra/db/marshal/ReversedType.java?rev=1163695&r1=1163694&r2=1163695&view=diff
==============================================================================
--- cassandra/branches/cassandra-0.8/src/java/org/apache/cassandra/db/marshal/ReversedType.java
(original)
+++ cassandra/branches/cassandra-0.8/src/java/org/apache/cassandra/db/marshal/ReversedType.java
Wed Aug 31 16:55:19 2011
@@ -59,6 +59,16 @@ public class ReversedType<T> extends Abs
 
     public int compare(ByteBuffer o1, ByteBuffer o2)
     {
+        // An empty byte buffer is always smaller
+        if (o1.remaining() == 0)
+        {
+            return o2.remaining() == 0 ? 0 : -1;
+        }
+        if (o2.remaining() == 0)
+        {
+            return 1;
+        }
+
         return -baseType.compare(o1, o2);
     }
 



Mime
View raw message