Package org.apache.cassandra.service
Class FileSystemOwnershipCheck
java.lang.Object
org.apache.cassandra.service.FileSystemOwnershipCheck
- All Implemented Interfaces:
StartupCheck
Ownership markers on disk are compatible with the java property file format.
(https://docs.oracle.com/javase/8/docs/api/java/util/Properties.html#load-java.io.Reader-)
This simple formatting is intended to enable them to be created either
manually or by automated tooling using minimal standard tools (editor/shell
builtins/etc).
The only mandatory property is version, which must be parseable as an int
and upon which the futher set of required properties will depend.
In version 1, two further property values are required:
- volume_count
to be parsed as an int representing the number of mounted volumes where
a marker file is expected.
- ownership_token
must contain a non-empty token string that can be compared to one
derived from system properties. For version 1, this is simply the cluster name.
For this check to succeed as of version 1 then:
- There must be a single properties file found in the fs tree for each
target directory.
- Every file found must contain the mandatory version property with the
literal value '1'.
- The value of the ownership_token property in each file must match the
cluster name
- The value of the volume_count property must be an int which must matches
the number of distinct marker files found when traversing the filesystem.
In overridden implementations, you will need to override
constructTokenFromProperties(Map)
and add the related *_PROPERTY values you will want the system to check on startup to confirm ownership.-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionprotected StringconstructTokenFromProperties(Map<String, Object> config) In version 1, we check and return the ownership token.voidexecute(StartupChecksOptions options) Run some test to determine whether the system is safe to be started In the case where a test determines it is not safe to proceed, the test should log a message regarding the reason for the failure and ideally the steps required to remedy the problem.getFsOwnershipFilename(Map<String, Object> config) getOwnershipToken(Map<String, Object> config) booleanisEnabled(StartupChecksOptions options) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.cassandra.service.StartupCheck
postAction
-
Field Details
-
FILE_SYSTEM_CHECK_OWNERSHIP_TOKEN
- See Also:
-
DEFAULT_FS_OWNERSHIP_FILENAME
- See Also:
-
-
Method Details
-
getStartupCheckType
- Specified by:
getStartupCheckTypein interfaceStartupCheck- Returns:
- type of this startup check for configuration retrieval
-
execute
Description copied from interface:StartupCheckRun some test to determine whether the system is safe to be started In the case where a test determines it is not safe to proceed, the test should log a message regarding the reason for the failure and ideally the steps required to remedy the problem.- Specified by:
executein interfaceStartupCheck- Parameters:
options- all options from descriptor- Throws:
StartupException- if the test determines that the environement or system is not in a safe state to startup
-
constructTokenFromProperties
In version 1, we check and return the ownership token. Extend this for custom ownership hierarchies.- Throws:
StartupException
-
isEnabled
-
getFsOwnershipFilename
-
getOwnershipToken
-