Remove unnecessary contexts passed as data to FatalIf. No need to log an empty context. (#6487)

master
Pontus Leitzler 6 years ago committed by Harshavardhana
parent 584cb61bb8
commit df60b3c733
  1. 4
      cmd/admin-rpc-client.go
  2. 3
      cmd/admin-rpc-server.go
  3. 2
      cmd/generic-handlers.go
  4. 2
      cmd/lock-rpc-server.go
  5. 4
      cmd/namespace-lock.go
  6. 4
      cmd/peer-rpc-client.go
  7. 2
      cmd/peer-rpc-server.go
  8. 5
      cmd/storage-rpc-client.go

@ -157,9 +157,9 @@ func makeAdminPeers(endpoints EndpointList) (adminPeerList adminPeers) {
for _, hostStr := range GetRemotePeers(endpoints) { for _, hostStr := range GetRemotePeers(endpoints) {
host, err := xnet.ParseHost(hostStr) host, err := xnet.ParseHost(hostStr)
logger.FatalIf(err, "Unable to parse Admin RPC Host", context.Background()) logger.FatalIf(err, "Unable to parse Admin RPC Host")
rpcClient, err := NewAdminRPCClient(host) rpcClient, err := NewAdminRPCClient(host)
logger.FatalIf(err, "Unable to initialize Admin RPC Client", context.Background()) logger.FatalIf(err, "Unable to initialize Admin RPC Client")
adminPeerList = append(adminPeerList, adminPeer{ adminPeerList = append(adminPeerList, adminPeer{
addr: hostStr, addr: hostStr,
cmdRunner: rpcClient, cmdRunner: rpcClient,

@ -17,7 +17,6 @@
package cmd package cmd
import ( import (
"context"
"path" "path"
"github.com/gorilla/mux" "github.com/gorilla/mux"
@ -98,7 +97,7 @@ func NewAdminRPCServer() (*xrpc.Server, error) {
// registerAdminRPCRouter - creates and registers Admin RPC server and its router. // registerAdminRPCRouter - creates and registers Admin RPC server and its router.
func registerAdminRPCRouter(router *mux.Router) { func registerAdminRPCRouter(router *mux.Router) {
rpcServer, err := NewAdminRPCServer() rpcServer, err := NewAdminRPCServer()
logger.FatalIf(err, "Unable to initialize Lock RPC Server", context.Background()) logger.FatalIf(err, "Unable to initialize Lock RPC Server")
subrouter := router.PathPrefix(minioReservedBucketPath).Subrouter() subrouter := router.PathPrefix(minioReservedBucketPath).Subrouter()
subrouter.Path(adminServiceSubPath).HandlerFunc(httpTraceHdrs(rpcServer.ServeHTTP)) subrouter.Path(adminServiceSubPath).HandlerFunc(httpTraceHdrs(rpcServer.ServeHTTP))
} }

@ -689,7 +689,7 @@ func setBucketForwardingHandler(h http.Handler) http.Handler {
// canceled immediately. // canceled immediately.
func setRateLimitHandler(h http.Handler) http.Handler { func setRateLimitHandler(h http.Handler) http.Handler {
_, maxLimit, err := sys.GetMaxOpenFileLimit() _, maxLimit, err := sys.GetMaxOpenFileLimit()
logger.FatalIf(err, "Unable to get maximum open file limit", context.Background()) logger.FatalIf(err, "Unable to get maximum open file limit")
// Burst value is set to 1 to allow only maxOpenFileLimit // Burst value is set to 1 to allow only maxOpenFileLimit
// requests to happen at once. // requests to happen at once.
l := rate.NewLimiter(rate.Limit(maxLimit), 1) l := rate.NewLimiter(rate.Limit(maxLimit), 1)

@ -186,7 +186,7 @@ func NewLockRPCServer() (*xrpc.Server, error) {
// Register distributed NS lock handlers. // Register distributed NS lock handlers.
func registerDistNSLockRouter(router *mux.Router) { func registerDistNSLockRouter(router *mux.Router) {
rpcServer, err := NewLockRPCServer() rpcServer, err := NewLockRPCServer()
logger.FatalIf(err, "Unable to initialize Lock RPC Server", context.Background()) logger.FatalIf(err, "Unable to initialize Lock RPC Server")
// Start lock maintenance from all lock servers. // Start lock maintenance from all lock servers.
go startLockMaintenance(globalLockServer) go startLockMaintenance(globalLockServer)

@ -86,9 +86,9 @@ func newDsyncNodes(endpoints EndpointList) (clnts []dsync.NetLocker, myNode int)
locker = &(receiver.ll) locker = &(receiver.ll)
} else { } else {
host, err := xnet.ParseHost(endpoint.Host) host, err := xnet.ParseHost(endpoint.Host)
logger.FatalIf(err, "Unable to parse Lock RPC Host", context.Background()) logger.FatalIf(err, "Unable to parse Lock RPC Host")
locker, err = NewLockRPCClient(host) locker, err = NewLockRPCClient(host)
logger.FatalIf(err, "Unable to initialize Lock RPC Client", context.Background()) logger.FatalIf(err, "Unable to initialize Lock RPC Client")
} }
clnts = append(clnts, locker) clnts = append(clnts, locker)

@ -165,9 +165,9 @@ func makeRemoteRPCClients(endpoints EndpointList) map[xnet.Host]*PeerRPCClient {
peerRPCClientMap := make(map[xnet.Host]*PeerRPCClient) peerRPCClientMap := make(map[xnet.Host]*PeerRPCClient)
for _, hostStr := range GetRemotePeers(endpoints) { for _, hostStr := range GetRemotePeers(endpoints) {
host, err := xnet.ParseHost(hostStr) host, err := xnet.ParseHost(hostStr)
logger.FatalIf(err, "Unable to parse peer RPC Host", context.Background()) logger.FatalIf(err, "Unable to parse peer RPC Host")
rpcClient, err := NewPeerRPCClient(host) rpcClient, err := NewPeerRPCClient(host)
logger.FatalIf(err, "Unable to parse peer RPC Client", context.Background()) logger.FatalIf(err, "Unable to parse peer RPC Client")
peerRPCClientMap[*host] = rpcClient peerRPCClientMap[*host] = rpcClient
} }

@ -226,7 +226,7 @@ func NewPeerRPCServer() (*xrpc.Server, error) {
// registerPeerRPCRouter - creates and registers Peer RPC server and its router. // registerPeerRPCRouter - creates and registers Peer RPC server and its router.
func registerPeerRPCRouter(router *mux.Router) { func registerPeerRPCRouter(router *mux.Router) {
rpcServer, err := NewPeerRPCServer() rpcServer, err := NewPeerRPCServer()
logger.FatalIf(err, "Unable to initialize peer RPC Server", context.Background()) logger.FatalIf(err, "Unable to initialize peer RPC Server")
subrouter := router.PathPrefix(minioReservedBucketPath).Subrouter() subrouter := router.PathPrefix(minioReservedBucketPath).Subrouter()
subrouter.Path(peerServiceSubPath).HandlerFunc(httpTraceHdrs(rpcServer.ServeHTTP)) subrouter.Path(peerServiceSubPath).HandlerFunc(httpTraceHdrs(rpcServer.ServeHTTP))
} }

@ -18,7 +18,6 @@ package cmd
import ( import (
"bytes" "bytes"
"context"
"crypto/tls" "crypto/tls"
"io" "io"
"net" "net"
@ -330,9 +329,9 @@ func NewStorageRPCClient(host *xnet.Host, endpointPath string) (*StorageRPCClien
// Initialize new storage rpc client. // Initialize new storage rpc client.
func newStorageRPC(endpoint Endpoint) *StorageRPCClient { func newStorageRPC(endpoint Endpoint) *StorageRPCClient {
host, err := xnet.ParseHost(endpoint.Host) host, err := xnet.ParseHost(endpoint.Host)
logger.FatalIf(err, "Unable to parse storage RPC Host", context.Background()) logger.FatalIf(err, "Unable to parse storage RPC Host")
rpcClient, err := NewStorageRPCClient(host, endpoint.Path) rpcClient, err := NewStorageRPCClient(host, endpoint.Path)
logger.FatalIf(err, "Unable to initialize storage RPC client", context.Background()) logger.FatalIf(err, "Unable to initialize storage RPC client")
// Attempt first try connection and save error if any. // Attempt first try connection and save error if any.
rpcClient.connect() rpcClient.connect()
return rpcClient return rpcClient

Loading…
Cancel
Save