ozone icon indicating copy to clipboard operation
ozone copied to clipboard

HDDS-13955. Handle empty datanode.id file gracefully

Open cchung100m opened this issue 2 months ago • 2 comments

What changes were proposed in this pull request?

  1. Fetch the datanode UUID from the VERSION file under hdds.datanode.dir directory
  2. 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 avatar Dec 11 '25 15:12 cchung100m

@cchung100m Please add a unit test in TestContainerUtils for the following scenario:

  1. Setup storage directory structure
  2. Create VERSION file with datanode UUID
  3. Simulate corrupted/empty datanode.id file. Creates an empty datanode.id file (0 bytes). Verifies the file is empty
  4. Calls ContainerUtils.readDatanodeDetailsFrom(datanodeIdFile, testConf)
  5. 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

Gargi-jais11 avatar Dec 13 '25 17:12 Gargi-jais11

@ChenSammi and @peterxcli Could you please review the patch?

Gargi-jais11 avatar Dec 15 '25 12:12 Gargi-jais11