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

Omicron services need more unique ids #2922

Merged
merged 5 commits into from
Apr 28, 2023
Merged

Conversation

davepacheco
Copy link
Collaborator

See #2813 for more context. Today, services have one id, the service_id, which is unique. We generally use the zone id for this. That means that if we wind up registering two logical services in one zone (as we do for things like Internal DNS), we cannot store both records. In this change I'm trying to balance:

  • it's very useful for debugging if the zone id matches the service id (it's one less mapping to write down and keep in your head)
  • we might want more than one service in some zones

What I did was:

  • There's a new zone_id column in the service table. It's nullable because we might have some services not in standard control plane zones (e.g., in the GZ). This column is really only intended for debugging.
  • The service id is now expected to be unique. If we have two services in a zone, they can (and must, and do, in this PR) have separate ids.
  • For most zones, I kept the behavior that the service_id matches the zone_id, again for debugging.

I could see this last part being the worst of both worlds. It'd be a problem if we accidentally depended on the fact that service_id == zone_id, which is true in most cases. Thoughts?

Fixes #2813.

#[derive(
Clone, Debug, Deserialize, Serialize, JsonSchema, PartialEq, Eq, Hash,
)]
pub struct ServiceZoneService {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can probably do another pass on the naming here to collapse "Service" out of this in a separate PR, but the addition of this structure makes sense to me!

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for taking a look!

Copy link
Contributor

@luqmana luqmana left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for getting that fixed!

@davepacheco davepacheco enabled auto-merge (squash) April 28, 2023 20:22
@davepacheco davepacheco merged commit 9f31e37 into main Apr 28, 2023
@davepacheco davepacheco deleted the dap/service-zone-unique branch April 28, 2023 21:01
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.

service inserts clobber other services for the same zone
3 participants