Skip to content

Commit

Permalink
address comments
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisSchinnerl committed Dec 17, 2024
1 parent 1618443 commit d4b31f4
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 12 deletions.
7 changes: 1 addition & 6 deletions autopilot/contractor/hostfilter.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -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=
Expand Down
12 changes: 9 additions & 3 deletions stores/sql/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -899,6 +899,13 @@ LEFT JOIN host_checks hc ON hc.db_host_id = h.id
err = fillInV2Addresses(ctx, tx, hostIDs, func(i int, addrs []string) {
hosts[i].V2SiamuxAddresses = addrs
i++

// 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
}
})
if err != nil {
return nil, err
Expand Down Expand Up @@ -2576,7 +2583,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 = ?
Expand All @@ -2589,9 +2596,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)
Expand Down

0 comments on commit d4b31f4

Please sign in to comment.