Uploaded image for project: 'Apache Ozone'
  1. Apache Ozone
  2. HDDS-3974

StateContext#addPipelineActionIfAbsent does not work as expected

    XMLWordPrintableJSON

Details

    Description

      /**
       * 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);
          }
        }
      }
      

      no matter absent or not, pipeline action will be added.

      Attachments

        Issue Links

          Activity

            People

              smeng Siyao Meng
              glengeng Glen Geng
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: