cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From xe...@apache.org
Subject [8/8] git commit: change ColumnSerializer.deserialize to be able fix timestamps from future, related to CASSANDRA-4561
Date Mon, 10 Sep 2012 21:45:18 GMT
change ColumnSerializer.deserialize to be able fix timestamps from future, related to CASSANDRA-4561


Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/429fa7a8
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/429fa7a8
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/429fa7a8

Branch: refs/heads/trunk
Commit: 429fa7a80e22757a55c03e99c27c157824a666af
Parents: 2a3b0c0
Author: Pavel Yaskevich <xedin@apache.org>
Authored: Fri Sep 7 14:43:51 2012 +0300
Committer: Pavel Yaskevich <xedin@apache.org>
Committed: Tue Sep 11 00:06:19 2012 +0300

----------------------------------------------------------------------
 .../org/apache/cassandra/db/ColumnSerializer.java  |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/429fa7a8/src/java/org/apache/cassandra/db/ColumnSerializer.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/db/ColumnSerializer.java b/src/java/org/apache/cassandra/db/ColumnSerializer.java
index d4a3e64..55cffe8 100644
--- a/src/java/org/apache/cassandra/db/ColumnSerializer.java
+++ b/src/java/org/apache/cassandra/db/ColumnSerializer.java
@@ -26,6 +26,7 @@ import org.apache.cassandra.io.FSReadError;
 import org.apache.cassandra.io.IColumnSerializer;
 import org.apache.cassandra.io.util.FileDataInput;
 import org.apache.cassandra.utils.ByteBufferUtil;
+import org.apache.cassandra.utils.FBUtilities;
 
 public class ColumnSerializer implements IColumnSerializer
 {
@@ -105,6 +106,11 @@ public class ColumnSerializer implements IColumnSerializer
         else
         {
             long ts = dis.readLong();
+            long now = FBUtilities.timestampMicros();
+
+            if (ts > now) // fixing the timestamp from the future to be 'now' in micros
+                ts = now; // helps with CASSANDRA-4561 as remote nodes can send schema with
wrong nanoTime() timestamps
+
             ByteBuffer value = ByteBufferUtil.readWithLength(dis);
             return (mask & COUNTER_UPDATE_MASK) != 0
                    ? new CounterUpdateColumn(name, value, ts)


Mime
View raw message