Repository navigation
Conversation
|
@xichen01 @Gargi-jais11 @ivandika3 Kindly review. |
Gargi-jais11
left a comment
There was a problem hiding this comment.
Thanks @devmadhuu for the patch.
Left few review comments.
| final Map<StorageType, List<VolumeFixedUsage>> usagesByStorageType = volumeUsages.stream() | ||
| .collect(Collectors.groupingBy(v -> v.getVolume().getStorageType())); | ||
| for (StorageType storageType : StorageType.values()) { |
There was a problem hiding this comment.
DiskBalancerService#getTasks calls the policy availableTaskCount times per loop. Each call returns the first type that has a candidate. While SSD is out of balance, every thread slot goes to SSD moves. DISK gets nothing until SSD is within threshold, or until SSD has no movable container left.
For Example: a datanode has two small SSD volumes at 40% and 25%, and ten large DISK volumes ranging from 95% down to 20%, with a 10% threshold. DISK is the urgent group: its volumes are much larger and close to full. It still waits for SSD to finish, and SSD moves can take hours when bandwidthInMB is throttled. With parallelThread=5, all five slots go to SSD.
Might be we can discuss on this how we will handle. What I think right now is:
- It should pick the group with the largest imbalance (highest.utilization - idealUsage).
- Rotate the starting storage type on each call.
There might be some better options as well, I am exploring more.
There was a problem hiding this comment.
Thanks, this is a valid concern. getTasks() invokes the policy once per available worker, and the policy currently restarts StorageType.values() on every invocation. Therefore, the first eligible type can consume every worker slot. I propose ranking eligible storage-type groups by their current threshold violation. We would then try groups in descending severity order, falling through when a group has no movable container. The source delta and destination committed-byte accounting are already updated between policy calls, so the ranking naturally changes as moves are scheduled. I prefer deterministic severity ranking over unconditional rotation because rotation can prioritize a mildly imbalanced tier over a volume close to full. StorageType order can remain only as a deterministic tie-breaker. I have also updated the test so DISK has the larger imbalance while SSD still appears first in the list; that will verify that selection is based on imbalance rather than list order.
There was a problem hiding this comment.
I propose ranking eligible storage-type groups by their current threshold violation.
This makes sense, agreed.
…ut and computation of threshold violation within storage type and avoiding worker threads starvation for different storage types.
Gargi-jais11
left a comment
There was a problem hiding this comment.
Thanks @devmadhuu for updating the PR.
Few more comments.
| return info; | ||
| } | ||
|
|
||
| @VisibleForTesting |
There was a problem hiding this comment.
@VisibleFprTesting is no more supported. Refernce: https://issues.apache.org/jira/browse/HDDS-12725
| * from each source volume during container moves | ||
| * @return Ideal usage as a ratio (used space / total capacity) | ||
| */ | ||
| public static double getIdealUsage(List<VolumeFixedUsage> volumes) { |
There was a problem hiding this comment.
getIdealUsage is not considering Storage Type. It should be per Storage type evaluated.
There was a problem hiding this comment.
Only 1 caller method was not passing per storage type list which is fixed now including CLI caller.
| lowestUsage.getUtilization() > lowerThreshold) { | ||
| return null; | ||
| } | ||
| private static double getThresholdViolation(List<VolumeFixedUsage> volumeUsages, |
There was a problem hiding this comment.
Many new helper methods are added and calling VolumeUsages. These helper methods should be moved to DiskBalancerVolumeCalaculation class as the logic can be reused and Each calculation will get one time snapshot of the VolumeUsages.
| "name": "ozoneAvailable", | ||
| "type": "uint64", | ||
| "optional": true | ||
| }, |
There was a problem hiding this comment.
Do we really need in this PR?
There was a problem hiding this comment.
I think this is needed as per proto-backwards-compatibility plugin else build will fail. This is auto generated file.
| optional StorageTypeProto storageType = 9; | ||
| } | ||
|
|
||
| message StorageTypeDiskBalancerInfoProto { |
There was a problem hiding this comment.
Please check the existing proto messages it those can be reused else we can keep the new ones.
There was a problem hiding this comment.
Checked the existing messages. VolumeReportProto describes a single physical volume (storageId, storagePath), and DatanodeUsageInfoProto carries per-datanode absolute byte counts plus DatanodeDetailsProto. The new message is an aggregate across all volumes of one storage type, and four of its six fields — currentVolumeDensitySum, idealUsage, usableVolumeCount, balanceable - have no counterpart in either. Reusing one would mean adding those fields to a message where its own existing fields don't apply, so I've kept the new message.
| appendStorageTypeDetails(header, p); | ||
| } else if (p.hasIdealUsage() && p.hasDiskBalancerConf() | ||
| && p.getDiskBalancerConf().hasThreshold()) { | ||
| double idealUsage = p.getIdealUsage(); |
There was a problem hiding this comment.
here in report we should display idealUsage for each storageType so that it's easy for user to compare.
What changes were proposed in this pull request?
The datanode disk balancer treats all volumes as one pool, so it can move a container from an SSD volume to a DISK volume. Now that buckets carry a storage policy, that silently breaks the policy the data was placed for.
This change groups volumes by
StorageTypeinDefaultContainerChoosingPolicyand balances each group on its own, so a container never moves between volumes of different storage types. The existing selection logic — ideal usage, lower/upper thresholds, source-is-highest-utilization, destination-walk, commit-on-selection — is unchanged; it was extracted into a private method and now runs per group.A storage type with fewer than two usable volumes is skipped rather than paired across types. The
stopAfterDiskEvenlog message was updated, since "disks are even" is now also reported when every storage type has fewer than two volumes.Most of the diff in
DefaultContainerChoosingPolicyis re-indentation from the method extraction; the new logic is few lines.What is the link to the Apache JIRA
https://issues.apache.org/jira/browse/HDDS-16040
How was this patch tested?
Three scenarios added to
TestDefaultContainerChoosingPolicy: