Skip to content

Commit

Permalink
fix(master): persist decommission error message
Browse files Browse the repository at this point in the history
Signed-off-by: NaturalSelect <[email protected]>
  • Loading branch information
NaturalSelect authored and longerfly committed Jul 2, 2024
1 parent d0fd485 commit 96ed7fd
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 6 deletions.
2 changes: 1 addition & 1 deletion cli/cmd/datanode.go
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ func newDataNodeQueryDecommissionedDisk(client *master.MasterClient) *cobra.Comm
}
stdoutln("[Decommissioned disks]")
for _, disk := range disks.Disks {
stdout("%v", disk)
stdout("%v\n", disk)
}
return nil
},
Expand Down
16 changes: 11 additions & 5 deletions cli/cmd/fmt.go
Original file line number Diff line number Diff line change
Expand Up @@ -943,11 +943,17 @@ func formatDiskDataPartitionTableRow(view *proto.DataPartitionReport) string {
}

func formatDecommissionProgress(progress *proto.DecommissionProgress) string {
return alignColumn(
arow("Status", progress.StatusMessage),
arow("Progress", progress.Progress),
arow("Failed Dps", progress.FailedDps),
)
sb := strings.Builder{}
sb.WriteString(fmt.Sprintf("Status: %v\n", progress.StatusMessage))
sb.WriteString(fmt.Sprintf("Progress: %v\n", progress.Progress))
if len(progress.FailedDps) != 0 {
sb.WriteString("Failed Dps: \n")
for i, info := range progress.FailedDps {
sb.WriteString(fmt.Sprintf(" [%v/%v] Partition Id : %v\n", i+1, len(progress.FailedDps), info.PartitionID))
sb.WriteString(fmt.Sprintf(" Error Message : %v\n", info.ErrMsg))
}
}
return sb.String()
}

func formatDataPartitionDecommissionProgress(info *proto.DecommissionDataPartitionInfo) string {
Expand Down
1 change: 1 addition & 0 deletions master/metadata_fsm_op.go
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,7 @@ func (dpv *dataPartitionValue) Restore(c *Cluster) (dp *DataPartition) {
dp.RecoverStartTime = time.Unix(dpv.RecoverStartTime, 0)
dp.RecoverLastConsumeTime = time.Duration(dpv.RecoverLastConsumeTime) * time.Second
dp.DecommissionNeedRollbackTimes = dpv.DecommissionNeedRollbackTimes
dp.DecommissionErrorMessage = dpv.DecommissionErrorMessage
for _, rv := range dpv.Replicas {
if !contains(dp.Hosts, rv.Addr) {
continue
Expand Down

0 comments on commit 96ed7fd

Please sign in to comment.