runzhiwang commented on a change in pull request #1371: URL: https://github.com/apache/hadoop-ozone/pull/1371#discussion_r496643970
########## File path: hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/pipeline/SCMPipelineManager.java ########## @@ -619,9 +619,9 @@ private void finalizePipeline(PipelineID pipelineId) throws IOException { * @throws IOException */ protected void destroyPipeline(Pipeline pipeline) throws IOException { - pipelineFactory.close(pipeline.getType(), pipeline); // remove the pipeline from the pipeline manager removePipeline(pipeline.getId()); + pipelineFactory.close(pipeline.getType(), pipeline); Review comment: If did not change, the order maybe: pipelineFactory.close(pipeline.getType(), pipeline) -> datanode close pipeline -> scm create new pipeline -> removePipeline(pipeline.getId()), then leader distribution will not be balance. For example, on server S1, S3, S3, there are 3 pipelines: P1, P2, P3 with leader: S1, S2, S3. S1 .. S2 .. S3 P1 .. P2 .. P3 If close P3, and order maybe: pipelineFactory.close(pipeline.getType(), P3) -> datanode close P3 -> scm create new pipeline P4 -> removePipeline(P3). When create new pipeline P4, because P3 has not been removed, P4 will choose S1 as the leader, then S1 has 2 leaders, but S3 has no leader. S1 .. S2 .. S3 P1 .. P2 P4 ---------------------------------------------------------------- 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 --------------------------------------------------------------------- To unsubscribe, e-mail: ozone-issues-unsubscr...@hadoop.apache.org For additional commands, e-mail: ozone-issues-h...@hadoop.apache.org