Author: brandonwilliams
Date: Thu Dec 22 16:17:50 2011
New Revision: 1222323

URL: http://svn.apache.org/viewvc?rev=1222323&view=rev
Log:
Warn if gossip generation is from the future.
Patch by Aaron Morton, reviewed by brandonwilliams for CASSANDRA-3654.

Modified:
    
cassandra/branches/cassandra-1.0/src/java/org/apache/cassandra/db/SystemTable.java

Modified: 
cassandra/branches/cassandra-1.0/src/java/org/apache/cassandra/db/SystemTable.java
URL: 
http://svn.apache.org/viewvc/cassandra/branches/cassandra-1.0/src/java/org/apache/cassandra/db/SystemTable.java?rev=1222323&r1=1222322&r2=1222323&view=diff
==============================================================================
--- 
cassandra/branches/cassandra-1.0/src/java/org/apache/cassandra/db/SystemTable.java
 (original)
+++ 
cassandra/branches/cassandra-1.0/src/java/org/apache/cassandra/db/SystemTable.java
 Thu Dec 22 16:17:50 2011
@@ -320,8 +320,19 @@ public class SystemTable
         }
         else
         {
-            generation = 
Math.max(ByteBufferUtil.toInt(cf.getColumn(GENERATION).value()) + 1,
-                                  (int) (System.currentTimeMillis() / 1000));
+            // Other nodes will ignore gossip messages about a node that have 
a lower generation than previously seen.
+            final int storedGeneration = 
ByteBufferUtil.toInt(cf.getColumn(GENERATION).value()) + 1;
+            final int now = (int) (System.currentTimeMillis() / 1000);
+            if (storedGeneration >= now)
+            {
+                logger.warn("Using stored Gossip Generation {} as it is 
greater than current system time {}.  See CASSANDRA-3654 if you experience 
problems",
+                            storedGeneration, now);
+                generation = storedGeneration;
+            }
+            else
+            {
+                generation = now;
+            }
         }
 
         RowMutation rm = new RowMutation(Table.SYSTEM_TABLE, LOCATION_KEY);


Reply via email to