Skip to content

Commit

Permalink
worker: overpay (migration) downloads on low health slabs
Browse files Browse the repository at this point in the history
  • Loading branch information
peterjan committed Nov 3, 2023
1 parent fb9a849 commit cb16ec1
Show file tree
Hide file tree
Showing 9 changed files with 154 additions and 74 deletions.
4 changes: 4 additions & 0 deletions api/autopilot.go
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,10 @@ func (sb HostScoreBreakdown) String() string {
return fmt.Sprintf("Age: %v, Col: %v, Int: %v, SR: %v, UT: %v, V: %v, Pr: %v", sb.Age, sb.Collateral, sb.Interactions, sb.StorageRemaining, sb.Uptime, sb.Version, sb.Prices)
}

func (hgb HostGougingBreakdown) DownloadGouging() bool {
return hgb.V3.DownloadErr != ""
}

func (hgb HostGougingBreakdown) Gouging() bool {
return hgb.V2.Gouging() || hgb.V3.Gouging()
}
Expand Down
6 changes: 6 additions & 0 deletions api/settings.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,12 @@ type (
// MinMaxEphemeralAccountBalance is the minimum accepted value for
// `MaxEphemeralAccountBalance` in the host's price settings.
MinMaxEphemeralAccountBalance types.Currency `json:"minMaxEphemeralAccountBalance"`

// MigrationSurchargeMultiplier is the multiplier applied to the
// 'MaxDownloadPrice' when checking whether a host is too expensive,
// this multiplier is only applied for when trying to migrate critically
// low-health slabs.
MigrationSurchargeMultiplier uint64 `json:"migrationSurchargeMultiplier"`
}

// RedundancySettings contain settings that dictate an object's redundancy.
Expand Down
4 changes: 0 additions & 4 deletions api/worker.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,6 @@ var (
// ErrContractSetNotSpecified is returned by the worker API by endpoints that
// need a contract set to be able to upload data.
ErrContractSetNotSpecified = errors.New("contract set is not specified")

// ErrGougingPreventedDownload is returned by the worker API when a download
// failed because a critical number of hosts were price gouging.
ErrGougingPreventedDownload = errors.New("gouging settings prevented download from succeeding")
)

type (
Expand Down
7 changes: 1 addition & 6 deletions autopilot/alerts.go
Original file line number Diff line number Diff line change
Expand Up @@ -141,11 +141,6 @@ func newSlabMigrationFailedAlert(slabKey object.EncryptionKey, health float64, e
severity = alerts.SeverityCritical
}

hint := "Migration failures can be temporary, but if they persist it can eventually lead to data loss and should therefor be taken very seriously."
if isErr(err, api.ErrGougingPreventedDownload) {
hint += " In this particular case, one or more hosts were considered to be price gouging. It might be necessary to adjust your price gouging settings."
}

return alerts.Alert{
ID: alertIDForSlab(alertMigrationID, slabKey),
Severity: severity,
Expand All @@ -154,7 +149,7 @@ func newSlabMigrationFailedAlert(slabKey object.EncryptionKey, health float64, e
"error": err,
"health": health,
"slabKey": slabKey.String(),
"hint": hint,
"hint": "Migration failures can be temporary, but if they persist it can eventually lead to data loss and should therefor be taken very seriously.",
},
Timestamp: time.Now(),
}
Expand Down
Loading

0 comments on commit cb16ec1

Please sign in to comment.