Do not select zones with <5% free after upload (#9877)

Looking into full disk errors on zoned setup. We don't take the
5% space requirement into account when selecting a zone.

The interesting part is that even considering this we don't
know the size of the object the user wants to upload when
they do multipart uploads.

It seems quite defensive to always upload multiparts to
the zone where there is the most space since all load will
be directed to a part of the cluster.

In these cases we make sure it can at least hold a 1GiB file
and we disadvantage fuller zones more by subtracting the
expected size before weighing.
This commit is contained in:
Klaus Post
2020-06-20 06:36:44 -07:00
committed by GitHub
parent b8cb21c954
commit 972d876ca9
3 changed files with 50 additions and 14 deletions

View File

@@ -288,7 +288,7 @@ var ignoreDiskFreeOS = []string{
func checkDiskMinTotal(di disk.Info) (err error) {
// Remove 5% from total space for cumulative disk space
// used for journalling, inodes etc.
totalDiskSpace := float64(di.Total) * 0.95
totalDiskSpace := float64(di.Total) * diskFillFraction
if int64(totalDiskSpace) <= diskMinTotalSpace {
return errMinDiskSize
}
@@ -298,7 +298,7 @@ func checkDiskMinTotal(di disk.Info) (err error) {
// check if disk free has minimum required size.
func checkDiskMinFree(di disk.Info) error {
// Remove 5% from free space for cumulative disk space used for journalling, inodes etc.
availableDiskSpace := float64(di.Free) * 0.95
availableDiskSpace := float64(di.Free) * diskFillFraction
if int64(availableDiskSpace) <= diskMinFreeSpace {
return errDiskFull
}
@@ -328,7 +328,7 @@ func checkDiskFree(diskPath string, neededSpace int64) (err error) {
}
// Check if we have enough space to store data
if neededSpace > int64(float64(di.Free)*0.95) {
if neededSpace > int64(float64(di.Free)*diskFillFraction) {
return errDiskFull
}