Do not rely on quorum for StorageInfo() (#8557)

StorageInfo() call is supposed to give each
server/disk information independently, rely
on this appropriately so that `mc admin info server`
gets correct information all the time.
master
Harshavardhana 5 years ago committed by kannappanr
parent 06bd1e582a
commit f96e902f63
  1. 6
      cmd/notification.go
  2. 15
      cmd/xl-sets.go

@ -55,6 +55,9 @@ type NotificationSys struct {
// GetARNList - returns available ARNs. // GetARNList - returns available ARNs.
func (sys *NotificationSys) GetARNList() []string { func (sys *NotificationSys) GetARNList() []string {
arns := []string{} arns := []string{}
if sys == nil {
return arns
}
region := globalServerRegion region := globalServerRegion
for _, targetID := range sys.targetList.List() { for _, targetID := range sys.targetList.List() {
// httpclient target is part of ListenBucketNotification // httpclient target is part of ListenBucketNotification
@ -439,8 +442,9 @@ func (sys *NotificationSys) ServerInfo(ctx context.Context) []ServerInfo {
info, err := sys.peerClients[index].ServerInfo() info, err := sys.peerClients[index].ServerInfo()
if err != nil { if err != nil {
serverInfo[index].Error = err.Error() serverInfo[index].Error = err.Error()
} else {
serverInfo[index].Data = &info
} }
serverInfo[index].Data = &info
// Last iteration log the error. // Last iteration log the error.
if i == 2 { if i == 2 {
return err return err

@ -385,20 +385,17 @@ func (s *xlSets) StorageInfo(ctx context.Context) StorageInfo {
errs := combineStorageErrors(dErrs, sErrs) errs := combineStorageErrors(dErrs, sErrs)
drivesInfo := formatsToDrivesInfo(s.endpoints, formats, errs) drivesInfo := formatsToDrivesInfo(s.endpoints, formats, errs)
refFormat, err := getFormatXLInQuorum(formats)
if err != nil {
// Ignore errors here, since this call cannot do anything at
// this point. too many disks are down already.
return storageInfo
}
// fill all the available/online endpoints // fill all the available/online endpoints
for _, drive := range drivesInfo { for k, drive := range drivesInfo {
if drive.UUID == "" { if drive.UUID == "" {
continue continue
} }
for i := range refFormat.XL.Sets { if formats[k] == nil {
for j, driveUUID := range refFormat.XL.Sets[i] { continue
}
for i := range formats[k].XL.Sets {
for j, driveUUID := range formats[k].XL.Sets[i] {
if driveUUID == drive.UUID { if driveUUID == drive.UUID {
storageInfo.Backend.Sets[i][j] = drive storageInfo.Backend.Sets[i][j] = drive
} }

Loading…
Cancel
Save