Skip to content

Commit

Permalink
Log all possible sled targets when creating a reservation (#5182)
Browse files Browse the repository at this point in the history
We hope this gives us some insight into
#5181.
  • Loading branch information
jgallagher authored Mar 4, 2024
1 parent dcd3d9e commit 77669cd
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion nexus/db-queries/src/db/datastore/sled.rs
Original file line number Diff line number Diff line change
Expand Up @@ -247,11 +247,20 @@ impl DataStore {
}

sql_function!(fn random() -> diesel::sql_types::Float);

// We only actually care about one target here, so this
// query should have a `.limit(1)` attached. We fetch all
// sled targets to leave additional debugging information in
// the logs, for now.
let sled_targets = sled_targets
.order(random())
.limit(1)
.get_results_async::<Uuid>(&conn)
.await?;
info!(
opctx.log,
"found {} available sled targets", sled_targets.len();
"sled_ids" => ?sled_targets,
);

if sled_targets.is_empty() {
return Err(err.bail(SledReservationError::NotFound));
Expand Down

0 comments on commit 77669cd

Please sign in to comment.