Skip to content
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

Merged
merged 4 commits into from
Jun 27, 2023

Conversation

lichunzhu
Copy link
Contributor

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

  • Unit test
  • Integration test
  • Manual test (add detailed scripts or steps below)

Side effects

  • None

Documentation

  • None

Release note

Please refer to Release Notes Language Style Guide to write a quality release note.

None

@ti-chi-bot ti-chi-bot bot added release-note-none Denotes a PR that doesn't merit a release note. needs-cherry-pick-release-5.3 Type: Need cherry pick to release-5.3 needs-cherry-pick-release-5.4 Should cherry pick this PR to release-5.4 branch. needs-cherry-pick-release-6.1 Should cherry pick this PR to release-6.1 branch. needs-cherry-pick-release-6.5 Should cherry pick this PR to release-6.5 branch. needs-cherry-pick-release-7.1 Should cherry pick this PR to release-7.1 branch. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Jun 19, 2023
@ti-chi-bot ti-chi-bot bot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Jun 20, 2023
Copy link
Contributor

@GMHDBJD GMHDBJD left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@ti-chi-bot ti-chi-bot bot added needs-1-more-lgtm Indicates a PR needs 1 more LGTM. approved labels Jun 21, 2023
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 {
Copy link
Member

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?

Copy link
Member

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?

Copy link
Contributor Author

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)
Copy link
Member

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.

Copy link
Contributor Author

@lichunzhu lichunzhu Jun 27, 2023

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

@ti-chi-bot
Copy link

ti-chi-bot bot commented Jun 27, 2023

[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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@ti-chi-bot ti-chi-bot bot added lgtm and removed needs-1-more-lgtm Indicates a PR needs 1 more LGTM. labels Jun 27, 2023
@ti-chi-bot
Copy link

ti-chi-bot bot commented Jun 27, 2023

[LGTM Timeline notifier]

Timeline:

  • 2023-06-21 09:51:39.521189728 +0000 UTC m=+182864.922440174: ☑️ agreed by GMHDBJD.
  • 2023-06-27 09:24:15.530777924 +0000 UTC m=+699620.932028372: ☑️ agreed by okJiang.

@lichunzhu
Copy link
Contributor Author

/cherry-pick release-6.5-20230625-v6.5.3

@ti-chi-bot
Copy link
Member

@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:

/cherry-pick release-6.5-20230625-v6.5.3

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.

@ti-chi-bot ti-chi-bot bot merged commit ffb0654 into pingcap:master Jun 27, 2023
@ti-chi-bot
Copy link
Member

In response to a cherrypick label: new pull request created to branch release-5.4: #44991.

@ti-chi-bot
Copy link
Member

In response to a cherrypick label: new pull request created to branch release-6.1: #44992.

ti-chi-bot pushed a commit to ti-chi-bot/tidb that referenced this pull request Jun 27, 2023
Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>
@ti-chi-bot
Copy link
Member

In response to a cherrypick label: new pull request created to branch release-6.5: #44993.

@ti-chi-bot
Copy link
Member

In response to a cherrypick label: new pull request created to branch release-7.1: #44994.

@ti-chi-bot
Copy link
Member

@lichunzhu: new pull request created to branch release-6.5-20230625-v6.5.3: #44995.

In response to this:

/cherry-pick release-6.5-20230625-v6.5.3

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.

@ti-chi-bot
Copy link
Member

In response to a cherrypick label: new pull request created to branch release-5.3: #44996.

ti-chi-bot pushed a commit to ti-chi-bot/tidb that referenced this pull request Jun 27, 2023
Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>
ti-chi-bot bot pushed a commit that referenced this pull request Jun 28, 2023
ti-chi-bot bot pushed a commit that referenced this pull request Jul 2, 2023
ti-chi-bot bot pushed a commit that referenced this pull request Jul 7, 2023
@lichunzhu
Copy link
Contributor Author

/cherry-pick release-5.4

@ti-chi-bot
Copy link
Member

@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:

/cherry-pick release-5.4

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.

ti-chi-bot pushed a commit to ti-chi-bot/tidb that referenced this pull request Aug 2, 2023
Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved lgtm needs-cherry-pick-release-5.3 Type: Need cherry pick to release-5.3 needs-cherry-pick-release-5.4 Should cherry pick this PR to release-5.4 branch. needs-cherry-pick-release-6.1 Should cherry pick this PR to release-6.1 branch. needs-cherry-pick-release-6.5 Should cherry pick this PR to release-6.5 branch. needs-cherry-pick-release-7.1 Should cherry pick this PR to release-7.1 branch. release-note-none Denotes a PR that doesn't merit a release note. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants