Gargi-jais11 commented on code in PR #9318:
URL: https://github.com/apache/ozone/pull/9318#discussion_r2605274379


##########
hadoop-hdds/framework/src/test/java/org/apache/hadoop/hdds/server/TestServerUtils.java:
##########
@@ -263,4 +266,211 @@ public void ozoneMetadataDirRejectsList() {
         () -> ServerUtils.getOzoneMetaDirPath(conf));
   }
 
+  /**
+   * Test that SCM, OM, and Datanode colocated on the same host with only
+   * ozone.metadata.dirs configured don't conflict with Ratis directories.
+   */
+  @Test
+  public void testColocatedComponentsWithSharedMetadataDir() {
+    final File metaDir = new File(folder.toFile(), "sharedMetaDir");
+    final OzoneConfiguration conf = new OzoneConfiguration();
+
+    // Only configure ozone.metadata.dirs (the fallback config)
+    conf.set(HddsConfigKeys.OZONE_METADATA_DIRS, metaDir.getPath());
+
+    try {
+      assertFalse(metaDir.exists());
+
+      // Test Ratis directories - each component should get its own with flat 
naming
+      String scmRatisDir = ServerUtils.getDefaultRatisDirectory(conf, 
HddsProtos.NodeType.SCM);
+      String omRatisDir = ServerUtils.getDefaultRatisDirectory(conf, 
HddsProtos.NodeType.OM);
+      String dnRatisDir = ServerUtils.getDefaultRatisDirectory(conf, 
HddsProtos.NodeType.DATANODE);
+
+      // Verify Ratis directories use flat naming pattern (component.ratis)
+      assertEquals(new File(metaDir, "scm.ratis").getPath(), scmRatisDir);
+      assertEquals(new File(metaDir, "om.ratis").getPath(), omRatisDir);
+      assertEquals(new File(metaDir, "datanode.ratis").getPath(), dnRatisDir);
+
+      // Verify all Ratis directories are different
+      assertNotEquals(scmRatisDir, omRatisDir);
+      assertNotEquals(scmRatisDir, dnRatisDir);
+      assertNotEquals(omRatisDir, dnRatisDir);
+
+      // Verify the base metadata dir exists
+      assertTrue(metaDir.exists());

Review Comment:
   Yes, `getDefaultRatisDirectory` creates the base metadata directory 
indirectly.
   So when `getDefaultRatisDirectory` is called, it:
   
   - Calls `getOzoneMetaDirPath()` to get the metadata directory
   - That calls `getDirectoryFromConfig()`, which creates the metadata directory
   - Then returns the component-specific Ratis directory path



-- 
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