-
Notifications
You must be signed in to change notification settings - Fork 726
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
Conversation
dantin
commented
Sep 28, 2017
- add info log
- add function to remove table_id/store_id from namespace
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. |
/ok-to-test |
pdctl/command/namespace_command.go
Outdated
|
||
postJSON(cmd, namespaceAddPrefix, input) | ||
postJSON(cmd, namespaceRelPrefix, input) |
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.
Why use another URL as you have defined different action fields?
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.
The old URL may confuse user as it also support 'delete' function.
server/api/namespace.go
Outdated
if err := cluster.AddNamespaceTableID(ns, tableID); err != nil { | ||
h.rd.JSON(w, http.StatusInternalServerError, err.Error()) | ||
switch action { | ||
case "append": |
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 add
instead of append
?
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.
OK
pdctl/command/namespace_command.go
Outdated
return | ||
} | ||
|
||
input := make(map[string]interface{}) |
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.
input := map[string]interface{} {
"namespace" : args[0],
......
}
may be better.
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.
OK, I'll fix it.
pdctl/command/store_command.go
Outdated
@@ -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]", |
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.
I prefer using another subcommand here, not in store. maybe store_ns set|rm
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.
OK, I'll move it to another subcommand.
pdctl/command/namespace_command.go
Outdated
@@ -23,18 +23,19 @@ import ( | |||
|
|||
const ( | |||
namespacePrefix = "pd/api/v1/namespaces" | |||
namespaceAddPrefix = "pd/api/v1/namespaces/add" | |||
namespaceRelPrefix = "pd/api/v1/namespaces/rel" |
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.
I am confused what dos rel
mean here?
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.
What I means here is relationship. @disksing raised the same question, maybe we need a new name to make it more clear.
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.
I think you can use /namespaces/table
here.
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.
fixed
PTAL @disksing |
LGTM |
LGTM. |