-
Notifications
You must be signed in to change notification settings - Fork 526
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
[feat]tools-v2: add update copyset availflag #2455
Conversation
99a7afa
to
0c358b5
Compare
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.
we also need to update doc in tools-v2/README.md
.
you can refer to pr #2465
tools-v2/internal/error/error.go
Outdated
@@ -420,7 +420,18 @@ var ( | |||
ErrBsOpNameNotSupport = func() *CmdError { | |||
return NewInternalCmdError(53, "not support op[%s], only support: operator, change_peer, add_peer, remove_peer, transfer_leader") | |||
} | |||
|
|||
ErrBsGetChunkServerInCluster = func() *CmdError { | |||
return NewInternalCmdError(53, "get chunkserver in cluster fail, err: %s") |
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 errorno 53 is already used above, we should start with errorno 54.
) | ||
|
||
const ( | ||
copysetAvailflagExample = `$ curve bs update copyset availflag --availflag=true --dryrun=false` |
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.
set
or update
?
you use set
in conversation, I think it should be update
, we should correct it.
Ok, I will fix all. This pr is not ready yet. I've been a little busy lately. |
tools-v2/pkg/config/bs.go
Outdated
CURVEBS_CHUNKSERVER_ADDRESS = "csaddress" | ||
VIPER_CURVEBS_CHUNKSERVER_ADDRESS = "curvebs.csaddress" |
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.
CURVEBS_CHUNKSERVER_ADDRESS = "csaddress" | |
VIPER_CURVEBS_CHUNKSERVER_ADDRESS = "curvebs.csaddress" | |
CURVEBS_CHUNKSERVER_ADDRESS = "chunkserveraddr" | |
VIPER_CURVEBS_CHUNKSERVER_ADDRESS = "curvebs.chunkserverAddr" |
type ChunkserverCommand struct { | ||
basecmd.FinalCurveCmd | ||
Rpc *GetChunkServerInClusterRpc | ||
response *topology.GetChunkServerInClusterResponse |
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.
response *topology.GetChunkServerInClusterResponse | |
ChunkServerInfos []*topology.ChunkServerInfo |
is better?
type UnAvailCopySetsCommand struct { | ||
basecmd.FinalCurveCmd | ||
Rpc *ListUnAvailCopySets | ||
response *topology.ListUnAvailCopySetsResponse |
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.
ditto
@@ -0,0 +1,167 @@ | |||
/* | |||
* Copyright (c) 2022 NetEase Inc. |
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.
* Copyright (c) 2022 NetEase Inc. | |
* Copyright (c) 2023 NetEase Inc. |
@@ -0,0 +1,131 @@ | |||
/* | |||
* Copyright (c) 2022 NetEase Inc. |
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.
* Copyright (c) 2022 NetEase Inc. | |
* Copyright (c) 2023 NetEase Inc. |
CopysetId: ©setIds[i], | ||
ChunkId: &chunkIds[i], | ||
}, | ||
Info: &basecmd.Rpc{[]string{addressList[i]}, timeout, retrytimes, "GetChunkInfo"}, |
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.
Info: &basecmd.Rpc{[]string{addressList[i]}, timeout, retrytimes, "GetChunkInfo"}, | |
Info: &basecmd.NewRpc{[]string{addressList[i]}, timeout, retrytimes, "GetChunkInfo"}, |
@@ -0,0 +1,259 @@ | |||
/* | |||
* Copyright (c) 2022 NetEase Inc. |
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.
* Copyright (c) 2022 NetEase Inc. | |
* Copyright (c) 2023 NetEase Inc. |
@@ -0,0 +1,259 @@ | |||
/* |
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.
add use in readme
c9d5cee
to
cc9f6cb
Compare
@Cyber-SiKu PTAL |
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.
this file has been implemented as chunkserver_cluster.go
in the latest master
branch. If necessary, use that.
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's this file for? chunk
is a different concept from chunkserver
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.
list/chunkserver/copyset.go
in current master
do the same thing, use the current one.
@@ -0,0 +1,132 @@ | |||
/* |
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.
You can directly use chunkserver.go
Or migrate it over here and modify it according to your needs.
row[cobrautil.ROW_POOL_ID] = strconv.FormatUint(uint64(info.GetLogicalPoolId()), 10) | ||
row[cobrautil.ROW_COPYSET_ID] = strconv.FormatUint(uint64(info.GetCopysetId()), 10) | ||
row[cobrautil.ROW_AVAILFLAG] = fmt.Sprintf("%v => %v", !*cCmd.Rpc.Request.AvailFlag, *cCmd.Rpc.Request.AvailFlag) | ||
row[cobrautil.ROW_DRYRUN] = "true" |
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.
row[cobrautil.ROW_DRYRUN] = "true" | |
row[cobrautil.ROW_DRYRUN] = cobrautil.ROW_VALUE_TRUE |
row[cobrautil.ROW_POOL_ID] = strconv.FormatUint(uint64(info.GetLogicalPoolId()), 10) | ||
row[cobrautil.ROW_COPYSET_ID] = strconv.FormatUint(uint64(info.GetCopysetId()), 10) | ||
row[cobrautil.ROW_AVAILFLAG] = fmt.Sprintf("%v => %v", !*cCmd.Rpc.Request.AvailFlag, *cCmd.Rpc.Request.AvailFlag) | ||
row[cobrautil.ROW_DRYRUN] = "false" |
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.
row[cobrautil.ROW_DRYRUN] = "false" | |
row[cobrautil.ROW_DRYRUN] = ROW_VALUE_FALSE |
cicheck |
Signed-off-by: baytan0720 <[email protected]>
cicheck |
What problem does this PR solve?
Issue Number: #2357
Problem Summary: support update availflag command in curve tool
What is changed and how it works?
What's Changed:
add tools-v2/pkg/cli/command/curvebs/list/unavailcopysets/unavailcopysets.go
add tools-v2/pkg/cli/command/curvebs/query/chunk/chunkinfo.go
add tools-v2/pkg/cli/command/curvebs/list/chunkserver/copyset_by_host.go
add tools-v2/pkg/cli/command/curvebs/set/set.go
add tools-v2/pkg/cli/command/curvebs/update/copyset/copyset.go
add tools-v2/pkg/cli/command/curvebs/update/copyset/availflag/availflag.go
modify tools-v2/internal/error/error.go
modify tools-v2/internal/utils/row.go
modify tools-v2/pkg/cli/command/curvebs/bs.go
modify tools-v2/pkg/config/bs.go
modify tools-v2/pkg/cli/command/curvebs/update/update.go
modify tools-v2/pkg/cli/command/curvebs/check/copyset/copyset.go
How it Works:
Side effects(Breaking backward compatibility? Performance regression?):
Check List