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 063e7fd HDDS-5390. reconPipelineReportHandler should not retry when
pipeline not found (#2371)
063e7fd is described below
commit 063e7fdd98fad133ec6b27fd333106190be8b98d
Author: Jackson Yao <[email protected]>
AuthorDate: Mon Aug 9 20:04:58 2021 +0800
HDDS-5390. reconPipelineReportHandler should not retry when pipeline not
found (#2371)
---
.../org/apache/hadoop/hdds/scm/ha/SCMHAUtils.java | 2 ++
.../hdds/scm/pipeline/PipelineReportHandler.java | 2 ++
.../recon/scm/ReconPipelineReportHandler.java | 22 +++++++++++++++++++---
3 files changed, 23 insertions(+), 3 deletions(-)
diff --git
a/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/scm/ha/SCMHAUtils.java
b/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/scm/ha/SCMHAUtils.java
index 7220d53..b5271fb 100644
---
a/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/scm/ha/SCMHAUtils.java
+++
b/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/scm/ha/SCMHAUtils.java
@@ -29,6 +29,7 @@ import org.apache.hadoop.hdds.conf.OzoneConfiguration;
import org.apache.hadoop.hdds.ratis.ServerNotLeaderException;
import org.apache.hadoop.hdds.scm.ScmConfigKeys;
import org.apache.hadoop.hdds.scm.exceptions.SCMException;
+import org.apache.hadoop.hdds.scm.pipeline.PipelineNotFoundException;
import org.apache.hadoop.hdds.server.ServerUtils;
import org.apache.hadoop.io.retry.RetryPolicy;
import org.apache.hadoop.ipc.RemoteException;
@@ -71,6 +72,7 @@ public final class SCMHAUtils {
ImmutableList.<Class<? extends Exception>>builder()
.add(SCMException.class)
.add(NonRetriableException.class)
+ .add(PipelineNotFoundException.class)
.build();
private SCMHAUtils() {
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 95599ea..85ea5a5 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
@@ -93,6 +93,8 @@ public class PipelineReportHandler implements
} catch(NotLeaderException ex) {
// Avoid NotLeaderException logging which happens when processing
// pipeline report on followers.
+ } catch (PipelineNotFoundException e) {
+ LOGGER.error("Could not find pipeline {}", report.getPipelineID());
} catch(IOException e) {
LOGGER.error("Could not process pipeline report={} from dn={}.",
report, dn, e);
diff --git
a/hadoop-ozone/recon/src/main/java/org/apache/hadoop/ozone/recon/scm/ReconPipelineReportHandler.java
b/hadoop-ozone/recon/src/main/java/org/apache/hadoop/ozone/recon/scm/ReconPipelineReportHandler.java
index b10f4c8..78c8469 100644
---
a/hadoop-ozone/recon/src/main/java/org/apache/hadoop/ozone/recon/scm/ReconPipelineReportHandler.java
+++
b/hadoop-ozone/recon/src/main/java/org/apache/hadoop/ozone/recon/scm/ReconPipelineReportHandler.java
@@ -31,6 +31,7 @@ import
org.apache.hadoop.hdds.scm.pipeline.PipelineNotFoundException;
import org.apache.hadoop.hdds.scm.pipeline.PipelineReportHandler;
import org.apache.hadoop.hdds.scm.safemode.SafeModeManager;
import org.apache.hadoop.hdds.server.events.EventPublisher;
+import org.apache.hadoop.ipc.RemoteException;
import org.apache.hadoop.ozone.recon.spi.StorageContainerServiceProvider;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -63,14 +64,29 @@ public class ReconPipelineReportHandler extends
PipelineReportHandler {
PipelineID pipelineID = PipelineID.getFromProtobuf(report.getPipelineID());
if (!reconPipelineManager.containsPipeline(pipelineID)) {
LOG.info("Unknown pipeline {}. Trying to get from SCM.", pipelineID);
- Pipeline pipelineFromScm =
- scmServiceProvider.getPipeline(report.getPipelineID());
+ Pipeline pipelineFromScm;
+
+ try {
+ pipelineFromScm =
+ scmServiceProvider.getPipeline(report.getPipelineID());
+ } catch (IOException ex) {
+ if (ex instanceof RemoteException) {
+ IOException ioe = ((RemoteException) ex)
+ .unwrapRemoteException(PipelineNotFoundException.class);
+ if (ioe instanceof PipelineNotFoundException) {
+ LOG.error("Could not find pipeline {} at SCM.", pipelineID);
+ throw new PipelineNotFoundException();
+ }
+ }
+ throw ex;
+ }
+
LOG.info("Adding new pipeline {} to Recon pipeline metadata.",
pipelineFromScm);
reconPipelineManager.addPipeline(pipelineFromScm);
}
- Pipeline pipeline = null;
+ Pipeline pipeline;
try {
pipeline = reconPipelineManager.getPipeline(pipelineID);
} catch (PipelineNotFoundException ex) {
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]