diff --git a/monkit.lock b/monkit.lock index 8f2ecfc08..9ff0479e7 100644 --- a/monkit.lock +++ b/monkit.lock @@ -50,6 +50,7 @@ storj.io/storj/satellite/gracefulexit."graceful_exit_success" Meter storj.io/storj/satellite/gracefulexit."graceful_exit_successful_pieces_transfer_ratio" IntVal storj.io/storj/satellite/gracefulexit."graceful_exit_transfer_piece_fail" Meter storj.io/storj/satellite/gracefulexit."graceful_exit_transfer_piece_success" Meter +storj.io/storj/satellite/orders."download_failed_not_enough_pieces_uplink" Meter storj.io/storj/satellite/repair/checker."checker_segment_age" IntVal storj.io/storj/satellite/repair/checker."checker_segment_healthy_count" IntVal storj.io/storj/satellite/repair/checker."checker_segment_time_until_irreparable" IntVal @@ -59,6 +60,7 @@ storj.io/storj/satellite/repair/checker."remote_files_lost" IntVal storj.io/storj/satellite/repair/checker."remote_segments_checked" IntVal storj.io/storj/satellite/repair/checker."remote_segments_lost" IntVal storj.io/storj/satellite/repair/checker."remote_segments_needing_repair" IntVal +storj.io/storj/satellite/repair/repairer."download_failed_not_enough_pieces_repair" Meter storj.io/storj/satellite/satellitedb."audit_reputation_alpha" FloatVal storj.io/storj/satellite/satellitedb."audit_reputation_beta" FloatVal storj.io/storj/storage/filestore."open_file_in_trash" Meter @@ -66,3 +68,4 @@ storj.io/storj/storagenode/contact."satellite_contact_request" Meter storj.io/storj/storagenode/gracefulexit."satellite_gracefulexit_request" Meter storj.io/storj/storagenode/monitor."allocated_bandwidth" IntVal storj.io/storj/storagenode/monitor."used_bandwidth" IntVal +storj.io/storj/uplink/eestream."download_stripe_failed_not_enough_pieces_uplink" Meter diff --git a/satellite/metainfo/metainfo.go b/satellite/metainfo/metainfo.go index c78fae01e..2540a250d 100644 --- a/satellite/metainfo/metainfo.go +++ b/satellite/metainfo/metainfo.go @@ -363,6 +363,9 @@ func (endpoint *Endpoint) DownloadSegmentOld(ctx context.Context, req *pb.Segmen } else if pointer.Type == pb.Pointer_REMOTE && pointer.Remote != nil { limits, privateKey, err := endpoint.orders.CreateGetOrderLimits(ctx, bucketID, pointer) if err != nil { + if orders.ErrDownloadFailedNotEnoughPieces.Has(err) { + endpoint.log.Sugar().Errorf("unable to create order limits for project id %s from api key id %s: %v.", keyInfo.ProjectID.String(), keyInfo.ID.String(), zap.Error(err)) + } return nil, rpcstatus.Error(rpcstatus.Internal, err.Error()) } return &pb.SegmentDownloadResponseOld{Pointer: pointer, AddressedLimits: limits, PrivateKey: privateKey}, nil @@ -2054,6 +2057,9 @@ func (endpoint *Endpoint) DownloadSegment(ctx context.Context, req *pb.SegmentDo } else if pointer.Type == pb.Pointer_REMOTE && pointer.Remote != nil { limits, privateKey, err := endpoint.orders.CreateGetOrderLimits(ctx, bucketID, pointer) if err != nil { + if orders.ErrDownloadFailedNotEnoughPieces.Has(err) { + endpoint.log.Sugar().Errorf("unable to create order limits for project id %s from api key id %s: %v.", keyInfo.ProjectID.String(), keyInfo.ID.String(), zap.Error(err)) + } return nil, rpcstatus.Error(rpcstatus.Internal, err.Error()) } diff --git a/satellite/orders/service.go b/satellite/orders/service.go index 4a381642f..7e71814cb 100644 --- a/satellite/orders/service.go +++ b/satellite/orders/service.go @@ -20,6 +20,9 @@ import ( "storj.io/storj/uplink/eestream" ) +// ErrDownloadFailedNotEnoughPieces is returned when download failed due to missing pieces +var ErrDownloadFailedNotEnoughPieces = errs.Class("not enough pieces for download") + // Config is a configuration struct for orders Service. type Config struct { Expiration time.Duration `help:"how long until an order expires" default:"168h"` // 7 days @@ -191,8 +194,9 @@ func (service *Service) CreateGetOrderLimits(ctx context.Context, bucketID []byt } if len(limits) < redundancy.RequiredCount() { + mon.Meter("download_failed_not_enough_pieces_uplink").Mark(1) //locked err = Error.New("not enough nodes available: got %d, required %d", len(limits), redundancy.RequiredCount()) - return nil, storj.PiecePrivateKey{}, errs.Combine(err, combinedErrs) + return nil, storj.PiecePrivateKey{}, ErrDownloadFailedNotEnoughPieces.Wrap(errs.Combine(err, combinedErrs)) } err = service.saveSerial(ctx, serialNumber, bucketID, orderExpiration) diff --git a/satellite/repair/repairer/ec.go b/satellite/repair/repairer/ec.go index 4086fd4e0..f23bb3562 100644 --- a/satellite/repair/repairer/ec.go +++ b/satellite/repair/repairer/ec.go @@ -142,7 +142,8 @@ func (ec *ECRepairer) Get(ctx context.Context, limits []*pb.AddressedOrderLimit, limiter.Wait() if successfulPieces < es.RequiredCount() { - return nil, failedPieces, Error.New("couldn't download enough pieces, number of successful downloaded pieces (%d) is less than required number (%d)", successfulPieces, es.RequiredCount()) + mon.Meter("download_failed_not_enough_pieces_repair").Mark(1) //locked + return nil, failedPieces, Error.New("couldn't download enough pieces for segment: %s, number of successful downloaded pieces (%d) is less than required number (%d)", path, successfulPieces, es.RequiredCount()) } fec, err := infectious.NewFEC(es.RequiredCount(), es.TotalCount()) diff --git a/uplink/eestream/stripe.go b/uplink/eestream/stripe.go index 58286ff53..b985d0465 100644 --- a/uplink/eestream/stripe.go +++ b/uplink/eestream/stripe.go @@ -116,6 +116,7 @@ func (r *StripeReader) ReadStripe(ctx context.Context, num int64, p []byte) (_ [ } } // could not read enough shares to attempt a decode + mon.Meter("download_stripe_failed_not_enough_pieces_uplink").Mark(1) //locked return nil, r.combineErrs(num) }