timmylicheng commented on issue #663: HDDS-3156 update allocateContainer to remove additional createPipeline step. URL: https://github.com/apache/hadoop-ozone/pull/663#issuecomment-600406625 > Thanks @timmylicheng for working on this. > > We don't need any complex conditions here. The below logic should be enough to handle > > ``` > try { > final List<Pipeline> pipelines = pipelineManager.getPipelines(type, replicationFactor, Pipeline.PipelineState.OPEN); > Pipeline pipeline; > if (pipelines.isEmpty()) { > pipeline = pipelineManager.createPipeline(type, replicationFactor); > pipelineManager.waitPipelineReady(pipeline.getId(), 0); > } else { > pipeline = pipelines.get((int) containerCount.get() % pipelines.size()); > } > } catch (IOException e) { > throw new IOException("Could not allocate container. Cannot get any" + > " matching pipeline for Type:" + type + > ", Factor:" + replicationFactor + ", State:PipelineState.OPEN"); > } > ``` @nandakumar131 I actually tried this and some tests fail. Basically some uts are expecting to have a new Ratis ONE pipeline when a new container is created. In your posted code, it will use an existing pipeline by default. My idea is to keep Ratis One behavior as it is: try to create pipeline every time a container is created. After pipeline is used up for creation, it will use the existing ones. Your idea seems to be using existing pipelines for both Ratis one and Ratis three. But like Bharat posts, Ratis one doesn't have to be auto created by background thread. We do have conditions when Ratis one is not auto created by a config. Also for StandAlone pipelines, background thread is also not working for them. I was thinking of changing the least UTs. Would you suggest to modify UTs on the other hand? That could be a lot tho.
---------------------------------------------------------------- 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: [email protected] With regards, Apache Git Services --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
