satellite/overlay: add AOST to GetParticipatingNodes method

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
This commit is contained in:
Michal Niewrzal 2023-09-26 09:41:15 +02:00 committed by Storj Robot
parent 2a8e5aecfd
commit e1215d5da8
3 changed files with 5 additions and 2 deletions

View File

@ -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.

View File

@ -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.

View File

@ -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: ""