-
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
CurveBs|tools-v2|rebuild check-consistency,list may-broken-vol, check-chunkserver #2132
Conversation
5a31ea7
to
9d0426e
Compare
5be2154
to
41e77ac
Compare
cicheck |
All output should be printed using tableNew, please do not print by yourself, this output is not friendly. 所有的输出都应该使用tableNew 打印,请不要自行打印,这样输出不友好。 |
tools-v2/internal/error/error.go
Outdated
@@ -357,7 +357,7 @@ var ( | |||
return NewInternalCmdError(36, "get time of day fail, the error is: %s") | |||
} | |||
ErrBsGetFileInfo = func() *CmdError { | |||
return NewInternalCmdError(37, "get file info fail, the error is: %s") | |||
return NewInternalCmdError(37, "%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.
why delete this?
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 delete this?
coding error, fix
SegmentNotAllocated = 107; // segment不存在 | ||
FileNotExists = 102; // 文件不存在 | ||
OtherError = -3; // 其他错误 | ||
} | ||
|
||
enum CopysetStatusCode{ | ||
CopysetSuccess = 0; | ||
Exist = 1; // copyset node 已经存在 | ||
NotExist = 2; | ||
UnknowErr = 3; | ||
Healthy = 4; | ||
} | ||
|
||
enum ChunkStatusCode{ | ||
ChunkSuccess = 0; | ||
Redirect = 1; //不是leader,重定向 | ||
DiskErr = 2; //磁盘返回错误 | ||
CrcFail = 3; //Crc校验错误 | ||
InvalidReqParam = 4; //请求参数错误 | ||
NoEnoughSpace = 5; //空间不够 | ||
CopysetNotExist = 6; //copyset不存在 | ||
ChunkNotExist = 7; //chunk或其快照文件不存在 | ||
UnknowFailure = 8; //未知错误 | ||
OverLoad = 9; //服务端过载 | ||
Backward = 10; // 请求的版本落后当前chunk的版本 | ||
ChunkExist = 11; //chunk已存在 | ||
EpochOld = 12; // 请求中的epoch太老了 |
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.
English and alignment
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.
English and alignment
fix
kCpsHealthy = 0 // chunkserver上所有copyset健康 | ||
kNotHealthy = -1 // chunkserver上有copyset不健康 | ||
kNotOnline = -2 // 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.
english
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.
english
fix
row["total copysets"] = total | ||
row["unhealthy copysets"] = unCnt | ||
row["unhealthy ratio"] = ratio |
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 in internal/utils/row.go
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 in internal/utils/row.go
fix
// 解析结果失败 | ||
kParseError = -1 | ||
// peer数量小于预期 | ||
kPeersNoSufficient = -2 | ||
// 副本间的index差距太大 | ||
kLogIndexGapTooBig = -3 | ||
// 有副本在安装快照 | ||
kInstallingSnapshot = -4 | ||
// 少数副本不在线 | ||
kMinorityPeerNotOnline = -5 | ||
// 大多数副本不在线 |
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.
english
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.
english
fix
for _, cpsInfo := range copysetInfos { | ||
cpsIds = append(cpsIds, cpsInfo.GetCopysetId()) | ||
} | ||
// fmt.Println("cpsIds is", cpsIds) |
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.
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.
rm
fix
这条命令会根据情况产生多种不一样的结果,表头无法统一,所以无法使用表格统一打印 |
The table header is not necessarily formulated in init, you can add the header when you are sure. |
cicheck |
proto/topology.proto
Outdated
|
||
|
||
|
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.
remove extra blank lines
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.
remove extra blank lines
fix
required sint32 statusCode = 1; | ||
repeated PoolsetInfo poolsetInfos = 2; | ||
} | ||
|
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.
remove extra blank lines
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.
remove extra blank lines
fix
tools-v2/testTopo.json
Outdated
@@ -0,0 +1,51 @@ | |||
{ |
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.
move to tools-v2/pkg/config/
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.
move to tools-v2/pkg/config/
fix
tools-v2/pkg/config/template.yaml
Outdated
@@ -23,3 +23,4 @@ curvebs: | |||
root: | |||
user: root | |||
password: root_password | |||
|
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.
remove extra blank lines
CURVEBS_PASSWORD = "password" | ||
VIPER_CURVEBS_PASSWORD = "curvebs.root.password" | ||
CURVEBS_DEFAULT_PASSWORD = "root_password" | ||
CURVEBS_CLUSTERMAP = "bsClusterMap" |
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.
lowercase
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.
lowercase
all lowercase is ambiguous
VIPER_CURVEBS_PORT = "curvebs.port" | ||
CURVEBS_CHUNKSERVER_ID = "csId" | ||
VIPER_CURVEBS_CHUNKSERVER_ID = "curvebs.csId" | ||
CURVEBS_CHUNKSERVER_ADDR = "csAddr" |
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
CURVEBS_CHUNKSERVER_ID = "csId" | ||
VIPER_CURVEBS_CHUNKSERVER_ID = "curvebs.csId" | ||
CURVEBS_CHUNKSERVER_ADDR = "csAddr" | ||
VIPER_CURVEBS_CHUNKSERVER_ADDR = "curvebs.csAddr" |
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
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
all lowercase is ambiguous
VIPER_CURVEBS_CHUNK_SIZE = "curvebs.chunkSize" | ||
CURVEBS_PORT = "port" | ||
VIPER_CURVEBS_PORT = "curvebs.port" | ||
CURVEBS_CHUNKSERVER_ID = "csId" |
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
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
all lowercase is ambiguous
tools-v2/pkg/cli/curvecli.go
Outdated
@@ -47,7 +47,7 @@ func setupRootCommand(cmd *cobra.Command) { | |||
} | |||
|
|||
func newCurveCommand() *cobra.Command { | |||
cmd := &cobra.Command{ | |||
rootCmd := &cobra.Command{ |
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 rename?
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 rename?
for test , I will change it back
@@ -166,7 +166,7 @@ func (tCmd *TopologyCommand) scanZones() *cmderror.CmdError { | |||
|
|||
func (tCmd *TopologyCommand) removeZones() *cmderror.CmdError { | |||
tCmd.deleteZoneRpc = &DeleteZoneRpc{} | |||
tCmd.deleteZoneRpc.Info = basecmd.NewRpc(tCmd.addrs, tCmd.timeout, tCmd.retryTimes, "DeleteServer") | |||
tCmd.deleteZoneRpc.Info = basecmd.NewRpc(tCmd.addrs, tCmd.timeout, tCmd.retryTimes, "DeleteZone") |
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.
good job!
@@ -189,26 +189,26 @@ func (eCmd *EtcdCommand) ResultPlainOutput() error { | |||
} | |||
|
|||
func NewStatusEtcdCommand() *EtcdCommand { | |||
etcdCmd := &EtcdCommand{ |
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 rename?
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 rename?
coding error. fix
// fmt.Println("user:", owner) | ||
// fmt.Println("viper:", viper.GetString(config.VIPER_CURVEBS_USER)) |
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 delete this
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 delete this
fix
func (ctCmd *ClusterTopoCmd) RunCommand(cmd *cobra.Command, args []string) error { | ||
err := ctCmd.updateTopology() | ||
if err.TypeCode() != cmderror.CODE_SUCCESS { | ||
//return fmt.Errorf(err.Message) |
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.
remove
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.
remove
fix
} | ||
|
||
func (mdvCmd *MayDamVolCmd) ListChunkServersOnServers() *cmderror.CmdError { | ||
// fmt.Println("ListChunkServersOnServers() in") |
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.
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.
rm
fix
mdvCmd.isRetired = true | ||
continue | ||
} | ||
//fmt.Println(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.
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.
rm
fix
} | ||
|
||
func (mdvCmd *MayDamVolCmd) CheckIfChunkServerOnline(csAddr string) bool { | ||
// fmt.Printf("CheckIfChunkServerOnline() in, csAddr is csAddr %s", csAddr) |
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.
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.
rm
fix
} | ||
|
||
func (mdvCmd *MayDamVolCmd) FindOffLineChunkServers() *cmderror.CmdError { | ||
// fmt.Println("FindOffLineChunkServers() in") |
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.
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.
rm
fix
// 列出集群中所有的server | ||
err := mdvCmd.GetServersInfo() | ||
if err.TypeCode() != cmderror.CODE_SUCCESS { | ||
return err.ToError() | ||
} | ||
// 列出每台server上所有的chunkserver | ||
err1 := mdvCmd.ListChunkServersOnServers() | ||
if err1.TypeCode() != cmderror.CODE_SUCCESS { | ||
return err1.ToError() | ||
} | ||
// 找出所有离线的chunkserver并记录这些chunkserver的地址到mdvCmd.offLineCsAddrs | ||
err = mdvCmd.FindOffLineChunkServers() | ||
if err.TypeCode() != cmderror.CODE_SUCCESS { | ||
return err.ToError() | ||
} | ||
if len(mdvCmd.offLineCsAddrs) == 0 { | ||
// fmt.Println("len(mdvCmd.offLineCsAddrs) == 0") | ||
return err.ToError() | ||
} | ||
// 获取所有离线server上的copysets | ||
err = mdvCmd.GetCopySetsOnOffLineCs() | ||
if err.TypeCode() != cmderror.CODE_SUCCESS { | ||
return err.ToError() | ||
} | ||
//统计各个copysets出现的次数,2次及以上的视为损坏的copyset,记录进mdvCmd.damagedCps |
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.
English note
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.
English note
fix
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.
delete tools-v2/pkg/cli/command/curvebs/list/topo
func NewMayDamVolCmd() *cobra.Command { | ||
mdvCmd := &MayDamVolCmd{ | ||
FinalCurveCmd: basecmd.FinalCurveCmd{ | ||
Use: "may-damaged-vols", |
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.
damaged-vols
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.
damaged-vols
may be better?
no, original name is may-broken-vol, may can't be removed
Signed-off-by: jolly-sy <[email protected]>
Signed-off-by: jolly-sy <[email protected]>
c3ed48d
to
902c0e7
Compare
Signed-off-by: jolly-sy <[email protected]>
we should split these commands and commit them one by one. |
the content of this pr is about rebuilding three command :check-consistency,list may-broken-vol, check-chunkserver
check-consistency:
list may broken vol:
check- chunkserver