From 8d127ff7befac26857fe6cf666921db1fa6bf0dc Mon Sep 17 00:00:00 2001 From: Chris Schinnerl Date: Tue, 17 Dec 2024 11:36:55 +0100 Subject: [PATCH] address comments --- autopilot/contractor/hostfilter.go | 7 +------ go.mod | 2 +- go.sum | 4 ++-- stores/sql/main.go | 13 ++++++++++--- 4 files changed, 14 insertions(+), 12 deletions(-) diff --git a/autopilot/contractor/hostfilter.go b/autopilot/contractor/hostfilter.go index d2d349479..b9dd6064d 100644 --- a/autopilot/contractor/hostfilter.go +++ b/autopilot/contractor/hostfilter.go @@ -8,7 +8,6 @@ import ( "go.sia.tech/core/types" "go.sia.tech/renterd/api" "go.sia.tech/renterd/internal/gouging" - rhp4 "go.sia.tech/renterd/internal/rhp/v4" ) const ( @@ -166,11 +165,7 @@ func checkHost(gc gouging.Checker, sh scoredHost, minScore float64, period uint6 // calculate remaining host info fields if !h.IsAnnounced() { ub.NotAnnounced = true - } else if !h.Scanned || - // NOTE: a v2 host might have been scanned before the v2 height so strictly - // speaking it is scanned but since it hasn't been scanned since, the - // settings aren't set so we treat it as not scanned - (h.IsV2() && h.V2Settings == (rhp4.HostSettings{})) { + } else if !h.Scanned { ub.NotCompletingScan = true } else { // online check diff --git a/go.mod b/go.mod index d9e8802ef..a9afd1705 100644 --- a/go.mod +++ b/go.mod @@ -15,7 +15,7 @@ require ( github.com/montanaflynn/stats v0.7.1 github.com/shopspring/decimal v1.4.0 go.sia.tech/core v0.8.0 - go.sia.tech/coreutils v0.8.0 + go.sia.tech/coreutils v0.8.1-0.20241217101542-5d6fc37cbb94 go.sia.tech/gofakes3 v0.0.5 go.sia.tech/hostd v1.1.3-0.20241212215223-9e3440475bed go.sia.tech/jape v0.12.1 diff --git a/go.sum b/go.sum index d35879f1a..5bac16294 100644 --- a/go.sum +++ b/go.sum @@ -57,8 +57,8 @@ go.etcd.io/bbolt v1.3.11 h1:yGEzV1wPz2yVCLsD8ZAiGHhHVlczyC9d1rP43/VCRJ0= go.etcd.io/bbolt v1.3.11/go.mod h1:dksAq7YMXoljX0xu6VF5DMZGbhYYoLUalEiSySYAS4I= go.sia.tech/core v0.8.0 h1:J6vZQlVhpj4bTVeuC2GKkfkGEs8jf0j651Kl1wwOxjg= go.sia.tech/core v0.8.0/go.mod h1:Wj1qzvpMM2rqEQjwWJEbCBbe9VWX/mSJUu2Y2ABl1QA= -go.sia.tech/coreutils v0.8.0 h1:1dcl0vxY+MBgAdJ7PdewAr8RkZJn4/6wAKEZfi4iYn0= -go.sia.tech/coreutils v0.8.0/go.mod h1:ml5MefDMWCvPKNeRVIGHmyF5tv27C9h1PiI/iOiTGLg= +go.sia.tech/coreutils v0.8.1-0.20241217101542-5d6fc37cbb94 h1:1fbD59wfyA1+5LmLYNh+ukNpkbtEmQgcXYlRUZTdr+M= +go.sia.tech/coreutils v0.8.1-0.20241217101542-5d6fc37cbb94/go.mod h1:ml5MefDMWCvPKNeRVIGHmyF5tv27C9h1PiI/iOiTGLg= go.sia.tech/gofakes3 v0.0.5 h1:vFhVBUFbKE9ZplvLE2w4TQxFMQyF8qvgxV4TaTph+Vw= go.sia.tech/gofakes3 v0.0.5/go.mod h1:LXEzwGw+OHysWLmagleCttX93cJZlT9rBu/icOZjQ54= go.sia.tech/hostd v1.1.3-0.20241212215223-9e3440475bed h1:C42AxWwwoP13EhZsdWwR17Rc9S7gXI4JnRN0AyZRxc8= diff --git a/stores/sql/main.go b/stores/sql/main.go index 636827822..c012b7ede 100644 --- a/stores/sql/main.go +++ b/stores/sql/main.go @@ -898,6 +898,14 @@ LEFT JOIN host_checks hc ON hc.db_host_id = h.id // fill in v2 addresses err = fillInV2Addresses(ctx, tx, hostIDs, func(i int, addrs []string) { hosts[i].V2SiamuxAddresses = addrs + + // NOTE: a v2 host might have been scanned before the v2 height so strictly + // speaking it is scanned but since it hasn't been scanned since, the + // settings aren't set so we treat it as not scanned + if hosts[i].IsV2() && hosts[i].V2Settings == (rhp.HostSettings{}) { + hosts[i].Scanned = false + } + i++ }) if err != nil { @@ -2576,7 +2584,7 @@ func Object(ctx context.Context, tx Tx, bucket, key string) (api.Object, error) // fetch slab slices rows, err = tx.Query(ctx, ` - SELECT sla.id, sla.health, sla.key, sla.min_shards, sli.offset, sli.length + SELECT sla.health, sla.key, sla.min_shards, sli.offset, sli.length FROM slices sli INNER JOIN slabs sla ON sli.db_slab_id = sla.id WHERE sli.db_object_id = ? @@ -2589,9 +2597,8 @@ func Object(ctx context.Context, tx Tx, bucket, key string) (api.Object, error) slabSlices := object.SlabSlices{} for rows.Next() { - var id int64 var ss object.SlabSlice - if err := rows.Scan(&id, &ss.Health, (*EncryptionKey)(&ss.EncryptionKey), &ss.MinShards, &ss.Offset, &ss.Length); err != nil { + if err := rows.Scan(&ss.Health, (*EncryptionKey)(&ss.EncryptionKey), &ss.MinShards, &ss.Offset, &ss.Length); err != nil { return api.Object{}, fmt.Errorf("failed to scan slab slice: %w", err) } slabSlices = append(slabSlices, ss)