Package org.apache.cassandra.service
Class StartupChecks
- java.lang.Object
-
- org.apache.cassandra.service.StartupChecks
-
public class StartupChecks extends java.lang.Object
Verifies that the system and environment is in a fit state to be started. Used in CassandraDaemon#setup() to check various settings and invariants. Each individual test is modelled as an implementation of StartupCheck, these are run at the start of CassandraDaemon#setup() before any local state is mutated. The default checks are a mix of informational tests (inspectJvmOptions), initialization (initSigarLibrary, checkCacheServiceInitialization) and invariant checking (checkValidLaunchDate, checkSystemKeyspaceState, checkSSTablesFormat). In addition, if checkSystemKeyspaceState determines that the release version has changed since last startup (i.e. the node has been upgraded) it snapshots the system keyspace to make it easier to back out if necessary. If any check reports a failure, then the setup method exits with an error (after logging any output from the tests). If all tests report success, setup can continue. We should be careful in future to ensure anything which mutates local state (such as writing new sstables etc) only happens after we've verified the initial setup.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
StartupChecks.StartupCheckType
-
Field Summary
Fields Modifier and Type Field Description static StartupCheck
checkDatacenter
static StartupCheck
checkDataDirs
static StartupCheck
checkJemalloc
static StartupCheck
checkJMXPorts
static StartupCheck
checkJMXProperties
static StartupCheck
checkKernelBug1057843
static StartupCheck
checkLegacyAuthTables
static StartupCheck
checkLz4Native
static StartupCheck
checkMaxMapCount
static StartupCheck
checkNativeLibraryInitialization
static StartupCheck
checkRack
static StartupCheck
checkReadAheadKbSetting
static StartupCheck
checkSSTablesFormat
static StartupCheck
checkSystemKeyspaceState
static StartupCheck
checkValidLaunchDate
static StartupCheck
initSigarLibrary
static StartupCheck
inspectJvmOptions
-
Constructor Summary
Constructors Constructor Description StartupChecks()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static java.nio.file.Path
getReadAheadKBPath(java.lang.String blockDirectoryPath)
void
verify(StartupChecksOptions options)
Run the configured tests and return a report detailing the results.StartupChecks
withDefaultTests()
StartupChecks
withTest(StartupCheck test)
Add system test to be run before schema is loaded during startup
-
-
-
Field Detail
-
checkKernelBug1057843
public static final StartupCheck checkKernelBug1057843
-
checkJemalloc
public static final StartupCheck checkJemalloc
-
checkLz4Native
public static final StartupCheck checkLz4Native
-
checkValidLaunchDate
public static final StartupCheck checkValidLaunchDate
-
checkJMXPorts
public static final StartupCheck checkJMXPorts
-
checkJMXProperties
public static final StartupCheck checkJMXProperties
-
inspectJvmOptions
public static final StartupCheck inspectJvmOptions
-
checkNativeLibraryInitialization
public static final StartupCheck checkNativeLibraryInitialization
-
initSigarLibrary
public static final StartupCheck initSigarLibrary
-
checkReadAheadKbSetting
public static final StartupCheck checkReadAheadKbSetting
-
checkMaxMapCount
public static final StartupCheck checkMaxMapCount
-
checkDataDirs
public static final StartupCheck checkDataDirs
-
checkSSTablesFormat
public static final StartupCheck checkSSTablesFormat
-
checkSystemKeyspaceState
public static final StartupCheck checkSystemKeyspaceState
-
checkDatacenter
public static final StartupCheck checkDatacenter
-
checkRack
public static final StartupCheck checkRack
-
checkLegacyAuthTables
public static final StartupCheck checkLegacyAuthTables
-
-
Method Detail
-
withDefaultTests
public StartupChecks withDefaultTests()
-
withTest
public StartupChecks withTest(StartupCheck test)
Add system test to be run before schema is loaded during startup- Parameters:
test
- the system test to include
-
verify
public void verify(StartupChecksOptions options) throws StartupException
Run the configured tests and return a report detailing the results.- Parameters:
options
- options to pass to respective checks for their configration- Throws:
StartupException
- if any test determines that the system is not in an valid state to startup
-
getReadAheadKBPath
public static java.nio.file.Path getReadAheadKBPath(java.lang.String blockDirectoryPath)
-
-