Skip to content

HDFS-16887 Log start and end of phase/step in startup progress #5292

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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;

/**
Expand All @@ -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();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;

/**
Expand All @@ -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>();
Expand Down Expand Up @@ -81,6 +87,7 @@ public void beginPhase(Phase phase) {
if (!isComplete()) {
phases.get(phase).beginTime = monotonicNow();
}
LOG.debug("Beginning of the phase: {}", phase);
}

/**
Expand All @@ -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);
}

/**
Expand All @@ -105,6 +113,7 @@ public void endPhase(Phase phase) {
if (!isComplete()) {
phases.get(phase).endTime = monotonicNow();
}
LOG.debug("End of the phase: {}", phase);
}

/**
Expand All @@ -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);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

/**
Expand Down Expand Up @@ -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();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

import java.util.concurrent.atomic.AtomicLong;

import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.hadoop.classification.InterfaceAudience;

/**
Expand All @@ -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();
}
}