-
Notifications
You must be signed in to change notification settings - Fork 44
Trust Quorum: Handle prepare messages + Alarms #8062
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
andrewjstone
wants to merge
6
commits into
ajs/realtq-4
Choose a base branch
from
ajs/realtq-5
base: ajs/realtq-4
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
10ae04e
Trust Quorum: Handle prepare messages + Alarms
andrewjstone a445874
clippy
andrewjstone 37b0fb6
some cleanup
andrewjstone 86dfdfb
Remove alarms from persistent state
andrewjstone f9ec07e
Some more decisions
andrewjstone e0c454b
Test alarm conditions
andrewjstone File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
// This Source Code Form is subject to the terms of the Mozilla Public | ||
// License, v. 2.0. If a copy of the MPL was not distributed with this | ||
// file, You can obtain one at https://mozilla.org/MPL/2.0/. | ||
|
||
//! A mechanism for reporting protocol invariant violations | ||
//! | ||
//! Invariant violations should _never_ occur. They represent a critical bug in | ||
//! the implementation of the system. In certain scenarios we can detect these | ||
//! invariant violations and record them. This allows reporting them to higher | ||
//! levels of control plane software so that we can debug them and fix them in | ||
//! future releases, as well as rectify outstanding issues on systems where such | ||
//! an alarm arose. | ||
|
||
use crate::{Epoch, PlatformId}; | ||
use omicron_uuid_kinds::RackUuid; | ||
use serde::{Deserialize, Serialize}; | ||
|
||
/// A critical invariant violation that should never occur. | ||
/// | ||
/// Many invariant violations are only possible on receipt of peer messages, | ||
/// and are _not_ a result of API calls. This means that there isn't a good | ||
/// way to directly inform the rest of the control plane. Instead we provide a | ||
/// queryable API for `crate::Node` status that includes alerts. | ||
/// | ||
/// If an `Alarm` is ever seen by an operator then support should be contacted | ||
/// immediately. | ||
#[derive( | ||
Debug, Clone, thiserror::Error, PartialEq, Eq, Serialize, Deserialize, | ||
)] | ||
pub enum Alarm { | ||
#[error( | ||
"TQ Alarm: commit attempted with invalid rack_id. Expected {expected}, got {got}." | ||
)] | ||
CommitWithInvalidRackId { expected: RackUuid, got: RackUuid }, | ||
#[error( | ||
"TQ Alarm: prepare for a later configuration exists: \ | ||
last_prepared_epoch = {last_prepared_epoch:?}, \ | ||
commit_epoch = {commit_epoch}" | ||
)] | ||
OutOfOrderCommit { last_prepared_epoch: Epoch, commit_epoch: Epoch }, | ||
|
||
#[error( | ||
"TQ Alarm: commit attempted, but missing prepare message: \ | ||
epoch = {epoch}. Latest seen epoch = {latest_seen_epoch:?}." | ||
)] | ||
MissingPrepare { epoch: Epoch, latest_seen_epoch: Option<Epoch> }, | ||
|
||
#[error( | ||
"TQ Alarm: prepare received from {from} with mismatched \ | ||
last_committed_epoch: prepare's last committed epoch = \ | ||
{prepare_last_committed_epoch:?}, \ | ||
persisted prepare's last_committed_epoch = \ | ||
{persisted_prepare_last_committed_epoch:?}" | ||
)] | ||
PrepareLastCommittedEpochMismatch { | ||
from: PlatformId, | ||
prepare_last_committed_epoch: Option<Epoch>, | ||
persisted_prepare_last_committed_epoch: Option<Epoch>, | ||
}, | ||
|
||
#[error( | ||
"TQ Alarm: prepare received with invalid rack_id from {from}. \ | ||
Expected {expected}, got {got}." | ||
)] | ||
PrepareWithInvalidRackId { | ||
from: PlatformId, | ||
expected: RackUuid, | ||
got: RackUuid, | ||
}, | ||
|
||
#[error( | ||
"TQ Alarm: different nodes coordinating same epoch = {epoch}: \ | ||
them = {them}, us = {us}" | ||
)] | ||
DifferentNodesCoordinatingSameEpoch { | ||
epoch: Epoch, | ||
them: PlatformId, | ||
us: PlatformId, | ||
}, | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alarm
is a nice name for this, going to steal it