Skip to content

Commit

Permalink
satellite/overlay: add AOST to GetParticipatingNodes method
Browse files Browse the repository at this point in the history
This method is sometimes ends with transaction error. Most probably
because it's trying to do full table scan on nodes table which is
heavily used. Adding AOST should help with DB contention.

Change-Id: Ibd4358d28dc26922b60c6b30862f20e7c0662cd1
  • Loading branch information
mniewrzal authored and Storj Robot committed Sep 27, 2023
1 parent 2a8e5ae commit e1215d5
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
1 change: 1 addition & 0 deletions satellite/overlay/config.go
Expand Up @@ -29,6 +29,7 @@ type Config struct {
RepairExcludedCountryCodes []string `help:"list of country codes to exclude nodes from target repair selection" default:"" testDefault:"FR,BE"`
SendNodeEmails bool `help:"whether to send emails to nodes" default:"false"`
MinimumNewNodeIDDifficulty int `help:"the minimum node id difficulty required for new nodes. existing nodes remain allowed" devDefault:"0" releaseDefault:"36"`
AsOfSystemTime time.Duration `help:"default AS OF SYSTEM TIME for service" default:"-10s" testDefault:"0"`
}

// AsOfSystemTimeConfig is a configuration struct to enable 'AS OF SYSTEM TIME' for CRDB queries.
Expand Down
3 changes: 1 addition & 2 deletions satellite/overlay/service.go
Expand Up @@ -506,8 +506,7 @@ func (service *Service) GetNodes(ctx context.Context, nodeIDs storj.NodeIDList)
func (service *Service) GetParticipatingNodes(ctx context.Context) (records []nodeselection.SelectedNode, err error) {
defer mon.Task()(&ctx)(&err)

// TODO add as of system time.
return service.db.GetParticipatingNodes(ctx, service.config.Node.OnlineWindow, 0)
return service.db.GetParticipatingNodes(ctx, service.config.Node.OnlineWindow, service.config.AsOfSystemTime)
}

// UpdateReputation updates the DB columns for any of the reputation fields.
Expand Down
3 changes: 3 additions & 0 deletions scripts/testdata/satellite-config.yaml.lock
Expand Up @@ -802,6 +802,9 @@ identity.key-path: /root/.local/share/storj/identity/satellite/identity.key
# how many concurrent orders to process at once. zero is unlimited
# orders.orders-semaphore-size: 2

# default AS OF SYSTEM TIME for service
# overlay.as-of-system-time: -10s

# the location of the maxmind database containing geoip country information
# overlay.geo-ip.db: ""

Expand Down

0 comments on commit e1215d5

Please sign in to comment.