cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jbel...@apache.org
Subject svn commit: r1059405 - in /cassandra/branches/cassandra-0.7: CHANGES.txt src/java/org/apache/cassandra/db/ColumnFamilyStore.java src/java/org/apache/cassandra/io/sstable/Descriptor.java
Date Sat, 15 Jan 2011 19:55:21 GMT
Author: jbellis
Date: Sat Jan 15 19:55:21 2011
New Revision: 1059405

URL: http://svn.apache.org/viewvc?rev=1059405&view=rev
Log:
refuse to open sstables from a future version
patch by Ryan King; reviewed by Stu Hood and jbellis for CASSANDRA-1935

Modified:
    cassandra/branches/cassandra-0.7/CHANGES.txt
    cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/db/ColumnFamilyStore.java
    cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/io/sstable/Descriptor.java

Modified: cassandra/branches/cassandra-0.7/CHANGES.txt
URL: http://svn.apache.org/viewvc/cassandra/branches/cassandra-0.7/CHANGES.txt?rev=1059405&r1=1059404&r2=1059405&view=diff
==============================================================================
--- cassandra/branches/cassandra-0.7/CHANGES.txt (original)
+++ cassandra/branches/cassandra-0.7/CHANGES.txt Sat Jan 15 19:55:21 2011
@@ -19,9 +19,11 @@
    (CASSANDRA-1962)
  * allow specifying specific SSTables to compact from JMX (CASSANDRA-1963)
  * fix race condition in MessagingService.targets (CASSANDRA-1959)
+ * refuse to open sstables from a future version (CASSANDRA-1935)
  * zero-copy reads (CASSANDRA-1714)
 
-0.7.0-dev
+
+0.7.0-final
  * fix offsets to ByteBuffer.get (CASSANDRA-1939)
 
 

Modified: cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/db/ColumnFamilyStore.java
URL: http://svn.apache.org/viewvc/cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/db/ColumnFamilyStore.java?rev=1059405&r1=1059404&r2=1059405&view=diff
==============================================================================
--- cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/db/ColumnFamilyStore.java
(original)
+++ cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/db/ColumnFamilyStore.java
Sat Jan 15 19:55:21 2011
@@ -445,7 +445,13 @@ public class ColumnFamilyStore implement
         // get the max generation number, to prevent generation conflicts
         List<Integer> generations = new ArrayList<Integer>();
         for (Descriptor desc : files(table.name, columnFamily, true).keySet())
+        {
             generations.add(desc.generation);
+            if (desc.isFromTheFuture())
+            {
+                throw new RuntimeException("you can't open sstables from the future!");
+            }
+        }
         Collections.sort(generations);
         int value = (generations.size() > 0) ? (generations.get(generations.size() - 1))
: 0;
 

Modified: cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/io/sstable/Descriptor.java
URL: http://svn.apache.org/viewvc/cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/io/sstable/Descriptor.java?rev=1059405&r1=1059404&r2=1059405&view=diff
==============================================================================
--- cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/io/sstable/Descriptor.java
(original)
+++ cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/io/sstable/Descriptor.java
Sat Jan 15 19:55:21 2011
@@ -180,6 +180,11 @@ public class Descriptor
         return true;
     }
 
+    public boolean isFromTheFuture()
+    {
+        return version.compareTo(CURRENT_VERSION) > 0;
+    }
+
     @Override
     public String toString()
     {



Mime
View raw message