oxidecomputer / oxidecomputer/omicron

Deleting external subnets is overly-complicated

Open
#9,797 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
572
Forks
97
Avg merge
2d 12h
Merged PRs (30d)
96

Description

The code for deleting external subnets looks like this:

https://github.com/oxidecomputer/omicron/blob/16c22eb154598b1b40f5ac73cbc2183219b4c133/nexus/db-queries/src/db/datastore/external_subnet.rs#L544-L565

That delegates to a custom query, which checks that the subnet isn't attached to an instance before deleting it. This is much more complicated than in needs to be. I forgot about the UpdateAndCheck trait we have for exactly this kind of conditional delete. The code is correct, but we should just use the standard mechanism.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in nexus/db-queries/src/db/datastore/external_subnet.rs at lines 544-565 and inspect the existing conditional-delete code and the UpdateAndCheck trait. Replace the custom query with the standard mechanism while preserving the check that prevents deletion when the subnet is attached to an instance; the existing deletion behavior should remain correct.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
database
Issue type
Refactor
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.