ozone
ozone copied to clipboard
HDDS-13955. Handle empty datanode.id file gracefully
What changes were proposed in this pull request?
- Fetch the datanode UUID from the VERSION file under
hdds.datanode.dirdirectory - Write the UUID to the datanode.id file
What is the link to the Apache JIRA
https://issues.apache.org/jira/browse/HDDS-13955
How was this patch tested?
Existing unit and integration tests
@cchung100m Please add a unit test in TestContainerUtils for the following scenario:
- Setup storage directory structure
- Create VERSION file with datanode UUID
- Simulate corrupted/empty datanode.id file. Creates an empty datanode.id file (0 bytes). Verifies the file is empty
- Calls
ContainerUtils.readDatanodeDetailsFrom(datanodeIdFile, testConf) - Verify recovery results
- Assertions:
- Recovered UUID matches the UUID in the VERSION file
- datanode.id is recreated with content (file size > 0)
- The recreated file can be read normally and contains the correct UUID
@ChenSammi and @peterxcli Could you please review the patch?