You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ozone.apache.org by xy...@apache.org on 2020/07/29 17:25:10 UTC

[hadoop-ozone] branch ozone-0.6.0 updated: HDDS-4027. Suppress ERROR message when SCM attempt to create additional pipelines. (#1265)

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

xyao pushed a commit to branch ozone-0.6.0
in repository https://gitbox.apache.org/repos/asf/hadoop-ozone.git


The following commit(s) were added to refs/heads/ozone-0.6.0 by this push:
     new afa8e2c  HDDS-4027. Suppress ERROR message when SCM attempt to create additional pipelines. (#1265)
afa8e2c is described below

commit afa8e2c33b10c9906b480bc1e0bd6c125dcab105
Author: Xiaoyu Yao <xy...@apache.org>
AuthorDate: Wed Jul 29 10:18:56 2020 -0700

    HDDS-4027. Suppress ERROR message when SCM attempt to create additional pipelines. (#1265)
    
    (cherry picked from commit 0892fabe487ce40cb2b7e9839fe08f4038251e89)
---
 .../hadoop/hdds/scm/pipeline/SCMPipelineManager.java       | 14 ++++++++++++--
 .../hadoop/hdds/scm/pipeline/TestSCMPipelineManager.java   |  7 +++++++
 2 files changed, 19 insertions(+), 2 deletions(-)

diff --git a/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/pipeline/SCMPipelineManager.java b/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/pipeline/SCMPipelineManager.java
index 6fce895..33b905c 100644
--- a/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/pipeline/SCMPipelineManager.java
+++ b/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/pipeline/SCMPipelineManager.java
@@ -42,6 +42,7 @@ import org.apache.hadoop.hdds.protocol.proto.HddsProtos.ReplicationType;
 import org.apache.hadoop.hdds.scm.ScmConfigKeys;
 import org.apache.hadoop.hdds.scm.container.ContainerID;
 import org.apache.hadoop.hdds.scm.events.SCMEvents;
+import org.apache.hadoop.hdds.scm.exceptions.SCMException;
 import org.apache.hadoop.hdds.scm.node.NodeManager;
 import org.apache.hadoop.hdds.scm.safemode.SCMSafeModeManager.SafeModeStatus;
 import org.apache.hadoop.hdds.server.events.EventPublisher;
@@ -56,6 +57,8 @@ import com.google.common.annotations.VisibleForTesting;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import static org.apache.hadoop.hdds.scm.exceptions.SCMException.ResultCodes.FAILED_TO_FIND_SUITABLE_NODE;
+
 /**
  * Implements api needed for management of pipelines. All the write operations
  * for pipelines must come via PipelineManager. It synchronises all write
@@ -272,8 +275,15 @@ public class SCMPipelineManager implements PipelineManager {
       recordMetricsForPipeline(pipeline);
       return pipeline;
     } catch (IOException ex) {
-      LOG.error("Failed to create pipeline of type {} and factor {}. " +
-          "Exception: {}", type, factor, ex.getMessage());
+      if (ex instanceof SCMException &&
+          ((SCMException) ex).getResult() == FAILED_TO_FIND_SUITABLE_NODE) {
+        // Avoid spam SCM log with errors when SCM has enough open pipelines
+        LOG.debug("Can't create more pipelines of type {} and factor {}. " +
+            "Reason: {}", type, factor, ex.getMessage());
+      } else {
+        LOG.error("Failed to create pipeline of type {} and factor {}. " +
+            "Exception: {}", type, factor, ex.getMessage());
+      }
       metrics.incNumPipelineCreationFailed();
       throw ex;
     } finally {
diff --git a/hadoop-hdds/server-scm/src/test/java/org/apache/hadoop/hdds/scm/pipeline/TestSCMPipelineManager.java b/hadoop-hdds/server-scm/src/test/java/org/apache/hadoop/hdds/scm/pipeline/TestSCMPipelineManager.java
index 62289b9..25957d8 100644
--- a/hadoop-hdds/server-scm/src/test/java/org/apache/hadoop/hdds/scm/pipeline/TestSCMPipelineManager.java
+++ b/hadoop-hdds/server-scm/src/test/java/org/apache/hadoop/hdds/scm/pipeline/TestSCMPipelineManager.java
@@ -76,6 +76,7 @@ import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.never;
 import static org.mockito.Mockito.verify;
 import static org.mockito.Mockito.when;
+import static org.slf4j.event.Level.INFO;
 
 /**
  * Test cases to verify PipelineManager.
@@ -304,6 +305,8 @@ public class TestSCMPipelineManager {
         "NumPipelineCreationFailed", metrics);
     Assert.assertEquals(0, numPipelineCreateFailed);
 
+    LogCapturer logs = LogCapturer.captureLogs(SCMPipelineManager.getLog());
+    GenericTestUtils.setLogLevel(SCMPipelineManager.getLog(), INFO);
     //This should fail...
     try {
       pipelineManager.createPipeline(HddsProtos.ReplicationType.RATIS,
@@ -313,6 +316,10 @@ public class TestSCMPipelineManager {
       // pipeline creation failed this time.
       Assert.assertEquals(SCMException.ResultCodes.FAILED_TO_FIND_SUITABLE_NODE,
           ioe.getResult());
+      Assert.assertFalse(logs.getOutput().contains(
+          "Failed to create pipeline of type"));
+    } finally {
+      logs.stopCapturing();
     }
 
     metrics = getMetrics(


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