diff --git a/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/statemachine/StateContext.java b/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/statemachine/StateContext.java index c2d5421347..9d5a7781b0 100644 --- a/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/statemachine/StateContext.java +++ b/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/statemachine/StateContext.java @@ -280,7 +280,7 @@ public void addPipelineActionIfAbsent(PipelineAction pipelineAction) { && pipelineActionIter.hasClosePipeline() && pipelineAction .hasClosePipeline() && pipelineActionIter.getClosePipeline().getPipelineID() - == pipelineAction.getClosePipeline().getPipelineID()) { + .equals(pipelineAction.getClosePipeline().getPipelineID())) { return; } } diff --git a/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/transport/server/ratis/XceiverServerRatis.java b/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/transport/server/ratis/XceiverServerRatis.java index f7753968dd..38d826b3e2 100644 --- a/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/transport/server/ratis/XceiverServerRatis.java +++ b/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/transport/server/ratis/XceiverServerRatis.java @@ -397,6 +397,9 @@ private void handlePipelineFailure(RaftGroupId groupId, .setAction(PipelineAction.Action.CLOSE) .build(); context.addPipelineActionIfAbsent(action); + LOG.debug( + "pipeline Action " + action.getAction() + " on pipeline " + pipelineID + + ".Reason : " + action.getClosePipeline().getDetailedReason()); } void handleNodeSlowness( diff --git a/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/node/StaleNodeHandler.java b/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/node/StaleNodeHandler.java index 0bd93395c3..b435e777ae 100644 --- a/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/node/StaleNodeHandler.java +++ b/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/node/StaleNodeHandler.java @@ -25,6 +25,8 @@ import org.apache.hadoop.hdds.scm.node.states.Node2ContainerMap; import org.apache.hadoop.hdds.server.events.EventHandler; import org.apache.hadoop.hdds.server.events.EventPublisher; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import java.util.Set; @@ -32,6 +34,7 @@ * Handles Stale node event. */ public class StaleNodeHandler implements EventHandler { + static final Logger LOG = LoggerFactory.getLogger(StaleNodeHandler.class); private final Node2ContainerMap node2ContainerMap; private final Mapping containerManager; @@ -48,6 +51,7 @@ public void onMessage(DatanodeDetails datanodeDetails, Set pipelineIDs = containerManager.getPipelineOnDatanode(datanodeDetails); for (PipelineID id : pipelineIDs) { + LOG.info("closing pipeline {}.", id); publisher.fireEvent(SCMEvents.PIPELINE_CLOSE, id); } } diff --git a/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/pipelines/PipelineActionEventHandler.java b/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/pipelines/PipelineActionEventHandler.java index 54c240037f..1053149bba 100644 --- a/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/pipelines/PipelineActionEventHandler.java +++ b/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/pipelines/PipelineActionEventHandler.java @@ -50,6 +50,8 @@ public void onMessage(PipelineActionsFromDatanode report, case CLOSE: PipelineID pipelineID = PipelineID. getFromProtobuf(action.getClosePipeline().getPipelineID()); + LOG.info("Closing pipeline " + pipelineID + " for reason:" + action + .getClosePipeline().getDetailedReason()); publisher.fireEvent(SCMEvents.PIPELINE_CLOSE, pipelineID); break; default: diff --git a/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/pipelines/ratis/RatisManagerImpl.java b/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/pipelines/ratis/RatisManagerImpl.java index 150802e2b1..0342e18c55 100644 --- a/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/pipelines/ratis/RatisManagerImpl.java +++ b/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/pipelines/ratis/RatisManagerImpl.java @@ -110,15 +110,15 @@ public void initializePipeline(Pipeline pipeline) throws IOException { * Close the pipeline. */ public void closePipeline(Pipeline pipeline) throws IOException { + try (XceiverClientRatis client = + XceiverClientRatis.newXceiverClientRatis(pipeline, conf)) { + client.destroyPipeline(); + } super.closePipeline(pipeline); for (DatanodeDetails node : pipeline.getMachines()) { // A node should always be the in ratis members list. Preconditions.checkArgument(ratisMembers.remove(node)); } - try (XceiverClientRatis client = - XceiverClientRatis.newXceiverClientRatis(pipeline, conf)) { - client.destroyPipeline(); - } } /**