cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jbel...@apache.org
Subject svn commit: r821128 - in /incubator/cassandra/trunk: src/java/org/apache/cassandra/db/ColumnFamilyStore.java src/java/org/apache/cassandra/db/CompactionManager.java test/unit/org/apache/cassandra/db/RecoveryManager2Test.java
Date Fri, 02 Oct 2009 18:40:35 GMT
Author: jbellis
Date: Fri Oct  2 18:40:35 2009
New Revision: 821128

URL: http://svn.apache.org/viewvc?rev=821128&view=rev
Log:
fix heisenbug in RecoveryManager2Test where a compaction could add back a new sstable to the
"cleared" ColumnFamilyStore
patch by jbellis; reviewed by junrao for CASSANDRA-463

Modified:
    incubator/cassandra/trunk/src/java/org/apache/cassandra/db/ColumnFamilyStore.java
    incubator/cassandra/trunk/src/java/org/apache/cassandra/db/CompactionManager.java
    incubator/cassandra/trunk/test/unit/org/apache/cassandra/db/RecoveryManager2Test.java

Modified: incubator/cassandra/trunk/src/java/org/apache/cassandra/db/ColumnFamilyStore.java
URL: http://svn.apache.org/viewvc/incubator/cassandra/trunk/src/java/org/apache/cassandra/db/ColumnFamilyStore.java?rev=821128&r1=821127&r2=821128&view=diff
==============================================================================
--- incubator/cassandra/trunk/src/java/org/apache/cassandra/db/ColumnFamilyStore.java (original)
+++ incubator/cassandra/trunk/src/java/org/apache/cassandra/db/ColumnFamilyStore.java Fri
Oct  2 18:40:35 2009
@@ -1011,7 +1011,6 @@
         }
     }
 
-    /** not threadsafe.  caller must have lock_ acquired. */
     public Collection<SSTableReader> getSSTables()
     {
         return ssTables_.getSSTables();

Modified: incubator/cassandra/trunk/src/java/org/apache/cassandra/db/CompactionManager.java
URL: http://svn.apache.org/viewvc/incubator/cassandra/trunk/src/java/org/apache/cassandra/db/CompactionManager.java?rev=821128&r1=821127&r2=821128&view=diff
==============================================================================
--- incubator/cassandra/trunk/src/java/org/apache/cassandra/db/CompactionManager.java (original)
+++ incubator/cassandra/trunk/src/java/org/apache/cassandra/db/CompactionManager.java Fri
Oct  2 18:40:35 2009
@@ -228,4 +228,10 @@
     {
         maximumCompactionThreshold = threshold;
     }
+
+    public void disableCompactions()
+    {
+        minimumCompactionThreshold_ = 0;
+        maximumCompactionThreshold = 0;
+    }
 }

Modified: incubator/cassandra/trunk/test/unit/org/apache/cassandra/db/RecoveryManager2Test.java
URL: http://svn.apache.org/viewvc/incubator/cassandra/trunk/test/unit/org/apache/cassandra/db/RecoveryManager2Test.java?rev=821128&r1=821127&r2=821128&view=diff
==============================================================================
--- incubator/cassandra/trunk/test/unit/org/apache/cassandra/db/RecoveryManager2Test.java
(original)
+++ incubator/cassandra/trunk/test/unit/org/apache/cassandra/db/RecoveryManager2Test.java
Fri Oct  2 18:40:35 2009
@@ -38,21 +38,22 @@
     @Test
     public void testWithFlush() throws IOException, ExecutionException, InterruptedException
     {
-        Table table1 = Table.open("Keyspace1");
-        Set<String> keys = new HashSet<String>();
+        CompactionManager.instance().disableCompactions();
 
         for (int i = 0; i < 100; i++)
         {
             String key = "key" + i;
             insertRow(key);
-            keys.add(key);
         }
-        table1.getColumnFamilyStore("Standard1").forceBlockingFlush();
 
-        table1.getColumnFamilyStore("Standard1").clearUnsafe();
+        Table table1 = Table.open("Keyspace1");
+        ColumnFamilyStore cfs = table1.getColumnFamilyStore("Standard1");
+        cfs.forceBlockingFlush();
+
+        cfs.clearUnsafe();
         RecoveryManager.doRecovery(); // this is a no-op. is testing this useful?
 
-        Set<String> foundKeys = new HashSet<String>(table1.getColumnFamilyStore("Standard1").getKeyRange("",
"", 1000).keys);
+        Set<String> foundKeys = new HashSet<String>(cfs.getKeyRange("", "", 1000).keys);
         assert foundKeys.equals(Collections.emptySet());
     }
 



Mime
View raw message