Skip to content

Commit

Permalink
Ignore AlreadyInitialized errors during cold boot (#4486)
Browse files Browse the repository at this point in the history
Ignore `bootstore::ApiError::AlreadyInitialized` errors when attempting
to start the sled-agent as a learner. We will always get this during
cold boot because the learner state has been persisted to the ledger.

Fixes #4485
  • Loading branch information
andrewjstone authored Nov 13, 2023
1 parent 6d73cf8 commit e2fa996
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion sled-agent/src/bootstrap/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -452,7 +452,15 @@ async fn start_sled_agent(

if request.body.use_trust_quorum && request.body.is_lrtq_learner {
info!(log, "Initializing sled as learner");
bootstore.init_learner().await?;
match bootstore.init_learner().await {
Err(bootstore::NodeRequestError::Fsm(
bootstore::ApiError::AlreadyInitialized,
)) => {
// This is a cold boot. Let's ignore this error and continue.
}
Err(e) => return Err(e.into()),
Ok(()) => (),
}
}

// Inform the storage service that the key manager is available
Expand Down

0 comments on commit e2fa996

Please sign in to comment.