Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[nexus] move dataset IDs to TypedUuid #5532

Closed

Conversation

sunshowers
Copy link
Contributor

Datasets are zones, so they're OmicronZoneUuid instances. Was quite
straightforward in the end.

There is some messiness around Diesel, and honestly I'm half-tempted to just
fork and publish our own version of Diesel, with support for typed UUIDs +
other things we've run into.

Created using spr 1.3.6-beta.1
@jgallagher
Copy link
Contributor

Datasets are zones, so they're OmicronZoneUuid instances.

Is this true? I thought a zone could have 0 or more datasets. Today it looks like it's "0 or exactly 1", and if 1, the dataset ID does match the zone ID, but I'm not sure it will always be that way?

@sunshowers
Copy link
Contributor Author

Oh interesting, I didn't realize that. Thoughts on how this should be represented then? I feel like we should use an enum that covers both the N = 1 and N = many cases.

@jgallagher
Copy link
Contributor

My gut feeling is that this should just be a DatasetUuid, and we should stop assuming that it will always match the zone ID it's assigned to. But I don't know how many places we're making that assumption...

@davepacheco
Copy link
Collaborator

Yeah, I believe that right now, there is at most one dataset associated with each zone. And you know based on the zone type whether it has one. In principle we could have more datasets later, but that's pretty hypothetical and I think it's a pretty useful simplification for the time being that the zone id == dataset id. That's especially useful when debugging. I'd be inclined not to frontload the work now to generalize this for something that we don't know whether/when/why we'll do later.

I also think it makes sense to use a separate type like DatasetUuid. It's a separate id that happens to always have the same value. Is this self-inconsistent?

Forking diesel sounds pretty extreme. There's a whole ecosystem of crates related to it and I think we also want to be able to take new updates to it pretty easily.

@sunshowers
Copy link
Contributor Author

I also think it makes sense to use a separate type like DatasetUuid. It's a separate id that happens to always have the same value. Is this self-inconsistent?

I'm okay with that, I think.

Forking diesel sounds pretty extreme. There's a whole ecosystem of crates related to it and I think we also want to be able to take new updates to it pretty easily.

Oh I was imagining just a patchset on top that we'd use a [patch] directive to pull in, we wouldn't lose any of the ecosystem. Then we could have our patched Diesel implement support for newtype-uuid just like it implements support for uuid today. But this isn't a fleshed-out idea. The Rust orphan rules cause this to really suck :(

@sunshowers
Copy link
Contributor Author

Oh I was imagining just a patchset on top that we'd use a [patch] directive to pull in, we wouldn't lose any of the ecosystem. Then we could have our patched Diesel implement support for newtype-uuid just like it implements support for uuid today. But this isn't a fleshed-out idea. The Rust orphan rules cause this to really suck :(

Made a post on the Diesel discussion board about this, diesel-rs/diesel#3993 -- hoping to have Diesel take in optional support for newtype-uuid, which will solve this problem.

@sunshowers
Copy link
Contributor Author

We'll have to do this from scratch -- going to abandon this and come back to it when I have more time.

@sunshowers sunshowers closed this Apr 26, 2024
@sunshowers sunshowers deleted the sunshowers/spr/nexus-move-dataset-ids-to-typeduuid branch April 26, 2024 17:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants