From 77669cdc49ebf07e451ee77109d0567129db3174 Mon Sep 17 00:00:00 2001 From: John Gallagher Date: Mon, 4 Mar 2024 11:49:11 -0500 Subject: [PATCH] Log all possible sled targets when creating a reservation (#5182) We hope this gives us some insight into https://github.com/oxidecomputer/omicron/issues/5181. --- nexus/db-queries/src/db/datastore/sled.rs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/nexus/db-queries/src/db/datastore/sled.rs b/nexus/db-queries/src/db/datastore/sled.rs index 8809f4d60d..8d812f69cc 100644 --- a/nexus/db-queries/src/db/datastore/sled.rs +++ b/nexus/db-queries/src/db/datastore/sled.rs @@ -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::(&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));