Skip to content

Commit

Permalink
[fix]tools-v2: supplementary status collection
Browse files Browse the repository at this point in the history
Signed-off-by: baytan0720 <baytan2@hotmail.com>
  • Loading branch information
baytan0720 authored and Cyber-SiKu committed Apr 26, 2023
1 parent 454ff1c commit 48872a0
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions tools-v2/pkg/cli/command/curvefs/check/copyset/copyset.go
Original file line number Diff line number Diff line change
Expand Up @@ -158,10 +158,12 @@ func (cCmd *CopysetCommand) RunCommand(cmd *cobra.Command, args []string) error
row[cobrautil.ROW_COPYSET_ID] = fmt.Sprintf("%d", copysetid)
if v == nil {
row[cobrautil.ROW_STATUS] = cobrautil.CopysetHealthStatus_Str[int32(cobrautil.COPYSET_NOTEXIST)]
(*cCmd.copysetKey2Status)[k] = cobrautil.COPYSET_NOTEXIST
} else {
status, errsCheck := cobrautil.CheckCopySetHealth(v)
copysetHealthCount[status]++
row[cobrautil.ROW_STATUS] = cobrautil.CopysetHealthStatus_Str[int32(status)]
(*cCmd.copysetKey2Status)[k] = status
explain := ""
if status != cobrautil.COPYSET_OK {
for i, e := range errsCheck {
Expand All @@ -177,6 +179,10 @@ func (cCmd *CopysetCommand) RunCommand(cmd *cobra.Command, args []string) error
leaderInfo := (*cCmd.copysetKey2LeaderInfo)[k]
if leaderInfo == nil {
explain = "no leader peer"
if row[cobrautil.ROW_STATUS] == cobrautil.COPYSET_OK_STR {
row[cobrautil.ROW_STATUS] = cobrautil.COPYSET_ERROR_STR
copysetHealthCount[cobrautil.COPYSET_ERROR]++
}
} else if leaderInfo.Snapshot {
installSnapshot := "installing snapshot"
if len(explain) > 0 {
Expand Down

0 comments on commit 48872a0

Please sign in to comment.