From 560cb38347c63388c2a49b1509e4720b7a50b9c9 Mon Sep 17 00:00:00 2001 From: Klaus Post Date: Fri, 23 Jun 2023 07:46:48 -0700 Subject: [PATCH] Fanout: Check individual errors (#272) --- pkg/bench/fanout.go | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/pkg/bench/fanout.go b/pkg/bench/fanout.go index 0e31de39..f7bb2f93 100644 --- a/pkg/bench/fanout.go +++ b/pkg/bench/fanout.go @@ -105,6 +105,20 @@ func (u *Fanout) Start(ctx context.Context, wait chan struct{}) (Operations, err op.Err = err.Error() } + var firstErr string + nErrs := 0 + for _, r := range res { + if r.Error != "" { + if firstErr == "" { + firstErr = r.Error + } + nErrs++ + } + } + if op.Err == "" && nErrs > 0 { + op.Err = fmt.Sprintf("%d copies failed. First error: %v", nErrs, firstErr) + } + if len(res) != u.Copies && op.Err == "" { err := fmt.Sprint("short upload. want:", u.Copies, " copies, got:", len(res)) if op.Err == "" { @@ -112,6 +126,7 @@ func (u *Fanout) Start(ctx context.Context, wait chan struct{}) (Operations, err } u.Error(err) } + cldone() rcv <- op }