Fix duplicate entries in IP pools list#4808
Merged
Merged
Conversation
david-crespo
commented
Jan 12, 2024
| ) | ||
| .filter(ip_pool::time_deleted.is_null()) | ||
| .select(IpPool::as_select()) | ||
| .distinct() |
Contributor
Author
There was a problem hiding this comment.
This is the easy fix, but I'm wondering if instead of using linkage to the internal silo to identify the internal pool, we could leave out the join altogether if we just had a well-known name for the internal pool and filtered that out.
Contributor
There was a problem hiding this comment.
I believe the SERVICE_IP_POOL_NAME const should be usable for this.
omicron/nexus/db-queries/src/db/datastore/rack.rs
Lines 756 to 760 in 009c4ae
009c4ae to
6c0518c
Compare
6370b3e to
d9d8701
Compare
david-crespo
commented
Jan 12, 2024
| })?; | ||
| Ok((authz_pool, pool)) | ||
| let name = SERVICE_IP_POOL_NAME.parse().unwrap(); | ||
| LookupPath::new(&opctx, self).ip_pool_name(&Name(name)).fetch().await |
Contributor
There was a problem hiding this comment.
I count this as a win, haha.
just-be-dev
reviewed
Jan 16, 2024
| // pool has no entry in the join table | ||
| .or(ip_pool_resource::resource_id.is_null()), | ||
| ) | ||
| .filter(ip_pool::name.ne(SERVICE_IP_POOL_NAME)) |
Contributor
There was a problem hiding this comment.
Yeah, so much better 🙌
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Bugfix for #4261. Using
distinctto eliminate dupes from the left outer join works, but it's better to just use the well-known name of the service IP pool to exclude it from whatever operations it needs to be excluded from.Potential followup related to #4762: if the ID was well-known too, we could do the
is_internalcheck without having to hit the DB.