You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by bl...@apache.org on 2020/06/09 08:42:28 UTC
[cassandra] branch trunk updated: Fix
SchemaTest.testTransKsMigration-cdc and CQLSSTableWriterTest-cdc
This is an automated email from the ASF dual-hosted git repository.
blerer pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/cassandra.git
The following commit(s) were added to refs/heads/trunk by this push:
new 2621e07 Fix SchemaTest.testTransKsMigration-cdc and CQLSSTableWriterTest-cdc
2621e07 is described below
commit 2621e07e87c1a5b53476871618740248d07607f2
Author: Bereng <be...@gmail.com>
AuthorDate: Mon Jun 1 12:32:27 2020 +0200
Fix SchemaTest.testTransKsMigration-cdc and CQLSSTableWriterTest-cdc
patch by Berenguer Blasi; reviewed by Benjamin Lerer for CASSANDRA-15842
The tests were constantly failing for the cdc test run due to the fact
that CDCSizeTracker.shutdown was throwing a NPE if the method was called
while CDCSizeTracker was not started.
The fix ensure that the test start the commitlog and that
CDCSizeTracker.shutdown is a NOOP if the tracker has not been started.
---
.../apache/cassandra/db/commitlog/CommitLogSegmentManagerCDC.java | 5 ++++-
test/unit/org/apache/cassandra/io/sstable/CQLSSTableWriterTest.java | 2 ++
test/unit/org/apache/cassandra/schema/SchemaTest.java | 2 ++
3 files changed, 8 insertions(+), 1 deletion(-)
diff --git a/src/java/org/apache/cassandra/db/commitlog/CommitLogSegmentManagerCDC.java b/src/java/org/apache/cassandra/db/commitlog/CommitLogSegmentManagerCDC.java
index bdd4f74..66c8a39 100644
--- a/src/java/org/apache/cassandra/db/commitlog/CommitLogSegmentManagerCDC.java
+++ b/src/java/org/apache/cassandra/db/commitlog/CommitLogSegmentManagerCDC.java
@@ -309,7 +309,10 @@ public class CommitLogSegmentManagerCDC extends AbstractCommitLogSegmentManager
public void shutdown()
{
- cdcSizeCalculationExecutor.shutdown();
+ if (cdcSizeCalculationExecutor != null && !cdcSizeCalculationExecutor.isShutdown())
+ {
+ cdcSizeCalculationExecutor.shutdown();
+ }
}
private void addSize(long toAdd)
diff --git a/test/unit/org/apache/cassandra/io/sstable/CQLSSTableWriterTest.java b/test/unit/org/apache/cassandra/io/sstable/CQLSSTableWriterTest.java
index 931d9ec..f035658 100644
--- a/test/unit/org/apache/cassandra/io/sstable/CQLSSTableWriterTest.java
+++ b/test/unit/org/apache/cassandra/io/sstable/CQLSSTableWriterTest.java
@@ -37,6 +37,7 @@ import org.apache.cassandra.cql3.*;
import org.apache.cassandra.cql3.functions.UDHelper;
import org.apache.cassandra.cql3.functions.types.*;
import org.apache.cassandra.db.Keyspace;
+import org.apache.cassandra.db.commitlog.CommitLog;
import org.apache.cassandra.dht.*;
import org.apache.cassandra.exceptions.*;
import org.apache.cassandra.schema.Schema;
@@ -59,6 +60,7 @@ public class CQLSSTableWriterTest
@BeforeClass
public static void setup() throws Exception
{
+ CommitLog.instance.start();
SchemaLoader.cleanupAndLeaveDirs();
Keyspace.setInitialized();
StorageService.instance.initServer();
diff --git a/test/unit/org/apache/cassandra/schema/SchemaTest.java b/test/unit/org/apache/cassandra/schema/SchemaTest.java
index 32a5620..64b1341 100644
--- a/test/unit/org/apache/cassandra/schema/SchemaTest.java
+++ b/test/unit/org/apache/cassandra/schema/SchemaTest.java
@@ -26,6 +26,7 @@ import org.junit.Test;
import org.apache.cassandra.SchemaLoader;
import org.apache.cassandra.config.DatabaseDescriptor;
import org.apache.cassandra.db.Keyspace;
+import org.apache.cassandra.db.commitlog.CommitLog;
import org.apache.cassandra.gms.Gossiper;
import static org.junit.Assert.assertNotNull;
@@ -43,6 +44,7 @@ public class SchemaTest
@Test
public void testTransKsMigration() throws IOException
{
+ CommitLog.instance.start();
SchemaLoader.cleanupAndLeaveDirs();
Schema.instance.loadFromDisk();
assertEquals(0, Schema.instance.getNonSystemKeyspaces().size());
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cassandra.apache.org
For additional commands, e-mail: commits-help@cassandra.apache.org