Fix hdfs gateway concurrent map writes (#13596)

Co-authored-by: Harshavardhana <harsha@minio.io>
This commit is contained in:
Daniel A. Ochoa 2021-11-08 11:07:58 -06:00 committed by GitHub
parent 4f3317effe
commit 07dd0692b6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 0 deletions

View File

@ -28,6 +28,7 @@ import (
"path" "path"
"sort" "sort"
"strings" "strings"
"sync"
"syscall" "syscall"
"time" "time"
@ -407,6 +408,7 @@ func (n *hdfsObjects) listDirFactory() minio.ListDirFunc {
// ListObjects lists all blobs in HDFS bucket filtered by prefix. // 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) { 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) fileInfos := make(map[string]os.FileInfo)
targetPath := n.hdfsPathJoin(bucket, prefix) 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) { getObjectInfo := func(ctx context.Context, bucket, entry string) (minio.ObjectInfo, error) {
mutex.Lock()
defer mutex.Unlock()
filePath := path.Clean(n.hdfsPathJoin(bucket, entry)) filePath := path.Clean(n.hdfsPathJoin(bucket, entry))
fi, ok := fileInfos[filePath] fi, ok := fileInfos[filePath]

View File

@ -108,6 +108,10 @@ func (c *minioCollector) Collect(ch chan<- prometheus.Metric) {
} }
func nodeHealthMetricsPrometheus(ch chan<- prometheus.Metric) { func nodeHealthMetricsPrometheus(ch chan<- prometheus.Metric) {
if globalIsGateway {
return
}
nodesUp, nodesDown := GetPeerOnlineCount() nodesUp, nodesDown := GetPeerOnlineCount()
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
prometheus.NewDesc( prometheus.NewDesc(