Konstantin Lebedev
2 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with
4 additions and
2 deletions
-
weed/topology/data_node.go
|
|
@ -9,6 +9,7 @@ import ( |
|
|
|
"github.com/seaweedfs/seaweedfs/weed/storage/needle" |
|
|
|
"github.com/seaweedfs/seaweedfs/weed/storage/types" |
|
|
|
"github.com/seaweedfs/seaweedfs/weed/util" |
|
|
|
"sync/atomic" |
|
|
|
) |
|
|
|
|
|
|
|
type DataNode struct { |
|
|
@ -141,12 +142,13 @@ func (dn *DataNode) AdjustMaxVolumeCounts(maxVolumeCounts map[string]uint32) { |
|
|
|
} |
|
|
|
dt := types.ToDiskType(diskType) |
|
|
|
currentDiskUsage := dn.diskUsages.getOrCreateDisk(dt) |
|
|
|
if currentDiskUsage.maxVolumeCount == int64(maxVolumeCount) { |
|
|
|
currentDiskUsageMaxVolumeCount := atomic.LoadInt64(¤tDiskUsage.maxVolumeCount) |
|
|
|
if currentDiskUsageMaxVolumeCount == int64(maxVolumeCount) { |
|
|
|
continue |
|
|
|
} |
|
|
|
disk := dn.getOrCreateDisk(dt.String()) |
|
|
|
deltaDiskUsage := deltaDiskUsages.getOrCreateDisk(dt) |
|
|
|
deltaDiskUsage.maxVolumeCount = int64(maxVolumeCount) - currentDiskUsage.maxVolumeCount |
|
|
|
deltaDiskUsage.maxVolumeCount = int64(maxVolumeCount) - currentDiskUsageMaxVolumeCount |
|
|
|
disk.UpAdjustDiskUsageDelta(deltaDiskUsages) |
|
|
|
} |
|
|
|
} |
|
|
|