mirror of
https://github.com/minio/minio.git
synced 2025-03-30 17:23:42 -04:00
allow locks with object affinity to spread across pools (#16312)
This commit is contained in:
parent
acc9c033ed
commit
5b8fe2e89a
@ -32,6 +32,7 @@ import (
|
|||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/dustin/go-humanize"
|
"github.com/dustin/go-humanize"
|
||||||
|
"github.com/google/uuid"
|
||||||
"github.com/minio/madmin-go/v2"
|
"github.com/minio/madmin-go/v2"
|
||||||
"github.com/minio/minio-go/v7/pkg/s3utils"
|
"github.com/minio/minio-go/v7/pkg/s3utils"
|
||||||
"github.com/minio/minio-go/v7/pkg/set"
|
"github.com/minio/minio-go/v7/pkg/set"
|
||||||
@ -50,6 +51,9 @@ type erasureServerPools struct {
|
|||||||
rebalMu sync.RWMutex
|
rebalMu sync.RWMutex
|
||||||
rebalMeta *rebalanceMeta
|
rebalMeta *rebalanceMeta
|
||||||
|
|
||||||
|
deploymentID [16]byte
|
||||||
|
distributionAlgo string
|
||||||
|
|
||||||
serverPools []*erasureSets
|
serverPools []*erasureSets
|
||||||
|
|
||||||
// Shut down async operations
|
// Shut down async operations
|
||||||
@ -124,6 +128,14 @@ func newErasureServerPools(ctx context.Context, endpointServerPools EndpointServ
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if deploymentID != "" && bytes.Equal(z.deploymentID[:], []byte{}) {
|
||||||
|
z.deploymentID = uuid.MustParse(deploymentID)
|
||||||
|
}
|
||||||
|
|
||||||
|
if distributionAlgo != "" && z.distributionAlgo == "" {
|
||||||
|
z.distributionAlgo = distributionAlgo
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
z.decommissionCancelers = make([]context.CancelFunc, len(z.serverPools))
|
z.decommissionCancelers = make([]context.CancelFunc, len(z.serverPools))
|
||||||
@ -154,7 +166,11 @@ func newErasureServerPools(ctx context.Context, endpointServerPools EndpointServ
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (z *erasureServerPools) NewNSLock(bucket string, objects ...string) RWLocker {
|
func (z *erasureServerPools) NewNSLock(bucket string, objects ...string) RWLocker {
|
||||||
return z.serverPools[0].NewNSLock(bucket, objects...)
|
poolID := hashKey(z.distributionAlgo, "", len(z.serverPools), z.deploymentID)
|
||||||
|
if len(objects) >= 1 {
|
||||||
|
poolID = hashKey(z.distributionAlgo, objects[0], len(z.serverPools), z.deploymentID)
|
||||||
|
}
|
||||||
|
return z.serverPools[poolID].NewNSLock(bucket, objects...)
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetDisksID will return disks by their ID.
|
// GetDisksID will return disks by their ID.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user