Do not use disqualified nodes when asking for get order limits (#2303)
Add checks about disqualification when creating order limits
This commit is contained in:
parent
fc11a17df7
commit
8226024ca8
@ -320,6 +320,16 @@ func (verifier *Verifier) Reverify(ctx context.Context, stripe *Stripe) (report
|
||||
go func(pending *PendingAudit, piece *pb.RemotePiece) {
|
||||
limit, err := verifier.orders.CreateAuditOrderLimit(ctx, verifier.auditor, createBucketID(stripe.SegmentPath), pending.NodeID, pending.PieceID, pending.ShareSize)
|
||||
if err != nil {
|
||||
if overlay.ErrNodeDisqualified.Has(err) {
|
||||
_, errDelete := verifier.containment.Delete(ctx, piece.NodeId)
|
||||
if errDelete != nil {
|
||||
verifier.log.Debug("Error deleting disqualified node from containment db", zap.Stringer("Node ID", piece.NodeId), zap.Error(err))
|
||||
err = errs.Combine(err, errDelete)
|
||||
}
|
||||
ch <- result{nodeID: piece.NodeId, status: erred, err: err}
|
||||
verifier.log.Debug("Reverify: order limit not created (disqualified)", zap.Stringer("Node ID", piece.NodeId))
|
||||
return
|
||||
}
|
||||
if overlay.ErrNodeOffline.Has(err) {
|
||||
ch <- result{nodeID: piece.NodeId, status: offline}
|
||||
verifier.log.Debug("Reverify: order limit not created (offline)", zap.Stringer("Node ID", piece.NodeId))
|
||||
|
@ -26,6 +26,9 @@ var ErrNodeNotFound = errs.Class("node not found")
|
||||
// ErrNodeOffline is returned if a nodes is offline
|
||||
var ErrNodeOffline = errs.Class("node is offline")
|
||||
|
||||
// ErrNodeDisqualified is returned if a nodes is disqualified
|
||||
var ErrNodeDisqualified = errs.Class("node is disqualified")
|
||||
|
||||
// ErrBucketNotFound is returned if a bucket is unable to be found in the routing table
|
||||
var ErrBucketNotFound = errs.New("bucket not found")
|
||||
|
||||
|
@ -155,6 +155,12 @@ func (service *Service) CreateGetOrderLimits(ctx context.Context, uplink *identi
|
||||
node.Type.DPanicOnInvalid("order service get order limits")
|
||||
}
|
||||
|
||||
if node.Disqualified != nil {
|
||||
service.log.Debug("node is disqualified", zap.Stringer("ID", node.Id))
|
||||
combinedErrs = errs.Combine(combinedErrs, overlay.ErrNodeDisqualified.New(node.Id.String()))
|
||||
continue
|
||||
}
|
||||
|
||||
if !service.cache.IsOnline(node) {
|
||||
service.log.Debug("node is offline", zap.Stringer("ID", node.Id))
|
||||
combinedErrs = errs.Combine(combinedErrs, Error.New("node is offline: %s", node.Id.String()))
|
||||
@ -296,6 +302,12 @@ func (service *Service) CreateDeleteOrderLimits(ctx context.Context, uplink *ide
|
||||
node.Type.DPanicOnInvalid("order service delete order limits")
|
||||
}
|
||||
|
||||
if node.Disqualified != nil {
|
||||
service.log.Debug("node is disqualified", zap.Stringer("ID", node.Id))
|
||||
combinedErrs = errs.Combine(combinedErrs, overlay.ErrNodeDisqualified.New(node.Id.String()))
|
||||
continue
|
||||
}
|
||||
|
||||
if !service.cache.IsOnline(node) {
|
||||
service.log.Debug("node is offline", zap.Stringer("ID", node.Id))
|
||||
combinedErrs = errs.Combine(combinedErrs, Error.New("node is offline: %s", node.Id.String()))
|
||||
@ -378,16 +390,16 @@ func (service *Service) CreateAuditOrderLimits(ctx context.Context, auditor *ide
|
||||
continue
|
||||
}
|
||||
|
||||
if node != nil {
|
||||
node.Type.DPanicOnInvalid("order service audit order limits")
|
||||
}
|
||||
|
||||
if node.Disqualified != nil {
|
||||
service.log.Debug("node is disqualified", zap.Stringer("ID", node.Id))
|
||||
combinedErrs = errs.Combine(combinedErrs, Error.New("node is disqualified: %s", node.Id.String()))
|
||||
continue
|
||||
}
|
||||
|
||||
if node != nil {
|
||||
node.Type.DPanicOnInvalid("order service audit order limits")
|
||||
}
|
||||
|
||||
if !service.cache.IsOnline(node) {
|
||||
service.log.Debug("node is offline", zap.Stringer("ID", node.Id))
|
||||
combinedErrs = errs.Combine(combinedErrs, Error.New("node is offline: %s", node.Id.String()))
|
||||
@ -458,6 +470,10 @@ func (service *Service) CreateAuditOrderLimit(ctx context.Context, auditor *iden
|
||||
node.Type.DPanicOnInvalid("order service audit order limits")
|
||||
}
|
||||
|
||||
if node.Disqualified != nil {
|
||||
return nil, overlay.ErrNodeDisqualified.New(nodeID.String())
|
||||
}
|
||||
|
||||
if !service.cache.IsOnline(node) {
|
||||
return nil, overlay.ErrNodeOffline.New(nodeID.String())
|
||||
}
|
||||
@ -533,6 +549,12 @@ func (service *Service) CreateGetRepairOrderLimits(ctx context.Context, repairer
|
||||
node.Type.DPanicOnInvalid("order service get repair order limits")
|
||||
}
|
||||
|
||||
if node.Disqualified != nil {
|
||||
service.log.Debug("node is disqualified", zap.Stringer("ID", node.Id))
|
||||
combinedErrs = errs.Combine(combinedErrs, overlay.ErrNodeDisqualified.New(node.Id.String()))
|
||||
continue
|
||||
}
|
||||
|
||||
if !service.cache.IsOnline(node) {
|
||||
service.log.Debug("node is offline", zap.Stringer("ID", node.Id))
|
||||
combinedErrs = errs.Combine(combinedErrs, Error.New("node is offline: %s", node.Id.String()))
|
||||
|
Loading…
Reference in New Issue
Block a user