slfan1989 opened a new pull request, #10284:
URL: https://github.com/apache/ozone/pull/10284

   ## What changes were proposed in this pull request?
   
   This PR updates DiskBalancer to persist `diskBalancer.info` atomically.
   
   Previously, DiskBalancer overwrote `diskBalancer.info` by deleting the 
existing file and creating a new one. If the write failed between these steps, 
the existing configuration could be lost or left incomplete.
   
   This patch changes the persistence flow to:
   
   - create the parent directory if needed;
   - write the new `DiskBalancerInfo` to a temporary file in the same directory;
   - atomically move the temporary file to `diskBalancer.info`;
   - preserve the existing file if the temporary write fails;
   - provide clear `IOException` messages for directory creation, temporary 
file creation, and overwrite failures.
   
   This makes DiskBalancer info persistence more robust and avoids losing the 
previous valid configuration on write failure.
   
   ## What is the link to the Apache JIRA
   
   JIRA: HDDS-15290. DiskBalancer should write info file atomically.
   
   ## How was this patch tested?
   
   Added unit tests.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


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

Reply via email to