cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From xe...@apache.org
Subject [9/13] git commit: change ColumnSerializer.deserialize to be able fix timestamps from future, related to CASSANDRA-4561
Date Mon, 10 Sep 2012 22:13:31 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/2c69e2ea
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/2c69e2ea
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/2c69e2ea

Branch: refs/heads/trunk
Commit: 2c69e2ea757be9492a095aa22b5d51234c4b4102
Parents: 06893e4
Author: Pavel Yaskevich <xedin@apache.org>
Authored: Fri Sep 7 14:43:51 2012 +0300
Committer: Pavel Yaskevich <xedin@apache.org>
Committed: Fri Sep 7 19:07:31 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/2c69e2ea/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 cd7ba33..d5011aa 100644
--- a/src/java/org/apache/cassandra/db/ColumnSerializer.java
+++ b/src/java/org/apache/cassandra/db/ColumnSerializer.java
@@ -32,6 +32,7 @@ import org.slf4j.LoggerFactory;
 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
 {
@@ -116,6 +117,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 (b & COUNTER_UPDATE_MASK) != 0
                    ? new CounterUpdateColumn(name, value, ts)


Mime
View raw message