Class StartupProgressView
java.lang.Object
org.apache.hadoop.hdfs.server.namenode.startupprogress.StartupProgressView
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 TypeMethodDescriptionlongReturns the sum of the counter values for all steps in the specified phase.longReturns the counter value for the specified phase and step.longReturns overall elapsed time, calculated as time between start of loading fsimage and end of safemode.longgetElapsedTime(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.longgetElapsedTime(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.Returns the optional file name associated with the specified phase, possibly null.floatReturns overall percent complete, calculated by aggregating percent complete of all phases.floatgetPercentComplete(Phase phase) Returns percent complete for the specified phase, calculated by aggregating the counter values and totals for all steps within the phase.floatgetPercentComplete(Phase phase, Step step) Returns percent complete for the specified phase and step, calculated as counter value divided by total.Returns all phases.longReturns 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.Returns all steps within a phase.longReturns the sum of the totals for all steps in the specified phase.longReturns the total for the specified phase and step.
-
Method Details
-
getCount
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
Returns the counter value for the specified phase and step.- Parameters:
phase- Phase to getstep- 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
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
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 getstep- Step to get- Returns:
- long elapsed time
-
getFile
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
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
Returns percent complete for the specified phase and step, calculated as counter value divided by total.- Parameters:
phase- Phase to getstep- Step to get- Returns:
- float percent complete
-
getPhases
Returns all phases.- Returns:
Iterable<Phase>containing all phases
-
getSteps
Returns all steps within a phase.- Parameters:
phase- Phase to get- Returns:
Iterable<Step>all steps
-
getSize
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
Returns the current run status of the specified phase.- Parameters:
phase- Phase to get- Returns:
- Status run status of phase
-
getTotal
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
Returns the total for the specified phase and step.- Parameters:
phase- Phase to getstep- Step to get- Returns:
- long total
-