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.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.ConcurrentMap;
|
||||
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.hadoop.classification.InterfaceAudience;
|
||||
|
||||
/**
|
||||
@ -43,4 +44,15 @@ public PhaseTracking 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.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.ConcurrentMap;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import org.apache.hadoop.classification.InterfaceAudience;
|
||||
|
||||
/**
|
||||
@ -48,6 +51,9 @@
|
||||
*/
|
||||
@InterfaceAudience.Private
|
||||
public class StartupProgress {
|
||||
|
||||
private static final Logger LOG = LoggerFactory.getLogger(StartupProgress.class);
|
||||
|
||||
// package-private for access by StartupProgressView
|
||||
final Map<Phase, PhaseTracking> phases =
|
||||
new ConcurrentHashMap<Phase, PhaseTracking>();
|
||||
@ -81,6 +87,7 @@ public void beginPhase(Phase phase) {
|
||||
if (!isComplete()) {
|
||||
phases.get(phase).beginTime = monotonicNow();
|
||||
}
|
||||
LOG.debug("Beginning of the phase: {}", phase);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -94,6 +101,7 @@ public void beginStep(Phase phase, Step step) {
|
||||
if (!isComplete(phase)) {
|
||||
lazyInitStep(phase, step).beginTime = monotonicNow();
|
||||
}
|
||||
LOG.debug("Beginning of the step. Phase: {}, Step: {}", phase, step);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -105,6 +113,7 @@ public void endPhase(Phase phase) {
|
||||
if (!isComplete()) {
|
||||
phases.get(phase).endTime = monotonicNow();
|
||||
}
|
||||
LOG.debug("End of the phase: {}", phase);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -118,6 +127,7 @@ public void endStep(Phase phase, Step step) {
|
||||
if (!isComplete(phase)) {
|
||||
lazyInitStep(phase, step).endTime = monotonicNow();
|
||||
}
|
||||
LOG.debug("End of the step. Phase: {}, Step: {}", phase, step);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -21,6 +21,7 @@
|
||||
import org.apache.commons.lang3.builder.CompareToBuilder;
|
||||
import org.apache.commons.lang3.builder.EqualsBuilder;
|
||||
import org.apache.commons.lang3.builder.HashCodeBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.hadoop.classification.InterfaceAudience;
|
||||
|
||||
/**
|
||||
@ -139,4 +140,14 @@ public int hashCode() {
|
||||
return new HashCodeBuilder().append(file).append(size).append(type)
|
||||
.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 @@
|
||||
|
||||
import java.util.concurrent.atomic.AtomicLong;
|
||||
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.hadoop.classification.InterfaceAudience;
|
||||
|
||||
/**
|
||||
@ -36,4 +37,14 @@ public StepTracking clone() {
|
||||
clone.total = total;
|
||||
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
Block a user