Merge pull request #3349 from influxdata/alamb/update_state_machine

docs: Update database startup machine diagram
pull/24376/head
kodiakhq[bot] 2021-12-10 10:01:44 +00:00 committed by GitHub
commit 306c2dcba7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 24 additions and 2 deletions

View File

@ -1061,10 +1061,21 @@ pub enum InitError {
/// The Database startup state machine
///
/// A Database starts in DatabaseState::Known and advances through the
/// states in sequential order until it reaches Initialized or an error
/// is encountered.
/// non error states in sequential order until either:
///
/// 1. It reaches `Initialized`
///
/// 2. It is reset to `Known` and starts initialization again
///
/// 3. An error is encountered, in which case it transitions to one of
/// the error states. Most are Terminal (and thus require operator
/// intervention) but some (such as `WriteBufferCreationError`) may
/// resolve after some time to the basic initialization sequence
/// (e.g. `Initialized`)
///
#[derive(Debug, Clone)]
enum DatabaseState {
// Basic initialization sequence states:
Known(DatabaseStateKnown),
DatabaseObjectStoreFound(DatabaseStateDatabaseObjectStoreFound),
OwnerInfoLoaded(DatabaseStateOwnerInfoLoaded),
@ -1072,12 +1083,23 @@ enum DatabaseState {
CatalogLoaded(DatabaseStateCatalogLoaded),
Initialized(DatabaseStateInitialized),
// Error states
/// Terminal State
DatabaseObjectStoreLookupError(DatabaseStateKnown, Arc<InitError>),
/// Terminal State
NoActiveDatabase(DatabaseStateKnown, Arc<InitError>),
/// Terminal State
OwnerInfoLoadError(DatabaseStateDatabaseObjectStoreFound, Arc<InitError>),
/// Terminal State
RulesLoadError(DatabaseStateOwnerInfoLoaded, Arc<InitError>),
/// Terminal State
CatalogLoadError(DatabaseStateRulesLoaded, Arc<InitError>),
/// Non Terminal State: There was an error creating a connction to
/// the WriteBuffer, but the connection will be retried. If a
/// connection is successfully created, the database will
/// transition to `Initialized`
WriteBufferCreationError(DatabaseStateCatalogLoaded, Arc<InitError>),
/// Terminal State
ReplayError(DatabaseStateCatalogLoaded, Arc<InitError>),
}