Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
cld
systems
cassandra
Commits
408f969f
Commit
408f969f
authored
Jun 12, 2020
by
Sam Tunnicliffe
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'cassandra-3.0' into cassandra-3.11
parents
e4985391
0a1e8d16
Changes
21
Hide whitespace changes
Inline
Side-by-side
Showing
21 changed files
with
112 additions
and
111 deletions
+112
-111
CHANGES.txt
CHANGES.txt
+1
-0
src/java/org/apache/cassandra/auth/jmx/AuthorizationProxy.java
...ava/org/apache/cassandra/auth/jmx/AuthorizationProxy.java
+23
-24
src/java/org/apache/cassandra/cql3/functions/UDFunction.java
src/java/org/apache/cassandra/cql3/functions/UDFunction.java
+11
-11
src/java/org/apache/cassandra/db/Directories.java
src/java/org/apache/cassandra/db/Directories.java
+20
-21
src/java/org/apache/cassandra/db/DisallowedDirectories.java
src/java/org/apache/cassandra/db/DisallowedDirectories.java
+15
-14
src/java/org/apache/cassandra/db/DisallowedDirectoriesMBean.java
...a/org/apache/cassandra/db/DisallowedDirectoriesMBean.java
+1
-1
src/java/org/apache/cassandra/db/DiskBoundaries.java
src/java/org/apache/cassandra/db/DiskBoundaries.java
+1
-1
src/java/org/apache/cassandra/db/DiskBoundaryManager.java
src/java/org/apache/cassandra/db/DiskBoundaryManager.java
+3
-3
src/java/org/apache/cassandra/db/compaction/AbstractCompactionStrategy.java
...e/cassandra/db/compaction/AbstractCompactionStrategy.java
+3
-3
src/java/org/apache/cassandra/db/compaction/LeveledManifest.java
...a/org/apache/cassandra/db/compaction/LeveledManifest.java
+1
-1
src/java/org/apache/cassandra/dht/RangeStreamer.java
src/java/org/apache/cassandra/dht/RangeStreamer.java
+5
-5
src/java/org/apache/cassandra/hints/HintsDispatchExecutor.java
...ava/org/apache/cassandra/hints/HintsDispatchExecutor.java
+1
-1
src/java/org/apache/cassandra/hints/HintsStore.java
src/java/org/apache/cassandra/hints/HintsStore.java
+5
-5
src/java/org/apache/cassandra/io/sstable/format/SSTableReader.java
...org/apache/cassandra/io/sstable/format/SSTableReader.java
+1
-1
src/java/org/apache/cassandra/service/DefaultFSErrorHandler.java
...a/org/apache/cassandra/service/DefaultFSErrorHandler.java
+3
-3
src/java/org/apache/cassandra/service/StorageService.java
src/java/org/apache/cassandra/service/StorageService.java
+1
-1
test/unit/org/apache/cassandra/Util.java
test/unit/org/apache/cassandra/Util.java
+2
-2
test/unit/org/apache/cassandra/auth/jmx/AuthorizationProxyTest.java
...org/apache/cassandra/auth/jmx/AuthorizationProxyTest.java
+2
-2
test/unit/org/apache/cassandra/db/DirectoriesTest.java
test/unit/org/apache/cassandra/db/DirectoriesTest.java
+1
-1
test/unit/org/apache/cassandra/db/DiskBoundaryManagerTest.java
...unit/org/apache/cassandra/db/DiskBoundaryManagerTest.java
+3
-3
test/unit/org/apache/cassandra/db/compaction/CorruptedSSTablesCompactionsTest.java
...andra/db/compaction/CorruptedSSTablesCompactionsTest.java
+9
-8
No files found.
CHANGES.txt
View file @
408f969f
...
...
@@ -18,6 +18,7 @@ Merged from 3.0:
* Memtable memory allocations may deadlock (CASSANDRA-15367)
* Run evictFromMembership in GossipStage (CASSANDRA-15592)
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)
...
...
src/java/org/apache/cassandra/auth/jmx/AuthorizationProxy.java
View file @
408f969f
...
...
@@ -32,7 +32,6 @@ import javax.management.ObjectName;
import
javax.security.auth.Subject
;
import
com.google.common.annotations.VisibleForTesting
;
import
com.google.common.base.Throwables
;
import
com.google.common.collect.ImmutableSet
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
...
...
@@ -69,7 +68,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
black
list 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 +77,30 @@ public class AuthorizationProxy implements InvocationHandler
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
AuthorizationProxy
.
class
);
/*
A
white
list 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
whitelist
ed methods are essentially descriptive,
rather than to the MBeans it manages. All of the
allow
ed methods are essentially descriptive,
hence they require the Subject to have the DESCRIBE permission on the root JMX resource.
*/
private
static
final
Set
<
String
>
MBEAN_SERVER_
METHOD_WHITELIST
=
ImmutableSet
.
of
(
"getDefaultDomain"
,
"getDomains"
,
"getMBeanCount"
,
"hashCode"
,
"queryMBeans"
,
"queryNames"
,
"toString"
);
private
static
final
Set
<
String
>
MBEAN_SERVER_
ALLOWED_METHODS
=
ImmutableSet
.
of
(
"getDefaultDomain"
,
"getDomains"
,
"getMBeanCount"
,
"hashCode"
,
"queryMBeans"
,
"queryNames"
,
"toString"
);
/*
A
black
list 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
<
String
>
METHOD_BLACKLIST
=
ImmutableSet
.
of
(
"createMBean"
,
"deserialize"
,
"getClassLoader"
,
"getClassLoaderFor"
,
"instantiate"
,
"registerMBean"
,
"unregisterMBean"
);
private
static
final
Set
<
String
>
DENIED_METHODS
=
ImmutableSet
.
of
(
"createMBean"
,
"deserialize"
,
"getClassLoader"
,
"getClassLoaderFor"
,
"instantiate"
,
"registerMBean"
,
"unregisterMBean"
);
private
static
final
JMXPermissionsCache
permissionsCache
=
new
JMXPermissionsCache
();
private
MBeanServer
mbs
;
...
...
@@ -203,9 +202,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
blacklis
ted method {}"
,
methodName
);
logger
.
trace
(
"Access denied to
restric
ted method {}"
,
methodName
);
return
false
;
}
...
...
@@ -233,7 +232,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
whitelist
ed methods that match this criteria are generally
* as its first argument. The
allow
ed 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 +246,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
()));
}
/**
...
...
src/java/org/apache/cassandra/cql3/functions/UDFunction.java
View file @
408f969f
...
...
@@ -80,19 +80,19 @@ public abstract class UDFunction extends AbstractFunction implements ScalarFunct
protected
final
UDFContext
udfContext
;
//
// Access to classes is controlled via a
whitelist and a black
list.
// Access to classes is controlled via a
llow and disallow
list
s
.
//
// When a class is requested (both during compilation and runtime),
// the
whitelist
edPatterns array is searched first, whether the
// the
allow
edPatterns 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
whitelist
ed pattern has been found, the
blacklist
edPatterns
// If a
n allow
ed pattern has been found, the
disallow
edPatterns
// 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
[]
whitelist
edPatterns
=
private
static
final
String
[]
allow
edPatterns
=
{
"com/datastax/driver/core/"
,
"com/google/common/reflect/TypeToken"
,
...
...
@@ -116,8 +116,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
whitelist
edPatterns
private
static
final
String
[]
blacklist
edPatterns
=
// Only need to
disallow
a pattern, if it would otherwise be allowed via
allow
edPatterns
private
static
final
String
[]
disallow
edPatterns
=
{
"com/datastax/driver/core/Cluster.class"
,
"com/datastax/driver/core/Metrics.class"
,
...
...
@@ -160,13 +160,13 @@ public abstract class UDFunction extends AbstractFunction implements ScalarFunct
while
(
resource
.
startsWith
(
"/"
))
resource
=
resource
.
substring
(
1
);
for
(
String
white
:
whitelist
edPatterns
)
if
(
resource
.
startsWith
(
white
))
for
(
String
allowed
:
allow
edPatterns
)
if
(
resource
.
startsWith
(
allowed
))
{
// resource is in
whitelist
edPatterns, let's see if it is not explicit
yl blacklist
ed
for
(
String
black
:
blacklist
edPatterns
)
if
(
resource
.
startsWith
(
black
))
// resource is in
allow
edPatterns, let's see if it is not explicit
ly disallow
ed
for
(
String
disallowed
:
disallow
edPatterns
)
if
(
resource
.
startsWith
(
disallowed
))
{
logger
.
trace
(
"access denied: resource {}"
,
resource
);
return
false
;
...
...
src/java/org/apache/cassandra/db/Directories.java
View file @
408f969f
...
...
@@ -326,10 +326,10 @@ public class Directories
/**
* Basically the same as calling {@link #getWriteableLocationAsFile(long)} with an unknown size ({@code -1L}),
* which may return any
non-blacklist
ed directory - even a data directory that has no usable space.
* which may return any
allow
ed directory - even a data directory that has no usable space.
* Do not use this method in production code.
*
* @throws FSWriteError if all directories are
blacklist
ed.
* @throws FSWriteError if all directories are
disallow
ed.
*/
public
File
getDirectoryForNewSSTables
()
{
...
...
@@ -337,9 +337,9 @@ public class Directories
}
/**
* Returns a
non-blacklisted data
directory that _currently_ has {@code writeSize} bytes as usable space.
* Returns a
n allowed
directory that _currently_ has {@code writeSize} bytes as usable space.
*
* @throws FSWriteError if all directories are
blacklist
ed.
* @throws FSWriteError if all directories are
disallow
ed.
*/
public
File
getWriteableLocationAsFile
(
long
writeSize
)
{
...
...
@@ -350,11 +350,11 @@ public class Directories
}
/**
* Returns a temporary subdirectory on
non-blacklist
ed data directory
* Returns a temporary subdirectory on
allow
ed 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
blacklist
ed.
* @throws IOError if all directories are
disallow
ed.
*/
public
File
getTemporaryWriteableDirectoryAsFile
(
long
writeSize
)
{
...
...
@@ -378,10 +378,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
blacklist
ed.
* @throws FSWriteError if all directories are
disallow
ed.
*/
public
DataDirectory
getWriteableLocation
(
long
writeSize
)
{
...
...
@@ -389,13 +388,13 @@ public class Directories
long
totalAvailable
=
0L
;
// pick directories with enough space and so that resulting sstable dirs aren't
blacklist
ed for writes.
// pick directories with enough space and so that resulting sstable dirs aren't
disallow
ed for writes.
boolean
tooBig
=
false
;
for
(
DataDirectory
dataDir
:
paths
)
{
if
(
Blacklist
edDirectories
.
isUnwritable
(
getLocationForDisk
(
dataDir
)))
if
(
Disallow
edDirectories
.
isUnwritable
(
getLocationForDisk
(
dataDir
)))
{
logger
.
trace
(
"removing
blacklist
ed candidate {}"
,
dataDir
.
location
);
logger
.
trace
(
"removing
disallow
ed candidate {}"
,
dataDir
.
location
);
continue
;
}
DataDirectoryCandidate
candidate
=
new
DataDirectoryCandidate
(
dataDir
);
...
...
@@ -414,7 +413,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
blacklist
ed as unwritable for erroring out"
),
""
);
throw
new
FSWriteError
(
new
IOException
(
"All configured data directories have been
disallow
ed as unwritable for erroring out"
),
""
);
// shortcut for single data directory systems
if
(
candidates
.
size
()
==
1
)
...
...
@@ -459,8 +458,8 @@ public class Directories
for
(
DataDirectory
dataDir
:
paths
)
{
if
(
Blacklist
edDirectories
.
isUnwritable
(
getLocationForDisk
(
dataDir
)))
continue
;
if
(
Disallow
edDirectories
.
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
)
...
...
@@ -472,14 +471,14 @@ public class Directories
public
DataDirectory
[]
getWriteableLocations
()
{
List
<
DataDirectory
>
nonBlacklist
edDirs
=
new
ArrayList
<>();
List
<
DataDirectory
>
allow
edDirs
=
new
ArrayList
<>();
for
(
DataDirectory
dir
:
paths
)
{
if
(!
Blacklist
edDirectories
.
isUnwritable
(
dir
.
location
))
nonBlacklist
edDirs
.
add
(
dir
);
if
(!
Disallow
edDirectories
.
isUnwritable
(
dir
.
location
))
allow
edDirs
.
add
(
dir
);
}
Collections
.
sort
(
nonBlacklist
edDirs
,
new
Comparator
<
DataDirectory
>()
Collections
.
sort
(
allow
edDirs
,
new
Comparator
<
DataDirectory
>()
{
@Override
public
int
compare
(
DataDirectory
o1
,
DataDirectory
o2
)
...
...
@@ -487,7 +486,7 @@ public class Directories
return
o1
.
location
.
compareTo
(
o2
.
location
);
}
});
return
nonBlacklist
edDirs
.
toArray
(
new
DataDirectory
[
nonBlacklist
edDirs
.
size
()]);
return
allow
edDirs
.
toArray
(
new
DataDirectory
[
allow
edDirs
.
size
()]);
}
public
static
File
getSnapshotDirectory
(
Descriptor
desc
,
String
snapshotName
)
...
...
@@ -738,7 +737,7 @@ public class Directories
for
(
File
location
:
dataPaths
)
{
if
(
Blacklist
edDirectories
.
isUnreadable
(
location
))
if
(
Disallow
edDirectories
.
isUnreadable
(
location
))
continue
;
if
(
snapshotName
!=
null
)
...
...
src/java/org/apache/cassandra/db/
Blacklist
edDirectories.java
→
src/java/org/apache/cassandra/db/
Disallow
edDirectories.java
View file @
408f969f
...
...
@@ -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
Blacklist
edDirectories
implements
Blacklist
edDirectoriesMBean
public
class
Disallow
edDirectories
implements
Disallow
edDirectoriesMBean
{
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
<
File
>
unreadableDirectories
=
new
CopyOnWriteArraySet
<
File
>();
private
final
Set
<
File
>
unwritableDirectories
=
new
CopyOnWriteArraySet
<
File
>();
private
static
final
AtomicInteger
directoriesVersion
=
new
AtomicInteger
();
private
Blacklist
edDirectories
()
private
Disallow
edDirectories
()
{
// 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
blacklist
ed directory or null if nothing has been added to the list.
* @return the
disallow
ed 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
(
"
Blacklist
ing {} for reads"
,
directory
);
logger
.
warn
(
"
Disallow
ing {} 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
blacklist
ed directory or null if nothing has been added to the list.
* @return the
disallow
ed 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
(
"
Blacklist
ing {} for writes"
,
directory
);
logger
.
warn
(
"
Disallow
ing {} for writes"
,
directory
);
return
directory
;
}
return
null
;
...
...
@@ -121,8 +122,8 @@ public class BlacklistedDirectories implements BlacklistedDirectoriesMBean
/**
* Tells whether or not the directory is
blacklist
ed for reads.
* @return whether or not the directory is
blacklist
ed for reads.
* Tells whether or not the directory is
disallow
ed for reads.
* @return whether or not the directory is
disallow
ed for reads.
*/
public
static
boolean
isUnreadable
(
File
directory
)
{
...
...
@@ -130,8 +131,8 @@ public class BlacklistedDirectories implements BlacklistedDirectoriesMBean
}
/**
* Tells whether or not the directory is
blacklist
ed for writes.
* @return whether or not the directory is
blacklist
ed for reads.
* Tells whether or not the directory is
disallow
ed for writes.
* @return whether or not the directory is
disallow
ed for reads.
*/
public
static
boolean
isUnwritable
(
File
directory
)
{
...
...
src/java/org/apache/cassandra/db/
Blacklist
edDirectoriesMBean.java
→
src/java/org/apache/cassandra/db/
Disallow
edDirectoriesMBean.java
View file @
408f969f
...
...
@@ -20,7 +20,7 @@ package org.apache.cassandra.db;
import
java.io.File
;
import
java.util.Set
;
public
interface
Blacklist
edDirectoriesMBean
public
interface
Disallow
edDirectoriesMBean
{
public
Set
<
File
>
getUnreadableDirectories
();
...
...
src/java/org/apache/cassandra/db/DiskBoundaries.java
View file @
408f969f
...
...
@@ -90,7 +90,7 @@ public class DiskBoundaries
{
if
(
isInvalid
)
return
true
;
int
currentDiskVersion
=
Blacklist
edDirectories
.
getDirectoriesVersion
();
int
currentDiskVersion
=
Disallow
edDirectories
.
getDirectoriesVersion
();
long
currentRingVersion
=
StorageService
.
instance
.
getTokenMetadata
().
getRingVersion
();
return
currentDiskVersion
!=
directoriesVersion
||
(
ringVersion
!=
-
1
&&
currentRingVersion
!=
ringVersion
);
}
...
...
src/java/org/apache/cassandra/db/DiskBoundaryManager.java
View file @
408f969f
...
...
@@ -43,7 +43,7 @@ public class DiskBoundaryManager
public
DiskBoundaries
getDiskBoundaries
(
ColumnFamilyStore
cfs
)
{
if
(!
cfs
.
getPartitioner
().
splitter
().
isPresent
())
return
new
DiskBoundaries
(
cfs
,
cfs
.
getDirectories
().
getWriteableLocations
(),
Blacklist
edDirectories
.
getDirectoriesVersion
());
return
new
DiskBoundaries
(
cfs
,
cfs
.
getDirectories
().
getWriteableLocations
(),
Disallow
edDirectories
.
getDirectoriesVersion
());
if
(
diskBoundaries
==
null
||
diskBoundaries
.
isOutOfDate
())
{
synchronized
(
this
)
...
...
@@ -98,10 +98,10 @@ public class DiskBoundaryManager
Directories
.
DataDirectory
[]
dirs
;
do
{
directoriesVersion
=
Blacklist
edDirectories
.
getDirectoriesVersion
();
directoriesVersion
=
Disallow
edDirectories
.
getDirectoriesVersion
();
dirs
=
cfs
.
getDirectories
().
getWriteableLocations
();
}
while
(
directoriesVersion
!=
Blacklist
edDirectories
.
getDirectoriesVersion
());
// if directoriesVersion has changed we need to recalculate
while
(
directoriesVersion
!=
Disallow
edDirectories
.
getDirectoriesVersion
());
// if directoriesVersion has changed we need to recalculate
if
(
localRanges
==
null
||
localRanges
.
isEmpty
())
return
new
DiskBoundaries
(
cfs
,
dirs
,
null
,
ringVersion
,
directoriesVersion
);
...
...
src/java/org/apache/cassandra/db/compaction/AbstractCompactionStrategy.java
View file @
408f969f
...
...
@@ -253,10 +253,10 @@ public abstract class AbstractCompactionStrategy
}
/**
* Filters SSTables that are to be
blacklist
ed from the given collection
* Filters SSTables that are to be
exclud
ed from the given collection
*
* @param originalCandidates The collection to check for
blacklist
ed SSTables
* @return list of the SSTables with
blacklist
ed ones filtered out
* @param originalCandidates The collection to check for
exclud
ed SSTables
* @return list of the SSTables with
exclud
ed ones filtered out
*/
public
static
List
<
SSTableReader
>
filterSuspectSSTables
(
Iterable
<
SSTableReader
>
originalCandidates
)
{
...
...
src/java/org/apache/cassandra/db/compaction/LeveledManifest.java
View file @
408f969f
...
...
@@ -621,7 +621,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
blacklist
ed
* If no compactions are possible (because of concurrent compactions or because some sstables are
exclud
ed
* for prior failure), will return an empty list. Never returns null.
*/
private
Collection
<
SSTableReader
>
getCandidatesFor
(
int
level
)
...
...
src/java/org/apache/cassandra/dht/RangeStreamer.java
View file @
408f969f
...
...
@@ -125,18 +125,18 @@ public class RangeStreamer
/**
* Source filter which only includes endpoints contained within a provided set.
*/
public
static
class
Whitelist
edSourcesFilter
implements
ISourceFilter
public
static
class
Allow
edSourcesFilter
implements
ISourceFilter
{
private
final
Set
<
InetAddress
>
whitelist
edSources
;
private
final
Set
<
InetAddress
>
allow
edSources
;
public
Whitelist
edSourcesFilter
(
Set
<
InetAddress
>
whitelist
edSources
)
public
Allow
edSourcesFilter
(
Set
<
InetAddress
>
allow
edSources
)
{
this
.
whitelist
edSources
=
whitelist
edSources
;
this
.
allow
edSources
=
allow
edSources
;
}
public
boolean
shouldInclude
(
InetAddress
endpoint
)
{
return
whitelist
edSources
.
contains
(
endpoint
);
return
allow
edSources
.
contains
(
endpoint
);
}
}
...
...
src/java/org/apache/cassandra/hints/HintsDispatchExecutor.java
View file @
408f969f
...
...
@@ -242,7 +242,7 @@ final class HintsDispatchExecutor
{
logger
.
error
(
"Failed to dispatch hints file {}: file is corrupted ({})"
,
descriptor
.
fileName
(),
e
);
store
.
cleanUp
(
descriptor
);
store
.
blacklist
(
descriptor
);
store
.
markCorrupted
(
descriptor
);
throw
e
;
}
}
...
...
src/java/org/apache/cassandra/hints/HintsStore.java
View file @
408f969f
...
...
@@ -52,7 +52,7 @@ final class HintsStore
private
final
Map
<
HintsDescriptor
,
InputPosition
>
dispatchPositions
;
private
final
Deque
<
HintsDescriptor
>
dispatchDequeue
;
private
final
Queue
<
HintsDescriptor
>
blacklis
tedFiles
;
private
final
Queue
<
HintsDescriptor
>
corrup
tedFiles
;
// 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
);
blacklis
tedFiles
=
new
ConcurrentLinkedQueue
<>();
corrup
tedFiles
=
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
=
blacklis
tedFiles
.
poll
())
!=
null
)
while
((
descriptor
=
corrup
tedFiles
.
poll
())
!=
null
)
{
cleanUp
(
descriptor
);
delete
(
descriptor
);
...
...
@@ -158,9 +158,9 @@ final class HintsStore
dispatchPositions
.
remove
(
descriptor
);
}
void
blacklist
(
HintsDescriptor
descriptor
)
void
markCorrupted
(
HintsDescriptor
descriptor
)
{
blacklis
tedFiles
.
add
(
descriptor
);
corrup
tedFiles
.
add
(
descriptor
);
}
/*
...
...
src/java/org/apache/cassandra/io/sstable/format/SSTableReader.java
View file @
408f969f
...
...
@@ -1714,7 +1714,7 @@ public abstract class SSTableReader extends SSTable implements SelfRefCounted<SS
public
void
markSuspect
()
{
if
(
logger
.
isTraceEnabled
())
logger
.
trace
(
"Marking {} as a suspect
for blacklisting
."
,
getFilename
());
logger
.
trace
(
"Marking {} as a suspect
to be excluded from reads
."
,
getFilename
());
isSuspect
.
getAndSet
(
true
);
}
...
...
src/java/org/apache/cassandra/service/DefaultFSErrorHandler.java
View file @
408f969f
...
...
@@ -24,7 +24,7 @@ import org.slf4j.Logger;
import
org.slf4j.LoggerFactory
;
import
org.apache.cassandra.config.DatabaseDescriptor
;
import
org.apache.cassandra.db.
Blacklist
edDirectories
;
import
org.apache.cassandra.db.
Disallow
edDirectories
;
import
org.apache.cassandra.db.Keyspace
;
import
org.apache.cassandra.io.FSError
;
import
org.apache.cassandra.io.FSErrorHandler
;
...
...
@@ -66,10 +66,10 @@ public class DefaultFSErrorHandler implements FSErrorHandler
break
;
case
best_effort:
// for both read and write errors mark the path as unwritable.
Blacklist
edDirectories
.
maybeMarkUnwritable
(
e
.
path
);
Disallow
edDirectories
.
maybeMarkUnwritable
(
e
.
path
);
if
(
e
instanceof
FSReadError
)
{
File
directory
=
Blacklist
edDirectories
.
maybeMarkUnreadable
(
e
.
path
);
File
directory
=
Disallow
edDirectories
.
maybeMarkUnreadable
(
e
.
path
);
if
(
directory
!=
null
)
Keyspace
.
removeUnreadableSSTables
(
directory
);
}
...
...
src/java/org/apache/cassandra/service/StorageService.java
View file @
408f969f
...
...
@@ -1293,7 +1293,7 @@ public class StorageService extends NotificationBroadcasterSupport implements IE
throw
new
IllegalArgumentException
(
"Unknown host specified "
+
stringHost
,
ex
);
}
}
streamer
.
addSourceFilter
(
new
RangeStreamer
.
Whitelist
edSourcesFilter
(
sources
));
streamer
.
addSourceFilter
(
new
RangeStreamer
.
Allow
edSourcesFilter
(
sources
));
}
streamer
.
addRanges
(
keyspace
,
ranges
);
...
...
test/unit/org/apache/cassandra/Util.java
View file @
408f969f
...
...
@@ -680,14 +680,14 @@ public class Util
for
(
;
;
)
{
DataDirectory
dir
=
cfs
.
getDirectories
().
getWriteableLocation
(
1
);
Blacklist
edDirectories
.
maybeMarkUnwritable
(
cfs
.
getDirectories
().
getLocationForDisk
(
dir
));
Disallow
edDirectories
.
maybeMarkUnwritable
(
cfs
.
getDirectories
().
getLocationForDisk
(
dir
));
}
}
catch
(
IOError
e
)
{
// Expected -- marked all directories as unwritable
}
return
()
->
Blacklist
edDirectories
.
clearUnwritableUnsafe
();
return
()
->
Disallow
edDirectories
.
clearUnwritableUnsafe
();
}
public
static
PagingState
makeSomePagingState
(
ProtocolVersion
protocolVersion
)
...
...
test/unit/org/apache/cassandra/auth/jmx/AuthorizationProxyTest.java
View file @
408f969f
...
...
@@ -343,7 +343,7 @@ public class AuthorizationProxyTest
}
@Test
public
void
rejectInvocationOf
Blacklis
tedMethods
()
throws
Throwable
public
void
rejectInvocationOf
Restric
tedMethods
()
throws
Throwable
{
String
[]
methods
=
{
"createMBean"
,
"deserialize"
,
...
...
@@ -441,7 +441,7 @@ public class AuthorizationProxyTest
for
(
String
method
:
methods
)
assertEquals
(
withPermission
,
proxy
.
authorize
(
subject
(
role1
.
getRoleName
()),
method
,
new
Object
[]{
null
}));
// non-
whitelist
ed methods should be rejected regardless.
// non-
allow
ed 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
)
...
...
test/unit/org/apache/cassandra/db/DirectoriesTest.java
View file @
408f969f
...
...
@@ -343,7 +343,7 @@ public class DirectoriesTest
for
(
DataDirectory
dd
:
Directories
.
dataDirectories
)
{
File
file
=
new
File
(
dd
.
location
,
new
File
(
KS
,
"bad"
).
getPath
());