|
@ -83,8 +83,7 @@ func (dn *DataNode) UpdateVolumes(actualVolumes []storage.VolumeInfo) (newVolume |
|
|
disk.DeleteVolumeById(vid) |
|
|
disk.DeleteVolumeById(vid) |
|
|
deletedVolumes = append(deletedVolumes, v) |
|
|
deletedVolumes = append(deletedVolumes, v) |
|
|
|
|
|
|
|
|
deltaDiskUsages := newDiskUsages() |
|
|
|
|
|
deltaDiskUsage := deltaDiskUsages.getOrCreateDisk(types.ToDiskType(v.DiskType)) |
|
|
|
|
|
|
|
|
deltaDiskUsage := &DiskUsageCounts{} |
|
|
deltaDiskUsage.volumeCount = -1 |
|
|
deltaDiskUsage.volumeCount = -1 |
|
|
if v.IsRemote() { |
|
|
if v.IsRemote() { |
|
|
deltaDiskUsage.remoteVolumeCount = -1 |
|
|
deltaDiskUsage.remoteVolumeCount = -1 |
|
@ -92,7 +91,7 @@ func (dn *DataNode) UpdateVolumes(actualVolumes []storage.VolumeInfo) (newVolume |
|
|
if !v.ReadOnly { |
|
|
if !v.ReadOnly { |
|
|
deltaDiskUsage.activeVolumeCount = -1 |
|
|
deltaDiskUsage.activeVolumeCount = -1 |
|
|
} |
|
|
} |
|
|
disk.UpAdjustDiskUsageDelta(deltaDiskUsages) |
|
|
|
|
|
|
|
|
disk.UpAdjustDiskUsageDelta(types.ToDiskType(v.DiskType), deltaDiskUsage) |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
for _, v := range actualVolumes { |
|
|
for _, v := range actualVolumes { |
|
@ -120,8 +119,7 @@ func (dn *DataNode) DeltaUpdateVolumes(newVolumes, deletedVolumes []storage.Volu |
|
|
} |
|
|
} |
|
|
disk.DeleteVolumeById(v.Id) |
|
|
disk.DeleteVolumeById(v.Id) |
|
|
|
|
|
|
|
|
deltaDiskUsages := newDiskUsages() |
|
|
|
|
|
deltaDiskUsage := deltaDiskUsages.getOrCreateDisk(types.ToDiskType(v.DiskType)) |
|
|
|
|
|
|
|
|
deltaDiskUsage := &DiskUsageCounts{} |
|
|
deltaDiskUsage.volumeCount = -1 |
|
|
deltaDiskUsage.volumeCount = -1 |
|
|
if v.IsRemote() { |
|
|
if v.IsRemote() { |
|
|
deltaDiskUsage.remoteVolumeCount = -1 |
|
|
deltaDiskUsage.remoteVolumeCount = -1 |
|
@ -129,7 +127,7 @@ func (dn *DataNode) DeltaUpdateVolumes(newVolumes, deletedVolumes []storage.Volu |
|
|
if !v.ReadOnly { |
|
|
if !v.ReadOnly { |
|
|
deltaDiskUsage.activeVolumeCount = -1 |
|
|
deltaDiskUsage.activeVolumeCount = -1 |
|
|
} |
|
|
} |
|
|
disk.UpAdjustDiskUsageDelta(deltaDiskUsages) |
|
|
|
|
|
|
|
|
disk.UpAdjustDiskUsageDelta(types.ToDiskType(v.DiskType), deltaDiskUsage) |
|
|
} |
|
|
} |
|
|
for _, v := range newVolumes { |
|
|
for _, v := range newVolumes { |
|
|
dn.doAddOrUpdateVolume(v) |
|
|
dn.doAddOrUpdateVolume(v) |
|
@ -143,7 +141,6 @@ func (dn *DataNode) AdjustMaxVolumeCounts(maxVolumeCounts map[string]uint32) { |
|
|
// the volume server may have set the max to zero
|
|
|
// the volume server may have set the max to zero
|
|
|
continue |
|
|
continue |
|
|
} |
|
|
} |
|
|
deltaDiskUsages := newDiskUsages() |
|
|
|
|
|
dt := types.ToDiskType(diskType) |
|
|
dt := types.ToDiskType(diskType) |
|
|
currentDiskUsage := dn.diskUsages.getOrCreateDisk(dt) |
|
|
currentDiskUsage := dn.diskUsages.getOrCreateDisk(dt) |
|
|
currentDiskUsageMaxVolumeCount := atomic.LoadInt64(¤tDiskUsage.maxVolumeCount) |
|
|
currentDiskUsageMaxVolumeCount := atomic.LoadInt64(¤tDiskUsage.maxVolumeCount) |
|
@ -151,9 +148,9 @@ func (dn *DataNode) AdjustMaxVolumeCounts(maxVolumeCounts map[string]uint32) { |
|
|
continue |
|
|
continue |
|
|
} |
|
|
} |
|
|
disk := dn.getOrCreateDisk(dt.String()) |
|
|
disk := dn.getOrCreateDisk(dt.String()) |
|
|
deltaDiskUsage := deltaDiskUsages.getOrCreateDisk(dt) |
|
|
|
|
|
deltaDiskUsage.maxVolumeCount = int64(maxVolumeCount) - currentDiskUsageMaxVolumeCount |
|
|
|
|
|
disk.UpAdjustDiskUsageDelta(deltaDiskUsages) |
|
|
|
|
|
|
|
|
disk.UpAdjustDiskUsageDelta(dt, &DiskUsageCounts{ |
|
|
|
|
|
maxVolumeCount: int64(maxVolumeCount) - currentDiskUsageMaxVolumeCount, |
|
|
|
|
|
}) |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|