oxidecomputer / oxidecomputer/omicron
`DataStore::sled_upsert` returns a confusing error when upserting a decommissioned sled
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 572
- Forks
- 97
- Avg merge
- 2d 12h
- Merged PRs (30d)
- 96
Description
The docs for sled_upsert note that attempting to upsert a decommissioned sled will fail, but the error it returns in such a case is confusing:
InternalError { internal_message: "Unknown diesel error creating Sled called \"d2de48dd-e9b2-4d5f-ac8c-d5ff0a97997d\": Record not found" }
I think the "Record not found" is coming because we filter on the state not being decommissioned, but we should map this to a more descriptive error than "unknown diesel error".
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in nexus/db-queries/src/db/datastore/sled.rs at the linked sled_upsert code and inspect how a decommissioned sled becomes a Record not found error. Trace the existing error mapping and related datastore behavior; done means the decommissioned-sled case returns a descriptive error instead of an unknown Diesel error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- databases
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 52/100