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

support removing table_id/store_id from namespace. #776

Merged
merged 10 commits into from
Oct 9, 2017

Conversation

dantin
Copy link
Contributor

@dantin dantin commented Sep 28, 2017

  1. add info log
  2. add function to remove table_id/store_id from namespace

@sre-bot
Copy link
Contributor

sre-bot commented Sep 28, 2017

Hi contributor, thanks for your PR.

This patch needs to be approved by someone of admins. They should reply with "/ok-to-test" to accept this PR for running test automatically.

@dantin dantin requested a review from disksing September 28, 2017 16:35
@disksing
Copy link
Contributor

/ok-to-test


postJSON(cmd, namespaceAddPrefix, input)
postJSON(cmd, namespaceRelPrefix, input)
Copy link
Contributor

Choose a reason for hiding this comment

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

Why use another URL as you have defined different action fields?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The old URL may confuse user as it also support 'delete' function.

if err := cluster.AddNamespaceTableID(ns, tableID); err != nil {
h.rd.JSON(w, http.StatusInternalServerError, err.Error())
switch action {
case "append":
Copy link
Contributor

Choose a reason for hiding this comment

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

How about add instead of append?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

OK

return
}

input := make(map[string]interface{})
Copy link
Contributor

Choose a reason for hiding this comment

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

input := map[string]interface{} {
    "namespace" : args[0],
    ......
}

may be better.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

OK, I'll fix it.

@@ -30,14 +30,15 @@ var (
// NewStoreCommand return a store subcommand of rootCmd
func NewStoreCommand() *cobra.Command {
s := &cobra.Command{
Use: "store [delete|label|weight] <store_id>",
Use: "store [delete|label|weight|set_namespace|rm_namespace] <store_id> [namespace]",
Copy link
Contributor

Choose a reason for hiding this comment

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

I prefer using another subcommand here, not in store. maybe store_ns set|rm

Copy link
Contributor Author

Choose a reason for hiding this comment

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

OK, I'll move it to another subcommand.

@@ -23,18 +23,19 @@ import (

const (
namespacePrefix = "pd/api/v1/namespaces"
namespaceAddPrefix = "pd/api/v1/namespaces/add"
namespaceRelPrefix = "pd/api/v1/namespaces/rel"
Copy link
Contributor

Choose a reason for hiding this comment

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

I am confused what dos rel mean here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

What I means here is relationship. @disksing raised the same question, maybe we need a new name to make it more clear.

Copy link
Contributor

Choose a reason for hiding this comment

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

I think you can use /namespaces/table here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed

@siddontang
Copy link
Contributor

PTAL @disksing

@siddontang
Copy link
Contributor

LGTM

@disksing
Copy link
Contributor

disksing commented Oct 9, 2017

LGTM.

@disksing disksing merged commit a2b6653 into namespace Oct 9, 2017
@disksing disksing deleted the dantin/add_remove_namespace_command branch October 9, 2017 10:43
@sre-bot sre-bot added the contribution This PR is from a community contributor. label Dec 18, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
contribution This PR is from a community contributor.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants