ChenSammi commented on a change in pull request #117: HDDS-1576. Support configure more than one raft log storage to host m… URL: https://github.com/apache/hadoop-ozone/pull/117#discussion_r358581999
########## File path: hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/hdds/scm/pipeline/TestRatisPipelineCreateAndDestroy.java ########## @@ -162,6 +173,58 @@ public void testPipelineCreationOnNodeRestart() throws Exception { } } + @Test(timeout = 300000) + public void testMultiRaftStorageDir() throws Exception { + final String suffix = "-testMultiRaftStorageDir-"; + Map<String, AtomicInteger> directories = new ConcurrentHashMap<>(); + int maxPipeline = maxPipelinePerNode; + int index = 0; + while(maxPipeline > 1) { + directories.put("ratis" + suffix + (index++), new AtomicInteger(0)); + maxPipeline--; + } + + conf.setTimeDuration(OZONE_SCM_STALENODE_INTERVAL, + 5, TimeUnit.SECONDS); + conf.set("dfs.container.ratis.datanode.storage.dir.suffix", suffix); + + // Create 3 RATIS THREE pipeline + init(3); + // make sure a pipelines is created + waitForPipelines(3); + List<Pipeline> pipelines = + pipelineManager.getPipelines(HddsProtos.ReplicationType.RATIS, + HddsProtos.ReplicationFactor.THREE); + List<RaftGroupId> raftGroupIds = new ArrayList<>(); + pipelines.stream().forEach(pipeline -> + raftGroupIds.add(RaftGroupId.valueOf(pipeline.getId().getId()))); + + List<HddsDatanodeService> dns = new ArrayList<>(cluster.getHddsDatanodes()); + dns.stream().forEach(dn -> { + XceiverServerSpi writeChannel = + dn.getDatanodeStateMachine().getContainer().getWriteChannel(); + RaftServerProxy server = + (RaftServerProxy)((XceiverServerRatis)writeChannel).getServer(); + raftGroupIds.stream().forEach(group -> { + try { + RaftServerImpl raft = server.getImpl(group); + String raftDir = + raft.getState().getStorage().getStorageDir().getRoot().toString(); + directories.keySet().stream().forEach(path -> { + if (raftDir.contains(path)) { + directories.get(path).incrementAndGet(); + } + }); + } catch (IOException e) { + e.printStackTrace(); + } + }); + }); + + directories.values().stream().forEach( + count -> Assert.assertEquals(maxPipelinePerNode - 1, count.get())); + } + private void waitForPipelines(int numPipelines) Review comment: Sure. A new commit addressed the concern. ---------------------------------------------------------------- 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services --------------------------------------------------------------------- To unsubscribe, e-mail: ozone-issues-unsubscr...@hadoop.apache.org For additional commands, e-mail: ozone-issues-h...@hadoop.apache.org