-
Notifications
You must be signed in to change notification settings - Fork 5.8k
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
binlog: fix show pump/drainer status #44764
Conversation
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.
LGTM
func createRegistry(urls string) (*node.EtcdRegistry, error) { | ||
// createRegistry returns an ectd registry, need to close, and error | ||
func createRegistry(urls string) (*node.EtcdRegistry, bool, error) { | ||
if pumpClient := binloginfo.GetPumpsClient(); pumpClient != nil && pumpClient.EtcdRegistry != 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.
Do we need tolerate pumpClient
is 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.
createRegistry
is used in excutor/change.go
too. Should it use the PumpsClient
?
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.
Do we need tolerate
pumpClient
is nil?
Yes. When TiDB doesn't enable binlog, pumpClient
is nil. If we use show drainer status
now TiDB will panic which is not acceptable.
createRegistry is used in excutor/change.go too. Should it use the PumpsClient?
Yes. It's also binlog's related sql. It also have the same problem.
executor/show.go
Outdated
@@ -1876,16 +1877,18 @@ func (e *ShowExec) fetchShowWarnings(errOnly bool) error { | |||
|
|||
// fetchShowPumpOrDrainerStatus gets status of all pumps or drainers and fill them into e.rows. | |||
func (e *ShowExec) fetchShowPumpOrDrainerStatus(kind string) error { | |||
registry, err := createRegistry(config.GetGlobalConfig().Path) | |||
registry, needToClose, err := createRegistry(config.GetGlobalConfig().Path) |
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.
Is it better to use a new function? This client, I think, is used for Pump/Drainer specifically.
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.
How about changing function's name to getOrCreateBinlogRegistry
to avoid abuse? @okJiang
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: GMHDBJD, okJiang The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
/cherry-pick release-6.5-20230625-v6.5.3 |
@lichunzhu: once the present PR merges, I will cherry-pick it on top of release-6.5-20230625-v6.5.3 in the new PR and assign it to you. In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the ti-community-infra/tichi repository. |
In response to a cherrypick label: new pull request created to branch |
In response to a cherrypick label: new pull request created to branch |
Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>
In response to a cherrypick label: new pull request created to branch |
In response to a cherrypick label: new pull request created to branch |
@lichunzhu: new pull request created to branch In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the ti-community-infra/tichi repository. |
In response to a cherrypick label: new pull request created to branch |
Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>
/cherry-pick release-5.4 |
@lichunzhu: new pull request could not be created: failed to create pull request against pingcap/tidb#release-5.4 from head ti-chi-bot:cherry-pick-44764-to-release-5.4: status code 422 not one of [201], body: {"message":"Validation Failed","errors":[{"resource":"PullRequest","code":"custom","message":"A pull request already exists for ti-chi-bot:cherry-pick-44764-to-release-5.4."}],"documentation_url":"https://docs.github.com/rest/pulls/pulls#create-a-pull-request"} In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the ti-community-infra/tichi repository. |
Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>
What problem does this PR solve?
Issue Number: ref #42643
Problem Summary:
What is changed and how it works?
In the past code we directly use tidb's global config path to create etcd registry. After this PR we use binlog client's etcd registry to do the following staff. Binlog client will update etcd urls in time.
Check List
Tests
Side effects
Documentation
Release note
Please refer to Release Notes Language Style Guide to write a quality release note.