Skip to content

Commit f47e578

Browse files
authored
Add per storage class parity nubmer in Heal struct (minio#23)
We are going to show disks/servers tolerance in `mc admin heal` status output. For that, we need the number of parity disks for each storage class.
1 parent 4c20d77 commit f47e578

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

heal-commands.go

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -309,15 +309,16 @@ type MRFStatus struct {
309309

310310
// BgHealState represents the status of the background heal
311311
type BgHealState struct {
312+
// Total items scanned by the continous background healing
312313
ScannedItemsCount int64
313-
314+
// Disks currently in heal states
314315
HealDisks []string
315-
316316
// SetStatus contains information for each set.
317317
Sets []SetStatus `json:"sets"`
318-
319318
// Endpoint -> MRF Status
320319
MRF map[string]MRFStatus `json:"mrf"`
320+
// Parity per storage class
321+
SCParity map[string]int `json:"sc_parity"`
321322
}
322323

323324
// SetStatus contains information about the heal status of a set.
@@ -370,6 +371,14 @@ type HealingDisk struct {
370371

371372
// Merge others into b.
372373
func (b *BgHealState) Merge(others ...BgHealState) {
374+
// SCParity is the same from all nodes, just pick
375+
// the information from the first node.
376+
if b.SCParity == nil && len(others) > 0 {
377+
b.SCParity = make(map[string]int)
378+
for k, v := range others[0].SCParity {
379+
b.SCParity[k] = v
380+
}
381+
}
373382
if b.MRF == nil {
374383
b.MRF = make(map[string]MRFStatus)
375384
}

0 commit comments

Comments
 (0)