cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jbel...@apache.org
Subject svn commit: r939687 - in /cassandra/branches/cassandra-0.6: CHANGES.txt src/java/org/apache/cassandra/db/Column.java
Date Fri, 30 Apr 2010 14:25:58 GMT
Author: jbellis
Date: Fri Apr 30 14:25:57 2010
New Revision: 939687

URL: http://svn.apache.org/viewvc?rev=939687&view=rev
Log:
make resolving timestamp ties deterministic.  patch by Roland Hänel; reviewed by jbellis
and Sylvain Lebresne for CASSANDRA-1039

Modified:
    cassandra/branches/cassandra-0.6/CHANGES.txt
    cassandra/branches/cassandra-0.6/src/java/org/apache/cassandra/db/Column.java

Modified: cassandra/branches/cassandra-0.6/CHANGES.txt
URL: http://svn.apache.org/viewvc/cassandra/branches/cassandra-0.6/CHANGES.txt?rev=939687&r1=939686&r2=939687&view=diff
==============================================================================
--- cassandra/branches/cassandra-0.6/CHANGES.txt (original)
+++ cassandra/branches/cassandra-0.6/CHANGES.txt Fri Apr 30 14:25:57 2010
@@ -3,6 +3,8 @@
  * split CommitLogExecutorService into BatchCommitLogExecutorService and 
    PeriodicCommitLogExecutorService (CASSANDRA-1014)
  * add latency histograms to CFSMBean (CASSANDRA-1024)
+ * make resolving timestamp ties deterministic by using value bytes
+   as a tiebreaker (CASSANDRA-1039)
 
 
 0.6.1

Modified: cassandra/branches/cassandra-0.6/src/java/org/apache/cassandra/db/Column.java
URL: http://svn.apache.org/viewvc/cassandra/branches/cassandra-0.6/src/java/org/apache/cassandra/db/Column.java?rev=939687&r1=939686&r2=939687&view=diff
==============================================================================
--- cassandra/branches/cassandra-0.6/src/java/org/apache/cassandra/db/Column.java (original)
+++ cassandra/branches/cassandra-0.6/src/java/org/apache/cassandra/db/Column.java Fri Apr
30 14:25:57 2010
@@ -28,6 +28,7 @@ import org.apache.commons.lang.ArrayUtil
 
 import org.apache.cassandra.db.marshal.AbstractType;
 import org.apache.cassandra.io.util.DataOutputBuffer;
+import org.apache.cassandra.utils.FBUtilities;
 
 
 /**
@@ -194,11 +195,17 @@ public class Column implements IColumn
     // note that we do not call this simply compareTo since it also makes sense to compare
Columns by name
     public long comparePriority(Column o)
     {
+        // tombstone always wins ties.
         if (isMarkedForDelete)
-        {
-            // tombstone always wins ties.
             return timestamp < o.timestamp ? -1 : 1;
-        }
+        if (o.isMarkedForDelete)
+            return timestamp > o.timestamp ? 1 : -1;
+        
+        // compare value as tie-breaker for equal timestamps
+        if (timestamp == o.timestamp)
+            return FBUtilities.compareByteArrays(value, o.value);
+
+        // neither is tombstoned and timestamps are different
         return timestamp - o.timestamp;
     }
 



Mime
View raw message