reject reference format from a different deployment (#18800)

reference format is constant for any lifetime of
a minio cluster, we do not have to ever replace
it during HealFormat() as it will never change.

additionally we should simply reject reference
formats that we do not understand early on.
This commit is contained in:
Harshavardhana 2024-01-16 15:13:14 -08:00 committed by GitHub
parent 8ccd1ee34a
commit a0e1163fb6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1111,6 +1111,13 @@ func (s *erasureSets) HealFormat(ctx context.Context, dryRun bool) (res madmin.H
return res, errNoHealRequired
}
if !reflect.DeepEqual(s.format, refFormat) {
// Format is corrupted and unrecognized by the running instance.
logger.LogIf(ctx, fmt.Errorf("Unable to heal the newly replaced drives due to format.json inconsistencies, please engage MinIO support for further assistance: %w",
errCorruptedFormat))
return res, errCorruptedFormat
}
formatOpID := mustGetUUID()
// Initialize a new set of set formats which will be written to disk.
@ -1192,9 +1199,6 @@ func (s *erasureSets) HealFormat(ctx context.Context, dryRun bool) (res madmin.H
}
}
// Replace reference format with what was loaded from disks.
s.format = refFormat
s.erasureDisksMu.Unlock()
}