You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ozone.apache.org by bh...@apache.org on 2021/06/09 16:40:45 UTC

[ozone] branch master updated: HDDS-5323. Avoid unncessary report processing log messages in follower. (#2317)

This is an automated email from the ASF dual-hosted git repository.

bharat pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ozone.git


The following commit(s) were added to refs/heads/master by this push:
     new baf8272  HDDS-5323. Avoid unncessary report processing log messages in follower. (#2317)
baf8272 is described below

commit baf8272b085d0c54cb19bad5a435b5c231275b10
Author: Bharat Viswanadham <bh...@apache.org>
AuthorDate: Wed Jun 9 22:10:30 2021 +0530

    HDDS-5323. Avoid unncessary report processing log messages in follower. (#2317)
---
 .../hadoop/hdds/scm/pipeline/PipelineReportHandler.java | 17 ++++++++++++-----
 1 file changed, 12 insertions(+), 5 deletions(-)

diff --git a/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/pipeline/PipelineReportHandler.java b/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/pipeline/PipelineReportHandler.java
index 6676c6e..95599ea 100644
--- a/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/pipeline/PipelineReportHandler.java
+++ b/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/pipeline/PipelineReportHandler.java
@@ -39,6 +39,7 @@ import org.apache.hadoop.hdds.server.events.EventPublisher;
 import org.apache.hadoop.ozone.protocol.commands.ClosePipelineCommand;
 import org.apache.hadoop.ozone.protocol.commands.CommandForDatanode;
 import org.apache.hadoop.ozone.protocol.commands.SCMCommand;
+import org.apache.ratis.protocol.exceptions.NotLeaderException;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -89,7 +90,10 @@ public class PipelineReportHandler implements
     for (PipelineReport report : pipelineReport.getPipelineReportList()) {
       try {
         processPipelineReport(report, dn, publisher);
-      } catch (IOException e) {
+      } catch(NotLeaderException ex) {
+        // Avoid NotLeaderException logging which happens when processing
+        // pipeline report on followers.
+      } catch(IOException e) {
         LOGGER.error("Could not process pipeline report={} from dn={}.",
             report, dn, e);
       }
@@ -103,10 +107,13 @@ public class PipelineReportHandler implements
     try {
       pipeline = pipelineManager.getPipeline(pipelineID);
     } catch (PipelineNotFoundException e) {
-      SCMCommand<?> command = new ClosePipelineCommand(pipelineID);
-      command.setTerm(scmContext.getTermOfLeader());
-      publisher.fireEvent(SCMEvents.DATANODE_COMMAND,
-          new CommandForDatanode<>(dn.getUuid(), command));
+      if (scmContext.isLeader()) {
+        LOGGER.info("Reported pipeline {} is not found", pipelineID);
+        SCMCommand< ? > command = new ClosePipelineCommand(pipelineID);
+        command.setTerm(scmContext.getTermOfLeader());
+        publisher.fireEvent(SCMEvents.DATANODE_COMMAND,
+            new CommandForDatanode<>(dn.getUuid(), command));
+      }
       return;
     }
 

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@ozone.apache.org
For additional commands, e-mail: commits-help@ozone.apache.org