REPLICATED_SYSTEM_KEYSPACE_NAMES =
ImmutableSet.of(TRACE_KEYSPACE_NAME, AUTH_KEYSPACE_NAME, DISTRIBUTED_KEYSPACE_NAME);
/**
- * longest permissible KS or CF name. Our main concern is that filename not be more than 255 characters;
- * the filename will contain both the KS and CF names. Since non-schema-name components only take up
- * ~64 characters, we could allow longer names than this, but on Windows, the entire path should be not greater than
- * 255 characters, so a lower limit here helps avoid problems. See CASSANDRA-4110.
+ * The longest permissible KS or CF name.
+ *
+ * Before CASSANDRA-16956, we used to care about not having the entire path longer than 255 characters because of
+ * Windows support but this limit is by implementing CASSANDRA-16956 not in effect anymore.
*/
public static final int NAME_LENGTH = 48;
diff --git a/src/java/org/apache/cassandra/service/CassandraDaemon.java b/src/java/org/apache/cassandra/service/CassandraDaemon.java
index 7c257f6cc2..3589ad99c5 100644
--- a/src/java/org/apache/cassandra/service/CassandraDaemon.java
+++ b/src/java/org/apache/cassandra/service/CassandraDaemon.java
@@ -60,7 +60,6 @@ import org.apache.cassandra.db.Keyspace;
import org.apache.cassandra.db.SizeEstimatesRecorder;
import org.apache.cassandra.db.SystemKeyspace;
import org.apache.cassandra.db.SystemKeyspaceMigrator40;
-import org.apache.cassandra.db.WindowsFailedSnapshotTracker;
import org.apache.cassandra.db.commitlog.CommitLog;
import org.apache.cassandra.db.virtual.SystemViewsKeyspace;
import org.apache.cassandra.db.virtual.VirtualKeyspaceRegistry;
@@ -84,7 +83,6 @@ import org.apache.cassandra.utils.JVMStabilityInspector;
import org.apache.cassandra.utils.MBeanWrapper;
import org.apache.cassandra.utils.Mx4jTool;
import org.apache.cassandra.utils.NativeLibrary;
-import org.apache.cassandra.utils.WindowsTimer;
import org.apache.cassandra.utils.concurrent.Future;
import org.apache.cassandra.utils.concurrent.FutureCombiner;
@@ -241,10 +239,6 @@ public class CassandraDaemon
exitOrFail(StartupException.ERR_WRONG_DISK_STATE, e.getMessage(), e);
}
- // Delete any failed snapshot deletions on Windows - see CASSANDRA-9658
- if (FBUtilities.isWindows)
- WindowsFailedSnapshotTracker.deleteOldSnapshots();
-
maybeInitJmx();
Mx4jTool.maybeLoad();
@@ -699,11 +693,6 @@ public class CassandraDaemon
destroyClientTransports();
StorageService.instance.setRpcReady(false);
- // On windows, we need to stop the entire system as prunsrv doesn't have the jsvc hooks
- // We rely on the shutdown hook to drain the node
- if (FBUtilities.isWindows)
- System.exit(0);
-
if (jmxServer != null)
{
try
@@ -744,13 +733,6 @@ public class CassandraDaemon
registerNativeAccess();
- if (FBUtilities.isWindows)
- {
- // We need to adjust the system timer on windows from the default 15ms down to the minimum of 1ms as this
- // impacts timer intervals, thread scheduling, driver interrupts, etc.
- WindowsTimer.startTimerPeriod(DatabaseDescriptor.getWindowsTimerInterval());
- }
-
setup();
String pidFile = CASSANDRA_PID_FILE.getString();
diff --git a/src/java/org/apache/cassandra/service/StartupChecks.java b/src/java/org/apache/cassandra/service/StartupChecks.java
index 0758dbc184..18f62b71b7 100644
--- a/src/java/org/apache/cassandra/service/StartupChecks.java
+++ b/src/java/org/apache/cassandra/service/StartupChecks.java
@@ -140,8 +140,6 @@ public class StartupChecks
{
public void execute()
{
- if (FBUtilities.isWindows)
- return;
String jemalloc = System.getProperty("cassandra.libjemalloc");
if (jemalloc == null)
logger.warn("jemalloc shared library could not be preloaded to speed up memory allocations");
diff --git a/src/java/org/apache/cassandra/service/StorageService.java b/src/java/org/apache/cassandra/service/StorageService.java
index d5b676f532..4c0562a835 100644
--- a/src/java/org/apache/cassandra/service/StorageService.java
+++ b/src/java/org/apache/cassandra/service/StorageService.java
@@ -784,10 +784,6 @@ public class StorageService extends NotificationBroadcasterSupport implements IE
public void runMayThrow() throws InterruptedException, ExecutionException, IOException
{
drain(true);
-
- if (FBUtilities.isWindows)
- WindowsTimer.endTimerPeriod(DatabaseDescriptor.getWindowsTimerInterval());
-
LoggingSupportFactory.getLoggingSupport().onShutdown();
}
}, "StorageServiceShutdownHook");
@@ -892,9 +888,6 @@ public class StorageService extends NotificationBroadcasterSupport implements IE
if (drainOnShutdown != null)
Runtime.getRuntime().removeShutdownHook(drainOnShutdown);
-
- if (FBUtilities.isWindows)
- WindowsTimer.endTimerPeriod(DatabaseDescriptor.getWindowsTimerInterval());
}
private boolean shouldBootstrap()
diff --git a/src/java/org/apache/cassandra/tools/SSTableExport.java b/src/java/org/apache/cassandra/tools/SSTableExport.java
index b3000d0a05..771380b6a1 100644
--- a/src/java/org/apache/cassandra/tools/SSTableExport.java
+++ b/src/java/org/apache/cassandra/tools/SSTableExport.java
@@ -217,7 +217,6 @@ public class SSTableExport
}
catch (IOException e)
{
- // throwing exception outside main with broken pipe causes windows cmd to hang
e.printStackTrace(System.err);
}
diff --git a/src/java/org/apache/cassandra/utils/FBUtilities.java b/src/java/org/apache/cassandra/utils/FBUtilities.java
index 58e66ec6f1..3c7d210f5e 100644
--- a/src/java/org/apache/cassandra/utils/FBUtilities.java
+++ b/src/java/org/apache/cassandra/utils/FBUtilities.java
@@ -103,7 +103,6 @@ public class FBUtilities
private static final String DEFAULT_TRIGGER_DIR = "triggers";
private static final String OPERATING_SYSTEM = System.getProperty("os.name").toLowerCase();
- public static final boolean isWindows = OPERATING_SYSTEM.contains("windows");
public static final boolean isLinux = OPERATING_SYSTEM.contains("linux");
private static volatile InetAddress localInetAddress;
diff --git a/src/java/org/apache/cassandra/utils/NativeLibrary.java b/src/java/org/apache/cassandra/utils/NativeLibrary.java
index b34f626f4a..59a95b040c 100644
--- a/src/java/org/apache/cassandra/utils/NativeLibrary.java
+++ b/src/java/org/apache/cassandra/utils/NativeLibrary.java
@@ -38,7 +38,6 @@ import static org.apache.cassandra.config.CassandraRelevantProperties.OS_ARCH;
import static org.apache.cassandra.config.CassandraRelevantProperties.OS_NAME;
import static org.apache.cassandra.utils.NativeLibrary.OSType.LINUX;
import static org.apache.cassandra.utils.NativeLibrary.OSType.MAC;
-import static org.apache.cassandra.utils.NativeLibrary.OSType.WINDOWS;
import static org.apache.cassandra.utils.NativeLibrary.OSType.AIX;
public final class NativeLibrary
@@ -50,7 +49,6 @@ public final class NativeLibrary
{
LINUX,
MAC,
- WINDOWS,
AIX,
OTHER;
}
@@ -99,7 +97,6 @@ public final class NativeLibrary
switch (osType)
{
case MAC: wrappedLibrary = new NativeLibraryDarwin(); break;
- case WINDOWS: wrappedLibrary = new NativeLibraryWindows(); break;
case LINUX:
case AIX:
case OTHER:
@@ -143,10 +140,8 @@ public final class NativeLibrary
return LINUX;
else if (osName.contains("mac"))
return MAC;
- else if (osName.contains("windows"))
- return WINDOWS;
- logger.warn("the current operating system, {}, is unsupported by cassandra", osName);
+ logger.warn("the current operating system, {}, is unsupported by Cassandra", osName);
if (osName.contains("aix"))
return AIX;
else
diff --git a/src/java/org/apache/cassandra/utils/NativeLibraryWindows.java b/src/java/org/apache/cassandra/utils/NativeLibraryWindows.java
deleted file mode 100644
index 85872ab50e..0000000000
--- a/src/java/org/apache/cassandra/utils/NativeLibraryWindows.java
+++ /dev/null
@@ -1,127 +0,0 @@
-/*
- * 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.utils;
-
-import java.util.Collections;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import com.sun.jna.LastErrorException;
-import com.sun.jna.Native;
-import com.sun.jna.Pointer;
-
-/**
- * A {@code NativeLibraryWrapper} implementation for Windows.
- * This implementation only offers support for the {@code callGetpid} method
- * using the Windows/Kernel32 library.
- *
- * @see org.apache.cassandra.utils.NativeLibraryWrapper
- * @see NativeLibrary
- */
-@Shared
-public class NativeLibraryWindows implements NativeLibraryWrapper
-{
- private static final Logger logger = LoggerFactory.getLogger(NativeLibraryWindows.class);
-
- private static boolean available;
-
- static
- {
- try
- {
- Native.register(com.sun.jna.NativeLibrary.getInstance("kernel32", Collections.emptyMap()));
- available = true;
- }
- catch (NoClassDefFoundError e)
- {
- logger.warn("JNA not found. Native methods will be disabled.");
- }
- catch (UnsatisfiedLinkError e)
- {
- logger.error("Failed to link the Windows/Kernel32 library against JNA. Native methods will be unavailable.", e);
- }
- catch (NoSuchMethodError e)
- {
- logger.warn("Obsolete version of JNA present; unable to register Windows/Kernel32 library. Upgrade to JNA 3.2.7 or later");
- }
- }
-
- /**
- * Retrieves the process identifier of the calling process (GetCurrentProcessId function).
- *
- * @return the process identifier of the calling process
- */
- private static native long GetCurrentProcessId() throws LastErrorException;
-
- public int callMlockall(int flags) throws UnsatisfiedLinkError, RuntimeException
- {
- throw new UnsatisfiedLinkError();
- }
-
- public int callMunlockall() throws UnsatisfiedLinkError, RuntimeException
- {
- throw new UnsatisfiedLinkError();
- }
-
- public int callFcntl(int fd, int command, long flags) throws UnsatisfiedLinkError, RuntimeException
- {
- throw new UnsatisfiedLinkError();
- }
-
- public int callPosixFadvise(int fd, long offset, int len, int flag) throws UnsatisfiedLinkError, RuntimeException
- {
- throw new UnsatisfiedLinkError();
- }
-
- public int callOpen(String path, int flags) throws UnsatisfiedLinkError, RuntimeException
- {
- throw new UnsatisfiedLinkError();
- }
-
- public int callFsync(int fd) throws UnsatisfiedLinkError, RuntimeException
- {
- throw new UnsatisfiedLinkError();
- }
-
- public int callClose(int fd) throws UnsatisfiedLinkError, RuntimeException
- {
- throw new UnsatisfiedLinkError();
- }
-
- public Pointer callStrerror(int errnum) throws UnsatisfiedLinkError, RuntimeException
- {
- throw new UnsatisfiedLinkError();
- }
-
- /**
- * @return the PID of the JVM running
- * @throws UnsatisfiedLinkError if we fail to link against Sigar
- * @throws RuntimeException if another unexpected error is thrown by Sigar
- */
- public long callGetpid() throws UnsatisfiedLinkError, RuntimeException
- {
- return GetCurrentProcessId();
- }
-
- public boolean isAvailable()
- {
- return available;
- }
-}
diff --git a/src/java/org/apache/cassandra/utils/SigarLibrary.java b/src/java/org/apache/cassandra/utils/SigarLibrary.java
index 81e44d2dc5..32987d83f7 100644
--- a/src/java/org/apache/cassandra/utils/SigarLibrary.java
+++ b/src/java/org/apache/cassandra/utils/SigarLibrary.java
@@ -113,10 +113,6 @@ public class SigarLibrary
private boolean hasAcceptableAddressSpace()
{
- // Check is invalid on Windows
- if (FBUtilities.isWindows)
- return true;
-
try
{
long fileMax = sigar.getResourceLimit().getVirtualMemoryMax();
diff --git a/src/java/org/apache/cassandra/utils/WindowsTimer.java b/src/java/org/apache/cassandra/utils/WindowsTimer.java
deleted file mode 100644
index bbd162c8c2..0000000000
--- a/src/java/org/apache/cassandra/utils/WindowsTimer.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * 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.utils;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import com.sun.jna.LastErrorException;
-import com.sun.jna.Native;
-
-public final class WindowsTimer
-{
- private static final Logger logger = LoggerFactory.getLogger(WindowsTimer.class);
-
- static
- {
- try
- {
- Native.register("winmm");
- }
- catch (NoClassDefFoundError e)
- {
- logger.warn("JNA not found. winmm.dll cannot be registered. Performance will be negatively impacted on this node.");
- }
- catch (Exception e)
- {
- logger.error("Failed to register winmm.dll. Performance will be negatively impacted on this node.");
- }
- }
-
- private static native int timeBeginPeriod(int period) throws LastErrorException;
- private static native int timeEndPeriod(int period) throws LastErrorException;
-
- private WindowsTimer() {}
-
- public static void startTimerPeriod(int period)
- {
- if (period == 0)
- return;
- assert(period > 0);
- if (timeBeginPeriod(period) != 0)
- logger.warn("Failed to set timer to : {}. Performance will be degraded.", period);
- }
-
- public static void endTimerPeriod(int period)
- {
- if (period == 0)
- return;
- assert(period > 0);
- if (timeEndPeriod(period) != 0)
- logger.warn("Failed to end accelerated timer period. System timer will remain set to: {} ms.", period);
- }
-}
diff --git a/test/conf/cdc.yaml b/test/conf/cdc.yaml
index 8fb9427af8..f79930a314 100644
--- a/test/conf/cdc.yaml
+++ b/test/conf/cdc.yaml
@@ -1,4 +1 @@
cdc_enabled: true
-# Compression enabled since uncompressed + cdc isn't compatible w/Windows
-commitlog_compression:
- - class_name: LZ4Compressor
diff --git a/test/microbench/org/apache/cassandra/test/microbench/DirectorySizerBench.java b/test/microbench/org/apache/cassandra/test/microbench/DirectorySizerBench.java
index a5b5fdd89b..c4466e11b0 100644
--- a/test/microbench/org/apache/cassandra/test/microbench/DirectorySizerBench.java
+++ b/test/microbench/org/apache/cassandra/test/microbench/DirectorySizerBench.java
@@ -64,11 +64,6 @@ public class DirectorySizerBench
// [java] Statistics: (min, avg, max) = (73.687, 74.714, 76.872), stdev = 0.835
// [java] Confidence interval (99.9%): [74.156, 75.272]
- // Throttle CPU on the Windows box to .87GHZ from 4.3GHZ turbo single-core, and #'s for 25600:
- // [java] Result: 298.628 ▒(99.9%) 14.755 ms/op [Average]
- // [java] Statistics: (min, avg, max) = (291.245, 298.628, 412.881), stdev = 22.085
- // [java] Confidence interval (99.9%): [283.873, 313.383]
-
// Test w/25,600 files, 100x the load of a full default CommitLog (8192) divided by size (32 per)
populateRandomFiles(tempDir, 25600);
sizer = new DirectorySizeCalculator(tempDir);
diff --git a/test/unit/org/apache/cassandra/LogbackStatusListener.java b/test/unit/org/apache/cassandra/LogbackStatusListener.java
index 1f95bd4936..719fada242 100644
--- a/test/unit/org/apache/cassandra/LogbackStatusListener.java
+++ b/test/unit/org/apache/cassandra/LogbackStatusListener.java
@@ -121,14 +121,6 @@ public class LogbackStatusListener implements StatusListener, LoggerContextListe
return;
}
- //Filter out Windows newline
- if (size() == 2)
- {
- byte[] bytes = toByteArray();
- if (bytes[0] == 0xD && bytes[1] == 0xA)
- return;
- }
-
String statement;
if (encoding != null)
statement = new String(toByteArray(), encoding);
diff --git a/test/unit/org/apache/cassandra/ServerTestUtils.java b/test/unit/org/apache/cassandra/ServerTestUtils.java
index 9109b07d4a..e742d88056 100644
--- a/test/unit/org/apache/cassandra/ServerTestUtils.java
+++ b/test/unit/org/apache/cassandra/ServerTestUtils.java
@@ -131,11 +131,10 @@ public final class ServerTestUtils
}
/**
- * Cleanup the directories used by the server, creating them if they do not exists.
+ * Cleanup the directories used by the server, creating them if they do not exist.
*/
public static void cleanupAndLeaveDirs() throws IOException
{
- // We need to stop and unmap all CLS instances prior to cleanup() or we'll get failures on Windows.
CommitLog.instance.stopUnsafe(true);
mkdirs(); // Creates the directories if they does not exists
cleanup(); // Ensure that the directories are all empty
diff --git a/test/unit/org/apache/cassandra/db/ColumnFamilyStoreTest.java b/test/unit/org/apache/cassandra/db/ColumnFamilyStoreTest.java
index 458b076754..f6efe6ade1 100644
--- a/test/unit/org/apache/cassandra/db/ColumnFamilyStoreTest.java
+++ b/test/unit/org/apache/cassandra/db/ColumnFamilyStoreTest.java
@@ -220,11 +220,6 @@ public class ColumnFamilyStoreTest
@Test
public void testClearEphemeralSnapshots() throws Throwable
{
- // We don't do snapshot-based repair on Windows so we don't have ephemeral snapshots from repair that need clearing.
- // This test will fail as we'll revert to the WindowsFailedSnapshotTracker and counts will be off, but since we
- // don't do snapshot-based repair on Windows, we just skip this test.
- Assume.assumeTrue(!FBUtilities.isWindows);
-
ColumnFamilyStore cfs = Keyspace.open(KEYSPACE1).getColumnFamilyStore(CF_INDEX1);
//cleanup any previous test gargbage
diff --git a/test/unit/org/apache/cassandra/db/SystemKeyspaceTest.java b/test/unit/org/apache/cassandra/db/SystemKeyspaceTest.java
index f80ba5556f..74565ad835 100644
--- a/test/unit/org/apache/cassandra/db/SystemKeyspaceTest.java
+++ b/test/unit/org/apache/cassandra/db/SystemKeyspaceTest.java
@@ -33,7 +33,6 @@ import org.apache.cassandra.cql3.QueryProcessor;
import org.apache.cassandra.cql3.UntypedResultSet;
import org.apache.cassandra.dht.ByteOrderedPartitioner.BytesToken;
import org.apache.cassandra.dht.Token;
-import org.apache.cassandra.schema.SchemaKeyspace;
import org.apache.cassandra.transport.ProtocolVersion;
import org.apache.cassandra.utils.ByteBufferUtil;
import org.apache.cassandra.utils.FBUtilities;
@@ -53,9 +52,6 @@ public class SystemKeyspaceTest
{
DatabaseDescriptor.daemonInitialization();
CommitLog.instance.start();
-
- if (FBUtilities.isWindows)
- WindowsFailedSnapshotTracker.deleteOldSnapshots();
}
@Test
@@ -98,26 +94,9 @@ public class SystemKeyspaceTest
assert firstId.equals(secondId) : String.format("%s != %s%n", firstId.toString(), secondId.toString());
}
- private void assertDeletedOrDeferred(int expectedCount)
+ private void assertDeleted()
{
- if (FBUtilities.isWindows)
- assertEquals(expectedCount, getDeferredDeletionCount());
- else
- assertTrue(getSystemSnapshotFiles(SchemaConstants.SYSTEM_KEYSPACE_NAME).isEmpty());
- }
-
- private int getDeferredDeletionCount()
- {
- try
- {
- Class c = Class.forName("java.io.DeleteOnExitHook");
- LinkedHashSet files = (LinkedHashSet)FBUtilities.getProtectedField(c, "files").get(c);
- return files.size();
- }
- catch (Exception e)
- {
- throw new RuntimeException(e);
- }
+ assertTrue(getSystemSnapshotFiles(SchemaConstants.SYSTEM_KEYSPACE_NAME).isEmpty());
}
@Test
@@ -128,15 +107,13 @@ public class SystemKeyspaceTest
cfs.clearUnsafe();
Keyspace.clearSnapshot(null, SchemaConstants.SYSTEM_KEYSPACE_NAME);
- int baseline = getDeferredDeletionCount();
-
SystemKeyspace.snapshotOnVersionChange();
- assertDeletedOrDeferred(baseline);
+ assertDeleted();
// now setup system.local as if we're upgrading from a previous version
setupReleaseVersion(getOlderVersionString());
Keyspace.clearSnapshot(null, SchemaConstants.SYSTEM_KEYSPACE_NAME);
- assertDeletedOrDeferred(baseline);
+ assertDeleted();
// Compare versions again & verify that snapshots were created for all tables in the system ks
SystemKeyspace.snapshotOnVersionChange();
@@ -153,10 +130,9 @@ public class SystemKeyspaceTest
SystemKeyspace.snapshotOnVersionChange();
- // snapshotOnVersionChange for upgrade case will open a SSTR when the CFS is flushed. On Windows, we won't be
- // able to delete hard-links to that file while segments are memory-mapped, so they'll be marked for deferred deletion.
+ // snapshotOnVersionChange for upgrade case will open a SSTR when the CFS is flushed.
// 10 files expected.
- assertDeletedOrDeferred(baseline + 10);
+ assertDeleted();
Keyspace.clearSnapshot(null, SchemaConstants.SYSTEM_KEYSPACE_NAME);
}
diff --git a/test/unit/org/apache/cassandra/db/commitlog/SnapshotDeletingTest.java b/test/unit/org/apache/cassandra/db/commitlog/SnapshotDeletingTest.java
deleted file mode 100644
index b3dc070101..0000000000
--- a/test/unit/org/apache/cassandra/db/commitlog/SnapshotDeletingTest.java
+++ /dev/null
@@ -1,107 +0,0 @@
-/*
- * 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.commitlog;
-
-import org.junit.Assume;
-import org.junit.BeforeClass;
-import org.junit.Test;
-import static org.junit.Assert.*;
-
-import org.apache.cassandra.SchemaLoader;
-import org.apache.cassandra.Util;
-import org.apache.cassandra.schema.TableMetadata;
-import org.apache.cassandra.config.DatabaseDescriptor;
-import org.apache.cassandra.db.ColumnFamilyStore;
-import org.apache.cassandra.db.DecoratedKey;
-import org.apache.cassandra.db.Keyspace;
-import org.apache.cassandra.db.RowUpdateBuilder;
-import org.apache.cassandra.db.WindowsFailedSnapshotTracker;
-import org.apache.cassandra.io.sstable.SnapshotDeletingTask;
-import org.apache.cassandra.schema.KeyspaceParams;
-import org.apache.cassandra.service.GCInspector;
-import org.apache.cassandra.utils.ByteBufferUtil;
-import org.apache.cassandra.utils.FBUtilities;
-
-public class SnapshotDeletingTest
-{
- private static final String KEYSPACE1 = "Keyspace1";
- private static final String CF_STANDARD1 = "CF_STANDARD1";
-
- @BeforeClass
- public static void defineSchema() throws Exception
- {
- DatabaseDescriptor.daemonInitialization();
- GCInspector.register();
- // Needed to init the output file where we print failed snapshots. This is called on node startup.
- WindowsFailedSnapshotTracker.deleteOldSnapshots();
- SchemaLoader.prepareServer();
- SchemaLoader.createKeyspace(KEYSPACE1,
- KeyspaceParams.simple(1),
- SchemaLoader.standardCFMD(KEYSPACE1, CF_STANDARD1));
- }
-
- @Test
- public void testCompactionHook() throws Exception
- {
- Assume.assumeTrue(FBUtilities.isWindows);
-
- Keyspace keyspace = Keyspace.open(KEYSPACE1);
- ColumnFamilyStore store = keyspace.getColumnFamilyStore(CF_STANDARD1);
- store.clearUnsafe();
-
- populate(10000);
- store.snapshot("snapshot1");
-
- // Confirm snapshot deletion fails. Sleep for a bit just to make sure the SnapshotDeletingTask has
- // time to run and fail.
- Thread.sleep(500);
- store.clearSnapshot("snapshot1");
- assertEquals(1, SnapshotDeletingTask.pendingDeletionCount());
-
- // Compact the cf and confirm that the executor's after hook calls rescheduleDeletion
- populate(20000);
- store.forceBlockingFlush();
- store.forceMajorCompaction();
-
- long start = System.currentTimeMillis();
- while (System.currentTimeMillis() - start < 1000 && SnapshotDeletingTask.pendingDeletionCount() > 0)
- {
- Thread.yield();
- }
-
- assertEquals(0, SnapshotDeletingTask.pendingDeletionCount());
- }
-
- private void populate(int rowCount) {
- long timestamp = System.currentTimeMillis();
- TableMetadata cfm = Keyspace.open(KEYSPACE1).getColumnFamilyStore(CF_STANDARD1).metadata();
- for (int i = 0; i <= rowCount; i++)
- {
- DecoratedKey key = Util.dk(Integer.toString(i));
- for (int j = 0; j < 10; j++)
- {
- new RowUpdateBuilder(cfm, timestamp, 0, key.getKey())
- .clustering(Integer.toString(j))
- .add("val", ByteBufferUtil.EMPTY_BYTE_BUFFER)
- .build()
- .applyUnsafe();
- }
- }
- }
-}
diff --git a/test/unit/org/apache/cassandra/db/lifecycle/LogTransactionTest.java b/test/unit/org/apache/cassandra/db/lifecycle/LogTransactionTest.java
index b459d05b6e..3ea710d348 100644
--- a/test/unit/org/apache/cassandra/db/lifecycle/LogTransactionTest.java
+++ b/test/unit/org/apache/cassandra/db/lifecycle/LogTransactionTest.java
@@ -1290,8 +1290,7 @@ public class LogTransactionTest extends AbstractTransactionalTest
}
// Check either that a temporary file is expected to exist (in the existingFiles) or that
- // it does not exist any longer (on Windows we need to check File.exists() because a list
- // might return a file as existing even if it does not)
+ // it does not exist any longer.
private static void assertFiles(Iterable existingFiles, Set temporaryFiles)
{
for (String filePath : existingFiles)
diff --git a/test/unit/org/apache/cassandra/io/sstable/SSTableLoaderTest.java b/test/unit/org/apache/cassandra/io/sstable/SSTableLoaderTest.java
index 51489a89af..b67cc8b4dd 100644
--- a/test/unit/org/apache/cassandra/io/sstable/SSTableLoaderTest.java
+++ b/test/unit/org/apache/cassandra/io/sstable/SSTableLoaderTest.java
@@ -97,7 +97,6 @@ public class SSTableLoaderTest
FileUtils.deleteRecursive(tmpdir);
} catch (FSWriteError e) {
/*
- Windows does not allow a mapped file to be deleted, so we probably forgot to clean the buffers somewhere.
We force a GC here to force buffer deallocation, and then try deleting the directory again.
For more information, see: http://bugs.java.com/bugdatabase/view_bug.do?bug_id=4715154
If this is not the problem, the exception will be rethrown anyway.
diff --git a/test/unit/org/apache/cassandra/io/sstable/SSTableWriterTest.java b/test/unit/org/apache/cassandra/io/sstable/SSTableWriterTest.java
index 84f80a8ce0..c850444870 100644
--- a/test/unit/org/apache/cassandra/io/sstable/SSTableWriterTest.java
+++ b/test/unit/org/apache/cassandra/io/sstable/SSTableWriterTest.java
@@ -33,7 +33,6 @@ import org.apache.cassandra.db.rows.*;
import org.apache.cassandra.io.sstable.format.SSTableReader;
import org.apache.cassandra.io.sstable.format.SSTableReadsListener;
import org.apache.cassandra.io.sstable.format.SSTableWriter;
-import org.apache.cassandra.utils.FBUtilities;
import static junit.framework.Assert.fail;
import static org.apache.cassandra.service.ActiveRepairService.NO_PENDING_REPAIR;
@@ -44,7 +43,7 @@ import static org.junit.Assert.assertTrue;
public class SSTableWriterTest extends SSTableWriterTestBase
{
@Test
- public void testAbortTxnWithOpenEarlyShouldRemoveSSTable() throws InterruptedException
+ public void testAbortTxnWithOpenEarlyShouldRemoveSSTable()
{
Keyspace keyspace = Keyspace.open(KEYSPACE);
ColumnFamilyStore cfs = keyspace.getColumnFamilyStore(CF);
@@ -81,13 +80,9 @@ public class SSTableWriterTest extends SSTableWriterTestBase
int datafiles = assertFileCounts(dir.tryListNames());
assertEquals(datafiles, 1);
- // These checks don't work on Windows because the writer has the channel still
- // open till .abort() is called (via the builder)
- if (!FBUtilities.isWindows)
- {
- LifecycleTransaction.waitForDeletions();
- assertFileCounts(dir.tryListNames());
- }
+ LifecycleTransaction.waitForDeletions();
+ assertFileCounts(dir.tryListNames());
+
writer.abort();
txn.abort();
LifecycleTransaction.waitForDeletions();
@@ -130,13 +125,9 @@ public class SSTableWriterTest extends SSTableWriterTestBase
assertEquals(datafiles, 1);
sstable.selfRef().release();
- // These checks don't work on Windows because the writer has the channel still
- // open till .abort() is called (via the builder)
- if (!FBUtilities.isWindows)
- {
- LifecycleTransaction.waitForDeletions();
- assertFileCounts(dir.tryListNames());
- }
+
+ LifecycleTransaction.waitForDeletions();
+ assertFileCounts(dir.tryListNames());
txn.abort();
LifecycleTransaction.waitForDeletions();
@@ -184,13 +175,9 @@ public class SSTableWriterTest extends SSTableWriterTestBase
int datafiles = assertFileCounts(dir.tryListNames());
assertEquals(datafiles, 2);
- // These checks don't work on Windows because the writer has the channel still
- // open till .abort() is called (via the builder)
- if (!FBUtilities.isWindows)
- {
- LifecycleTransaction.waitForDeletions();
- assertFileCounts(dir.tryListNames());
- }
+ LifecycleTransaction.waitForDeletions();
+ assertFileCounts(dir.tryListNames());
+
txn.abort();
LifecycleTransaction.waitForDeletions();
datafiles = assertFileCounts(dir.tryListNames());
diff --git a/test/unit/org/apache/cassandra/io/sstable/SSTableWriterTestBase.java b/test/unit/org/apache/cassandra/io/sstable/SSTableWriterTestBase.java
index 41d026f93f..10bb783bd8 100644
--- a/test/unit/org/apache/cassandra/io/sstable/SSTableWriterTestBase.java
+++ b/test/unit/org/apache/cassandra/io/sstable/SSTableWriterTestBase.java
@@ -44,7 +44,6 @@ import org.apache.cassandra.exceptions.ConfigurationException;
import org.apache.cassandra.io.sstable.format.SSTableReader;
import org.apache.cassandra.io.sstable.format.SSTableWriter;
import org.apache.cassandra.schema.KeyspaceParams;
-import org.apache.cassandra.utils.FBUtilities;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
@@ -67,15 +66,6 @@ public class SSTableWriterTestBase extends SchemaLoader
{
DatabaseDescriptor.daemonInitialization();
- if (FBUtilities.isWindows)
- {
- standardMode = DatabaseDescriptor.getDiskAccessMode();
- indexMode = DatabaseDescriptor.getIndexAccessMode();
-
- DatabaseDescriptor.setDiskAccessMode(Config.DiskAccessMode.standard);
- DatabaseDescriptor.setIndexAccessMode(Config.DiskAccessMode.standard);
- }
-
SchemaLoader.prepareServer();
SchemaLoader.createKeyspace(KEYSPACE,
KeyspaceParams.simple(1),
diff --git a/test/unit/org/apache/cassandra/repair/messages/RepairOptionTest.java b/test/unit/org/apache/cassandra/repair/messages/RepairOptionTest.java
index 3f09b36e60..a6ca084c28 100644
--- a/test/unit/org/apache/cassandra/repair/messages/RepairOptionTest.java
+++ b/test/unit/org/apache/cassandra/repair/messages/RepairOptionTest.java
@@ -26,14 +26,12 @@ import java.util.Set;
import org.junit.Assert;
import org.junit.Test;
-import org.apache.cassandra.config.Config;
import org.apache.cassandra.config.DatabaseDescriptor;
import org.apache.cassandra.dht.IPartitioner;
import org.apache.cassandra.dht.Murmur3Partitioner;
import org.apache.cassandra.dht.Range;
import org.apache.cassandra.dht.Token;
import org.apache.cassandra.repair.RepairParallelism;
-import org.apache.cassandra.utils.FBUtilities;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
@@ -52,11 +50,7 @@ public class RepairOptionTest
// parse with empty options
RepairOption option = RepairOption.parse(new HashMap(), partitioner);
-
- if (FBUtilities.isWindows && (DatabaseDescriptor.getDiskAccessMode() != Config.DiskAccessMode.standard || DatabaseDescriptor.getIndexAccessMode() != Config.DiskAccessMode.standard))
- assertTrue(option.getParallelism() == RepairParallelism.PARALLEL);
- else
- assertTrue(option.getParallelism() == RepairParallelism.SEQUENTIAL);
+ assertTrue(option.getParallelism() == RepairParallelism.SEQUENTIAL);
assertFalse(option.isPrimaryRange());
assertFalse(option.isIncremental());
diff --git a/test/unit/org/apache/cassandra/service/StorageServiceServerTest.java b/test/unit/org/apache/cassandra/service/StorageServiceServerTest.java
index d9cf4f2e98..7bef3a5570 100644
--- a/test/unit/org/apache/cassandra/service/StorageServiceServerTest.java
+++ b/test/unit/org/apache/cassandra/service/StorageServiceServerTest.java
@@ -19,9 +19,7 @@
package org.apache.cassandra.service;
-import org.apache.cassandra.io.util.File;
import java.io.IOException;
-import java.io.PrintWriter;
import java.net.InetAddress;
import java.net.UnknownHostException;
import java.util.*;
@@ -37,7 +35,6 @@ import org.junit.Test;
import org.apache.cassandra.audit.AuditLogManager;
import org.apache.cassandra.config.DatabaseDescriptor;
import org.apache.cassandra.db.Keyspace;
-import org.apache.cassandra.db.WindowsFailedSnapshotTracker;
import org.apache.cassandra.db.commitlog.CommitLog;
import org.apache.cassandra.dht.Murmur3Partitioner;
import org.apache.cassandra.dht.Murmur3Partitioner.LongToken;
@@ -53,13 +50,11 @@ import org.apache.cassandra.locator.InetAddressAndPort;
import org.apache.cassandra.locator.PropertyFileSnitch;
import org.apache.cassandra.locator.TokenMetadata;
import org.apache.cassandra.schema.*;
-import org.apache.cassandra.io.util.FileWriter;
import org.apache.cassandra.utils.FBUtilities;
import org.assertj.core.api.Assertions;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
-import static org.junit.Assume.assumeTrue;
public class StorageServiceServerTest
{
@@ -88,75 +83,6 @@ public class StorageServiceServerTest
StorageService.instance.takeSnapshot(UUID.randomUUID().toString());
}
- private void checkTempFilePresence(File f, boolean exist)
- {
- for (int i = 0; i < 5; i++)
- {
- File subdir = new File(f, Integer.toString(i));
- subdir.tryCreateDirectory();
- for (int j = 0; j < 5; j++)
- {
- File subF = new File(subdir, Integer.toString(j));
- assert(exist ? subF.exists() : !subF.exists());
- }
- }
- }
-
- @Test
- public void testSnapshotFailureHandler() throws IOException
- {
- assumeTrue(FBUtilities.isWindows);
-
- // Initial "run" of Cassandra, nothing in failed snapshot file
- WindowsFailedSnapshotTracker.deleteOldSnapshots();
-
- File f = new File(System.getenv("TEMP") + File.pathSeparator() + Integer.toString(new Random().nextInt()));
- f.tryCreateDirectory();
- f.deleteOnExit();
- for (int i = 0; i < 5; i++)
- {
- File subdir = new File(f, Integer.toString(i));
- subdir.tryCreateDirectory();
- for (int j = 0; j < 5; j++)
- new File(subdir, Integer.toString(j)).createFileIfNotExists();
- }
-
- checkTempFilePresence(f, true);
-
- // Confirm deletion is recursive
- for (int i = 0; i < 5; i++)
- WindowsFailedSnapshotTracker.handleFailedSnapshot(new File(f, Integer.toString(i)));
-
- assertTrue(new File(WindowsFailedSnapshotTracker.TODELETEFILE).exists());
-
- // Simulate shutdown and restart of C* node, closing out the list of failed snapshots.
- WindowsFailedSnapshotTracker.resetForTests();
-
- // Perform new run, mimicking behavior of C* at startup
- WindowsFailedSnapshotTracker.deleteOldSnapshots();
- checkTempFilePresence(f, false);
-
- // Check to make sure we don't delete non-temp, non-datafile locations
- WindowsFailedSnapshotTracker.resetForTests();
- PrintWriter tempPrinter = new PrintWriter(new FileWriter(new File(WindowsFailedSnapshotTracker.TODELETEFILE), File.WriteMode.APPEND));
- tempPrinter.println(".safeDir");
- tempPrinter.close();
-
- File protectedDir = new File(".safeDir");
- protectedDir.tryCreateDirectory();
- File protectedFile = new File(protectedDir, ".safeFile");
- protectedFile.createFileIfNotExists();
-
- WindowsFailedSnapshotTracker.handleFailedSnapshot(protectedDir);
- WindowsFailedSnapshotTracker.deleteOldSnapshots();
-
- assertTrue(protectedDir.exists());
- assertTrue(protectedFile.exists());
-
- protectedFile.tryDelete();
- protectedDir.tryDelete();
- }
-
@Test
public void testTableSnapshot() throws IOException
{
diff --git a/test/unit/org/apache/cassandra/utils/MonotonicClockTest.java b/test/unit/org/apache/cassandra/utils/MonotonicClockTest.java
index 3cdb4449c3..3839be004b 100644
--- a/test/unit/org/apache/cassandra/utils/MonotonicClockTest.java
+++ b/test/unit/org/apache/cassandra/utils/MonotonicClockTest.java
@@ -43,11 +43,11 @@ public class MonotonicClockTest
nowNanos = Math.max(nowNanos, nanoTime());
long convertedNow = approxTime.translate().toMillisSinceEpoch(nowNanos);
- int maxDiff = FBUtilities.isWindows ? 15 : 1;
+ int maxDiff = 1;
assertTrue("convertedNow = " + convertedNow + " lastConverted = " + lastConverted + " in iteration " + ii,
convertedNow >= (lastConverted - maxDiff));
- maxDiff = FBUtilities.isWindows ? 25 : 2;
+ maxDiff = 2;
assertTrue("now = " + now + " convertedNow = " + convertedNow + " in iteration " + ii,
(maxDiff - 2) <= convertedNow);
diff --git a/tools/stress/src/org/apache/cassandra/stress/Stress.java b/tools/stress/src/org/apache/cassandra/stress/Stress.java
index 1fd808fd08..e505633040 100644
--- a/tools/stress/src/org/apache/cassandra/stress/Stress.java
+++ b/tools/stress/src/org/apache/cassandra/stress/Stress.java
@@ -24,8 +24,6 @@ import java.net.SocketException;
import org.apache.cassandra.config.DatabaseDescriptor;
import org.apache.cassandra.stress.settings.StressSettings;
import org.apache.cassandra.stress.util.MultiResultLogger;
-import org.apache.cassandra.utils.FBUtilities;
-import org.apache.cassandra.utils.WindowsTimer;
import org.apache.commons.lang3.exception.ExceptionUtils;
public final class Stress
@@ -57,18 +55,9 @@ public final class Stress
public static void main(String[] arguments) throws Exception
{
- if (FBUtilities.isWindows)
- WindowsTimer.startTimerPeriod(1);
-
- int exitCode = run(arguments);
-
- if (FBUtilities.isWindows)
- WindowsTimer.endTimerPeriod(1);
-
- System.exit(exitCode);
+ System.exit(run(arguments));
}
-
private static int run(String[] arguments)
{
try