You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-commits@hadoop.apache.org by sh...@apache.org on 2020/02/21 19:06:58 UTC
[hadoop] branch branch-2.10 updated: HDFS-15185. StartupProgress
reports edits segments until the entire startup completes. Contributed by
Konstantin V Shvachko.
This is an automated email from the ASF dual-hosted git repository.
shv pushed a commit to branch branch-2.10
in repository https://gitbox.apache.org/repos/asf/hadoop.git
The following commit(s) were added to refs/heads/branch-2.10 by this push:
new 9c2c14f HDFS-15185. StartupProgress reports edits segments until the entire startup completes. Contributed by Konstantin V Shvachko.
9c2c14f is described below
commit 9c2c14f36dee9e8d0276af02ff5628eb92f81088
Author: Konstantin V Shvachko <sh...@apache.org>
AuthorDate: Fri Feb 21 10:51:14 2020 -0800
HDFS-15185. StartupProgress reports edits segments until the entire startup completes. Contributed by Konstantin V Shvachko.
(cherry picked from commit 6f84269bcd5cdb08ca68b2d8276f66d34a2a7a0d)
---
.../hdfs/server/namenode/startupprogress/StartupProgress.java | 2 +-
.../server/namenode/startupprogress/TestStartupProgress.java | 11 +++++++++++
2 files changed, 12 insertions(+), 1 deletion(-)
diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/startupprogress/StartupProgress.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/startupprogress/StartupProgress.java
index 0e0e68c..3e8bdc6 100644
--- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/startupprogress/StartupProgress.java
+++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/startupprogress/StartupProgress.java
@@ -218,7 +218,7 @@ public class StartupProgress {
* @param total long to set
*/
public void setTotal(Phase phase, Step step, long total) {
- if (!isComplete()) {
+ if (!isComplete(phase)) {
lazyInitStep(phase, step).total = total;
}
}
diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/startupprogress/TestStartupProgress.java b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/startupprogress/TestStartupProgress.java
index c01844d..8c0aa0c 100644
--- a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/startupprogress/TestStartupProgress.java
+++ b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/startupprogress/TestStartupProgress.java
@@ -33,6 +33,7 @@ import java.util.concurrent.ExecutorService;
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 class TestStartupProgress {
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);
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-commits-help@hadoop.apache.org