-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
go/cmd/vtbackup: wait for plugins to finish initializing #14113
Merged
ajm188
merged 2 commits into
vitessio:main
from
planetscale:maxeng-deflake-vtb-e2e-tests
Sep 28, 2023
Merged
Changes from 1 commit
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this seems fine to me; it might be a bit more readable (in absence of the comment) to do this:
and then here:
(or abstract a bit further so we don't expose the particular plugins (i.e.
stats.AwaitPlugins(ctx)
))There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the suggestion, I'll go with the middle option for now (
opentsdb.AwaitInit
).There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually going with third option since we don't know if user will select
--stats_backend opentsdb
or something else.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But opentsdbs OnRun still gets registered either way, no?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ajm188 ah that's true 😳
Do you prefer I switch to that or are you OK with what I pushed up for
stats.AwaitBackend
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so i like yours structurally (since it's possible of course to compile vitess without a particular plugin_ file), however, the problem is this close happens during
init()
and not duringservenv.OnRun
we need some mechanism for a plugin to signal back to the main
stats
package that it's been fully initialized.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
something maybe like this:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ajm188 and I chatted about this part:
It turns out
opentsdb
is a bit special in this regard in that it exposes aInit
function that usesservenv.OnRun
under the hood. So the full sequence is:vitess/go/cmd/vtbackup/cli/plugin_opentsdb.go
Line 24 in 83932bc
vitess/go/stats/opentsdb/init.go
Lines 36 to 38 in 83932bc
vitess/go/vt/servenv/run.go
Lines 40 to 43 in 83932bc
vitess/go/stats/opentsdb/init.go
Lines 51 to 58 in 83932bc
vitess/go/stats/export.go
Lines 228 to 236 in 83932bc
It's probably worth making the
opentsdb
package and consumer plugins more like the rest of the code base at some point, but will leave things as they are for now if that's alright.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yep, you're totally right! this is looking good to me now