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

pd-ctl: add keyspace commands #7158

Merged
merged 17 commits into from Oct 11, 2023
Merged

Conversation

AmoebaProtozoa
Copy link
Contributor

@AmoebaProtozoa AmoebaProtozoa commented Sep 27, 2023

What problem does this PR solve?

Add Keyspace related commands to pd-ctl, so they can be accessed via pd-ctl, which gives better help information than using curl to access RESTful api.

Create:

Usage:
  pd-ctl keyspace create <keyspace-name> [flags]

Flags:
      --config strings   keyspace configs for the new keyspace
                         specify as comma separated key value pairs, e.g. --config k1=v1,k2=v2

Show:

Usage:
  pd-ctl keyspace show id <id> [flags]
  pd-ctl keyspace show name <name> [flags]

List:

Usage:
  pd-ctl keyspace list [flags]

Flags:
      --limit string        The maximum number of keyspace metas to return. If not set, no limit is posed.
      --page_token string   The keyspace id of the scan start. If not set, scan from keyspace/keyspace group with id 0

Update State:

Usage:
  pd-ctl keyspace update-state <keyspace-name> <state> [flags]

Update Config:

Usage:
  pd-ctl keyspace update-config <keyspace-name> [flags]

Flags:
      --remove strings   keys to remove from keyspace config
                         specify as comma separated keys, e.g. --remove k1,k2
      --update strings   kv pairs to upsert into keyspace config
                         specify as comma separated key value pairs, e.g. --update k1=v1,k2=v2

Issue Number: Ref #4399

Check List

Tests

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

Release note

None.

Signed-off-by: AmoebaProtozoa <8039876+AmoebaProtozoa@users.noreply.github.com>
@ti-chi-bot
Copy link
Contributor

ti-chi-bot bot commented Sep 27, 2023

[REVIEW NOTIFICATION]

This pull request has been approved by:

  • nolouch
  • rleungx

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
Copy link
Contributor

ti-chi-bot bot commented Sep 27, 2023

Hi @AmoebaProtozoa. Thanks for your PR.

I'm waiting for a tikv member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

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 kubernetes/test-infra repository.

@ti-chi-bot ti-chi-bot bot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Sep 27, 2023
Signed-off-by: AmoebaProtozoa <8039876+AmoebaProtozoa@users.noreply.github.com>
@rleungx
Copy link
Member

rleungx commented Sep 27, 2023

/ok-to-test

Signed-off-by: AmoebaProtozoa <8039876+AmoebaProtozoa@users.noreply.github.com>
Signed-off-by: AmoebaProtozoa <8039876+AmoebaProtozoa@users.noreply.github.com>
Signed-off-by: AmoebaProtozoa <8039876+AmoebaProtozoa@users.noreply.github.com>
Signed-off-by: AmoebaProtozoa <8039876+AmoebaProtozoa@users.noreply.github.com>
Signed-off-by: AmoebaProtozoa <8039876+AmoebaProtozoa@users.noreply.github.com>
@codecov
Copy link

codecov bot commented Oct 6, 2023

Codecov Report

Merging #7158 (869d08b) into master (92858b7) will decrease coverage by 0.21%.
The diff coverage is 60.86%.

❗ Current head 869d08b differs from pull request most recent head cdffdf0. Consider uploading reports for the commit cdffdf0 to get more accurate results

@@            Coverage Diff             @@
##           master    #7158      +/-   ##
==========================================
- Coverage   74.67%   74.46%   -0.21%     
==========================================
  Files         442      441       -1     
  Lines       47440    47518      +78     
==========================================
- Hits        35425    35384      -41     
- Misses       8928     9017      +89     
- Partials     3087     3117      +30     
Flag Coverage Δ
unittests 74.46% <60.86%> (-0.21%) ⬇️

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

Signed-off-by: AmoebaProtozoa <8039876+AmoebaProtozoa@users.noreply.github.com>
Signed-off-by: AmoebaProtozoa <8039876+AmoebaProtozoa@users.noreply.github.com>
Signed-off-by: AmoebaProtozoa <8039876+AmoebaProtozoa@users.noreply.github.com>
@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 Oct 7, 2023
Signed-off-by: AmoebaProtozoa <8039876+AmoebaProtozoa@users.noreply.github.com>
}
updateFlags, err := cmd.Flags().GetStringSlice(nmUpdate)
if err != nil {
cmd.Println("Failed to parse flag: ", err)
Copy link
Member

Choose a reason for hiding this comment

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

I find in this PR, some use Println and the others use PrintErrln.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's now fixed.

In general, I use Println for response, and PrintErrln for any error occurred.

I believe the version of cobra we used does not really make difference between PrintErrln and Println, despite the description of them, resulting in that other places of pd-ctl use them interchangeably (they have the same implementation anyway).

This is fixed in newer version of cobra, and we probably need to do some cleanup when we update the reference.

@ti-chi-bot ti-chi-bot bot added the status/LGT1 Indicates that a PR has LGTM 1. label Oct 8, 2023
@ti-chi-bot
Copy link
Contributor

ti-chi-bot bot commented Oct 11, 2023

@ystaticy: Thanks for your review. The bot only counts approvals from reviewers and higher roles in list, but you're still welcome to leave your comments.

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.

@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 Oct 11, 2023
@nolouch
Copy link
Contributor

nolouch commented Oct 11, 2023

/merge

@ti-chi-bot
Copy link
Contributor

ti-chi-bot bot commented Oct 11, 2023

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

@ti-chi-bot
Copy link
Contributor

ti-chi-bot bot commented Oct 11, 2023

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

Commit hash: 869d08b

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

ti-chi-bot bot commented Oct 11, 2023

@AmoebaProtozoa: 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 873212f into tikv:master Oct 11, 2023
22 checks passed
@AmoebaProtozoa AmoebaProtozoa deleted the pd-ctl-keyspace branch October 11, 2023 07:06
lhy1024 pushed a commit to lhy1024/pd that referenced this pull request Oct 12, 2023
ref tikv#4399

Signed-off-by: AmoebaProtozoa <8039876+AmoebaProtozoa@users.noreply.github.com>

Co-authored-by: ti-chi-bot[bot] <108142056+ti-chi-bot[bot]@users.noreply.github.com>
rleungx pushed a commit to rleungx/pd that referenced this pull request Dec 1, 2023
* pd-ctl: add keyspace commands (tikv#7158)

ref tikv#4399

Signed-off-by: AmoebaProtozoa <8039876+AmoebaProtozoa@users.noreply.github.com>

Co-authored-by: ti-chi-bot[bot] <108142056+ti-chi-bot[bot]@users.noreply.github.com>
(cherry picked from commit 873212f)

* fix test

Signed-off-by: AmoebaProtozoa <8039876+AmoebaProtozoa@users.noreply.github.com>

---------

Signed-off-by: AmoebaProtozoa <8039876+AmoebaProtozoa@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ok-to-test release-note-none size/XL Denotes a PR that changes 500-999 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.

None yet

4 participants