mirror of
https://github.com/minio/minio.git
synced 2024-12-24 22:25:54 -05:00
Fix hdfs gateway concurrent map writes (#13596)
Co-authored-by: Harshavardhana <harsha@minio.io>
This commit is contained in:
parent
4f3317effe
commit
07dd0692b6
@ -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]
|
||||||
|
|
||||||
|
@ -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(
|
||||||
|
Loading…
Reference in New Issue
Block a user