HDDS-1028. Improve logging in SCMPipelineManager. Contributed by Lokesh Jain.

This commit is contained in:
Shashikant Banerjee 2019-02-15 14:38:38 +05:30
parent 75e15cc0c4
commit 8a426dc848
4 changed files with 20 additions and 1 deletions

View File

@ -56,6 +56,8 @@ public class StaleNodeHandler implements EventHandler<DatanodeDetails> {
EventPublisher publisher) { EventPublisher publisher) {
Set<PipelineID> pipelineIds = Set<PipelineID> pipelineIds =
nodeManager.getPipelines(datanodeDetails); nodeManager.getPipelines(datanodeDetails);
LOG.info("Datanode {} moved to stale state. Finalizing its pipelines {}",
datanodeDetails, pipelineIds);
for (PipelineID pipelineID : pipelineIds) { for (PipelineID pipelineID : pipelineIds) {
try { try {
Pipeline pipeline = pipelineManager.getPipeline(pipelineID); Pipeline pipeline = pipelineManager.getPipeline(pipelineID);

View File

@ -57,6 +57,8 @@ public class PipelineActionHandler
pipelineID = PipelineID. pipelineID = PipelineID.
getFromProtobuf(action.getClosePipeline().getPipelineID()); getFromProtobuf(action.getClosePipeline().getPipelineID());
Pipeline pipeline = pipelineManager.getPipeline(pipelineID); Pipeline pipeline = pipelineManager.getPipeline(pipelineID);
LOG.info("Received pipeline action {} for {} from datanode [}",
action.getAction(), pipeline, report.getDatanodeDetails());
RatisPipelineUtils RatisPipelineUtils
.finalizeAndDestroyPipeline(pipelineManager, pipeline, ozoneConf, .finalizeAndDestroyPipeline(pipelineManager, pipeline, ozoneConf,
true); true);

View File

@ -84,6 +84,7 @@ public class PipelineReportHandler implements
} }
if (pipeline.getPipelineState() == Pipeline.PipelineState.ALLOCATED) { if (pipeline.getPipelineState() == Pipeline.PipelineState.ALLOCATED) {
LOGGER.info("Pipeline {} reported by {}", pipeline.getId(), dn);
pipeline.reportDatanode(dn); pipeline.reportDatanode(dn);
if (pipeline.isHealthy()) { if (pipeline.isHealthy()) {
// if all the dns have reported, pipeline can be moved to OPEN state // if all the dns have reported, pipeline can be moved to OPEN state
@ -94,6 +95,8 @@ public class PipelineReportHandler implements
if (numContainers == 0) { if (numContainers == 0) {
// since all the containers have been closed the pipeline can be // since all the containers have been closed the pipeline can be
// destroyed // destroyed
LOGGER.info("Destroying pipeline {} as all containers are closed",
pipeline);
RatisPipelineUtils.destroyPipeline(pipelineManager, pipeline, conf); RatisPipelineUtils.destroyPipeline(pipelineManager, pipeline, conf);
} }
} else { } else {

View File

@ -23,6 +23,8 @@ import org.apache.hadoop.hdds.protocol.proto.HddsProtos.ReplicationType;
import org.apache.hadoop.hdds.protocol.proto.HddsProtos.ReplicationFactor; import org.apache.hadoop.hdds.protocol.proto.HddsProtos.ReplicationFactor;
import org.apache.hadoop.hdds.scm.container.ContainerID; import org.apache.hadoop.hdds.scm.container.ContainerID;
import org.apache.hadoop.hdds.scm.pipeline.Pipeline.PipelineState; import org.apache.hadoop.hdds.scm.pipeline.Pipeline.PipelineState;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.IOException; import java.io.IOException;
import java.util.List; import java.util.List;
@ -37,6 +39,9 @@ import java.util.NavigableSet;
*/ */
class PipelineStateManager { class PipelineStateManager {
private static final Logger LOG =
LoggerFactory.getLogger(PipelineStateManager.class);
private final PipelineStateMap pipelineStateMap; private final PipelineStateMap pipelineStateMap;
PipelineStateManager(Configuration conf) { PipelineStateManager(Configuration conf) {
@ -45,6 +50,9 @@ class PipelineStateManager {
void addPipeline(Pipeline pipeline) throws IOException { void addPipeline(Pipeline pipeline) throws IOException {
pipelineStateMap.addPipeline(pipeline); pipelineStateMap.addPipeline(pipeline);
if (pipeline.getPipelineState() == PipelineState.OPEN) {
LOG.info("Created pipeline " + pipeline);
}
} }
void addContainerToPipeline(PipelineID pipelineId, ContainerID containerID) void addContainerToPipeline(PipelineID pipelineId, ContainerID containerID)
@ -87,7 +95,9 @@ class PipelineStateManager {
} }
Pipeline removePipeline(PipelineID pipelineID) throws IOException { Pipeline removePipeline(PipelineID pipelineID) throws IOException {
return pipelineStateMap.removePipeline(pipelineID); Pipeline pipeline = pipelineStateMap.removePipeline(pipelineID);
LOG.info("Pipeline {} removed from db", pipeline);
return pipeline;
} }
void removeContainerFromPipeline(PipelineID pipelineID, void removeContainerFromPipeline(PipelineID pipelineID,
@ -101,6 +111,7 @@ class PipelineStateManager {
if (!pipeline.isClosed()) { if (!pipeline.isClosed()) {
pipeline = pipelineStateMap pipeline = pipelineStateMap
.updatePipelineState(pipelineId, PipelineState.CLOSED); .updatePipelineState(pipelineId, PipelineState.CLOSED);
LOG.info("Pipeline {} moved to CLOSED state", pipeline);
} }
return pipeline; return pipeline;
} }
@ -113,6 +124,7 @@ class PipelineStateManager {
if (pipeline.getPipelineState() == PipelineState.ALLOCATED) { if (pipeline.getPipelineState() == PipelineState.ALLOCATED) {
pipeline = pipelineStateMap pipeline = pipelineStateMap
.updatePipelineState(pipelineId, PipelineState.OPEN); .updatePipelineState(pipelineId, PipelineState.OPEN);
LOG.info("Pipeline {} moved to OPEN state", pipeline.toString());
} }
return pipeline; return pipeline;
} }