Shilun Fan created HDDS-15346:
---------------------------------
Summary: DiskBalancer should update delta sizes atomically
Key: HDDS-15346
URL: https://issues.apache.org/jira/browse/HDDS-15346
Project: Apache Ozone
Issue Type: Improvement
Components: Ozone Datanode
Reporter: Shilun Fan
Assignee: Shilun Fan
h3. Description
DiskBalancer tracks scheduled container moves with deltaSizes, which is backed
by a concurrent map. However, some updates are currently done with separate
read and write operations, such as getOrDefault(...) + put(...) or get(...) +
put(...).
These updates are not atomic. If multiple DiskBalancer tasks update the same
source volume concurrently, one update may overwrite another one. This can
leave an incorrect delta size for the volume, which may affect later volume
selection and balancing decisions.
h3. Proposed Fix
Update deltaSizes using atomic map operations, such as
ConcurrentHashMap.compute(...), when reserving or releasing bytes for a source
volume.
This ensures each per-volume delta update is applied atomically and avoids lost
updates under concurrent DiskBalancer task execution.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]