smengcl commented on a change in pull request #2321:
URL: https://github.com/apache/ozone/pull/2321#discussion_r652171758
##########
File path:
hadoop-ozone/recon/src/main/java/org/apache/hadoop/ozone/recon/scm/ReconContainerManager.java
##########
@@ -203,6 +207,15 @@ private void checkContainerStateAndUpdate(ContainerID
containerID,
&& isHealthy(state)) {
LOG.info("Container {} has state OPEN, but given state is {}.",
containerID, state);
+ Pipeline pipeline =
+ pipelineManager.getPipeline(containerInfo.getPipelineID());
+ // subtract open container count from the pipeline
+ int curCnt = pipelineToOpenContainer.getOrDefault(pipeline.getId(), 0);
+ if (curCnt == 1) {
+ pipelineToOpenContainer.remove(pipeline.getId());
+ } else if (curCnt > 0) {
+ pipelineToOpenContainer.put(pipeline.getId(), curCnt - 1);
+ }
Review comment:
Can we use `containerInfo.getPipelineID()` directly?
Seems we are converting from `PipelineID` to `Pipeline` then back to the
same `PipelineID`?
```suggestion
final PipelineID pipelineID = containerInfo.getPipelineID();
// subtract open container count from the map
int curCnt = pipelineToOpenContainer.getOrDefault(pipelineID, 0);
if (curCnt == 1) {
pipelineToOpenContainer.remove(pipelineID);
} else if (curCnt > 0) {
pipelineToOpenContainer.put(pipelineID, curCnt - 1);
}
```
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]