From cf1fe326432f707a0ff44e6baa1dc6100c3ab6d4 Mon Sep 17 00:00:00 2001 From: Vlad Date: Fri, 14 Jul 2023 08:32:34 +0300 Subject: [PATCH 1/3] don't log availability errors on shutdown --- share/availability/full/availability.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/share/availability/full/availability.go b/share/availability/full/availability.go index cfa5bd0c39..030153222d 100644 --- a/share/availability/full/availability.go +++ b/share/availability/full/availability.go @@ -72,7 +72,9 @@ func (fa *ShareAvailability) SharesAvailable(ctx context.Context, root *share.Ro _, err := fa.getter.GetEDS(ctx, root) if err != nil { - log.Errorw("availability validation failed", "root", root.String(), "err", err.Error()) + if !errors.Is(err, context.Canceled) { + log.Errorw("availability validation failed", "root", root.String(), "err", err.Error()) + } var byzantineErr *byzantine.ErrByzantine if ipldFormat.IsNotFound(err) || errors.Is(err, context.DeadlineExceeded) && !errors.As(err, &byzantineErr) { return share.ErrNotAvailable From 1ae50202704ad6dd6e22513fc176f74876425a61 Mon Sep 17 00:00:00 2001 From: Vlad Date: Fri, 14 Jul 2023 10:30:41 +0300 Subject: [PATCH 2/3] return fast --- share/availability/full/availability.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/share/availability/full/availability.go b/share/availability/full/availability.go index 030153222d..5eba6d0e1f 100644 --- a/share/availability/full/availability.go +++ b/share/availability/full/availability.go @@ -72,9 +72,10 @@ func (fa *ShareAvailability) SharesAvailable(ctx context.Context, root *share.Ro _, err := fa.getter.GetEDS(ctx, root) if err != nil { - if !errors.Is(err, context.Canceled) { - log.Errorw("availability validation failed", "root", root.String(), "err", err.Error()) + if errors.Is(err, context.Canceled) { + return err } + log.Errorw("availability validation failed", "root", root.String(), "err", err.Error()) var byzantineErr *byzantine.ErrByzantine if ipldFormat.IsNotFound(err) || errors.Is(err, context.DeadlineExceeded) && !errors.As(err, &byzantineErr) { return share.ErrNotAvailable From 98db5b7839df0d820384e428671f730f52853670 Mon Sep 17 00:00:00 2001 From: Vlad Date: Fri, 14 Jul 2023 14:53:10 +0300 Subject: [PATCH 3/3] clean-up errors --- share/availability/full/availability.go | 2 -- share/availability/light/availability.go | 6 +++--- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/share/availability/full/availability.go b/share/availability/full/availability.go index 5eba6d0e1f..4b19183be1 100644 --- a/share/availability/full/availability.go +++ b/share/availability/full/availability.go @@ -80,8 +80,6 @@ func (fa *ShareAvailability) SharesAvailable(ctx context.Context, root *share.Ro if ipldFormat.IsNotFound(err) || errors.Is(err, context.DeadlineExceeded) && !errors.As(err, &byzantineErr) { return share.ErrNotAvailable } - - return err } return err } diff --git a/share/availability/light/availability.go b/share/availability/light/availability.go index 761671b955..cc2e08129e 100644 --- a/share/availability/light/availability.go +++ b/share/availability/light/availability.go @@ -84,13 +84,13 @@ func (la *ShareAvailability) SharesAvailable(ctx context.Context, dah *share.Roo } if err != nil { - if !errors.Is(err, context.Canceled) { - log.Errorw("availability validation failed", "root", dah.String(), "err", err.Error()) + if errors.Is(err, context.Canceled) { + return err } + log.Errorw("availability validation failed", "root", dah.String(), "err", err.Error()) if ipldFormat.IsNotFound(err) || errors.Is(err, context.DeadlineExceeded) { return share.ErrNotAvailable } - return err } }