HDDS-1028. Improve logging in SCMPipelineManager. Contributed by Lokesh Jain.
This commit is contained in:
parent
75e15cc0c4
commit
8a426dc848
|
@ -56,6 +56,8 @@ public class StaleNodeHandler implements EventHandler<DatanodeDetails> {
|
|||
EventPublisher publisher) {
|
||||
Set<PipelineID> pipelineIds =
|
||||
nodeManager.getPipelines(datanodeDetails);
|
||||
LOG.info("Datanode {} moved to stale state. Finalizing its pipelines {}",
|
||||
datanodeDetails, pipelineIds);
|
||||
for (PipelineID pipelineID : pipelineIds) {
|
||||
try {
|
||||
Pipeline pipeline = pipelineManager.getPipeline(pipelineID);
|
||||
|
|
|
@ -57,6 +57,8 @@ public class PipelineActionHandler
|
|||
pipelineID = PipelineID.
|
||||
getFromProtobuf(action.getClosePipeline().getPipelineID());
|
||||
Pipeline pipeline = pipelineManager.getPipeline(pipelineID);
|
||||
LOG.info("Received pipeline action {} for {} from datanode [}",
|
||||
action.getAction(), pipeline, report.getDatanodeDetails());
|
||||
RatisPipelineUtils
|
||||
.finalizeAndDestroyPipeline(pipelineManager, pipeline, ozoneConf,
|
||||
true);
|
||||
|
|
|
@ -84,6 +84,7 @@ public class PipelineReportHandler implements
|
|||
}
|
||||
|
||||
if (pipeline.getPipelineState() == Pipeline.PipelineState.ALLOCATED) {
|
||||
LOGGER.info("Pipeline {} reported by {}", pipeline.getId(), dn);
|
||||
pipeline.reportDatanode(dn);
|
||||
if (pipeline.isHealthy()) {
|
||||
// if all the dns have reported, pipeline can be moved to OPEN state
|
||||
|
@ -94,6 +95,8 @@ public class PipelineReportHandler implements
|
|||
if (numContainers == 0) {
|
||||
// since all the containers have been closed the pipeline can be
|
||||
// destroyed
|
||||
LOGGER.info("Destroying pipeline {} as all containers are closed",
|
||||
pipeline);
|
||||
RatisPipelineUtils.destroyPipeline(pipelineManager, pipeline, conf);
|
||||
}
|
||||
} else {
|
||||
|
|
|
@ -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.scm.container.ContainerID;
|
||||
import org.apache.hadoop.hdds.scm.pipeline.Pipeline.PipelineState;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
@ -37,6 +39,9 @@ import java.util.NavigableSet;
|
|||
*/
|
||||
class PipelineStateManager {
|
||||
|
||||
private static final Logger LOG =
|
||||
LoggerFactory.getLogger(PipelineStateManager.class);
|
||||
|
||||
private final PipelineStateMap pipelineStateMap;
|
||||
|
||||
PipelineStateManager(Configuration conf) {
|
||||
|
@ -45,6 +50,9 @@ class PipelineStateManager {
|
|||
|
||||
void addPipeline(Pipeline pipeline) throws IOException {
|
||||
pipelineStateMap.addPipeline(pipeline);
|
||||
if (pipeline.getPipelineState() == PipelineState.OPEN) {
|
||||
LOG.info("Created pipeline " + pipeline);
|
||||
}
|
||||
}
|
||||
|
||||
void addContainerToPipeline(PipelineID pipelineId, ContainerID containerID)
|
||||
|
@ -87,7 +95,9 @@ class PipelineStateManager {
|
|||
}
|
||||
|
||||
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,
|
||||
|
@ -101,6 +111,7 @@ class PipelineStateManager {
|
|||
if (!pipeline.isClosed()) {
|
||||
pipeline = pipelineStateMap
|
||||
.updatePipelineState(pipelineId, PipelineState.CLOSED);
|
||||
LOG.info("Pipeline {} moved to CLOSED state", pipeline);
|
||||
}
|
||||
return pipeline;
|
||||
}
|
||||
|
@ -113,6 +124,7 @@ class PipelineStateManager {
|
|||
if (pipeline.getPipelineState() == PipelineState.ALLOCATED) {
|
||||
pipeline = pipelineStateMap
|
||||
.updatePipelineState(pipelineId, PipelineState.OPEN);
|
||||
LOG.info("Pipeline {} moved to OPEN state", pipeline.toString());
|
||||
}
|
||||
return pipeline;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue