[topo] Refactor ExpandCells to not error on valid aliases#8291
Merged
ajm188 merged 2 commits intovitessio:mainfrom Jun 9, 2021
Merged
[topo] Refactor ExpandCells to not error on valid aliases#8291ajm188 merged 2 commits intovitessio:mainfrom
ExpandCells to not error on valid aliases#8291ajm188 merged 2 commits intovitessio:mainfrom
Conversation
added 2 commits
June 8, 2021 21:29
Signed-off-by: Andrew Mason <amason@slack-corp.com>
A couple other changes here: - Store the output cells in a set to dedupe the final slice. This covers the case where a caller passes `"alias,cell1"` where `cell1` is in the cell list for `alias`. Without a set, it would appear twice in the final result. - Add an inner function to correct `defer` semantics on the cancel funcs. Defering within the scope of a for loop is generally not what we want, since all of the deferred functions will pile up until the total function is done. Fixes vitessio#8290. Signed-off-by: Andrew Mason <amason@slack-corp.com>
rafael
approved these changes
Jun 9, 2021
| if err2 == nil { | ||
| outputCells = append(outputCells, alias.Cells...) | ||
| } | ||
| if err != nil { |
Member
There was a problem hiding this comment.
For my understanding, here is the bug in the current code. Per conversation with @ajm188
we don't nil out err if err2 is nil, so even if there's a valid alias, we still return the error from trying to look up the alias as pure cell
ajm188
pushed a commit
to tinyspeck/vitess
that referenced
this pull request
Jul 23, 2021
…_aliases [topo] Refactor `ExpandCells` to not error on valid aliases Signed-off-by: Andrew Mason <amason@slack-corp.com>
8 tasks
33 tasks
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.
Description
A couple other changes here, in addition to the title:
the case where a caller passes
"alias,cell1"wherecell1is in thecell list for
alias. Without a set, it would appear twice in the finalresult.
defersemantics on the cancelfuncs. Defering within the scope of a for loop is generally not what we
want, since all of the deferred functions will pile up until the total
function is done.
Related Issue(s)
Fixes #8290
Checklist
Deployment Notes