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.

### Field Summary

Fields
`static StartupCheck` `checkDatacenter`
`static StartupCheck` `checkDataDirs`
`static StartupCheck` `checkJemalloc`
`static StartupCheck` `checkJMXPorts`
`static StartupCheck` `checkJMXProperties`
`static StartupCheck` `checkLegacyAuthTables`
`static StartupCheck` `checkMaxMapCount`
`static StartupCheck` `checkNativeLibraryInitialization`
`static StartupCheck` `checkRack`
`static StartupCheck` `checkSSTablesFormat`
`static StartupCheck` `checkSystemKeyspaceState`
`static StartupCheck` `checkValidLaunchDate`
`static StartupCheck` `initSigarLibrary`
`static StartupCheck` `inspectJvmOptions`

### Constructor Summary

Constructors
Constructor and Description
`StartupChecks()`

### Method Summary

All Methods Instance Methods Concrete Methods
`void` `verify()` 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

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Field Detail

#### checkJemalloc

    public static final StartupCheck checkJemalloc

#### 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

#### 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

### Constructor Detail

#### StartupChecks

    public StartupChecks()

### 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()
                throws StartupException

Run the configured tests and return a report detailing the results.

Throws:
  `StartupException` - if any test determines that the system is not in an valid state to startup