-
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
[vtctld] sleep/ping tablets #8826
Conversation
|
Signed-off-by: Andrew Mason <[email protected]>
Signed-off-by: Andrew Mason <[email protected]>
Signed-off-by: Andrew Mason <[email protected]>
Signed-off-by: Andrew Mason <[email protected]>
2e93566
to
e53673c
Compare
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 looks good as always. I have two small questions.
// SleepTablet makes a SleepTablet gRPC call to a vtctld. | ||
SleepTablet = &cobra.Command{ | ||
Use: "SleepTablet <alias> <duration>", | ||
Short: "Blocks the action queue on the specified tablet for the specified amount of time. This is typically used for testing.", |
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.
Maybe an inline example would be helpful for "specified amount of time"? (Unless it's super obvious to Vitess operators.) We could steal what's noted here
The value is a string that contains a possibly signed sequence of decimal numbers, each with optional fraction and a unit suffix, such as “300ms” or “1h45m”
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.
will do!!
if err != nil { | ||
return nil, err | ||
} else if !ok { | ||
dur = *topo.RemoteOperationTimeout |
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.
I'm kinda surprised that we don't return if we can't parse the duration. Does using RemoteOperationTimeout
here mean "sleep for the maximum timeout"? Or will tmc.Sleep
fail?
(I did a bit of hunting in the codebase to answer this for myself but wound up in an interface declaration, and Sleep
is... a cumbersome search term, haha.)
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.
the three-tuple here is (parsedDuration, wasDurationSet, error)
, so if the duration is nil
you get back 0, false, nil
, and we default to *topo.RemoteOperationTimeout
. If we actually fail to parse, then the third value is non-nil and we take the earlier case (err != nil
)
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.
(it's named "ok" to mirror the map two-value semantic of (value, isThereAValue))
Signed-off-by: Andrew Mason <[email protected]>
Description
This PR migrates the
Sleep
andPing
legacy vtctl commands, renamed toSleepTablet
andPingTablet
since that is the component they operate on.Demo
Related Issue(s)
#7135
Checklist
Deployment Notes