HDFS-15185. StartupProgress reports edits segments until the entire startup completes. Contributed by Konstantin V Shvachko.
This commit is contained in:
parent
e77767bb1e
commit
6f84269bcd
@ -218,7 +218,7 @@ public void setSize(Phase phase, long size) {
|
||||
* @param total long to set
|
||||
*/
|
||||
public void setTotal(Phase phase, Step step, long total) {
|
||||
if (!isComplete()) {
|
||||
if (!isComplete(phase)) {
|
||||
lazyInitStep(phase, step).total = total;
|
||||
}
|
||||
}
|
||||
|
@ -33,6 +33,7 @@
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import org.apache.hadoop.hdfs.server.namenode.startupprogress.StartupProgress.Counter;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
@ -457,5 +458,15 @@ public void testTotal() {
|
||||
assertEquals(800L, view.getTotal(LOADING_FSIMAGE,
|
||||
loadingFsImageDelegationKeys));
|
||||
assertEquals(10000L, view.getTotal(LOADING_EDITS, loadingEditsFile));
|
||||
|
||||
// Try adding another step to the completed phase
|
||||
// Check the step is not added and the total is not updated
|
||||
Step step2 = new Step("file_2", 7000L);
|
||||
startupProgress.setTotal(LOADING_EDITS, step2, 2000L);
|
||||
view = startupProgress.createView();
|
||||
assertEquals(view.getTotal(LOADING_EDITS, step2), 0);
|
||||
Counter counter = startupProgress.getCounter(Phase.LOADING_EDITS, step2);
|
||||
counter.increment();
|
||||
assertEquals(view.getCount(LOADING_EDITS, step2), 0);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user