maobaolong commented on a change in pull request #938:
URL: https://github.com/apache/hadoop-ozone/pull/938#discussion_r428986889



##########
File path: 
hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/pipeline/PipelineStateMap.java
##########
@@ -372,13 +372,20 @@ Pipeline updatePipelineState(PipelineID pipelineID, 
PipelineState state)
     Pipeline updatedPipeline = pipelineMap.compute(pipelineID,
         (id, p) -> Pipeline.newBuilder(pipeline).setState(state).build());
     PipelineQuery query = new PipelineQuery(pipeline);
+    List<Pipeline> pipelineList = query2OpenPipelines.get(query);
     if (updatedPipeline.getPipelineState() == PipelineState.OPEN) {
       // for transition to OPEN state add pipeline to query2OpenPipelines
-      query2OpenPipelines.get(query).add(updatedPipeline);
+      if (pipelineList == null) {

Review comment:
       @xiaoyuyao Yeah, you are right while we do something initialized in 
initializeQueryMap(), but i am working on query unknown replication query 
dynamically, so initializeQueryMap() just put the known replication factor into 
the query2OpenPipelines. Further more, i have an idea to remove 
initializeQueryMap, instead, using a lazy way to add and remove items from/to 
the query2OpenPipelines, it is only an idea, but for this PR, it makes NPE gone 
away.




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

Reply via email to