You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ozone.apache.org by "Glen Geng (Jira)" <ji...@apache.org> on 2020/07/16 11:19:00 UTC

[jira] [Created] (HDDS-3974) StateContext::addPipelineActionIfAbsent does not work as expected.

Glen Geng created HDDS-3974:
-------------------------------

             Summary: StateContext::addPipelineActionIfAbsent does not work as expected.
                 Key: HDDS-3974
                 URL: https://issues.apache.org/jira/browse/HDDS-3974
             Project: Hadoop Distributed Data Store
          Issue Type: Bug
          Components: Ozone Datanode
    Affects Versions: 0.6.0
            Reporter: Glen Geng
            Assignee: Aravindan Vijayan


{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: ozone-issues-unsubscribe@hadoop.apache.org
For additional commands, e-mail: ozone-issues-help@hadoop.apache.org