cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jbel...@apache.org
Subject [1/3] cassandra git commit: Stop CommitLogTest hanging
Date Tue, 11 Aug 2015 21:33:19 GMT
Repository: cassandra
Updated Branches:
  refs/heads/cassandra-2.0 028e7cb5a -> 50e5802a7
  refs/heads/cassandra-2.1 012b987e2 -> 972ae1472


Stop CommitLogTest hanging

patch by branimir; reviewed by aweisberg for CASSANDRA-8992


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

Branch: refs/heads/cassandra-2.0
Commit: 50e5802a7d7151d9fb1339aa3cdd2b9e1c261712
Parents: 028e7cb
Author: blambov <branimir.lambov@datastax.com>
Authored: Fri Apr 3 22:57:59 2015 +0100
Committer: Jonathan Ellis <jbellis@apache.org>
Committed: Tue Aug 11 16:12:59 2015 -0500

----------------------------------------------------------------------
 .../db/CommitLogFailurePolicyTest.java          | 53 ++++++++++++++++++++
 .../org/apache/cassandra/db/CommitLogTest.java  | 33 +++---------
 2 files changed, 61 insertions(+), 25 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/50e5802a/test/unit/org/apache/cassandra/db/CommitLogFailurePolicyTest.java
----------------------------------------------------------------------
diff --git a/test/unit/org/apache/cassandra/db/CommitLogFailurePolicyTest.java b/test/unit/org/apache/cassandra/db/CommitLogFailurePolicyTest.java
new file mode 100644
index 0000000..235c9f1
--- /dev/null
+++ b/test/unit/org/apache/cassandra/db/CommitLogFailurePolicyTest.java
@@ -0,0 +1,53 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements.  See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership.  The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License.  You may obtain a copy of the License at
+*
+*    http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied.  See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*/
+
+package org.apache.cassandra.db;
+
+import org.junit.Assert;
+import org.junit.Test;
+
+import org.apache.cassandra.config.Config;
+import org.apache.cassandra.config.DatabaseDescriptor;
+import org.apache.cassandra.db.commitlog.CommitLog;
+import org.apache.cassandra.exceptions.ConfigurationException;
+import org.apache.cassandra.gms.Gossiper;
+import org.apache.cassandra.service.StorageService;
+
+public class CommitLogFailurePolicyTest
+{
+    @Test
+    public void testCommitFailurePolicy_stop() throws ConfigurationException
+    {
+        // Need storage service active so stop policy can shutdown gossip
+        StorageService.instance.initServer();
+        Assert.assertTrue(Gossiper.instance.isEnabled());
+
+        Config.CommitFailurePolicy oldPolicy = DatabaseDescriptor.getCommitFailurePolicy();
+        try
+        {
+            DatabaseDescriptor.setCommitFailurePolicy(Config.CommitFailurePolicy.stop);
+            CommitLog.handleCommitError("Test stop error", new Throwable());
+            Assert.assertFalse(Gossiper.instance.isEnabled());
+        }
+        finally
+        {
+            DatabaseDescriptor.setCommitFailurePolicy(oldPolicy);
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/cassandra/blob/50e5802a/test/unit/org/apache/cassandra/db/CommitLogTest.java
----------------------------------------------------------------------
diff --git a/test/unit/org/apache/cassandra/db/CommitLogTest.java b/test/unit/org/apache/cassandra/db/CommitLogTest.java
index 289fbc9..45cd30c 100644
--- a/test/unit/org/apache/cassandra/db/CommitLogTest.java
+++ b/test/unit/org/apache/cassandra/db/CommitLogTest.java
@@ -23,26 +23,23 @@ import java.io.*;
 import java.nio.ByteBuffer;
 import java.util.UUID;
 import java.util.concurrent.ExecutionException;
-import java.util.concurrent.TimeUnit;
 import java.util.zip.CRC32;
 import java.util.zip.Checksum;
 
-import com.google.common.util.concurrent.Uninterruptibles;
 import org.junit.Assert;
+import org.junit.BeforeClass;
 import org.junit.Test;
 
 import org.apache.cassandra.SchemaLoader;
 import org.apache.cassandra.Util;
-import org.apache.cassandra.config.Config;
 import org.apache.cassandra.config.DatabaseDescriptor;
 import org.apache.cassandra.db.commitlog.CommitLog;
 import org.apache.cassandra.db.commitlog.CommitLogDescriptor;
 import org.apache.cassandra.db.commitlog.ReplayPosition;
+import org.apache.cassandra.db.compaction.CompactionManager;
 import org.apache.cassandra.db.filter.NamesQueryFilter;
 import org.apache.cassandra.exceptions.ConfigurationException;
-import org.apache.cassandra.gms.Gossiper;
 import org.apache.cassandra.net.MessagingService;
-import org.apache.cassandra.service.StorageService;
 import org.apache.cassandra.utils.ByteBufferUtil;
 import org.apache.cassandra.utils.FBUtilities;
 
@@ -50,6 +47,12 @@ import static org.apache.cassandra.utils.ByteBufferUtil.bytes;
 
 public class CommitLogTest extends SchemaLoader
 {
+    @BeforeClass
+    public static void init() throws ConfigurationException
+    {
+        CompactionManager.instance.disableAutoCompaction();
+    }
+
     @Test
     public void testRecoveryWithEmptyLog() throws Exception
     {
@@ -239,26 +242,6 @@ public class CommitLogTest extends SchemaLoader
     }
 
     @Test
-    public void testCommitFailurePolicy_stop() throws ConfigurationException
-    {
-        // Need storage service active so stop policy can shutdown gossip
-        StorageService.instance.initServer();
-        Assert.assertTrue(Gossiper.instance.isEnabled());
-
-        Config.CommitFailurePolicy oldPolicy = DatabaseDescriptor.getCommitFailurePolicy();
-        try
-        {
-            DatabaseDescriptor.setCommitFailurePolicy(Config.CommitFailurePolicy.stop);
-            CommitLog.handleCommitError("Test stop error", new Throwable());
-            Assert.assertFalse(Gossiper.instance.isEnabled());
-        }
-        finally
-        {
-            DatabaseDescriptor.setCommitFailurePolicy(oldPolicy);
-        }
-    }
-
-    @Test
     public void testTruncateWithoutSnapshot()  throws ExecutionException, InterruptedException
     {
         CommitLog.instance.resetUnsafe();


Mime
View raw message