Class StartupProgressView

java.lang.Object
org.apache.hadoop.hdfs.server.namenode.startupprogress.StartupProgressView

@Private public class StartupProgressView extends Object
StartupProgressView is an immutable, consistent, read-only view of namenode startup progress. Callers obtain an instance by calling StartupProgress.createView() to clone current startup progress state. Subsequent updates to startup progress will not alter the view. This isolates the reader from ongoing updates and establishes a guarantee that the values returned by the view are consistent and unchanging across multiple related read operations. Calculations that require aggregation, such as overall percent complete, will not be impacted by mutations performed in other threads mid-way through the calculation. Methods that return primitive long may return Long.MIN_VALUE as a sentinel value to indicate that the property is undefined.
  • Method Summary

    Modifier and Type
    Method
    Description
    long
    getCount(Phase phase)
    Returns the sum of the counter values for all steps in the specified phase.
    long
    getCount(Phase phase, Step step)
    Returns the counter value for the specified phase and step.
    long
    Returns overall elapsed time, calculated as time between start of loading fsimage and end of safemode.
    long
    Returns elapsed time for the specified phase, calculated as (end - begin) if phase is complete or (now - begin) if phase is running or 0 if the phase is still pending.
    long
    getElapsedTime(Phase phase, Step step)
    Returns elapsed time for the specified phase and step, calculated as (end - begin) if step is complete or (now - begin) if step is running or 0 if the step is still pending.
    getFile(Phase phase)
    Returns the optional file name associated with the specified phase, possibly null.
    float
    Returns overall percent complete, calculated by aggregating percent complete of all phases.
    float
    Returns percent complete for the specified phase, calculated by aggregating the counter values and totals for all steps within the phase.
    float
    Returns percent complete for the specified phase and step, calculated as counter value divided by total.
    Returns all phases.
    long
    getSize(Phase phase)
    Returns the optional size in bytes associated with the specified phase, possibly Long.MIN_VALUE if undefined.
    Returns the current run status of the specified phase.
    getSteps(Phase phase)
    Returns all steps within a phase.
    long
    getTotal(Phase phase)
    Returns the sum of the totals for all steps in the specified phase.
    long
    getTotal(Phase phase, Step step)
    Returns the total for the specified phase and step.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • getCount

      public long getCount(Phase phase)
      Returns the sum of the counter values for all steps in the specified phase.
      Parameters:
      phase - Phase to get
      Returns:
      long sum of counter values for all steps
    • getCount

      public long getCount(Phase phase, Step step)
      Returns the counter value for the specified phase and step.
      Parameters:
      phase - Phase to get
      step - Step to get
      Returns:
      long counter value for phase and step
    • getElapsedTime

      public long getElapsedTime()
      Returns overall elapsed time, calculated as time between start of loading fsimage and end of safemode.
      Returns:
      long elapsed time
    • getElapsedTime

      public long getElapsedTime(Phase phase)
      Returns elapsed time for the specified phase, calculated as (end - begin) if phase is complete or (now - begin) if phase is running or 0 if the phase is still pending.
      Parameters:
      phase - Phase to get
      Returns:
      long elapsed time
    • getElapsedTime

      public long getElapsedTime(Phase phase, Step step)
      Returns elapsed time for the specified phase and step, calculated as (end - begin) if step is complete or (now - begin) if step is running or 0 if the step is still pending.
      Parameters:
      phase - Phase to get
      step - Step to get
      Returns:
      long elapsed time
    • getFile

      public String getFile(Phase phase)
      Returns the optional file name associated with the specified phase, possibly null.
      Parameters:
      phase - Phase to get
      Returns:
      String optional file name, possibly null
    • getPercentComplete

      public float getPercentComplete()
      Returns overall percent complete, calculated by aggregating percent complete of all phases. This is an approximation that assumes all phases have equal running time. In practice, this isn't true, but there isn't sufficient information available to predict proportional weights for each phase.
      Returns:
      float percent complete
    • getPercentComplete

      public float getPercentComplete(Phase phase)
      Returns percent complete for the specified phase, calculated by aggregating the counter values and totals for all steps within the phase.
      Parameters:
      phase - Phase to get
      Returns:
      float percent complete
    • getPercentComplete

      public float getPercentComplete(Phase phase, Step step)
      Returns percent complete for the specified phase and step, calculated as counter value divided by total.
      Parameters:
      phase - Phase to get
      step - Step to get
      Returns:
      float percent complete
    • getPhases

      public Iterable<Phase> getPhases()
      Returns all phases.
      Returns:
      Iterable<Phase> containing all phases
    • getSteps

      public Iterable<Step> getSteps(Phase phase)
      Returns all steps within a phase.
      Parameters:
      phase - Phase to get
      Returns:
      Iterable<Step> all steps
    • getSize

      public long getSize(Phase phase)
      Returns the optional size in bytes associated with the specified phase, possibly Long.MIN_VALUE if undefined.
      Parameters:
      phase - Phase to get
      Returns:
      long optional size in bytes, possibly Long.MIN_VALUE
    • getStatus

      public Status getStatus(Phase phase)
      Returns the current run status of the specified phase.
      Parameters:
      phase - Phase to get
      Returns:
      Status run status of phase
    • getTotal

      public long getTotal(Phase phase)
      Returns the sum of the totals for all steps in the specified phase.
      Parameters:
      phase - Phase to get
      Returns:
      long sum of totals for all steps
    • getTotal

      public long getTotal(Phase phase, Step step)
      Returns the total for the specified phase and step.
      Parameters:
      phase - Phase to get
      step - Step to get
      Returns:
      long total