Shilun Fan created HDDS-15290:
---------------------------------

             Summary: DiskBalancer should write info file atomically
                 Key: HDDS-15290
                 URL: https://issues.apache.org/jira/browse/HDDS-15290
             Project: Apache Ozone
          Issue Type: Improvement
            Reporter: Shilun Fan
            Assignee: Shilun Fan


DiskBalancer persists its running configuration and state into 
diskBalancer.info on the datanode.

Currently, DiskBalancerService overwrites diskBalancer.info by deleting the 
existing file first and then creating/writing the new file.

If the process fails between deleting the old file and completing the new 
write, for example due to an IOException or datanode crash, the existing 
diskBalancer.info may be lost or left in an incomplete state.

This can make DiskBalancer state recovery less reliable on datanode restart.

The write path should be made atomic by writing the new DiskBalancerInfo into a 
temporary file in the same directory first, and then replacing the target 
diskBalancer.info using an atomic move. If writing the temporary file fails, 
the existing diskBalancer.info should remain unchanged.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to