Skip to content

Commit

Permalink
STAR-571 fix *SnichTests (#197)
Browse files Browse the repository at this point in the history
Migrate to commit log initialization implemented by
ServerTestUtils that is race free. Files were removed by
the cleanup that followed CL init.

(cherry picked from commit 37e2e3d)
(cherry picked from commit 5d10d16)
(cherry picked from commit bb4a904)
(cherry picked from commit fa0293a)
(cherry picked from commit 2f5313d)
(cherry picked from commit 8889b2a)
(cherry picked from commit f32f43d)
(cherry picked from commit a5f211f)
(cherry picked from commit 0fcfd8e)
  • Loading branch information
jtgrabowski authored and djatnieks committed Apr 2, 2024
1 parent 7184f13 commit 23239d5
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 16 deletions.
1 change: 1 addition & 0 deletions test/unit/org/apache/cassandra/ServerTestUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ public static void cleanupAndLeaveDirs() throws IOException
mkdirs(); // Creates the directories if they does not exists
cleanup(); // Ensure that the directories are all empty
CommitLog.instance.restartUnsafe();
CommitLog.instance.segmentManager.awaitManagementTasksCompletion();
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import org.junit.BeforeClass;
import org.junit.Test;

import org.apache.cassandra.ServerTestUtils;
import org.apache.cassandra.config.DatabaseDescriptor;
import org.apache.cassandra.db.Keyspace;
import org.apache.cassandra.db.commitlog.CommitLog;
Expand Down Expand Up @@ -55,10 +56,7 @@ public static void setup() throws Exception
{
GOSSIP_DISABLE_THREAD_VALIDATION.setBoolean(true);
DatabaseDescriptor.daemonInitialization();
CommitLog.instance.start();
CommitLog.instance.segmentManager.awaitManagementTasksCompletion();
mkdirs();
cleanup();
ServerTestUtils.cleanupAndLeaveDirs();
Keyspace.setInitialized();
StorageService.instance.initServer(0);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import org.junit.BeforeClass;
import org.junit.Test;

import org.apache.cassandra.ServerTestUtils;
import org.apache.cassandra.config.DatabaseDescriptor;
import org.apache.cassandra.db.Keyspace;
import org.apache.cassandra.db.commitlog.CommitLog;
Expand Down Expand Up @@ -55,10 +56,7 @@ public static void setup() throws Exception
{
GOSSIP_DISABLE_THREAD_VALIDATION.setBoolean(true);
DatabaseDescriptor.daemonInitialization();
CommitLog.instance.start();
CommitLog.instance.segmentManager.awaitManagementTasksCompletion();
mkdirs();
cleanup();
ServerTestUtils.cleanupAndLeaveDirs();
Keyspace.setInitialized();
StorageService.instance.initServer(0);
}
Expand Down
6 changes: 2 additions & 4 deletions test/unit/org/apache/cassandra/locator/Ec2SnitchTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import org.junit.BeforeClass;
import org.junit.Test;

import org.apache.cassandra.ServerTestUtils;
import org.apache.cassandra.config.DatabaseDescriptor;
import org.apache.cassandra.db.Keyspace;
import org.apache.cassandra.db.commitlog.CommitLog;
Expand Down Expand Up @@ -68,10 +69,7 @@ public static void setup() throws Exception
{
GOSSIP_DISABLE_THREAD_VALIDATION.setBoolean(true);
DatabaseDescriptor.daemonInitialization();
CommitLog.instance.start();
CommitLog.instance.segmentManager.awaitManagementTasksCompletion();
mkdirs();
cleanup();
ServerTestUtils.cleanupAndLeaveDirs();
Keyspace.setInitialized();
StorageService.instance.initServer(0);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import org.junit.BeforeClass;
import org.junit.Test;

import org.apache.cassandra.ServerTestUtils;
import org.apache.cassandra.config.DatabaseDescriptor;
import org.apache.cassandra.db.Keyspace;
import org.apache.cassandra.db.commitlog.CommitLog;
Expand Down Expand Up @@ -56,10 +57,7 @@ public static void setup() throws Exception
{
GOSSIP_DISABLE_THREAD_VALIDATION.setBoolean(true);
DatabaseDescriptor.daemonInitialization();
CommitLog.instance.start();
CommitLog.instance.segmentManager.awaitManagementTasksCompletion();
mkdirs();
cleanup();
ServerTestUtils.cleanupAndLeaveDirs();
Keyspace.setInitialized();
StorageService.instance.initServer(0);
}
Expand Down

0 comments on commit 23239d5

Please sign in to comment.