diff --git a/CHANGES.txt b/CHANGES.txt index 0c4203b70a..5f09cdc981 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -56,6 +56,7 @@ Merged from 3.0: * cqlsh return non-zero status when STDIN CQL fails (CASSANDRA-15623) * Don't skip sstables in slice queries based only on local min/max/deletion timestamp (CASSANDRA-15690) Merged from 2.2: + * Fix nomenclature of allow and deny lists (CASSANDRA-15862) * Remove generated files from source artifact (CASSANDRA-15849) * Remove duplicated tools binaries from tarballs (CASSANDRA-15768) * Duplicate results with DISTINCT queries in mixed mode (CASSANDRA-15501) diff --git a/NEWS.txt b/NEWS.txt index 8f18659002..351f80dc0b 100644 --- a/NEWS.txt +++ b/NEWS.txt @@ -252,6 +252,14 @@ Upgrading break existing scripts that rely on the current behavior. See CASSANDRA-15623 for more details. +Deprecation +----------- + + - The JMX MBean org.apache.cassandra.db:type=BlacklistedDirectories has been + deprecated in favor of org.apache.cassandra.db:type=DisallowedDirectories + and will be removed in a subsequent major version. + + Materialized Views ------------------- - Following a discussion regarding concerns about the design and safety of Materialized Views, the C* development diff --git a/src/java/org/apache/cassandra/auth/jmx/AuthorizationProxy.java b/src/java/org/apache/cassandra/auth/jmx/AuthorizationProxy.java index b213c43d66..68cff0c12d 100644 --- a/src/java/org/apache/cassandra/auth/jmx/AuthorizationProxy.java +++ b/src/java/org/apache/cassandra/auth/jmx/AuthorizationProxy.java @@ -69,7 +69,7 @@ import org.apache.cassandra.service.StorageService; * MBeanServer::getDomains is primarily a function of the MBeanServer itself. This class makes * such a distinction in order to identify which JMXResource the subject requires permissions on. * - * Certain operations are never allowed for users and these are recorded in a blacklist so that we + * Certain operations are never allowed for users and these are recorded in a deny list so that we * can short circuit authorization process if one is attempted by a remote subject. * */ @@ -78,30 +78,30 @@ public class AuthorizationProxy implements InvocationHandler private static final Logger logger = LoggerFactory.getLogger(AuthorizationProxy.class); /* - A whitelist of permitted methods on the MBeanServer interface which *do not* take an ObjectName + A list of permitted methods on the MBeanServer interface which *do not* take an ObjectName as their first argument. These methods can be thought of as relating to the MBeanServer itself, - rather than to the MBeans it manages. All of the whitelisted methods are essentially descriptive, + rather than to the MBeans it manages. All of the allowed methods are essentially descriptive, hence they require the Subject to have the DESCRIBE permission on the root JMX resource. */ - private static final Set MBEAN_SERVER_METHOD_WHITELIST = ImmutableSet.of("getDefaultDomain", - "getDomains", - "getMBeanCount", - "hashCode", - "queryMBeans", - "queryNames", - "toString"); + private static final Set MBEAN_SERVER_ALLOWED_METHODS = ImmutableSet.of("getDefaultDomain", + "getDomains", + "getMBeanCount", + "hashCode", + "queryMBeans", + "queryNames", + "toString"); /* - A blacklist of method names which are never permitted to be executed by a remote user, + A list of method names which are never permitted to be executed by a remote user, regardless of privileges they may be granted. */ - private static final Set METHOD_BLACKLIST = ImmutableSet.of("createMBean", - "deserialize", - "getClassLoader", - "getClassLoaderFor", - "instantiate", - "registerMBean", - "unregisterMBean"); + private static final Set DENIED_METHODS = ImmutableSet.of("createMBean", + "deserialize", + "getClassLoader", + "getClassLoaderFor", + "instantiate", + "registerMBean", + "unregisterMBean"); private static final JMXPermissionsCache permissionsCache = new JMXPermissionsCache(); private MBeanServer mbs; @@ -203,9 +203,9 @@ public class AuthorizationProxy implements InvocationHandler return true; // Restrict access to certain methods by any remote user - if (METHOD_BLACKLIST.contains(methodName)) + if (DENIED_METHODS.contains(methodName)) { - logger.trace("Access denied to blacklisted method {}", methodName); + logger.trace("Access denied to restricted method {}", methodName); return false; } @@ -233,7 +233,7 @@ public class AuthorizationProxy implements InvocationHandler /** * Authorize execution of a method on the MBeanServer which does not take an MBean ObjectName - * as its first argument. The whitelisted methods that match this criteria are generally + * as its first argument. The allowed methods that match this criteria are generally * descriptive methods concerned with the MBeanServer itself, rather than with any particular * set of MBeans managed by the server and so we check the DESCRIBE permission on the root * JMXResource (representing the MBeanServer) @@ -247,8 +247,8 @@ public class AuthorizationProxy implements InvocationHandler private boolean authorizeMBeanServerMethod(RoleResource subject, String methodName) { logger.trace("JMX invocation of {} on MBeanServer requires permission {}", methodName, Permission.DESCRIBE); - return (MBEAN_SERVER_METHOD_WHITELIST.contains(methodName) && - hasPermission(subject, Permission.DESCRIBE, JMXResource.root())); + return (MBEAN_SERVER_ALLOWED_METHODS.contains(methodName) && + hasPermission(subject, Permission.DESCRIBE, JMXResource.root())); } /** diff --git a/src/java/org/apache/cassandra/cql3/functions/UDFunction.java b/src/java/org/apache/cassandra/cql3/functions/UDFunction.java index f98c75f1f8..f0fd8d9fc5 100644 --- a/src/java/org/apache/cassandra/cql3/functions/UDFunction.java +++ b/src/java/org/apache/cassandra/cql3/functions/UDFunction.java @@ -84,19 +84,19 @@ public abstract class UDFunction extends AbstractFunction implements ScalarFunct protected final UDFContext udfContext; // - // Access to classes is controlled via a whitelist and a blacklist. + // Access to classes is controlled via allow and disallow lists. // // When a class is requested (both during compilation and runtime), - // the whitelistedPatterns array is searched first, whether the + // the allowedPatterns array is searched first, whether the // requested name matches one of the patterns. If not, nothing is // returned from the class-loader - meaning ClassNotFoundException // during runtime and "type could not resolved" during compilation. // - // If a whitelisted pattern has been found, the blacklistedPatterns + // If an allowed pattern has been found, the disallowedPatterns // array is searched for a match. If a match is found, class-loader // rejects access. Otherwise the class/resource can be loaded. // - private static final String[] whitelistedPatterns = + private static final String[] allowedPatterns = { "com/google/common/reflect/TypeToken", "java/io/IOException.class", @@ -120,8 +120,8 @@ public abstract class UDFunction extends AbstractFunction implements ScalarFunct "org/apache/cassandra/exceptions/", "org/apache/cassandra/transport/ProtocolVersion.class" }; - // Only need to blacklist a pattern, if it would otherwise be allowed via whitelistedPatterns - private static final String[] blacklistedPatterns = + // Only need to disallow a pattern, if it would otherwise be allowed via allowedPatterns + private static final String[] disallowedPatterns = { "com/datastax/driver/core/Cluster.class", "com/datastax/driver/core/Metrics.class", @@ -164,13 +164,13 @@ public abstract class UDFunction extends AbstractFunction implements ScalarFunct while (resource.startsWith("/")) resource = resource.substring(1); - for (String white : whitelistedPatterns) - if (resource.startsWith(white)) + for (String allowed : allowedPatterns) + if (resource.startsWith(allowed)) { - // resource is in whitelistedPatterns, let's see if it is not explicityl blacklisted - for (String black : blacklistedPatterns) - if (resource.startsWith(black)) + // resource is in allowedPatterns, let's see if it is not explicitly disallowed + for (String disallowed : disallowedPatterns) + if (resource.startsWith(disallowed)) { logger.trace("access denied: resource {}", resource); return false; diff --git a/src/java/org/apache/cassandra/db/Directories.java b/src/java/org/apache/cassandra/db/Directories.java index de5ab8873d..bd4081fa75 100644 --- a/src/java/org/apache/cassandra/db/Directories.java +++ b/src/java/org/apache/cassandra/db/Directories.java @@ -324,10 +324,10 @@ public class Directories /** * Basically the same as calling {@link #getWriteableLocationAsFile(long)} with an unknown size ({@code -1L}), - * which may return any non-blacklisted directory - even a data directory that has no usable space. + * which may return any allowed directory - even a data directory that has no usable space. * Do not use this method in production code. * - * @throws FSWriteError if all directories are blacklisted. + * @throws FSWriteError if all directories are disallowed. */ public File getDirectoryForNewSSTables() { @@ -335,9 +335,9 @@ public class Directories } /** - * Returns a non-blacklisted data directory that _currently_ has {@code writeSize} bytes as usable space. + * Returns an allowed directory that _currently_ has {@code writeSize} bytes as usable space. * - * @throws FSWriteError if all directories are blacklisted. + * @throws FSWriteError if all directories are disallowed. */ public File getWriteableLocationAsFile(long writeSize) { @@ -352,9 +352,9 @@ public class Directories * data directory then use that one as data directory otherwise use {@link #getWriteableLocationAsFile(long)} to * find suitable data directory. * - * Also makes sure returned directory is non-blacklisted. + * Also makes sure returned directory is not disallowed. * - * @throws FSWriteError if all directories are blacklisted + * @throws FSWriteError if all directories are disallowed. */ public File getWriteableLocationToLoadFile(final File sourceFile) { @@ -363,7 +363,7 @@ public class Directories final FileStore srcFileStore = Files.getFileStore(sourceFile.toPath()); for (final File dataPath : dataPaths) { - if (BlacklistedDirectories.isUnwritable(dataPath)) + if (DisallowedDirectories.isUnwritable(dataPath)) { continue; } @@ -383,11 +383,11 @@ public class Directories } /** - * Returns a temporary subdirectory on non-blacklisted data directory + * Returns a temporary subdirectory on allowed data directory * that _currently_ has {@code writeSize} bytes as usable space. * This method does not create the temporary directory. * - * @throws IOError if all directories are blacklisted. + * @throws IOError if all directories are disallowed. */ public File getTemporaryWriteableDirectoryAsFile(long writeSize) { @@ -411,10 +411,9 @@ public class Directories } /** - * Returns a non-blacklisted data directory that _currently_ has {@code writeSize} bytes as usable space, null if - * there is not enough space left in all directories. + * Returns an allowed data directory that _currently_ has {@code writeSize} bytes as usable space. * - * @throws FSWriteError if all directories are blacklisted. + * @throws FSWriteError if all directories are disallowed. */ public DataDirectory getWriteableLocation(long writeSize) { @@ -422,13 +421,13 @@ public class Directories long totalAvailable = 0L; - // pick directories with enough space and so that resulting sstable dirs aren't blacklisted for writes. + // pick directories with enough space and so that resulting sstable dirs aren't disallowed for writes. boolean tooBig = false; for (DataDirectory dataDir : paths) { - if (BlacklistedDirectories.isUnwritable(getLocationForDisk(dataDir))) + if (DisallowedDirectories.isUnwritable(getLocationForDisk(dataDir))) { - logger.trace("removing blacklisted candidate {}", dataDir.location); + logger.trace("removing disallowed candidate {}", dataDir.location); continue; } DataDirectoryCandidate candidate = new DataDirectoryCandidate(dataDir); @@ -447,7 +446,7 @@ public class Directories if (tooBig) throw new FSDiskFullWriteError(new IOException("Insufficient disk space to write " + writeSize + " bytes"), ""); else - throw new FSWriteError(new IOException("All configured data directories have been blacklisted as unwritable for erroring out"), ""); + throw new FSWriteError(new IOException("All configured data directories have been disallowed as unwritable for erroring out"), ""); // shortcut for single data directory systems if (candidates.size() == 1) @@ -492,8 +491,8 @@ public class Directories for (DataDirectory dataDir : paths) { - if (BlacklistedDirectories.isUnwritable(getLocationForDisk(dataDir))) - continue; + if (DisallowedDirectories.isUnwritable(getLocationForDisk(dataDir))) + continue; DataDirectoryCandidate candidate = new DataDirectoryCandidate(dataDir); // exclude directory if its total writeSize does not fit to data directory if (candidate.availableSpace < writeSize) @@ -505,14 +504,14 @@ public class Directories public DataDirectory[] getWriteableLocations() { - List nonBlacklistedDirs = new ArrayList<>(); + List allowedDirs = new ArrayList<>(); for (DataDirectory dir : paths) { - if (!BlacklistedDirectories.isUnwritable(dir.location)) - nonBlacklistedDirs.add(dir); + if (!DisallowedDirectories.isUnwritable(dir.location)) + allowedDirs.add(dir); } - Collections.sort(nonBlacklistedDirs, new Comparator() + Collections.sort(allowedDirs, new Comparator() { @Override public int compare(DataDirectory o1, DataDirectory o2) @@ -520,7 +519,7 @@ public class Directories return o1.location.compareTo(o2.location); } }); - return nonBlacklistedDirs.toArray(new DataDirectory[nonBlacklistedDirs.size()]); + return allowedDirs.toArray(new DataDirectory[allowedDirs.size()]); } public static File getSnapshotDirectory(Descriptor desc, String snapshotName) @@ -780,7 +779,7 @@ public class Directories for (File location : dataPaths) { - if (BlacklistedDirectories.isUnreadable(location)) + if (DisallowedDirectories.isUnreadable(location)) continue; if (snapshotName != null) diff --git a/src/java/org/apache/cassandra/db/BlacklistedDirectories.java b/src/java/org/apache/cassandra/db/DisallowedDirectories.java similarity index 80% rename from src/java/org/apache/cassandra/db/BlacklistedDirectories.java rename to src/java/org/apache/cassandra/db/DisallowedDirectories.java index cff9a78418..f030253f70 100644 --- a/src/java/org/apache/cassandra/db/BlacklistedDirectories.java +++ b/src/java/org/apache/cassandra/db/DisallowedDirectories.java @@ -28,23 +28,24 @@ import java.util.concurrent.atomic.AtomicInteger; import com.google.common.annotations.VisibleForTesting; -import org.apache.cassandra.utils.JVMStabilityInspector; import org.apache.cassandra.utils.MBeanWrapper; -public class BlacklistedDirectories implements BlacklistedDirectoriesMBean +public class DisallowedDirectories implements DisallowedDirectoriesMBean { - public static final String MBEAN_NAME = "org.apache.cassandra.db:type=BlacklistedDirectories"; - private static final Logger logger = LoggerFactory.getLogger(BlacklistedDirectories.class); - private static final BlacklistedDirectories instance = new BlacklistedDirectories(); + public static final String DEPRECATED_MBEAN_NAME = "org.apache.cassandra.db:type=BlacklistedDirectories"; + public static final String MBEAN_NAME = "org.apache.cassandra.db:type=DisallowedDirectories"; + private static final Logger logger = LoggerFactory.getLogger(DisallowedDirectories.class); + private static final DisallowedDirectories instance = new DisallowedDirectories(); private final Set unreadableDirectories = new CopyOnWriteArraySet(); private final Set unwritableDirectories = new CopyOnWriteArraySet(); private static final AtomicInteger directoriesVersion = new AtomicInteger(); - private BlacklistedDirectories() + private DisallowedDirectories() { // Register this instance with JMX + MBeanWrapper.instance.registerMBean(this, DEPRECATED_MBEAN_NAME, MBeanWrapper.OnException.LOG); MBeanWrapper.instance.registerMBean(this, MBEAN_NAME, MBeanWrapper.OnException.LOG); } @@ -72,7 +73,7 @@ public class BlacklistedDirectories implements BlacklistedDirectoriesMBean * Adds parent directory of the file (or the file itself, if it is a directory) * to the set of unreadable directories. * - * @return the blacklisted directory or null if nothing has been added to the list. + * @return the disallowed directory or null if nothing has been added to the list. */ public static File maybeMarkUnreadable(File path) { @@ -80,7 +81,7 @@ public class BlacklistedDirectories implements BlacklistedDirectoriesMBean if (instance.unreadableDirectories.add(directory)) { directoriesVersion.incrementAndGet(); - logger.warn("Blacklisting {} for reads", directory); + logger.warn("Disallowing {} for reads", directory); return directory; } return null; @@ -90,7 +91,7 @@ public class BlacklistedDirectories implements BlacklistedDirectoriesMBean * Adds parent directory of the file (or the file itself, if it is a directory) * to the set of unwritable directories. * - * @return the blacklisted directory or null if nothing has been added to the list. + * @return the disallowed directory or null if nothing has been added to the list. */ public static File maybeMarkUnwritable(File path) { @@ -98,7 +99,7 @@ public class BlacklistedDirectories implements BlacklistedDirectoriesMBean if (instance.unwritableDirectories.add(directory)) { directoriesVersion.incrementAndGet(); - logger.warn("Blacklisting {} for writes", directory); + logger.warn("Disallowing {} for writes", directory); return directory; } return null; @@ -121,8 +122,8 @@ public class BlacklistedDirectories implements BlacklistedDirectoriesMBean /** - * Tells whether or not the directory is blacklisted for reads. - * @return whether or not the directory is blacklisted for reads. + * Tells whether or not the directory is disallowed for reads. + * @return whether or not the directory is disallowed for reads. */ public static boolean isUnreadable(File directory) { @@ -130,8 +131,8 @@ public class BlacklistedDirectories implements BlacklistedDirectoriesMBean } /** - * Tells whether or not the directory is blacklisted for writes. - * @return whether or not the directory is blacklisted for reads. + * Tells whether or not the directory is disallowed for writes. + * @return whether or not the directory is disallowed for reads. */ public static boolean isUnwritable(File directory) { diff --git a/src/java/org/apache/cassandra/db/BlacklistedDirectoriesMBean.java b/src/java/org/apache/cassandra/db/DisallowedDirectoriesMBean.java similarity index 96% rename from src/java/org/apache/cassandra/db/BlacklistedDirectoriesMBean.java rename to src/java/org/apache/cassandra/db/DisallowedDirectoriesMBean.java index 3fb9f39ac8..64f15e53ef 100644 --- a/src/java/org/apache/cassandra/db/BlacklistedDirectoriesMBean.java +++ b/src/java/org/apache/cassandra/db/DisallowedDirectoriesMBean.java @@ -20,7 +20,7 @@ package org.apache.cassandra.db; import java.io.File; import java.util.Set; -public interface BlacklistedDirectoriesMBean +public interface DisallowedDirectoriesMBean { public Set getUnreadableDirectories(); diff --git a/src/java/org/apache/cassandra/db/DiskBoundaries.java b/src/java/org/apache/cassandra/db/DiskBoundaries.java index 6c69007085..5b377e2cfe 100644 --- a/src/java/org/apache/cassandra/db/DiskBoundaries.java +++ b/src/java/org/apache/cassandra/db/DiskBoundaries.java @@ -91,7 +91,7 @@ public class DiskBoundaries { if (isInvalid) return true; - int currentDiskVersion = BlacklistedDirectories.getDirectoriesVersion(); + int currentDiskVersion = DisallowedDirectories.getDirectoriesVersion(); long currentRingVersion = StorageService.instance.getTokenMetadata().getRingVersion(); return currentDiskVersion != directoriesVersion || (ringVersion != -1 && currentRingVersion != ringVersion); } diff --git a/src/java/org/apache/cassandra/db/DiskBoundaryManager.java b/src/java/org/apache/cassandra/db/DiskBoundaryManager.java index 2628af81bb..bbb6dbb6bf 100644 --- a/src/java/org/apache/cassandra/db/DiskBoundaryManager.java +++ b/src/java/org/apache/cassandra/db/DiskBoundaryManager.java @@ -46,7 +46,7 @@ public class DiskBoundaryManager public DiskBoundaries getDiskBoundaries(ColumnFamilyStore cfs) { if (!cfs.getPartitioner().splitter().isPresent()) - return new DiskBoundaries(cfs, cfs.getDirectories().getWriteableLocations(), BlacklistedDirectories.getDirectoriesVersion()); + return new DiskBoundaries(cfs, cfs.getDirectories().getWriteableLocations(), DisallowedDirectories.getDirectoriesVersion()); if (diskBoundaries == null || diskBoundaries.isOutOfDate()) { synchronized (this) @@ -101,10 +101,10 @@ public class DiskBoundaryManager Directories.DataDirectory[] dirs; do { - directoriesVersion = BlacklistedDirectories.getDirectoriesVersion(); + directoriesVersion = DisallowedDirectories.getDirectoriesVersion(); dirs = cfs.getDirectories().getWriteableLocations(); } - while (directoriesVersion != BlacklistedDirectories.getDirectoriesVersion()); // if directoriesVersion has changed we need to recalculate + while (directoriesVersion != DisallowedDirectories.getDirectoriesVersion()); // if directoriesVersion has changed we need to recalculate if (localRanges == null || localRanges.isEmpty()) return new DiskBoundaries(cfs, dirs, null, ringVersion, directoriesVersion); diff --git a/src/java/org/apache/cassandra/db/compaction/AbstractCompactionStrategy.java b/src/java/org/apache/cassandra/db/compaction/AbstractCompactionStrategy.java index 30b4cb8ceb..1e72ae55ff 100644 --- a/src/java/org/apache/cassandra/db/compaction/AbstractCompactionStrategy.java +++ b/src/java/org/apache/cassandra/db/compaction/AbstractCompactionStrategy.java @@ -209,10 +209,10 @@ public abstract class AbstractCompactionStrategy public abstract long getMaxSSTableBytes(); /** - * Filters SSTables that are to be blacklisted from the given collection + * Filters SSTables that are to be excluded from the given collection * - * @param originalCandidates The collection to check for blacklisted SSTables - * @return list of the SSTables with blacklisted ones filtered out + * @param originalCandidates The collection to check for excluded SSTables + * @return list of the SSTables with excluded ones filtered out */ public static List filterSuspectSSTables(Iterable originalCandidates) { diff --git a/src/java/org/apache/cassandra/db/compaction/LeveledManifest.java b/src/java/org/apache/cassandra/db/compaction/LeveledManifest.java index 1cce780df0..2c32361ae2 100644 --- a/src/java/org/apache/cassandra/db/compaction/LeveledManifest.java +++ b/src/java/org/apache/cassandra/db/compaction/LeveledManifest.java @@ -638,7 +638,7 @@ public class LeveledManifest /** * @return highest-priority sstables to compact for the given level. - * If no compactions are possible (because of concurrent compactions or because some sstables are blacklisted + * If no compactions are possible (because of concurrent compactions or because some sstables are excluded * for prior failure), will return an empty list. Never returns null. */ private Collection getCandidatesFor(int level) diff --git a/src/java/org/apache/cassandra/dht/RangeStreamer.java b/src/java/org/apache/cassandra/dht/RangeStreamer.java index 75e2530348..75ccb4b50a 100644 --- a/src/java/org/apache/cassandra/dht/RangeStreamer.java +++ b/src/java/org/apache/cassandra/dht/RangeStreamer.java @@ -216,24 +216,24 @@ public class RangeStreamer /** * Source filter which only includes endpoints contained within a provided set. */ - public static class WhitelistedSourcesFilter implements SourceFilter + public static class AllowedSourcesFilter implements SourceFilter { - private final Set whitelistedSources; + private final Set allowedSources; - public WhitelistedSourcesFilter(Set whitelistedSources) + public AllowedSourcesFilter(Set allowedSources) { - this.whitelistedSources = whitelistedSources; + this.allowedSources = allowedSources; } public boolean apply(Replica replica) { - return whitelistedSources.contains(replica.endpoint()); + return allowedSources.contains(replica.endpoint()); } @Override public String message(Replica replica) { - return "Filtered " + replica + " out because it was not whitelisted, whitelisted sources: " + whitelistedSources; + return "Filtered " + replica + " out because it was not in the allowed set: " + allowedSources; } } diff --git a/src/java/org/apache/cassandra/hints/HintsDispatchExecutor.java b/src/java/org/apache/cassandra/hints/HintsDispatchExecutor.java index 2d9fd9d678..e71ae07f38 100644 --- a/src/java/org/apache/cassandra/hints/HintsDispatchExecutor.java +++ b/src/java/org/apache/cassandra/hints/HintsDispatchExecutor.java @@ -242,7 +242,7 @@ final class HintsDispatchExecutor { logger.error(String.format("Failed to dispatch hints file %s: file is corrupted", descriptor.fileName()), e); store.cleanUp(descriptor); - store.blacklist(descriptor); + store.markCorrupted(descriptor); throw e; } } diff --git a/src/java/org/apache/cassandra/hints/HintsStore.java b/src/java/org/apache/cassandra/hints/HintsStore.java index 9f95884926..aeefbd74a7 100644 --- a/src/java/org/apache/cassandra/hints/HintsStore.java +++ b/src/java/org/apache/cassandra/hints/HintsStore.java @@ -52,7 +52,7 @@ final class HintsStore private final Map dispatchPositions; private final Deque dispatchDequeue; - private final Queue blacklistedFiles; + private final Queue corruptedFiles; // last timestamp used in a descriptor; make sure to not reuse the same timestamp for new descriptors. private volatile long lastUsedTimestamp; @@ -66,7 +66,7 @@ final class HintsStore dispatchPositions = new ConcurrentHashMap<>(); dispatchDequeue = new ConcurrentLinkedDeque<>(descriptors); - blacklistedFiles = new ConcurrentLinkedQueue<>(); + corruptedFiles = new ConcurrentLinkedQueue<>(); //noinspection resource lastUsedTimestamp = descriptors.stream().mapToLong(d -> d.timestamp).max().orElse(0L); @@ -119,7 +119,7 @@ final class HintsStore delete(descriptor); } - while ((descriptor = blacklistedFiles.poll()) != null) + while ((descriptor = corruptedFiles.poll()) != null) { cleanUp(descriptor); delete(descriptor); @@ -158,9 +158,9 @@ final class HintsStore dispatchPositions.remove(descriptor); } - void blacklist(HintsDescriptor descriptor) + void markCorrupted(HintsDescriptor descriptor) { - blacklistedFiles.add(descriptor); + corruptedFiles.add(descriptor); } /* diff --git a/src/java/org/apache/cassandra/io/sstable/format/SSTableReader.java b/src/java/org/apache/cassandra/io/sstable/format/SSTableReader.java index e85abb7be6..04c4826f15 100644 --- a/src/java/org/apache/cassandra/io/sstable/format/SSTableReader.java +++ b/src/java/org/apache/cassandra/io/sstable/format/SSTableReader.java @@ -1742,7 +1742,7 @@ public abstract class SSTableReader extends SSTable implements SelfRefCounted BlacklistedDirectories.clearUnwritableUnsafe(); + return () -> DisallowedDirectories.clearUnwritableUnsafe(); } public static PagingState makeSomePagingState(ProtocolVersion protocolVersion) diff --git a/test/unit/org/apache/cassandra/auth/jmx/AuthorizationProxyTest.java b/test/unit/org/apache/cassandra/auth/jmx/AuthorizationProxyTest.java index 924d467749..85b1f7f013 100644 --- a/test/unit/org/apache/cassandra/auth/jmx/AuthorizationProxyTest.java +++ b/test/unit/org/apache/cassandra/auth/jmx/AuthorizationProxyTest.java @@ -344,7 +344,7 @@ public class AuthorizationProxyTest } @Test - public void rejectInvocationOfBlacklistedMethods() throws Throwable + public void rejectInvocationOfRestrictedMethods() throws Throwable { String[] methods = { "createMBean", "deserialize", @@ -442,7 +442,7 @@ public class AuthorizationProxyTest for (String method : methods) assertEquals(withPermission, proxy.authorize(subject(role1.getRoleName()), method, new Object[]{ null })); - // non-whitelisted methods should be rejected regardless. + // non-allowed methods should be rejected regardless. // This isn't exactly comprehensive, but it's better than nothing String[] notAllowed = { "fooMethod", "barMethod", "bazMethod" }; for (String method : notAllowed) diff --git a/test/unit/org/apache/cassandra/db/DirectoriesTest.java b/test/unit/org/apache/cassandra/db/DirectoriesTest.java index ec1b34c6d6..dd4e51fa9b 100644 --- a/test/unit/org/apache/cassandra/db/DirectoriesTest.java +++ b/test/unit/org/apache/cassandra/db/DirectoriesTest.java @@ -342,7 +342,7 @@ public class DirectoriesTest for (DataDirectory dd : Directories.dataDirectories) { File file = new File(dd.location, new File(KS, "bad").getPath()); - assertTrue(BlacklistedDirectories.isUnwritable(file)); + assertTrue(DisallowedDirectories.isUnwritable(file)); } } finally diff --git a/test/unit/org/apache/cassandra/db/DiskBoundaryManagerTest.java b/test/unit/org/apache/cassandra/db/DiskBoundaryManagerTest.java index 6e2a714d95..3cd501e80f 100644 --- a/test/unit/org/apache/cassandra/db/DiskBoundaryManagerTest.java +++ b/test/unit/org/apache/cassandra/db/DiskBoundaryManagerTest.java @@ -49,7 +49,7 @@ public class DiskBoundaryManagerTest extends CQLTester @Before public void setup() { - BlacklistedDirectories.clearUnwritableUnsafe(); + DisallowedDirectories.clearUnwritableUnsafe(); TokenMetadata metadata = StorageService.instance.getTokenMetadata(); metadata.updateNormalTokens(BootStrapper.getRandomTokens(metadata, 10), FBUtilities.getBroadcastAddressAndPort()); createTable("create table %s (id int primary key, x text)"); @@ -69,12 +69,12 @@ public class DiskBoundaryManagerTest extends CQLTester } @Test - public void blackListTest() + public void disallowedDirectoriesTest() { DiskBoundaries dbv = dbm.getDiskBoundaries(mock); Assert.assertEquals(3, dbv.positions.size()); assertEquals(dbv.directories, dirs.getWriteableLocations()); - BlacklistedDirectories.maybeMarkUnwritable(new File("/tmp/3")); + DisallowedDirectories.maybeMarkUnwritable(new File("/tmp/3")); dbv = dbm.getDiskBoundaries(mock); Assert.assertEquals(2, dbv.positions.size()); Assert.assertEquals(Lists.newArrayList(new Directories.DataDirectory(new File("/tmp/1")), diff --git a/test/unit/org/apache/cassandra/db/compaction/BlacklistingCompactionsTest.java b/test/unit/org/apache/cassandra/db/compaction/CorruptedSSTablesCompactionsTest.java similarity index 94% rename from test/unit/org/apache/cassandra/db/compaction/BlacklistingCompactionsTest.java rename to test/unit/org/apache/cassandra/db/compaction/CorruptedSSTablesCompactionsTest.java index e0f24f28d6..7b100192ea 100644 --- a/test/unit/org/apache/cassandra/db/compaction/BlacklistingCompactionsTest.java +++ b/test/unit/org/apache/cassandra/db/compaction/CorruptedSSTablesCompactionsTest.java @@ -48,13 +48,13 @@ import org.apache.cassandra.schema.*; import static org.junit.Assert.assertTrue; -public class BlacklistingCompactionsTest +public class CorruptedSSTablesCompactionsTest { - private static final Logger logger = LoggerFactory.getLogger(BlacklistingCompactionsTest.class); + private static final Logger logger = LoggerFactory.getLogger(CorruptedSSTablesCompactionsTest.class); private static Random random; - private static final String KEYSPACE1 = "BlacklistingCompactionsTest"; + private static final String KEYSPACE1 = "CorruptedSSTablesCompactionsTest"; private static final String STANDARD_STCS = "Standard_STCS"; private static final String STANDARD_LCS = "Standard_LCS"; private static int maxValueSize; @@ -113,18 +113,19 @@ public class BlacklistingCompactionsTest } @Test - public void testBlacklistingWithSizeTieredCompactionStrategy() throws Exception + public void testCorruptedSSTablesWithSizeTieredCompactionStrategy() throws Exception { - testBlacklisting(STANDARD_STCS); + testCorruptedSSTables(STANDARD_STCS); } @Test - public void testBlacklistingWithLeveledCompactionStrategy() throws Exception + public void testCorruptedSSTablesWithLeveledCompactionStrategy() throws Exception { - testBlacklisting(STANDARD_LCS); + testCorruptedSSTables(STANDARD_LCS); } - private void testBlacklisting(String tableName) throws Exception + + public void testCorruptedSSTables(String tableName) throws Exception { // this test does enough rows to force multiple block indexes to be used Keyspace keyspace = Keyspace.open(KEYSPACE1);