oxidecomputer / oxidecomputer/omicron
could db schema and model enforce that IP/port are present iff kind = 'crucible'?
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 572
- Forks
- 97
- Avg merge
- 2d 12h
- Merged PRs (30d)
- 96
Description
I can't find a primary source for this but I believe that for datasets, the IP and port fields are supposed be populated if and only if the dataset kind is "crucible". This comment suggests it:
https://github.com/oxidecomputer/omicron/blob/c1408170715de64017c2b5908501d7e84e19ac92/schema/crdb/dbinit.sql#L3769-L3771
Both this table and the "dataset" table have an explicit constraint to enforce one side of this:
https://github.com/oxidecomputer/omicron/blob/c1408170715de64017c2b5908501d7e84e19ac92/schema/crdb/dbinit.sql#L595-L598
but they allows rows of kind != crucible that have an IP and port set.
If these are unexpected, could we enforce both sides of this in both tables? And also in the model types? I'm hopeful that catch problems like #7299.
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 with the cited constraints and comment in schema/crdb/dbinit.sql, around lines 3769-3771 and 595-598, then locate the corresponding model types. Verify how both tables represent dataset kind, IP, and port, and check the context of #7299. Done means the iff invariant is enforced in both database tables and model types.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust, sql
- Domain
- backend, database
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100