diff --git a/cmd/gateway/hdfs/gateway-hdfs.go b/cmd/gateway/hdfs/gateway-hdfs.go index ebb5f32bc..9012a5dc0 100644 --- a/cmd/gateway/hdfs/gateway-hdfs.go +++ b/cmd/gateway/hdfs/gateway-hdfs.go @@ -28,6 +28,7 @@ import ( "path" "sort" "strings" + "sync" "syscall" "time" @@ -407,6 +408,7 @@ func (n *hdfsObjects) listDirFactory() minio.ListDirFunc { // ListObjects lists all blobs in HDFS bucket filtered by prefix. func (n *hdfsObjects) ListObjects(ctx context.Context, bucket, prefix, marker, delimiter string, maxKeys int) (loi minio.ListObjectsInfo, err error) { + var mutex sync.Mutex fileInfos := make(map[string]os.FileInfo) targetPath := n.hdfsPathJoin(bucket, prefix) @@ -430,6 +432,9 @@ func (n *hdfsObjects) ListObjects(ctx context.Context, bucket, prefix, marker, d } getObjectInfo := func(ctx context.Context, bucket, entry string) (minio.ObjectInfo, error) { + mutex.Lock() + defer mutex.Unlock() + filePath := path.Clean(n.hdfsPathJoin(bucket, entry)) fi, ok := fileInfos[filePath] diff --git a/cmd/metrics.go b/cmd/metrics.go index 1ec4000c8..66f30bad7 100644 --- a/cmd/metrics.go +++ b/cmd/metrics.go @@ -108,6 +108,10 @@ func (c *minioCollector) Collect(ch chan<- prometheus.Metric) { } func nodeHealthMetricsPrometheus(ch chan<- prometheus.Metric) { + if globalIsGateway { + return + } + nodesUp, nodesDown := GetPeerOnlineCount() ch <- prometheus.MustNewConstMetric( prometheus.NewDesc(