Skip to content

Commit 5c3c0b1

Browse files
committed
review comments
1 parent 2c5fdcb commit 5c3c0b1

File tree

7 files changed

+28
-45
lines changed

7 files changed

+28
-45
lines changed

bootstore/src/schemes/v0/storage.rs

Lines changed: 19 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -88,35 +88,30 @@ impl PersistentFsmState {
8888
}
8989

9090
/// Load the ledger for use by trust quorum
91-
pub async fn load_for_trust_quorum(
91+
pub async fn load_for_trust_quorum_upgrade(
9292
log: &Logger,
9393
paths: Vec<Utf8PathBuf>,
9494
) -> Option<SharePkgCommon> {
95-
if let Some(ledger) =
96-
Ledger::<PersistentFsmState>::new(&log, paths).await
97-
{
98-
let persistent_state = ledger.into_inner();
99-
info!(
100-
log,
101-
"Loaded LRTQ PersistentFsmState from ledger in state {} with generation {}",
102-
persistent_state.state.name(),
103-
persistent_state.generation
104-
);
95+
let ledger = Ledger::<PersistentFsmState>::new(&log, paths).await?;
96+
let persistent_state = ledger.into_inner();
97+
info!(
98+
log,
99+
"Loaded LRTQ PersistentFsmState from ledger in state {} with generation {}",
100+
persistent_state.state.name(),
101+
persistent_state.generation
102+
);
105103

106-
match persistent_state.state {
107-
State::Uninitialized | State::Learning => {
108-
warn!(
109-
log,
110-
"Unexpected LRTQ state: {}. No share available.",
111-
persistent_state.state.name()
112-
);
113-
None
114-
}
115-
State::InitialMember { pkg, .. } => Some(pkg.common.clone()),
116-
State::Learned { pkg } => Some(pkg.common.clone()),
104+
match persistent_state.state {
105+
State::Uninitialized | State::Learning => {
106+
warn!(
107+
log,
108+
"Unexpected LRTQ state: {}. No share available.",
109+
persistent_state.state.name()
110+
);
111+
None
117112
}
118-
} else {
119-
None
113+
State::InitialMember { pkg, .. } => Some(pkg.common.clone()),
114+
State::Learned { pkg } => Some(pkg.common.clone()),
120115
}
121116
}
122117
}

dev-tools/omdb/src/bin/omdb/nexus.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4541,10 +4541,8 @@ async fn cmd_nexus_trust_quorum_lrtq_upgrade(
45414541
client: &nexus_lockstep_client::Client,
45424542
_destruction_token: DestructiveOperationToken,
45434543
) -> Result<(), anyhow::Error> {
4544-
// We already know the uuid at Nexus. Don't make the user type it.
4545-
let fake_uuid = Uuid::nil();
45464544
let epoch = client
4547-
.trust_quorum_lrtq_upgrade(&fake_uuid)
4545+
.trust_quorum_lrtq_upgrade()
45484546
.await
45494547
.context("lrtq upgrade")?
45504548
.into_inner();

nexus/db-queries/src/db/datastore/trust_quorum.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1643,6 +1643,9 @@ mod tests {
16431643
assert!(read_config.members.iter().all(|(_, info)| {
16441644
info.state == TrustQuorumMemberState::Unacked
16451645
}));
1646+
1647+
db.terminate().await;
1648+
logctx.cleanup_successful();
16461649
}
16471650

16481651
#[tokio::test]

nexus/lockstep-api/src/lib.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -569,7 +569,7 @@ pub trait NexusLockstepApi {
569569
// if no epoch is given
570570
#[endpoint {
571571
method = GET,
572-
path = "/trust-quorum/{rack_id}/config",
572+
path = "/trust-quorum/config/{rack_id}",
573573
}]
574574
async fn trust_quorum_get_config(
575575
rqctx: RequestContext<Self::Context>,
@@ -583,11 +583,10 @@ pub trait NexusLockstepApi {
583583
/// asynchronously.
584584
#[endpoint {
585585
method = POST,
586-
path = "/trust-quorum/{rack_id}/lrtq-upgrade"
586+
path = "/trust-quorum/lrtq-upgrade"
587587
}]
588588
async fn trust_quorum_lrtq_upgrade(
589589
rqctx: RequestContext<Self::Context>,
590-
path_params: Path<RackPathParam>,
591590
) -> Result<HttpResponseOk<Epoch>, HttpError>;
592591
}
593592

nexus/src/lockstep_api/http_entrypoints.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1126,7 +1126,6 @@ impl NexusLockstepApi for NexusLockstepApiImpl {
11261126
// know from Nexus.
11271127
async fn trust_quorum_lrtq_upgrade(
11281128
rqctx: RequestContext<Self::Context>,
1129-
_path_params: Path<RackPathParam>,
11301129
) -> Result<HttpResponseOk<Epoch>, HttpError> {
11311130
let apictx = &rqctx.context().context;
11321131
let nexus = &apictx.nexus;

openapi/nexus-lockstep.json

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1389,7 +1389,7 @@
13891389
}
13901390
}
13911391
},
1392-
"/trust-quorum/{rack_id}/config": {
1392+
"/trust-quorum/config/{rack_id}": {
13931393
"get": {
13941394
"summary": "Retrieve the trust quorum configuration for the given epoch, or latest",
13951395
"operationId": "trust_quorum_get_config",
@@ -1434,22 +1434,11 @@
14341434
}
14351435
}
14361436
},
1437-
"/trust-quorum/{rack_id}/lrtq-upgrade": {
1437+
"/trust-quorum/lrtq-upgrade": {
14381438
"post": {
14391439
"summary": "Initiate an LRTQ upgrade",
14401440
"description": "Return the epoch of the proposed configuration, so it can be polled asynchronously.",
14411441
"operationId": "trust_quorum_lrtq_upgrade",
1442-
"parameters": [
1443-
{
1444-
"in": "path",
1445-
"name": "rack_id",
1446-
"required": true,
1447-
"schema": {
1448-
"type": "string",
1449-
"format": "uuid"
1450-
}
1451-
}
1452-
],
14531442
"responses": {
14541443
"200": {
14551444
"description": "successful operation",

trust-quorum/src/task.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -448,7 +448,7 @@ impl NodeTask {
448448
ps_ledger.generation,
449449
)
450450
} else if let Some(lrtq_share_data) =
451-
PersistentFsmState::load_for_trust_quorum(
451+
PersistentFsmState::load_for_trust_quorum_upgrade(
452452
&log,
453453
config.lrtq_ledger_paths.clone(),
454454
)

0 commit comments

Comments
 (0)