mirror of
https://github.com/minio/minio.git
synced 2025-11-09 21:49:46 -05:00
Make sure to close the disk connections (#5752)
Since we do not re-use storageDisks after moving the connections to object layer we should close them appropriately otherwise we have a lot of connection leaks and these can compound as the time goes by. This PR also refactors the initialization code to re-use storageDisks for given set of endpoints until we have confirmed a valid reference format.
This commit is contained in:
committed by
Nitish Tiwari
parent
d67e423a32
commit
85a57d2021
@@ -87,6 +87,11 @@ func TestFixFormatV3(t *testing.T) {
|
||||
}
|
||||
endpoints := mustGetNewEndpointList(xlDirs...)
|
||||
|
||||
storageDisks, err := initStorageDisks(endpoints)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
format := newFormatXLV3(1, 8)
|
||||
formats := make([]*formatXLV3, 8)
|
||||
|
||||
@@ -96,17 +101,18 @@ func TestFixFormatV3(t *testing.T) {
|
||||
formats[j] = &newFormat
|
||||
}
|
||||
|
||||
if err = initFormatXLMetaVolume(endpoints, formats); err != nil {
|
||||
if err = initFormatXLMetaVolume(storageDisks, formats); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
formats[1] = nil
|
||||
expThis := formats[2].XL.This
|
||||
formats[2].XL.This = ""
|
||||
if err := fixFormatXLV3(endpoints, formats); err != nil {
|
||||
if err := fixFormatXLV3(storageDisks, endpoints, formats); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
newFormats, errs := loadFormatXLAll(endpoints)
|
||||
|
||||
newFormats, errs := loadFormatXLAll(storageDisks)
|
||||
for _, err := range errs {
|
||||
if err != nil && errors.Cause(err) != errUnformattedDisk {
|
||||
t.Fatal(err)
|
||||
|
||||
Reference in New Issue
Block a user