cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From slebre...@apache.org
Subject [2/2] git commit: Fix flapping RecoveryManagerTest
Date Wed, 21 May 2014 09:49:04 GMT
Fix flapping RecoveryManagerTest

patch by benedict; reviewed by jbellis for CASSANDRA-7084


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

Branch: refs/heads/cassandra-2.0
Commit: 484d2816940cd2eb22d2365fcb376dd27e059e2e
Parents: ca213cc
Author: Sylvain Lebresne <sylvain@datastax.com>
Authored: Wed May 21 11:48:21 2014 +0200
Committer: Sylvain Lebresne <sylvain@datastax.com>
Committed: Wed May 21 11:48:21 2014 +0200

----------------------------------------------------------------------
 CHANGES.txt                                                    | 1 +
 .../org/apache/cassandra/db/commitlog/CommitLogAllocator.java  | 6 ++++--
 test/unit/org/apache/cassandra/db/RecoveryManagerTest.java     | 3 +++
 3 files changed, 8 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/484d2816/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index 432d688..3f8e3d0 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -48,6 +48,7 @@
  * Improve compaction visibility (CASSANDRA-7242)
  * Fix 2ndary index queries with DESC clustering order (CASSANDRA-6950)
  * Invalid key cache entries on DROP (CASSANDRA-6525)
+ * Fix flapping RecoveryManagerTest (CASSANDRA-7084)
 Merged from 1.2:
  * Add Cloudstack snitch (CASSANDRA-7147)
  * Update system.peers correctly when relocating tokens (CASSANDRA-7126)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/484d2816/src/java/org/apache/cassandra/db/commitlog/CommitLogAllocator.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/db/commitlog/CommitLogAllocator.java b/src/java/org/apache/cassandra/db/commitlog/CommitLogAllocator.java
index 3009a63..7ab062b 100644
--- a/src/java/org/apache/cassandra/db/commitlog/CommitLogAllocator.java
+++ b/src/java/org/apache/cassandra/db/commitlog/CommitLogAllocator.java
@@ -29,6 +29,7 @@ import java.util.concurrent.ConcurrentLinkedQueue;
 import java.util.concurrent.atomic.AtomicLong;
 
 import com.google.common.collect.Iterables;
+import com.google.common.util.concurrent.Uninterruptibles;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -36,7 +37,6 @@ import org.apache.cassandra.config.DatabaseDescriptor;
 import org.apache.cassandra.config.Schema;
 import org.apache.cassandra.db.ColumnFamilyStore;
 import org.apache.cassandra.db.Keyspace;
-import org.apache.cassandra.io.FSError;
 import org.apache.cassandra.io.util.FileUtils;
 import org.apache.cassandra.net.MessagingService;
 import org.apache.cassandra.service.StorageService;
@@ -343,9 +343,11 @@ public class CommitLogAllocator
     {
         logger.debug("Closing and clearing existing commit log segments...");
 
-        while (!queue.isEmpty())
+        while (StorageService.tasks.getActiveCount() > 0 || !queue.isEmpty())
             Thread.yield();
 
+        Uninterruptibles.sleepUninterruptibly(10, TimeUnit.MILLISECONDS);
+
         for (CommitLogSegment segment : Iterables.concat(activeSegments, availableSegments))
             segment.close();
 

http://git-wip-us.apache.org/repos/asf/cassandra/blob/484d2816/test/unit/org/apache/cassandra/db/RecoveryManagerTest.java
----------------------------------------------------------------------
diff --git a/test/unit/org/apache/cassandra/db/RecoveryManagerTest.java b/test/unit/org/apache/cassandra/db/RecoveryManagerTest.java
index c053211..d14d184 100644
--- a/test/unit/org/apache/cassandra/db/RecoveryManagerTest.java
+++ b/test/unit/org/apache/cassandra/db/RecoveryManagerTest.java
@@ -23,9 +23,11 @@ import java.util.Date;
 import java.util.concurrent.ExecutionException;
 import java.util.concurrent.TimeUnit;
 
+import org.apache.cassandra.OrderedJUnit4ClassRunner;
 import org.apache.cassandra.Util;
 import org.junit.Assert;
 import org.junit.Test;
+import org.junit.runner.RunWith;
 
 import org.apache.cassandra.SchemaLoader;
 import org.apache.cassandra.db.commitlog.CommitLog;
@@ -35,6 +37,7 @@ import org.apache.cassandra.utils.ByteBufferUtil;
 import static org.apache.cassandra.Util.column;
 import static org.apache.cassandra.db.KeyspaceTest.assertColumns;
 
+@RunWith(OrderedJUnit4ClassRunner.class)
 public class RecoveryManagerTest extends SchemaLoader
 {
     @Test


Mime
View raw message