HDFS-16887 Log start and end of phase/step in startup progress (#5292)
Signed-off-by: Chris Nauroth <cnauroth@apache.org>
This commit is contained in:
parent
36bf54aba0
commit
1263e024b9
|
@ -20,6 +20,7 @@ import java.util.Map;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
import java.util.concurrent.ConcurrentMap;
|
import java.util.concurrent.ConcurrentMap;
|
||||||
|
|
||||||
|
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||||
import org.apache.hadoop.classification.InterfaceAudience;
|
import org.apache.hadoop.classification.InterfaceAudience;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -43,4 +44,15 @@ final class PhaseTracking extends AbstractTracking {
|
||||||
}
|
}
|
||||||
return clone;
|
return clone;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return new ToStringBuilder(this)
|
||||||
|
.append("file", file)
|
||||||
|
.append("size", size)
|
||||||
|
.append("steps", steps)
|
||||||
|
.append("beginTime", beginTime)
|
||||||
|
.append("endTime", endTime)
|
||||||
|
.toString();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,6 +24,9 @@ import java.util.Map;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
import java.util.concurrent.ConcurrentMap;
|
import java.util.concurrent.ConcurrentMap;
|
||||||
|
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import org.apache.hadoop.classification.InterfaceAudience;
|
import org.apache.hadoop.classification.InterfaceAudience;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -48,6 +51,9 @@ import org.apache.hadoop.classification.InterfaceAudience;
|
||||||
*/
|
*/
|
||||||
@InterfaceAudience.Private
|
@InterfaceAudience.Private
|
||||||
public class StartupProgress {
|
public class StartupProgress {
|
||||||
|
|
||||||
|
private static final Logger LOG = LoggerFactory.getLogger(StartupProgress.class);
|
||||||
|
|
||||||
// package-private for access by StartupProgressView
|
// package-private for access by StartupProgressView
|
||||||
final Map<Phase, PhaseTracking> phases =
|
final Map<Phase, PhaseTracking> phases =
|
||||||
new ConcurrentHashMap<Phase, PhaseTracking>();
|
new ConcurrentHashMap<Phase, PhaseTracking>();
|
||||||
|
@ -81,6 +87,7 @@ public class StartupProgress {
|
||||||
if (!isComplete()) {
|
if (!isComplete()) {
|
||||||
phases.get(phase).beginTime = monotonicNow();
|
phases.get(phase).beginTime = monotonicNow();
|
||||||
}
|
}
|
||||||
|
LOG.debug("Beginning of the phase: {}", phase);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -94,6 +101,7 @@ public class StartupProgress {
|
||||||
if (!isComplete(phase)) {
|
if (!isComplete(phase)) {
|
||||||
lazyInitStep(phase, step).beginTime = monotonicNow();
|
lazyInitStep(phase, step).beginTime = monotonicNow();
|
||||||
}
|
}
|
||||||
|
LOG.debug("Beginning of the step. Phase: {}, Step: {}", phase, step);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -105,6 +113,7 @@ public class StartupProgress {
|
||||||
if (!isComplete()) {
|
if (!isComplete()) {
|
||||||
phases.get(phase).endTime = monotonicNow();
|
phases.get(phase).endTime = monotonicNow();
|
||||||
}
|
}
|
||||||
|
LOG.debug("End of the phase: {}", phase);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -118,6 +127,7 @@ public class StartupProgress {
|
||||||
if (!isComplete(phase)) {
|
if (!isComplete(phase)) {
|
||||||
lazyInitStep(phase, step).endTime = monotonicNow();
|
lazyInitStep(phase, step).endTime = monotonicNow();
|
||||||
}
|
}
|
||||||
|
LOG.debug("End of the step. Phase: {}, Step: {}", phase, step);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -21,6 +21,7 @@ import java.util.concurrent.atomic.AtomicInteger;
|
||||||
import org.apache.commons.lang3.builder.CompareToBuilder;
|
import org.apache.commons.lang3.builder.CompareToBuilder;
|
||||||
import org.apache.commons.lang3.builder.EqualsBuilder;
|
import org.apache.commons.lang3.builder.EqualsBuilder;
|
||||||
import org.apache.commons.lang3.builder.HashCodeBuilder;
|
import org.apache.commons.lang3.builder.HashCodeBuilder;
|
||||||
|
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||||
import org.apache.hadoop.classification.InterfaceAudience;
|
import org.apache.hadoop.classification.InterfaceAudience;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -139,4 +140,14 @@ public class Step implements Comparable<Step> {
|
||||||
return new HashCodeBuilder().append(file).append(size).append(type)
|
return new HashCodeBuilder().append(file).append(size).append(type)
|
||||||
.toHashCode();
|
.toHashCode();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return new ToStringBuilder(this)
|
||||||
|
.append("file", file)
|
||||||
|
.append("sequenceNumber", sequenceNumber)
|
||||||
|
.append("size", size)
|
||||||
|
.append("type", type)
|
||||||
|
.toString();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,6 +18,7 @@ package org.apache.hadoop.hdfs.server.namenode.startupprogress;
|
||||||
|
|
||||||
import java.util.concurrent.atomic.AtomicLong;
|
import java.util.concurrent.atomic.AtomicLong;
|
||||||
|
|
||||||
|
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||||
import org.apache.hadoop.classification.InterfaceAudience;
|
import org.apache.hadoop.classification.InterfaceAudience;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -36,4 +37,14 @@ final class StepTracking extends AbstractTracking {
|
||||||
clone.total = total;
|
clone.total = total;
|
||||||
return clone;
|
return clone;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return new ToStringBuilder(this)
|
||||||
|
.append("count", count)
|
||||||
|
.append("total", total)
|
||||||
|
.append("beginTime", beginTime)
|
||||||
|
.append("endTime", endTime)
|
||||||
|
.toString();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue