ListObjectsV1 requests unnecessarily fail with offline nodes (#10386)

ListObjectsV1 requests are actually redirected to a specific node, 
depending on the bucket name. The purpose of this behavior was
to optimize listing.

However, the current code sends a Bad Gateway error if the
target node is offline, which is a bad behavior because it means
that the list request will fail, although this is unnecessary since
we can still use the current node to list as well (the default behavior
without using proxying optimization)

Currently, you can see mint fails when there is one offline node, after
this PR, mint will always succeed.
master
Anis Elleuch 4 years ago committed by GitHub
parent 102ad60dee
commit ba8a8ad818
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 8
      cmd/handler-utils.go

@ -19,6 +19,7 @@ package cmd
import (
"bytes"
"context"
"errors"
"fmt"
"io"
"io/ioutil"
@ -498,10 +499,9 @@ func proxyRequest(ctx context.Context, w http.ResponseWriter, r *http.Request, e
RoundTripper: ep.Transport,
ErrorHandler: func(w http.ResponseWriter, r *http.Request, err error) {
success = false
w.WriteHeader(http.StatusBadGateway)
},
Logger: func(err error) {
logger.LogIf(GlobalContext, err)
if err != nil && !errors.Is(err, context.Canceled) {
logger.LogIf(GlobalContext, err)
}
},
})

Loading…
Cancel
Save