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

ctl: replace cluster info with HTTP SDK #7605

Merged
merged 13 commits into from
Jan 3, 2024

Conversation

HuSharp
Copy link
Member

@HuSharp HuSharp commented Dec 21, 2023

What problem does this PR solve?

Issue Number: Ref #7300, wait for #7635 merged

What is changed and how does it work?

  • want to replace all pd-ctl
  • support cluster command firstly
$ ./pd-ctl cluster
{
  "id": 7316377368062736100,
  "max_peer_count": 3
}

$ ./pd-ctl --pd http://127.0.0.1:52719 cluster
{
  "id": 7316426302202361416,
  "max_peer_count": 3
}

Check List

Tests

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

Release note

None.

Copy link
Contributor

ti-chi-bot bot commented Dec 21, 2023

[REVIEW NOTIFICATION]

This pull request has been approved by:

  • CabinfeverB
  • JmPotato

To complete the pull request process, please ask the reviewers in the list to review by filling /cc @reviewer in the comment.
After your PR has acquired the required number of LGTMs, you can assign this pull request to the committer in the list by filling /assign @committer in the comment to help you merge this pull request.

The full list of commands accepted by this bot can be found here.

Reviewer can indicate their review by submitting an approval review.
Reviewer can cancel approval by submitting a request changes review.

@ti-chi-bot ti-chi-bot bot added the release-note-none Denotes a PR that doesn't merit a release note. label Dec 21, 2023
@ti-chi-bot ti-chi-bot bot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Dec 21, 2023
@HuSharp HuSharp changed the title ctl: replace cluster info ctl: replace cluster info HTTP SDK Dec 21, 2023
@HuSharp HuSharp changed the title ctl: replace cluster info HTTP SDK ctl: replace cluster info with HTTP SDK Dec 21, 2023
Copy link

codecov bot commented Dec 21, 2023

Codecov Report

Merging #7605 (fa30740) into master (335bd1e) will decrease coverage by 0.03%.
The diff coverage is 0.00%.

❗ Current head fa30740 differs from pull request most recent head 5ca044c. Consider uploading reports for the commit 5ca044c to get more accurate results

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #7605      +/-   ##
==========================================
- Coverage   73.89%   73.86%   -0.03%     
==========================================
  Files         429      429              
  Lines       47317    47320       +3     
==========================================
- Hits        34965    34954      -11     
- Misses       9360     9371      +11     
- Partials     2992     2995       +3     
Flag Coverage Δ
unittests 73.86% <0.00%> (-0.03%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

@ti-chi-bot ti-chi-bot bot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Dec 21, 2023
Signed-off-by: husharp <jinhao.hu@pingcap.com>
client/http/types.go Outdated Show resolved Hide resolved
tools/pd-ctl/pdctl/command/cluster_command.go Outdated Show resolved Hide resolved
go.mod Outdated Show resolved Hide resolved
Signed-off-by: husharp <jinhao.hu@pingcap.com>
Signed-off-by: husharp <jinhao.hu@pingcap.com>
Signed-off-by: husharp <jinhao.hu@pingcap.com>
Signed-off-by: husharp <jinhao.hu@pingcap.com>
@HuSharp HuSharp force-pushed the replace_ctl_test branch 5 times, most recently from e5123ef to c14a305 Compare December 25, 2023 09:18
@ti-chi-bot ti-chi-bot bot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Dec 25, 2023
Signed-off-by: husharp <jinhao.hu@pingcap.com>
@HuSharp
Copy link
Member Author

HuSharp commented Dec 27, 2023

@rleungx @CabinfeverB friendly ping :)

@ti-chi-bot ti-chi-bot bot added the status/LGT1 Indicates that a PR has LGTM 1. label Dec 27, 2023
Signed-off-by: husharp <jinhao.hu@pingcap.com>
@HuSharp
Copy link
Member Author

HuSharp commented Dec 28, 2023

/hold wait #7635 merged

@ti-chi-bot ti-chi-bot bot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Dec 28, 2023
Signed-off-by: husharp <jinhao.hu@pingcap.com>
Signed-off-by: husharp <jinhao.hu@pingcap.com>
@HuSharp
Copy link
Member Author

HuSharp commented Jan 2, 2024

/unhold

@ti-chi-bot ti-chi-bot bot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Jan 2, 2024
@HuSharp
Copy link
Member Author

HuSharp commented Jan 2, 2024

FYI, after #7635 merged, we do not need to update the server's gomod to import client

@JmPotato @CabinfeverB @rleungx PTAL, thx!

client/http/api.go Outdated Show resolved Hide resolved
@@ -34,12 +35,25 @@ const (
pingPrefix = "pd/api/v1/ping"
)

// PDCli is a pd HTTP client
var PDCli pd.Client
Copy link
Member

Choose a reason for hiding this comment

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

What about using a sync.Once here?

Copy link
Member Author

Choose a reason for hiding this comment

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

because we support -i which can reset client addrs, maybe sync.Once is not suitable

rootCmd.Println(err)
return err
}
} else {
command.SetNewPDClient(strings.Split(addrs, ","))
Copy link
Member

Choose a reason for hiding this comment

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

What about setting the PD HTTP client unconditionally before we finish the replacement?

Copy link
Member Author

Choose a reason for hiding this comment

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

we can simplify it after replacing dialClient

Signed-off-by: husharp <jinhao.hu@pingcap.com>
@ti-chi-bot ti-chi-bot bot added status/LGT2 Indicates that a PR has LGTM 2. and removed status/LGT1 Indicates that a PR has LGTM 1. labels Jan 3, 2024
@JmPotato
Copy link
Member

JmPotato commented Jan 3, 2024

/merge

Copy link
Contributor

ti-chi-bot bot commented Jan 3, 2024

@JmPotato: It seems you want to merge this PR, I will help you trigger all the tests:

/run-all-tests

You only need to trigger /merge once, and if the CI test fails, you just re-trigger the test that failed and the bot will merge the PR for you after the CI passes.

If you have any questions about the PR merge process, please refer to pr process.

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.

Copy link
Contributor

ti-chi-bot bot commented Jan 3, 2024

This pull request has been accepted and is ready to merge.

Commit hash: edc498f

@ti-chi-bot ti-chi-bot bot added the status/can-merge Indicates a PR has been approved by a committer. label Jan 3, 2024
Copy link
Contributor

ti-chi-bot bot commented Jan 3, 2024

@HuSharp: Your PR was out of date, I have automatically updated it for you.

If the CI test fails, you just re-trigger the test that failed and the bot will merge the PR for you after the CI passes.

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 5d91220 into tikv:master Jan 3, 2024
22 checks passed
@HuSharp HuSharp deleted the replace_ctl_test branch January 3, 2024 06:54
pingandb pushed a commit to pingandb/pd that referenced this pull request Jan 18, 2024
ref tikv#7300

Signed-off-by: husharp <jinhao.hu@pingcap.com>

Co-authored-by: ti-chi-bot[bot] <108142056+ti-chi-bot[bot]@users.noreply.github.com>
Signed-off-by: pingandb <songge102@pingan.com.cn>
@HuSharp HuSharp mentioned this pull request Jan 29, 2024
7 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release-note-none Denotes a PR that doesn't merit a release note. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. status/can-merge Indicates a PR has been approved by a committer. status/LGT2 Indicates that a PR has LGTM 2.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants