[ 
https://issues.apache.org/jira/browse/HDDS-3974?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17278572#comment-17278572
 ] 

Janus Chow commented on HDDS-3974:
----------------------------------

[~avijayan] Could you help to make an interpretation about this method? Kind of 
confused about the logic of the method.

> StateContext::addPipelineActionIfAbsent does not work as expected.
> ------------------------------------------------------------------
>
>                 Key: HDDS-3974
>                 URL: https://issues.apache.org/jira/browse/HDDS-3974
>             Project: Apache Ozone
>          Issue Type: Bug
>          Components: Ozone Datanode
>    Affects Versions: 1.0.0
>            Reporter: Glen Geng
>            Assignee: Aravindan Vijayan
>            Priority: Minor
>
> {code:java}
> /**
>  * Add PipelineAction to PipelineAction queue if it's not present.
>  *
>  * @param pipelineAction PipelineAction to be added
>  */
> public void addPipelineActionIfAbsent(PipelineAction pipelineAction) {
>   synchronized (pipelineActions) {
>     /**
>      * If pipelineAction queue already contains entry for the pipeline id
>      * with same action, we should just return.
>      * Note: We should not use pipelineActions.contains(pipelineAction) here
>      * as, pipelineAction has a msg string. So even if two msgs differ though
>      * action remains same on the given pipeline, it will end up adding it
>      * multiple times here.
>      */
>     for (InetSocketAddress endpoint : endpoints) {
>       Queue<PipelineAction> actionsForEndpoint =
>           this.pipelineActions.get(endpoint);
>       for (PipelineAction pipelineActionIter : actionsForEndpoint) {
>         if (pipelineActionIter.getAction() == pipelineAction.getAction()
>             && pipelineActionIter.hasClosePipeline() && pipelineAction
>             .hasClosePipeline()
>             && pipelineActionIter.getClosePipeline().getPipelineID()
>             .equals(pipelineAction.getClosePipeline().getPipelineID())) {
>           break;
>         }
>       }
>       actionsForEndpoint.add(pipelineAction);
>     }
>   }
> }
> {code}
> no matter absent or not, pipeline action will be added.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to